-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
138 lines (116 loc) · 2.98 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
CC = gcc -std=c11
CXX = g++ -std=c++17
LONG = 0
SANITIZE = 0
SRAND = 1
O0 = 0
O1 = 0
O2 = 0
O3 = 0
Og = 0
Ofast = 0
Os = 0
CFLAGS = -Ictl
CFLAGS += -Wall -Wextra -Wpedantic -Wfatal-errors -Wshadow
CFLAGS += -march=native
CFLAGS += -g
ifeq (1, $(LONG))
CFLAGS += -Werror
CFLAGS += -DLONG
endif
ifeq (1, $(SANITIZE))
CFLAGS += -fsanitize=address -fsanitize=undefined
endif
ifeq (1, $(Og))
CFLAGS += -Og
endif
ifeq (1, $(O0))
CFLAGS += -O0
endif
ifeq (1, $(O1))
CFLAGS += -O1
endif
ifeq (1, $(O2))
CFLAGS += -O2
endif
ifeq (1, $(O3))
CFLAGS += -O3
endif
ifeq (1, $(Ofast))
CFLAGS += -Ofast
endif
ifeq (1, $(Os))
CFLAGS += -Os
endif
ifeq (1, $(SRAND))
CFLAGS += -DSRAND
endif
TESTS = \
tests/func/test_std_headers \
tests/func/test_c11 \
tests/func/test_container_composing \
tests/func/test_deq \
tests/func/test_lst \
tests/func/test_str \
tests/func/test_pqu \
tests/func/test_que \
tests/func/test_set \
tests/func/test_ust \
tests/func/test_stk \
tests/func/test_vec_capacity \
tests/func/test_vec
EXAMPLES = \
examples/astar \
examples/postfix \
examples/json \
examples/snow \
examples/6502
all: $(TESTS)
$(foreach bin,$(TESTS),./$(bin) &&) exit 0
@$(CC) --version
@$(CXX) --version
@rm -f $(TESTS)
examples: $(EXAMPLES)
clean:
@rm -f $(TESTS)
@rm -f $(EXAMPLES)
str:
$(call expand,$@)
lst:
$(call expand,$@,-DT=int -DP)
vec:
$(call expand,$@,-DT=int -DP)
deq:
$(call expand,$@,-DT=int -DP)
stk:
$(call expand,$@,-DT=int -DP)
que:
$(call expand,$@,-DT=int -DP)
pqu:
$(call expand,$@,-DT=int -DP)
set:
$(call expand,$@,-DT=int -DP)
ust:
$(call expand,$@,-DT=int -DP)
examples/astar: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
examples/postfix: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
examples/json: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
examples/snow: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
examples/6502: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
tests/func/test_std_headers: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
tests/func/test_c11: ALWAYS; $(CC) $(CFLAGS) $@.c -o $@
tests/func/test_container_composing: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_deq: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_lst: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_pqu: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_que: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_set: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_ust: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_stk: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_str: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_vec_capacity: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
tests/func/test_vec: ALWAYS; $(CXX) $(CFLAGS) $@.cc -o $@
define expand
@$(CC) $(CFLAGS) ctl/$(1).h -E $(2) | clang-format -style=webkit
endef
ALWAYS: