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)
5 CCAN_CFLAGS=-g -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror
6 CFLAGS = $(CCAN_CFLAGS) -I. $(DEPGEN)
8 #CFLAGS=-g -Wall -Wstrict-prototypes -Wold-style-definition -Werror $(DEPGEN)
12 # Automatic dependency generation: makes ccan/*/*.d files.
16 # Every directory with .c files is included.
17 DIRS=$(filter-out $(foreach d,$(EXCLUDE),ccan/$d), $(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/*.c)))))
19 # Generate everyone's separate Makefiles.
20 -include $(foreach dir, $(DIRS), $(dir)-Makefile)
23 @echo $@: $(wildcard ccan/$*/*.[ch]) ccan/$*/_info > $@
24 @echo ccan/$*.o: $(patsubst %.c, %.o, $(wildcard ccan/$*/*.c)) >> $@
26 # We compile all the ccan/foo/*.o files together into ccan/foo.o
29 # We create all the .o files and link them together.
33 libccan.a: $(OBJFILES)
34 $(AR) r $@ $(OBJFILES)