]> git.ozlabs.org Git - ccan/blob - tools/ccanlint/Makefile
b84b8353fa2da22c8692963acfd8919e6854f304
[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/doc_extract-core.o \
8         tools/depends.o \
9         tools/tools.o \
10         tools/compile.o \
11         ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
12         ccan/btree/btree.o \
13         ccan/talloc/talloc.o ccan/noerr/noerr.o \
14         ccan/read_write_all/read_write_all.o \
15         ccan/opt/opt.o ccan/opt/usage.o ccan/opt/helpers.o ccan/opt/parse.o
16
17 OBJS := $(CORE_OBJS) $(TEST_OBJS)
18
19 # FIXME: write a trivial C program to do this
20 tools/ccanlint/generated-normal-tests: $(NORMAL_TEST_CFILES)
21         cat $^ | grep ^REGISTER_TEST > $@
22 tools/ccanlint/generated-compulsory-tests: $(COMPULSORY_TEST_CFILES)
23         cat $^ | grep ^REGISTER_TEST > $@
24
25 $(TEST_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
26
27 # Otherwise, ccanlint.c et al. may fail to build
28 $(CORE_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
29
30 tools/ccanlint/ccanlint: $(OBJS)
31
32 ccanlint-clean:
33         $(RM) tools/ccanlint/generated-compulsory-tests
34         $(RM) tools/ccanlint/generated-normal-tests
35         $(RM) tools/ccanlint/ccanlint
36