7 XCC ?= ~/local/bin/eccp
8 XCC_GOOD = gcc -malign-double -S
18 TESTERR = .compile.err.log
19 TESTSUC = .compile.suc.log
21 # maximum running time for a testprogram in seconds (default 5min)
26 # define extension and additional includes
29 #INC = -I$(HOME)/cvs/be/C_GENERIC
43 SRC = apfel.c Doit.c LongLong.c Switcher.c \
44 Args.c Empty.c mul.c Test.c \
45 Arrays.c EmptyFor.c optest.c Thilo.c \
46 Field.c Pdg.c trivial_add.c \
47 BinaryOpTest.c Float.c Queens.c trivial_div.c \
48 BreakTest.c ForTest.c QuickSort.c trivial_empty.c \
49 ByteTest.c gcd.c RegallocBug.c trivial_extern_add.c \
50 CallingTest.c GlobalCseTest.c Return.c trivial_max.c \
51 callref.c Hanoi.c SieveBits.c trivial_sum_upto.c \
52 HeapSort.c Sieve.c trivial_two_times.c \
53 CondExpr.c HelloWorld.c SimpleExpr.c While.c \
54 IfExpr.c Strings.c ContinueTest.c XXEndless.c \
56 DeclTest.c Label.c structtest.c \
57 Do.c Local.c Swap.c ll_call.c \
58 MergeSort.c Or.c while-printf.c multidim-array.c \
59 fehler1.c fehler3.c fehler4.c \
60 fehler5.c fehler6.c fehler7.c fehler8.c \
61 fehler9.c fehler10.c fehler11.c fehler12.c \
62 simd1.c simd2.c enum.c max.c \
63 use_uninit_ptr.c func_arg.c ns.c array_type.c \
64 sparam.c wrong_cmp.c nested_loops.c alloca.c \
65 nested_loops2.c truth.c iabs.c stmt_expr.c \
66 dblstruct.c tailrec.c types.c types2.c \
67 nullnode.c bf_store.c duffs.c bf_init.c \
68 bf_localinit.c switch_test.c rotate.c biggest_prime.c \
69 DivBug.c strenght_red.c divtest.c pbqp_RedN.c \
74 ##################################
75 ###### causes endless loop: ######
76 ##################################
79 ASM_SRC = $(SRC:.c=.$(EXT))
80 TARGETS = $(ASM_SRC:.$(EXT)=)
81 LOGS = $(ASM_SRC:.$(EXT)=.log)
83 .PHONY: run clean good good_i all
87 @echo "compile == run your backend"
88 @echo "build == assemble files (on target platform)"
89 @echo "compare == run the executeables and compare with GOOD results"
90 @echo "good == copy the log files into GOOD repository"
91 @echo "run == make the combined test (only for ia-32)"
92 @echo "clean == removes cores and logs"
93 @echo "realclean == removes all generated files"
94 @echo "test == try to compile, used by automatic tests"
98 # how to assemble "something"
101 @$(ECHO) gcc $(INC) -o $@ $<
102 @gcc $(INC) -o $@ $< || gcc -o $@ error.c
105 # how to compile a C file into "something"
109 @$(XCC) $< >/dev/null 2>error || (mv core* $<.core ; $(ECHO) -e "\n$<: corefile $<.core" >> $(ERR) && $(CAT) error >> $(ERR) && $(ECHO) "int main(void) { printf(\"$<\\n Compile failed!\\n\"); }" > $@)
110 @if [ -f $@ ]; then $(RM) error ; else $(ECHO) "int main(void) { printf(\"$<\\n Compile produced empty file!\\n\"); }" > $@ ; $(CAT) error >> $(ERR) ; fi
114 @$(XCC) $< >/dev/null 2>error || (mv core* $<.core ; $(ECHO) -e "\n$<: corefile $<.core" >> $(ERR) && $(CAT) error >> $(ERR) && $(ECHO) "int main(void) { printf(\"$<\\n Compile failed!\\n\"); }" > $@.c.c && gcc -S $@.c.c -o $@ && rm $@.c.c )
115 @if [ -f $@ ]; then $(RM) error ; else $(ECHO) "int main(void) { printf(\"$<\\n Compile produced empty file!\\n\"); }" > $@.c.c ; gcc -S $@.c.c -o $@; rm $@.c.c ; $(CAT) error >> $(ERR) ; fi
119 # how to create an mmix emulator executable from a .mms assembler file (for gas)
122 mmix-gcc -xassembler $< -o $@
125 # how to create a default executable from an .s assembler file (for gas)
128 gcc -malign-double -g -lm $< -o $@ || true
131 # how to create a default executable from an .s assembler file (for gas)
134 gcc -g -lm $< -o $@ || true
137 # how to create a file from a target
141 @ulimit -St $(maxtime); ./$^ > $@ || \
142 if [ "$$?" = "152" ]; then echo "$^: Process killed (CPU time limit exceeded)"; tail -1000 $@ > $@.tmp; mv $@.tmp $@; fi || \
145 $(TARGETS): $(ASM_SRC)
147 compile: clean $(ASM_SRC)
151 run: error.c $(TARGETS)
153 @$(ECHO) -e "\nRunning..."
154 @for i in $(TARGETS); do ./$$i | tee -a $(LOG) | tee $$i.log ; done
155 @if [ -s $(ERR) ]; then $(ECHO) -e "\nThere were compile errors, see $(LOG)"; fi
156 @$(ECHO) -e "\nError reports:" >> $(LOG)
157 -@$(CAT) $(ERR) >> $(LOG)
159 @$(ECHO) "For run log, see file $(LOG)"
162 @$(ECHO) "main() { printf(\"GCC compile errors!\n\"); }" > $@
165 $(RM) *.stat *.ilp *.ra *.ra.res *.pstat *.vcg *.$(EXT) *.o core* $(TARGETS) .error.c *.errlog $(TESTERR) $(TESTSUC) error $(ERR) .comp.log
168 $(RM) $(LOG) $(RUN) $(ERR) $(ECNT) $(GCNT) *.core *.log GOOD/*.good
171 @for i in $(TARGETS); do ./$$i ; done
174 @for i in $(TARGETS); do mv $$i.log GOOD/$$i.good ; done
177 $(MAKE) XCC="$(XCC_GOOD)" realclean good_i
182 # @for i in $(TARGETS); do diff -u1 $$i.log GOOD/$$i.good | less ; done
183 @for i in $(TARGETS); do echo $$i >> $(GCNT); diff -u1 $$i.log GOOD/$$i.good || echo $$i >> $(ECNT) ; done
184 @diff -u $(ECNT) $(GCNT) || true
185 @echo "############# Number of Differences #############"
187 @echo "############# Total number of Tests #############"
189 @echo "############# Detailed list of failures #########"
190 @$(RM) $(ECNT) $(GCNT)
193 for i in $(SRC); do \
194 $(ECHO) $(XCC) $$i; \
195 $(XCC) $$i &> $$i.errlog; \
196 if [ $$? -ne 0 ]; then \
197 $(ECHO) -e "Compilation of $$i failed: \n" >> $(TESTERR); \
198 $(CAT) $$i.errlog >> $(TESTERR); \
199 $(ECHO) -e "\n--------------------------------------------------------------------------------------\n" >> $(TESTERR); \
201 $(ECHO) "Compilation of $$i successful." >> $(TESTSUC); \
206 for i in *.c.xml ; do ~/CRS/firmxml/test/inout $$i $$i.xml ; done
209 for i in *.c.xml.xml ; do ~/CRS/firmxml/test/inout $$i $$i.xml ; done
212 for i in *.c.xml.xml.xml ; do ~/CRS/firmxml/test/inout $$i $$i.xml ; done