-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.04 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
52
53
54
55
56
57
n := win32-snake
mode := release
ifeq ($(mode), debug)
cflags += -g
endif
ifeq ($(mode), release)
cflags += -Oz
endif
libpath := $(shell misc/winsdk.exe --type:lib --arch:x64 --kit:um)
cflags += -std=c11
cflags += -Wall
cflags += -Wextra
cflags += -pedantic
cflags += -nostdlib
cflags += -ffreestanding
cflags += -fno-stack-check
cflags += -fno-stack-protector
cflags += -mno-stack-arg-probe
cflags += -fuse-ld=lld-link
cflags += -lkernel32
cflags += -lshell32
cflags += -luser32
cflags += -flto
cflags += -Xlinker /entry:start
cflags += -Xlinker /nodefaultlib
cflags += -Xlinker /subsystem:console
cflags += -Xlinker /libpath:"$(libpath)"
rcedit := "misc/rcedit/rcedit-x64.exe"
build: clean bin/$n.exe
-
bin/$n.ll: src/$n.c bin Makefile
clang $< $(cflags) -masm=intel -fverbose-asm -S -o $@
bin/$n.tiny.exe: src/$n.c bin Makefile
clang $< $(cflags) -o $@
ifeq ($(mode), release)
llvm-strip $@
endif
bin/$n.exe: bin/$n.tiny.exe
./misc/cp.exe $< $@
$(rcedit) $@ --set-icon misc/icon.ico
clean:
-rd /s /q bin
bin:
@-mkdir bin
.PHONY: build clean bin