# Automatic dependency generation: makes ccan/*.d files.
DEPGEN=-MD
--include ccan/*.d
+-include ccan/*/*.d
# Every directory with .c files (other than _info.c) is included.
DIRS=$(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/[a-z]*.c))))
$(AR) r $@ $^
# Dependencies are autogenerated in the .d files.
+# We create all the .o files and link them together.
$(OBJFILES): %.o:
- $(CC) $(CFLAGS) -c -o $@ $*/[a-z]*.c
+ cd $* && $(CC) -I../.. $(CFLAGS) -c [a-z]*.c && cd ../.. && $(LD) -r -o $@ `echo $*/[a-z]*.c ' ' | sed 's/\.c /.o /g'`