]> pd.if.org Git - pdclib/blob - Makefile
Added 'regtest' target for regression against system lib; made tests quiet; added...
[pdclib] / Makefile
1 # This is a list of all non-source files that are part of the distribution.
2 AUXFILES := Makefile Readme.txt
3
4 PROJDIRS := functions includes internals
5 SRCFILES := $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.c")
6 HDRFILES := $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.h")
7 INTFILES := $(patsubst %.c,%.r,$(shell find functions/_PDCLIB -name "*.c"))
8 OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
9 TSTFILES := $(patsubst %.c,%.t,$(SRCFILES))
10 REGFILES := $(filter-out $(INTFILES),$(patsubst %.c,%.r,$(SRCFILES)))
11 DEPFILES := $(patsubst %.c,%.d,$(SRCFILES))
12 ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
13
14 .PHONY: all clean dist
15
16 all: $(OBJFILES)
17         @ar r pdclib.a $?
18
19 test: $(TSTFILES)
20         -@rc=0; for file in $(TSTFILES); do ./$$file; rc=`expr $$rc + $$?`; done; echo; echo "Tests failed: $$rc"
21
22 regtest: $(REGFILES)
23         -@rc=0; for file in $(REGFILES); do ./$$file; rc=`expr $$rc + $$?`; done; echo; echo "Regression tests failed: $$rc"
24
25 -include $(DEPFILES)
26
27 clean:
28         -@for file in $(OBJFILES) $(DEPFILES) $(TSTFILES) $(REGFILES) pdclib.a pdclib.tgz; do if [ -f $$file ]; then rm $$file; fi; done
29
30 dist:
31         @tar czf pdclib.tgz $(ALLFILES)
32
33 %.o: %.c Makefile
34         @$(CC) -Wall -DNDEBUG -MMD -MP -MT "$*.d $*.t" -g -std=c99 -I./internals -c $< -o $@
35
36 %.t: %.c Makefile all
37         @$(CC) -Wall -DTEST -std=c99 -I./internals/ $< pdclib.a -o $@
38
39 %.r: %.c Makefile
40         @$(CC) -Wall -DTEST -DREGTEST -std=c99 -I./internals/ $< -o $@