]> git.ozlabs.org Git - ccan/blob - Makefile-ccan
More header fixups: now it all compiles again.
[ccan] / Makefile-ccan
1 # Example makefile which makes a "libccan.a" of everything under ccan/.
2 # For simple projects you could just do:
3 #       SRCFILES += $(wildcard ccan/*/*.c)
4
5 #CFLAGS=-g -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I. $(DEPGEN)
6 CFLAGS=-g -Wall -Wstrict-prototypes -Wold-style-definition -Werror -I. $(DEPGEN)
7
8 # Automatic dependency generation: makes ccan/*.d files.
9 DEPGEN=-MD
10 -include ccan/*/*.d
11
12 # Every directory with .c files is included.
13 DIRS=$(filter-out $(EXCLUDE), $(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/*.c)))))
14
15 # We compile all the ccan/foo/*.o files together into ccan/foo.o
16 OBJFILES=$(DIRS:=.o)
17
18 libccan.a: $(OBJFILES)
19         $(AR) r $@ $^
20
21 # Dependencies are autogenerated in the .d files.
22 # We create all the .o files and link them together.
23 $(OBJFILES): %.o:
24         cd $* && $(CC) -I../.. $(CFLAGS) -c *.c && cd ../.. && $(LD) -r -o $@ `echo $*/*.c ' ' | sed 's/\.c /.o /g'`
25