forked from rhempel/umm_malloc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (74 loc) · 1.91 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
ifeq ($(OSTYPE),cygwin)
CLEANUP=rm -f
MKDIR=mkdir -p
TARGET_EXTENSION=out
else ifeq ($(OS),Windows_NT)
ifeq ("$(SHELL)","/bin/sh")
CLEANUP=rm -f
MKDIR=mkdir -p
TARGET_EXTENSION=exe
else
CLEANUP=del /F /Q
MKDIR=mkdir
TARGET_EXTENSION=exe
endif
else
CLEANUP=rm -f
MKDIR=mkdir -p
TARGET_EXTENSION=out
endif
PATHU = unity/src/
PATHX = unity/extras/fixture/src/
PATHS = src/
PATHI = includes/c-helper-macros/
PATHT = test/
PATHB = build/
PATHD = build/depends/
PATHO = build/objs/
PATHR = build/results/
BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHR)
SRCT = $(wildcard $(PATHT)*.c)
COMPILE=gcc -c
LINK=gcc
DEPEND=gcc -MM -MG -MF
CFLAGS=-I. -I$(PATHU) -I$(PATHX) -I$(PATHS) -I$(PATHI) -DTEST_BUILD
RESULTS = $(patsubst $(PATHT)test_%.c,$(PATHR)test_%.txt,$(SRCT))
$(PATHR)%.txt: $(PATHB)%.$(TARGET_EXTENSION)
-./$< > $@ 2>&1
$(PATHB)test_%.$(TARGET_EXTENSION): $(PATHO)test_%.o $(PATHO)%.o $(PATHU)unity.o $(PATHX)unity_fixture.o
$(LINK) -o $@ $^
$(PATHO)%.o:: $(PATHT)%.c
$(COMPILE) $(CFLAGS) $< -o $@
$(PATHO)%.o:: $(PATHS)%.c
$(COMPILE) $(CFLAGS) $< -o $@
$(PATHO)%.o:: $(PATHU)%.c $(PATHU)%.h
$(COMPILE) $(CFLAGS) $< -o $@
$(PATHO)%.o:: $(PATHX)%.c $(PATHX)%.h
$(COMPILE) $(CFLAGS) $< -o $@
$(PATHD)%.d:: $(PATHT)%.c
$(DEPEND) $@ $<
$(PATHB):
$(MKDIR) $(PATHB)
$(PATHD):
$(MKDIR) $(PATHD)
$(PATHO):
$(MKDIR) $(PATHO)
$(PATHR):
$(MKDIR) $(PATHR)
clean:
$(CLEANUP) $(PATHO)*.o
$(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION)
$(CLEANUP) $(PATHR)*.txt
.PRECIOUS: $(PATHB)test_%.$(TARGET_EXTENSION)
.PRECIOUS: $(PATHD)%.d
.PRECIOUS: $(PATHO)%.o
.PRECIOUS: $(PATHR)%.txt
.PHONY: clean
.PHONY: test
test: $(BUILD_PATHS) $(RESULTS)
@echo "OSTYPE:$(OSTYPE) OS:$(OS) SHELL:$(SHELL)"
@echo "-----------------------\nIGNORES:\n-----------------------"
@echo `grep -s IGNORE $(PATHR)*.txt`
@echo "-----------------------\nFAILURES:\n-----------------------"
@echo `grep -s FAIL $(PATHR)*.txt`
@echo "\nDONE"