]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/tool/preprocess/test/Makefile
update
[l4.git] / kernel / fiasco / tool / preprocess / test / Makefile
1 # scan the L4 global configuration file
2 L4DIR   ?= ../../..
3 #include $(L4DIR)/mk/Makeconf
4
5 TOOL = ../src/preprocess
6
7 all:: test
8
9 ALL_TESTS = $(TOOL_TESTS)
10 TOOL_TESTS = mapping mapping_inline random random_inline extern_c static \
11   noinline explicit operator template template_inline c-preproc \
12   inline inline_noinline \
13   parser parser_noinline \
14   multifile variable line line_not line_nh interface comment_in_string \
15   default_args drop_single1 drop_single2 drop_single3 drop_multi1 \
16   drop_multi2 implement_template
17
18 mapping_inline_src = mapping
19 mapping_inline_flags = -i
20
21 random_inline_src = random
22 random_inline_flags = -i
23
24 static_flags = -i
25
26 inline_flags = -i
27
28 inline_noinline_src = inline
29 inline_noinline_flags =
30
31 noinline_flags = -i
32
33 template_inline_src = template
34 template_inline_flags = -i
35
36 parser_flags = -i
37
38 parser_noinline_src = parser
39 parser_noinline_flags = 
40
41 multifile_src = multifile1 multifile2
42 multifile_flags = -i
43 multifile_extra = multifile-part1.cc multifile-part2.cc
44
45 line_not_src = line
46 line_not_flags = -l
47
48 line_nh_src = line
49 line_nh_flags = -L
50
51 interface_missing = interface.h
52 interface_extra = interfacepublic.h
53
54 drop_single1_src   = dropsection
55 drop_single1_flags = -s -e "bax"
56
57 drop_single2_src   = dropsection
58 drop_single2_flags = -s -e "bax ixbix"
59
60 drop_single3_src   = dropsection
61 drop_single3_flags = -s -e "bax aba"
62
63 drop_multi1_src    = dropsection dropsection-ext
64 drop_multi1_flags  = -s -e "bax aba"
65 drop_multi1_extra  = drop_multi1-ext.cc
66
67 drop_multi2_src    = dropsection dropsection-ext
68 drop_multi2_flags  = -s -e "bax aba ext"
69 drop_multi2_extra  = drop_multi2-ext.cc
70
71 ifdef_src          = ifdef
72 ifdef_flags        = -s -e "true"
73
74 ifdef1_src         = ifdef1
75 ifdef1_flags       = -s -e "true"
76 ifdef1_extra       = ifdef1-more.cpp
77
78 random.cpp: combine.pl
79         perl $< > $@.new
80         mv $@.new $@
81
82 clean::
83         rm -f random.cpp
84
85 test_rules: Makefile
86         rm -f $@.new
87         for test in $(TOOL_TESTS); \
88           do \
89             echo "ifndef $${test}_src" >> $@.new; \
90             echo "$${test}_src = $${test}" >> $@.new; \
91             echo "endif" >> $@.new; \
92             echo "ifndef $${test}_flags" >> $@.new; \
93             echo "$${test}_flags = " >> $@.new; \
94             echo "endif" >> $@.new; \
95             echo "$${test}.cc: \$$(addsuffix .cpp, \$$($${test}_src)) \$$(TOOL); \$$(TOOL) \$$($${test}_flags) -c $${test} \$$(filter-out \$$(TOOL), \$$^)" >> $@.new; \
96           done
97         mv $@.new $@
98
99 include test_rules
100
101 clean::
102         rm -f $(addsuffix .cc, $(TOOL_TESTS)) \
103           $(addsuffix .h, $(TOOL_TESTS)) \
104           $(addsuffix _i.h, $(TOOL_TESTS)) 
105
106 .PHONY: test
107 test: $(addsuffix .t.ok, $(ALL_TESTS)) 
108
109 %.t.ok: %.cc
110         @echo -n "Running test $* ... "
111 ifeq ($(RECREATE_OUTPUT),1)
112         @cp $(filter-out $($*_missing),$*.h $*_i.h $*.cc) $($*_extra) verify/
113 endif
114         @for i in $(filter-out $($*_missing),$*.h $*_i.h $*.cc) $($*_extra); \
115           do \
116             diff -u verify $$i || exit 1; \
117           done
118         @echo "OK"
119         @touch $@
120
121 .PHONY: init
122 init:
123         $(MAKE) test RECREATE_OUTPUT=1
124
125 install:
126         @echo Not installing tests.
127
128 clean:: 
129         $(RM) $(ALL) $(OBJS) *.t.ok
130
131 cleanall::      clean
132         $(RM) *~ .*.d test_rules
133
134 #include $(DEPS)