]> pd.if.org Git - pdclib/blob - Makefile
Disabled zero-length sorting test when running under *BSD as *BSD libc falls into...
[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 := atomax digits seed strtox_main strtox_prelim multiinclude
8 OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
9 TSTFILES := $(patsubst %.c,%.t,$(SRCFILES))
10 REGFILES := $(filter-out $(patsubst %,functions/_PDCLIB/%.r,$(INTFILES)),$(patsubst %.c,%.r,$(SRCFILES)))
11 DEPFILES := $(patsubst %.c,%.d,$(SRCFILES))
12 ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
13
14 .PHONY: clean dist test testdrivers regtest
15
16 all: pdclib.a
17
18 pdclib.a: $(OBJFILES)
19         @ar r pdclib.a $?
20
21 test: testdrivers
22         -@rc=0; for file in $(TSTFILES); do ./$$file; rc=`expr $$rc + $$?`; done; echo; echo "Tests failed: $$rc"
23
24 testdrivers: $(TSTFILES)
25
26 regtest: regtestdrivers
27         -@rc=0; for file in $(REGFILES); do ./$$file; rc=`expr $$rc + $$?`; done; echo; echo "Regression tests failed: $$rc"
28
29 regtestdrivers: $(REGFILES)
30
31 -include $(DEPFILES)
32
33 clean:
34         -@for file in $(OBJFILES) $(DEPFILES) $(TSTFILES) $(REGFILES) pdclib.a pdclib.tgz; do if [ -f $$file ]; then rm $$file; fi; done
35
36 dist:
37         @tar czf pdclib.tgz $(ALLFILES)
38
39 todolist:
40         -@for file in $(ALLFILES); do grep -H TODO $$file; done; true
41
42 %.o: %.c Makefile
43         @$(CC) -Wall -DNDEBUG -MMD -MP -MT "$*.d $*.t" -g -std=c99 -I./includes -I./internals -c $< -o $@
44
45 %.t: %.c Makefile pdclib.a
46         @$(CC) -Wall -DTEST -std=c99 -I./includes -I./internals $< pdclib.a -o $@
47
48 %.r: %.c Makefile
49         @$(CC) -Wall -DTEST -DREGTEST -std=c99 -I./internals $< -o $@