]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/Makefile
Make ccanlint core objects depend on generated-init-tests to fix build error
[ccan] / tools / ccanlint / Makefile
index cd507e5d08d8237ba06b0c138a85c39dd39d25c4..16c4bfd2b3324daab2c6462af18341d7528601a8 100644 (file)
@@ -10,10 +10,14 @@ CORE_OBJS := tools/ccanlint/ccanlint.o \
 
 OBJS := $(CORE_OBJS) $(TEST_OBJS)
 
-tools/ccanlint/generated-init-tests: $(OBJS)
-       cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@
+# FIXME: write a trivial C program to do this
+tools/ccanlint/generated-init-tests: $(TEST_CFILES)
+       cat $(TEST_CFILES) | grep ^REGISTER_TEST > $@
 
-tools/ccanlint/ccanlint.o: tools/ccanlint/generated-init-tests
+$(TEST_OBJS): tools/ccanlint/generated-init-tests
+
+# Otherwise, ccanlint.c et al. may fail to build
+$(CORE_OBJS): tools/ccanlint/generated-init-tests
 
 tools/ccanlint/ccanlint: $(OBJS)