6bec8c4a90dbb84c5ea68965a2eb1990cb113118
[ccan] / tools / ccanlint / Makefile
1 COMPULSORY_TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c)
2 NORMAL_TEST_CFILES := $(wildcard tools/ccanlint/tests/*.c)
3 TEST_OBJS := $(NORMAL_TEST_CFILES:.c=.o) $(COMPULSORY_TEST_CFILES:.c=.o)
4
5 CORE_OBJS := tools/ccanlint/ccanlint.o \
6         tools/ccanlint/file_analysis.o \
7         tools/ccanlint/licenses.o \
8         tools/doc_extract-core.o \
9         tools/depends.o \
10         tools/tools.o \
11         tools/compile.o \
12         ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
13         ccan/str/str.o ccan/str/debug.o \
14         ccan/asort/asort.o \
15         ccan/btree/btree.o \
16         ccan/talloc/talloc.o ccan/noerr/noerr.o \
17         ccan/talloc_link/talloc_link.o ccan/noerr/noerr.o \
18         ccan/foreach/foreach.o \
19         ccan/hash/hash.o ccan/htable/htable.o \
20         ccan/read_write_all/read_write_all.o \
21         ccan/opt/opt.o ccan/opt/usage.o ccan/opt/helpers.o ccan/opt/parse.o
22
23 OBJS := $(CORE_OBJS) $(TEST_OBJS)
24
25 # FIXME: write a trivial C program to do this
26 tools/ccanlint/generated-normal-tests: $(NORMAL_TEST_CFILES)
27         cat $^ | grep ^REGISTER_TEST > $@
28 tools/ccanlint/generated-compulsory-tests: $(COMPULSORY_TEST_CFILES)
29         cat $^ | grep ^REGISTER_TEST > $@
30
31 $(TEST_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
32
33 # Otherwise, ccanlint.c et al. may fail to build
34 $(CORE_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests config.h
35
36 tools/ccanlint/ccanlint: $(OBJS)
37
38 ccanlint-clean:
39         $(RM) tools/ccanlint/generated-compulsory-tests
40         $(RM) tools/ccanlint/generated-normal-tests
41         $(RM) tools/ccanlint/ccanlint
42