クロック周波数の定義を追加
[YACASL2.git] / test / astest / Test.mk
1 CASL2 = ../../../casl2
2 ifndef CASL2FLAG
3         CASL2FLAG = -tals
4 endif
5 COMET2 = ../../../comet2
6 ifndef COMET2FLAG
7         COMET2FLAG = -td
8 endif
9 ifndef ASFILE
10         ASFILE=../../../as/$(UNITNAME).casl
11 endif
12 ifdef INFILE
13         IN= <$(INFILE)
14 endif
15 LOGFILE = ../test.log
16 define report
17   @echo -n "$(UNITNAME): Test " >$@
18   @if test ! -s $^; then \
19     echo -n "Success " >>$@; \
20   else \
21     echo -n "Failure " >>$@; \
22   fi
23   @echo `date +"%F %T"` >>$@
24 endef
25
26 .PHPNY: all check ocheck prepare oprepare testclean otestclean orgclean oorgclean
27 check: testclean logadd
28 ocheck: otestclean ologadd
29 all: check ocheck
30 prepare: orgclean testclean 0.txt
31 oprepare: oorgclean otestclean 0.o 0.o.txt
32 orgclean:
33         @rm -f 0.txt
34 oorgclean:
35         @rm -f 0.o 0.o.txt
36 testclean:
37         @rm -f 1.txt diff.txt report.txt
38 otestclean:
39         @rm -f 1.o 1.o.txt diff.o.txt report.o.txt
40 0.txt 1.txt: $(CASL2) $(ASFILE) $(INFILE)
41         @-$(CASL2) $(CASL2FLAG) $(ASFILE) $(IN) >res.txt 2>err.txt; \
42       cat res.txt err.txt >$@; \
43       rm res.txt err.txt
44 diff.txt: 1.txt
45         @-diff 0.txt 1.txt >$@ 2>&1
46 report.txt: diff.txt
47         $(report)
48 logadd: report.txt
49         @cat $^ >>$(LOGFILE)
50 0.o 1.o: $(CASL2) $(ASFILE)
51         @-$(CASL2) -o $@ $(ASFILE)
52 0.o.txt: $(COMET2) 0.o
53         @-$(COMET2) $(COMET2FLAG) 0.o >0.o.txt
54 1.o.txt: $(COMET2) 1.o
55         @-$(COMET2) $(COMET2FLAG) 1.o >1.o.txt
56 diff.o.txt: 1.o.txt
57         @-diff 0.o.txt 1.o.txt >>$@ 2>&1
58 report.o.txt: diff.o.txt
59         $(report)
60 ologadd: report.o.txt
61         @cat $^ >>$(LOGFILE)