-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
makefile
105 lines (86 loc) · 2.37 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
#compiler settings reference
#CC=gcc
#CFLAGS+=-std=c17 -g -Wall -Werror -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wformat=2
#LIBS+=-lm
#LDFLAGS+=
#directories
export TOY_SOURCEDIR=source
export TOY_REPLDIR=repl
export TOY_CASESDIR=tests/cases
export TOY_INTEGRATIONSDIR=tests/integrations
export TOY_OUTDIR=out
export TOY_OBJDIR=obj
#targets
#all:
.PHONY: source
source:
$(MAKE) -C source -k
.PHONY: repl
repl: source
$(MAKE) -C repl -k
#various kinds of available tests
.PHONY: tests
tests: clean test-cases test-integrations
.PHONY: test-cases
test-cases:
$(MAKE) -C $(TOY_CASESDIR) -k
.PHONY: test-integrations
test-integrations:
$(MAKE) -C $(TOY_INTEGRATIONSDIR) -k
#same as above, but with GDB
.PHONY: tests-gdb
tests-gdb: clean test-cases-gdb test-integrations-gdb
.PHONY: test-cases-gdb
test-cases-gdb:
$(MAKE) -C $(TOY_CASESDIR) gdb -k
.PHONY: test-integrations-gdb
test-integrations-gdb:
$(MAKE) -C $(TOY_INTEGRATIONSDIR) gdb -k
#same as above, but with valgrind
.PHONY: tests-valgrind
tests-valgrind: clean test-cases-valgrind test-integrations-valgrind
.PHONY: test-cases-valgrind
test-cases-valgrind:
$(MAKE) -C $(TOY_CASESDIR) valgrind -k
.PHONY: test-integrations-valgrind
test-integrations-valgrind:
$(MAKE) -C $(TOY_INTEGRATIONSDIR) valgrind -k
#Run all tests
.PHONY: tests-all
tests-all: clean tests tests-gdb tests-valgrind
#TODO: mustfail tests
#util targets
$(TOY_OUTDIR):
mkdir $(TOY_OUTDIR)
$(TOY_OBJDIR):
mkdir $(TOY_OBJDIR)
#util commands
.PHONY: clean
clean:
ifeq ($(shell uname),Linux)
find . -type f -name '*.o' -delete
find . -type f -name '*.a' -delete
find . -type f -name '*.exe' -delete
find . -type f -name '*.dll' -delete
find . -type f -name '*.lib' -delete
find . -type f -name '*.so' -delete
find . -type f -name '*.dylib' -delete
find . -type d -name 'out' -delete
find . -type d -name 'obj' -delete
else ifeq ($(OS),Windows_NT)
$(RM) *.o *.a *.exe *.dll *.lib *.so *.dylib
$(RM) out
$(RM) obj
else ifeq ($(shell uname),Darwin)
find . -type f -name '*.o' -delete
find . -type f -name '*.a' -delete
find . -type f -name '*.exe' -delete
find . -type f -name '*.dll' -delete
find . -type f -name '*.lib' -delete
find . -type f -name '*.so' -delete
find . -type f -name '*.dylib' -delete
find . -type d -name 'out' -delete
find . -type d -name 'obj' -delete
else
@echo "Deletion failed - what platform is this?"
endif