Move ccanlint tests into subdirectories.
[ccan] / tools / ccanlint / Makefile
1 TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c) \
2         $(wildcard tools/ccanlint/tests/*.c)
3 TEST_OBJS := $(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         ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
9         ccan/talloc/talloc.o ccan/noerr/noerr.o
10
11 OBJS := $(CORE_OBJS) $(TEST_OBJS)
12
13 tools/ccanlint/generated-init-tests: $(OBJS)
14         cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@
15
16 tools/ccanlint/ccanlint.o: tools/ccanlint/generated-init-tests
17
18 tools/ccanlint/ccanlint: $(OBJS)
19
20 ccanlint-clean:
21         $(RM) tools/ccanlint/generated-init-tests
22         $(RM) tools/ccanlint/ccanlint
23