Added regression tests for compound comparisons.
[fw/sdcc] / src / regression / Makefile
1 # Regression testing Makefile for Pic Port of SDCC
2 #
3 # note that this regression suite was started before
4 # the one in sdcc/regression. The regression suite in
5 # sdcc/regression is better suited for testing mature
6 # ports.
7 #
8 # GPL'd
9 #
10 # T. Scott Dattalo scott@dattalo.com
11 #
12 # This makefile provides a means by which the output
13 # of the SDCC Compiler can be tested. This version
14 # is unique to the PIC (as in Microchip PIC) port.
15 # As such it requires the following software:
16 #
17 #  gpasm version 0.8.10 (or greater)
18 #  gpsim version 0.20.7 (or greater)
19 #
20 # Usage:
21 #
22 # make
23 #  - without any options the whole regression test is
24 #    performed. The results are placed into a log file
25 #    (defined by $LOGFILE).
26 #
27 # make asm
28 #  - Creates .asm files by compiling the .c files
29 #
30 # make cod
31 #  - Creates .cod files by assembling the .asm files
32 #    (.cod files are symbolic files compatible with
33 #    MPASM, Microchip's assembler)
34 #
35 # make stc
36 #  - Creates .stc files which are script files for
37 #    gpsim.
38 #
39 # make clean
40 #  - removes all of the intermediate files created
41 #
42 # make cleancod
43 # make cleanasm
44 # make cleanstc
45 #  - removes either the .stc, .asm, or .cod files
46
47
48 CC = ../../bin/sdcc
49
50 HEADER=/usr/local/share/gpasm/header
51
52 .SUFFIXES: .asm .c .cod .stc
53
54 # Results of the test are placed here:
55 LOGFILE = test.log
56
57 # Script file for creating gpsim scripts
58 CREATESTC = create_stc
59
60 # Script file for invoking gpsim
61 SIMULATE = simulate
62
63 # List the C files to be test here:
64 SRC = b.c \
65         add.c \
66         add2.c \
67         add3.c \
68         and1.c \
69         bool1.c \
70         bool2.c \
71         bool3.c \
72         call1.c \
73         compare.c \
74         compare2.c \
75         compare3.c \
76         compare4.c \
77         compare5.c \
78         compare6.c \
79         for.c \
80         or1.c \
81         rotate1.c \
82         rotate2.c \
83         rotate3.c \
84         rotate4.c \
85         rotate5.c \
86         struct1.c \
87         sub.c \
88         sub2.c \
89         switch1.c \
90         while.c \
91         xor.c
92
93 #       mul1.c \
94
95 COD := $(patsubst %.c, %.cod, $(SRC))
96 ASM := $(patsubst %.c, %.asm, $(SRC))
97 STC := $(patsubst %.c, %.stc, $(SRC))
98
99 all:    test
100
101
102 # The asm files are generated by sdcc
103 .c.asm:
104         $(CC) -mpic14 -S $*.c
105
106 # The .cod files are generated by gpasm
107 # these get loaded by gpsim.
108 .asm.cod:
109         gpasm -c -I $(HEADER) $*.asm
110
111 # The .stc files are script files for gpsim
112 .cod.stc:
113         ./$(CREATESTC) $*.cod $*.stc
114         ./$(SIMULATE) $*.stc $(LOGFILE)
115
116 # this will also make .stc files
117 #%.stc : %.cod
118 #       ./create_stc $^ $@
119
120 # now for the dependencies
121
122 cod : $(COD)
123
124
125 asm : $(ASM)
126
127 stc : $(STC)
128
129 test:   $(STC)
130         echo "Done - Results are in $(LOGFILE)"
131
132 cleancod:
133         files="$(COD)" ; \
134         for f in $$files ; do \
135           if [ -f $$f ]; then rm $$f; fi \
136         done ; \
137
138 cleanasm:
139         files="$(ASM)" ; \
140         for f in $$files ; do \
141           if [ -f $$f ]; then rm $$f; fi \
142         done ; \
143
144 cleanstc:
145         files="$(STC)" ; \
146         for f in $$files ; do \
147           if [ -f $$f ]; then rm $$f; fi \
148         done ; \
149
150 clean: cleancod cleanasm cleanstc
151         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi