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 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)
10 # Automatic dependency generation: makes ccan/*/*.d files.
14 # Every directory with .c files is included.
15 DIRS=$(filter-out $(foreach d,$(EXCLUDE),ccan/$d), $(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/*.c)))))
17 # Generate everyone's separate Makefiles.
18 -include $(foreach dir, $(DIRS), $(dir)-Makefile)
21 @echo $@: $(wildcard ccan/$*/*.[ch]) ccan/$*/_info > $@
22 @echo ccan/$*.o: $(patsubst %.c, %.o, $(wildcard ccan/$*/*.c)) >> $@
24 # We compile all the ccan/foo/*.o files together into ccan/foo.o
27 # We create all the .o files and link them together.
31 libccan.a: $(OBJFILES)
32 $(AR) r $@ $(OBJFILES)