]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/Makefile
ccanlint: test for C++ reserved words in headers.
[ccan] / tools / ccanlint / Makefile
index 60a35c121050a9e08785f4543775e67c5e487506..3772267ed418b4d845fc10d777a4c64c41792899 100644 (file)
@@ -1,32 +1,41 @@
-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 \
-       tools/ccanlint/get_file_lines.o \
+COMPULSORY_TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c)
+NORMAL_TEST_CFILES := $(wildcard tools/ccanlint/tests/*.c)
+TEST_OBJS := $(NORMAL_TEST_CFILES:.c=.o) $(COMPULSORY_TEST_CFILES:.c=.o)
+
+CORE_OBJS := tools/ccanlint/ccanlint.o \
        tools/ccanlint/file_analysis.o \
-       ccan/talloc/talloc.o ccan/noerr/noerr.o
+       tools/doc_extract-core.o \
+       tools/depends.o \
+       tools/tools.o \
+       tools/compile.o \
+       ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
+       ccan/str/str.o ccan/str/debug.o \
+       ccan/asort/asort.o \
+       ccan/btree/btree.o \
+       ccan/talloc/talloc.o ccan/noerr/noerr.o \
+       ccan/talloc_link/talloc_link.o ccan/noerr/noerr.o \
+       ccan/foreach/foreach.o \
+       ccan/hash/hash.o ccan/htable/htable.o \
+       ccan/read_write_all/read_write_all.o \
+       ccan/opt/opt.o ccan/opt/usage.o ccan/opt/helpers.o ccan/opt/parse.o
+
+OBJS := $(CORE_OBJS) $(TEST_OBJS)
+
+# FIXME: write a trivial C program to do this
+tools/ccanlint/generated-normal-tests: $(NORMAL_TEST_CFILES)
+       cat $^ | grep ^REGISTER_TEST > $@
+tools/ccanlint/generated-compulsory-tests: $(COMPULSORY_TEST_CFILES)
+       cat $^ | grep ^REGISTER_TEST > $@
+
+$(TEST_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
+
+# Otherwise, ccanlint.c et al. may fail to build
+$(CORE_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests config.h
+
+tools/ccanlint/ccanlint: $(OBJS)
 
 ccanlint-clean:
-       $(RM) tools/ccanlint/generated-init-tests
+       $(RM) tools/ccanlint/generated-compulsory-tests
+       $(RM) tools/ccanlint/generated-normal-tests
        $(RM) tools/ccanlint/ccanlint