-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
90 lines (65 loc) · 2.21 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
.SUFFIXES:
.ONESHELL:
#.NOTPARALLEL:
# default is ON
NNG_WITH_MBEDTLS?=ON
DC=dmd
DCFLAGS=-O -d -m64 -i -debug -g -gf -gs -gx -dip1000
DINC=nngd extern/libnng/libnng
DTESTS=$(wildcard tests/test*.d)
RUNTESTS=$(basename $(notdir $(DTESTS)))
TESTBENCH=testnng.d
BINTESTBENCH=./build/$(basename $(notdir $(TESTBENCH)))
ifeq ($(NNG_WITH_MBEDTLS),ON)
DCFLAGS=-O -d -m64 -i -debug -g -version=withtls
DLFLAGS=-Lextern/libnng/extern/nng/build/lib/ -Lextern/libnng/extern/mbedtls/build/target/lib/ -lnng -lmbedtls -lmbedcrypto -lmbedx509
else
DCFLAGS=-O -d -m64 -i -debug -g
DLFLAGS=-Lextern/libnng/extern/nng/build/lib/ -lnng
endif
all: extern mime lib testbench
@echo "All done!"
testbench: $(BINTESTBENCH)
$(BINTESTBENCH):
$(DC) $(DCFLAGS) -od=build/ -of=$@ ${addprefix -I,$(DINC)} ${addprefix -L,$(DLFLAGS)} $(TESTBENCH)
runtest: testbench
$(BINTESTBENCH) && echo "All passed!" || echo "Tests failed, see log"
buildtest: $(DTESTS)
extern:
git submodule update --init --recursive && \
$(MAKE) -C extern/
$(DTESTS):
$(DC) $(DCFLAGS) -od=tests/build -of=tests/build/$(basename $(notdir $@)) ${addprefix -I,$(DINC)} -Itests ${addprefix -L,$(DLFLAGS)} $@
mime:
@curl -s -K mime.list |\
awk -f mime.awk > nngd/mime.new && wc -l nngd/mime.new |\
cut -d " " -f 1 |\
awk '{if($$1 > 5) print "mv nngd/mime.new nngd/mime.d";}' |\
sh && rm -f nngd/mime.new || true
lib:
$(DC) $(DCFLAGS) -lib -of=build/libnngd.a -H -Hd=build/ ${addprefix -I,$(DINC)} ${addprefix -L,$(DLFLAGS)} nngd/nngd.d
test: pretest $(RUNTESTS) posttest
pretest:
@echo "It will take about a minute. Be patient."
rm -f logs/*
cp -r tests/webapp tests/build/
cp -r tests/ssl tests/build/
posttest:
@echo "."
@grep -a '#TEST' logs/runtest.log |grep -q ERROR && echo "There are errors. See runtest.log" || echo "All passed!"
.SILENT: $(RUNTESTS)
$(RUNTESTS):
NNG_DEBUG=TRUE tests/build/$@ >> logs/runtest.log
@echo -n "."
clean: clean-extern clean-local
proper: proper-extern clean-local
clean-local:
rm -f ./nngd/mime.d && \
rm -f ./logs/* && \
rm -rf ./build && \
rm -rf ./tests/build
clean-extern:
$(MAKE) clean -C extern/
proper-extern:
$(MAKE) proper -C extern/
.PHONY: all extern mime lib clean $(BINTESTBENCH) testbench runtest $(DTESTS) $(RUNTESTS)