]> pd.if.org Git - pdclib/blob - Makefile
Added #ifdef to allow for regression against system library.
[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 OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
8 TSTFILES := $(patsubst %.c,%.t,$(SRCFILES))
9 DEPFILES := $(patsubst %.c,%.d,$(SRCFILES))
10 ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
11
12 .PHONY: all clean dist
13
14 all: $(OBJFILES)
15         @ar r pdclib.a $?
16
17 test: $(TSTFILES)
18         -@rc=0; for file in $(TSTFILES); do echo "Testing $$file..."; ./$$file; rc=`expr $$rc + $$?`; done; echo; echo "Tests failed: $$rc"
19
20 -include $(DEPFILES)
21
22 clean:
23         -@for file in $(OBJFILES) $(DEPFILES) $(TSTFILES) pdclib.a; do if [ -f $$file ]; then rm $$file; fi; done
24
25 dist:
26         @tar czf pdclib.tgz $(ALLFILES)
27
28 %.o: %.c Makefile
29         @$(CC) -Wall -DNDEBUG -MMD -MP -MT "$*.d $*.t" -g -std=c99 -I./internals -c $< -o $@
30
31 %.t: %.c Makefile all
32         @$(CC) -Wall -DTEST -std=c99 -I./internals/ $< pdclib.a -o $@
33