-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
38 lines (28 loc) · 1012 Bytes
/
Makefile.in
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
CFLAGS = @CFLAGS@ @DEFS@ -DSTIC_INTERNAL_TESTS
CC = @CC@
MKDIR_P = @MKDIR_P@
STIC_TESTS = src/stic.c tests/stic_tests.c
STIC_TESTS_OBJ = $(addprefix bin/,$(notdir $(STIC_TESTS:.c=.o)))
RM_F = rm -f
pos = $(strip $(eval T := ) \
$(eval i := 0) \
$(foreach elem, $1, \
$(if $(filter $2,$(elem)), \
$(eval i := $(words $T)), \
$(eval T := $T $(elem)))) \
$i)
all: clean stic_tests
stic_tests: bin/stic_tests
@./$<
bin/stic_tests: $(STIC_TESTS_OBJ) | bin
$(CC) $^ $(CFLAGS) -o bin/stic_tests
bin:
$(MKDIR_P) $@
bin/%.o: src/%.c tests/. | bin
$(CC) -c $(CFLAGS) -o $@ -DTESTID=$(call pos, $(STIC_TESTS_OBJ), $@) \
-DMAXTESTID=$(words $(STIC_TESTS_OBJ)) $<
bin/%.o: tests/%.c tests/. | bin
$(CC) -c $(CFLAGS) -o $@ -DTESTID=$(call pos, $(STIC_TESTS_OBJ), $@) \
-DMAXTESTID=$(words $(STIC_TESTS_OBJ)) $<
clean:
$(RM_F) bin/*.o