-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (40 loc) · 1.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.PHONY: shak-cli win-shak-cli release
.SILENT:
.DEFAULT_GOAL = win-shak-cli
CURDATE = `date +%T`
logdate = \033[90m[$(CURDATE)]\033[0m:
VMAJOR = 0# Not released yet
VMINOR = 9
COMMIT = $(shell git rev-list --count --all)
VPATCH = $(shell printf %03i `expr $(COMMIT) % 1000`)
VERSION = "$(VMAJOR).$(VMINOR).$(VPATCH)"
CFILES = src/main.c src/sha1.c src/sha2-32.c src/sha2-64.c src/shacom.c
HFILES = include/shacom.h include/sha1.h include/sha2-32.h include/sha2-64.h include/shaconstants.h
EXENAME = shak
gcc = gcc
wingcc = x86_64-w64-mingw32-gcc.exe
WINGCC_VERSION = "$(shell $(wingcc) --version | head -n 1)"
GCC_VERSION = "$(shell $(gcc) --version | head -n 1)"
WINGCC_MACHINE = "$(shell $(wingcc) -dumpmachine)"
GCC_MACHINE = "$(shell $(gcc) -dumpmachine)"
ifeq ($(MAKECMDGOALS),release)
RELEASEARGS = -DSHAK_RELEASE
else
RELEASEARGS =
endif
shak-cli: $(CFILES) $(HFILES)
printf "$(logdate) building \033[33mshak-cli\033[0m... (\033[90mwith \033[3m$(gcc)\033[0m) ~ "
$(gcc) -Wall -o bin/$(EXENAME) $(CFILES) -Iinclude -DGCCVERSION='$(GCC_VERSION)' -DSHAKVERSION='$(VERSION)' $(RELEASEARGS)
echo done!
win-shak-cli: $(CFILES) $(HFILES)
printf "$(logdate) building \033[33mwin-shak-cli\033[0m... (\033[90mwith \033[3m$(wingcc)\033[0m) ~ "
$(wingcc) -Wall -o bin/$(EXENAME).exe $(CFILES) -Iinclude -DGCCVERSION='$(WINGCC_VERSION)' -DSHAKVERSION='$(VERSION)' $(RELEASEARGS)
echo done!
release: win-shak-cli shak-cli
printf "$(logdate) Creating archive \033[33m$(EXENAME)-$(VERSION)-$(GCC_MACHINE).tar.gz\033[0m... ~ "
tar -C bin -cz -f releases/$(EXENAME)-$(VERSION)-$(GCC_MACHINE).tar.gz $(EXENAME)
echo done!
printf "$(logdate) Creating archive \033[33m$(EXENAME)-$(VERSION)-$(WINGCC_MACHINE).tar.gz\033[0m... ~ "
tar -C bin -cz -f releases/$(EXENAME)-$(VERSION)-$(WINGCC_MACHINE).tar.gz $(EXENAME).exe
echo done!
printf "$(logdate) \033[32mrelease all done!\033[0m \n"