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)
7 # Automatic dependency generation: makes ccan/*.d files.
11 # Every directory with .c files is included.
12 DIRS=$(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/*.c))))
14 # We compile all the ccan/foo/*.o files together into ccan/foo.o
17 libccan.a: $(OBJFILES)
20 # Dependencies are autogenerated in the .d files.
21 # We create all the .o files and link them together.
23 cd $* && $(CC) -I../.. $(CFLAGS) -c *.c && cd ../.. && $(LD) -r -o $@ `echo $*/*.c ' ' | sed 's/\.c /.o /g'`