]> rtime.felk.cvut.cz Git - l4.git/blob - tools/preprocess/test/Makefile
Some minor fixes.
[l4.git] / tools / 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             echo "ifdef $${test}_extra" >> $@.new; \
97             echo "clean:: ; \$$(RM) \$$($${test}_extra)" >> $@.new; \
98             echo "endif" >> $@.new; \
99           done
100         mv $@.new $@
101
102 include test_rules
103
104 clean::
105         rm -f $(addsuffix .cc, $(TOOL_TESTS)) \
106           $(addsuffix .h, $(TOOL_TESTS)) \
107           $(addsuffix _i.h, $(TOOL_TESTS)) 
108
109 .PHONY: test
110 test: $(addsuffix .t.ok, $(ALL_TESTS)) 
111
112 %.t.ok: %.cc
113         @echo -n "Running test $* ... "
114 ifeq ($(RECREATE_OUTPUT),1)
115         @cp $(filter-out $($*_missing),$*.h $*_i.h $*.cc) $($*_extra) verify/
116 endif
117         @for i in $(filter-out $($*_missing),$*.h $*_i.h $*.cc) $($*_extra); \
118           do \
119             diff -u verify $$i || exit 1; \
120           done
121         @echo "OK"
122         @touch $@
123
124 .PHONY: init
125 init:
126         $(MAKE) test RECREATE_OUTPUT=1
127
128 install:
129         @echo Not installing tests.
130
131 clean:: 
132         $(RM) $(ALL) $(OBJS) *.t.ok
133
134 cleanall::      clean
135         $(RM) *~ .*.d test_rules
136
137 #include $(DEPS)