dcbd6f9c19b7a8e947984aff9fada5633c4b824a
[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         ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
11         ccan/talloc/talloc.o ccan/noerr/noerr.o
12
13 OBJS := $(CORE_OBJS) $(TEST_OBJS)
14
15 # FIXME: write a trivial C program to do this
16 tools/ccanlint/generated-normal-tests: $(NORMAL_TEST_CFILES)
17         cat $^ | grep ^REGISTER_TEST > $@
18 tools/ccanlint/generated-compulsory-tests: $(COMPULSORY_TEST_CFILES)
19         cat $^ | grep ^REGISTER_TEST > $@
20
21 $(TEST_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
22
23 # Otherwise, ccanlint.c et al. may fail to build
24 $(CORE_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
25
26 tools/ccanlint/ccanlint: $(OBJS)
27
28 ccanlint-clean:
29         $(RM) tools/ccanlint/generated-compulsory-tests
30         $(RM) tools/ccanlint/generated-normal-tests
31         $(RM) tools/ccanlint/ccanlint
32