chiark / gitweb /
build system: Rename stamp-h to config.stamp
[secnet.git] / test / Makefile.in
1
2 CC:=@CC@
3
4 TARGETS=udp-preload.so check
5
6 TESTSCRIPTS ?= $(shell echo t-*[0-9a-z])
7 TESTNAMES := $(patsubst t-%,%,$(notdir $(TESTSCRIPTS)))
8
9 all: $(TARGETS)
10
11 CFLAGS += -D_REENTRANT -fPIC
12
13 udp-preload.so: udp-preload.o
14         $(CC) -shared -Wl,-soname,$@.1 $^ -o $@ -ldl
15
16 # These test scripts use little cpu but contain sleeps etc.  So when
17 # there are several, we are going to want to run *loads* in parallel.
18 #
19 # Ideally we would do something like "every one of these counts for a
20 # tenth of a job" but make can't do that.  So bodge it: we treat all the
21 # tests as a single job, and disconnect the parent's jobserver.
22 #
23 # make.info says $(MAKE) causes special handling of the rule but only
24 # if it's written literally like that in the rule, hence this
25 # indirection.  We need no squash MAKEFLAGS and MFLAGS too.
26 # MAKELEVEL seems like it will be fine to pass on.
27
28 MAKE_NOTSPECIAL:=$(MAKE)
29
30 check:
31         env -u MAKEFLAGS -u MFLAGS \
32         $(MAKE_NOTSPECIAL) -j$(shell nproc || 1)0 check-real
33
34 check-real: $(foreach t,$(TESTNAMES),d-$t/ok)
35
36 d-%/ok: t-% udp-preload.so common.tcl ../secnet ../test-example/sites.conf
37         @rm -rf d-$*; mkdir d-$*
38         @cd .. && test/$< >test/d-$*/log 2>&1
39         @printf "$* "
40         @touch $@
41
42 clean:
43         $(RM) -f *.o *.so
44         $(RM) -rf tmp