summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-03-13 09:13:17 +1030
committerRusty Russell <rusty@rustcorp.com.au>2009-03-13 09:13:17 +1030
commitc1bdf46aba778eb16577a23db03ef2166d9de75d (patch)
tree7d6a7ea2368572ae050c02cfc7379172a247088b
parenta5f9a8fbcea19f50aa3594ce2dbf5a13c5455ecc (diff)
Handle multiple .c files in directory properly (isaac).
-rw-r--r--Makefile-ccan5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile-ccan b/Makefile-ccan
index 68f7d02d..5d04109e 100644
--- a/Makefile-ccan
+++ b/Makefile-ccan
@@ -6,7 +6,7 @@ CFLAGS=-g -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototy
# 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))))
@@ -18,6 +18,7 @@ libccan.a: $(OBJFILES)
$(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'`