]> 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 a084a2244dbb73c854cac36389b4c917c1aaf27b..16c4bfd2b3324daab2c6462af18341d7528601a8 100644 (file)
@@ -1,31 +1,26 @@
-OBJS := tools/ccanlint/no_info.o \
-       tools/ccanlint/has_main_header.o \
-       tools/ccanlint/has_tests.o \
-       tools/ccanlint/trailing_whitespace.o \
-       tools/ccanlint/idempotent.o \
-
-FUTURE:=tools/ccanlint/if_have_not_ifdef.o \
-       tools/ccanlint/needs_depends.o \
-       tools/ccanlint/has_info_documentation.o \
-       tools/ccanlint/has_header_documentation.o \
-       tools/ccanlint/has_tests.o \
-       tools/ccanlint/builds_ok.o \
-       tools/ccanlint/builds_ok_all_have_variants.o \
-       tools/ccanlint/run_tests.o \
-       tools/ccanlint/test_coverage.o \
-
-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' >$@
-
-tools/ccanlint/ccanlint.o: tools/ccanlint/generated-init-tests
-
-tools/ccanlint/ccanlint: \
-       $(OBJS)                 \
-       tools/ccanlint/ccanlint.o \
+TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c) \
+       $(wildcard tools/ccanlint/tests/*.c)
+TEST_OBJS := $(TEST_CFILES:.c=.o)
+
+CORE_OBJS := tools/ccanlint/ccanlint.o \
        tools/ccanlint/file_analysis.o \
+       tools/doc_extract-core.o \
        ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
        ccan/talloc/talloc.o ccan/noerr/noerr.o
 
+OBJS := $(CORE_OBJS) $(TEST_OBJS)
+
+# FIXME: write a trivial C program to do this
+tools/ccanlint/generated-init-tests: $(TEST_CFILES)
+       cat $(TEST_CFILES) | grep ^REGISTER_TEST > $@
+
+$(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)
+
 ccanlint-clean:
        $(RM) tools/ccanlint/generated-init-tests
        $(RM) tools/ccanlint/ccanlint