-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (54 loc) · 1.23 KB
/
Makefile
File metadata and controls
71 lines (54 loc) · 1.23 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# E652.
#
CWARNS= \
-Wshadow \
-Wundef \
-Wwrite-strings \
-Wdisabled-optimization \
-Wmissing-declarations \
-Wno-override-init \
# -pedantic
MYCFLAGS= $(CWARNS) -std=gnu99
MYLDFLAGS=
CC= gcc
RM= rm -rf
CFLAGS= -Wall -Wextra $(MYCFLAGS) -MMD -MP
LDFLAGS= $(MYLDFLAGS)
## build file names
ALL_C= main.c e652.c disasm.c
ALL_O= $(ALL_C:.c=.o)
ALL_D= $(ALL_C:.c=.d)
ALL_T= e652
.PHONY: all debug release ci test clean help echo
all: $(ALL_T)
debug release ci: all
ci:
$(MAKE) test
debug: CFLAGS+= -Og -g
release: CFLAGS+= -O2 -DNDEBUG -march=native
ci: CFLAGS+= -Werror
test: all
$(MAKE) -C./test
clean:
$(RM) $(ALL_O) $(ALL_D) $(ALL_T)
help:
@echo 'E652 Makefile'
@echo ' help Show this help'
@echo ' clean Remove generated files'
@echo ' echo Print make vars'
@echo ' test Run tests'
@echo 'Build targets'
@echo ' all Default (plain) build'
@echo ' debug For debugging'
@echo ' release Optimized build'
@echo ' ci For CI checking'
echo:
@echo 'CC = $(CC)'
@echo 'RM = $(RM)'
@echo 'MYCFLAGS = $(MYCFLAGS)'
@echo 'MYLDFLAGS = $(MYLDFLAGS)'
$(ALL_T): $(ALL_O)
$(CC) $(LDFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
-include $(ALL_D)