-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
100 lines (70 loc) · 1.81 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
#============================================
# Unity Test Framework
# Author: Lukas Ungerland
#============================================
ifeq ($(OSTYPE),cygwin)
CLEANUP=rm -f
MKDIR=mkdir -p
TARGET_EXTENSION=out
else ifeq ($(OS),Windows_NT)
CLEANUP=del /F /Q
MKDIR=mkdir
TARGET_EXTENSION=exe
else
CLEANUP=rm -f
MKDIR=mkdir -p
TARGET_EXTENSION=out
endif
PATHU = Unity/src/
PATHS = src/
PATHT = test/
PATHB = build/
PATHD = build/depends/
PATHO = build/objs/
PATHR = build/results/
BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHR)
SRCT = $(wildcard $(PATHT)*.c)
$(info $(SRCT))
COMPILE=gcc -c
LINK=gcc
DEPEND=gcc -MM -MG -MF
CFLAGS=-I. -I$(PATHU) -I$(PATHS) -DTEST
RESULTS = $(patsubst $(PATHT)test%.c,$(PATHR)test%.txt,$(SRCT))
$(info "hallo: "$(RESULTS))
test: $(BUILD_PATHS) $(RESULTS)
@echo $(RESULTS)
@echo "-----------------------\nIGNORES:\n------------------------"
@echo `grep -s IGNORE $(PATHR)*.txt`
@echo "-----------------------\nFAILURES:\n-----------------------"
@echo `grep -s FAIL $(PATHR)*.txt`
@echo "\nDONE"
$(PATHR)%.txt: $(PATHB)%.$(TARGET_EXTENSION)
-./$< > $@ 2>&1
$(PATHB)test%.$(TARGET_EXTENSION): $(PATHO)test%.o $(PATHO)%.o $(PATHU)unity.o $(PATHD)test%.d
$(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 $@
$(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