]> pd.if.org Git - pdclib/blob - Makefile
Added Makefile and moved internal headers into seperate directory (allowing easier...
[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 SRCFILES := $(shell find . -name "*.c" -mindepth 1 -maxdepth 3)
5 HDRFILES := $(shell find . -name "*.h" -mindepth 1 -maxdepth 3)
6 OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
7 DEPFILES := $(patsubst %.c,%.d,$(SRCFILES))
8 ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
9
10 CPPFLAGS  := -MMD -MP
11 CFLAGS    := -g -std=c99 -I./internals/
12
13 .PHONY: all clean dist
14
15 all: $(OBJFILES)
16         ar r pdclib.a $(OBJFILES)
17
18 -include $(DEPFILES)
19
20 clean:
21         -@for file in $(OBJFILES) $(DEPFILES) pdclib.a; do if [ -f $$file ]; then rm $$file; fi; done
22
23 dist:
24         @tar czf pdclib.tgz $(ALLFILES)
25
26 %.o: %.c Makefile
27         $(CC) $(MODE) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
28