X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=Makefile;h=409c4b4aed627494cb151ddf718d3990ca744e1d;hp=55d5f5ede3269af8928cb3689613918aa2541dc0;hb=75a2f5a4b855ba9efd9e6de954eb35fda633909e;hpb=9d724ba2aa3b69cc56d20e5f578b2c1399e965f6 diff --git a/Makefile b/Makefile index 55d5f5ed..409c4b4a 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,17 @@ # Especially tools/ccanlint/ccanlint and tools/namespacize. # distclean: destroy everything back to pristine state -ALL=$(patsubst ccan/%/test, %, $(wildcard ccan/*/test)) -ALL_DIRS=$(patsubst %, ccan/%, $(ALL)) +# Anything with an _info.c file is a module. +ALL=$(patsubst ccan/%/_info.c, %, $(wildcard ccan/*/_info.c)) ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(ALL)) +# Not all modules have tests. +ALL_TESTS=$(patsubst ccan/%/test/, %, $(wildcard ccan/*/test/)) default: libccan.a include Makefile-ccan -check: $(ALL_DIRS:ccan/%=check-%) +check: $(ALL_TESTS:%=check-%) distclean: clean rm -f $(ALL_DEPENDS) @@ -27,9 +29,12 @@ $(ALL_DEPENDS): %/.depends: %/_info.c tools/ccan_depends @tools/ccan_depends $* > $@ || ( rm -f $@; exit 1 ) # Actual dependencies are created in inter-depends -check-%: tools/run_tests +check-%: tools/run_tests ccan/%/_info @echo Testing $*... - @if tools/run_tests $(V) `[ ! -f ccan/$*.o ] || echo --apiobj=ccan/$*.o` ccan/$* $(filter-out ccan/$*.o, $(filter %.o, $^)) | grep ^'not ok'; then exit 1; else exit 0; fi + @if tools/run_tests $(V) $$(for f in `ccan/$*/_info libs`; do echo --lib=$$f; done) `[ ! -f ccan/$*.o ] || echo --apiobj=ccan/$*.o` ccan/$* $(filter-out ccan/$*.o, $(filter %.o, $^)) | grep ^'not ok'; then exit 1; else exit 0; fi + +ccan/%/_info: ccan/%/_info.c + $(CC) $(CFLAGS) -o $@ $< libccan.a(%.o): ccan/%.o $(AR) r $@ $<