-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (54 loc) · 1.36 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
# Author: Yotam Medini yotam.medini@gmail.com -- Created:
#
ifneq ($(emv),)
emv:
@echo $($(emv))
endif
.DELETE_ON_ERROR:
SHELL=/bin/bash
DBGFLAGS = -g
OPTFLAGS = ${DBGFLAGS}
CFLAGS = ${OPTFLAGS} -Wall -Wshadow -std=c++17 -MMD
CXXS := $(wildcard *.cc)
OBJS = $(patsubst %.cc,obj.d/%.o,$(CXXS))
DEPS = $(patsubst %.cc,obj.d/%.d,$(CXXS))
BINDIR = bin
objs: ${OBJS}
obj.d/%.o: %.cc
@mkdir -p $(@D)
g++ -c ${CFLAGS} -o $@ $<
${BINDIR}/%: obj.d/%.o
@mkdir -p $(@D)
g++ ${CFLAGS} -o $@ $^
define run_test_123
.PHONY: ${3}
${3}: ${BINDIR}/${1} ${2}.in ${2}.out
timeout 2 ${BINDIR}/${1} -naive ${2}.in ${2}.xnout
diff ${2}.xnout ${2}.out
timeout 2 ${BINDIR}/${1} ${2}.in ${2}.xout
diff ${2}.xout ${2}.out
endef
define run_test
$(eval $(call run_test_123,${1},${1}-tiny,${1}-test))
endef
define run_test2
.PHONY: ${1}-test
${1}-test: ${1}-test1 ${1}-test2
$(call run_test_123,${1},${1}-tiny,${1}-test1)
$(call run_test_123,${1},${1}-tiny2,${1}-test2)
endef
NDIFF=numdiff -r 0.000001
define run_nd_test
$(eval $(call run_test_1234,${1},${1}-tiny,${1}-test,${NDIFF}))
endef
define run_nd_test2
.PHONY: ${1}-test
${1}-test: ${1}-test1 ${1}-test2
$(call run_test_1234,${1},${1}-tiny,${1}-test1,${NDIFF})
$(call run_test_1234,${1},${1}-tiny2,${1}-test2,${NDIFF)
endef
# $(eval $(call run_test,xxx))
# $(eval $(call run_test2,xxx))
clean:
rm -f ${OBJS} ${BINDIR}
-include ${DEPS}