* src/pic/pcoderegs.c (pCodeOptime2pCodes): fixed bogus optimization,
[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.11.1 (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 # make cleano
46 #  - removes either the .stc, .asm, .cod or .o files
47
48 # verboseness
49 #Q ?= # be verbose
50 Q ?= @ # be quiet
51
52 CC = sdcc
53 LINKER = gplink
54 TARGETPIC = 16f877
55 TARGETPIC = 16f84
56 CFLAGS = -mpic14 -p$(TARGETPIC)
57 CFLAGS += -Wl,-q
58 CFLAGS += -Wl,--map -I ../../device/include/pic
59 CFLAGS += -L ../../device/lib/pic/bin
60 #CFLAGS += --no-pcode-opt
61
62 .SUFFIXES: .asm .c .cod .stc
63
64 # Results of the test are placed here:
65 LOGFILE = test.log
66
67 # Script file for creating gpsim scripts
68 CREATESTC = create_stc
69
70 # Script file for invoking gpsim
71 SIMULATE = simulate
72
73 # List the C files to be test here:
74 SRC = add.c \
75       add2.c \
76       add3.c \
77       add4.c \
78       and1.c \
79       and2.c \
80       arrays.c \
81       b.c \
82       bank1.c \
83       bool1.c \
84       bool2.c \
85       bool3.c \
86       call1.c \
87       compare.c \
88       compare10.c \
89       compare2.c \
90       compare3.c \
91       compare4.c \
92       compare5.c \
93       compare6.c \
94       compare7.c \
95       compare8.c \
96       compare9.c \
97       configword.c \
98       empty.c \
99       for.c \
100       inline.c \
101       mult1.c \
102       nestfor.c \
103       or1.c \
104       pcodeopt.c \
105       pointer1.c \
106       ptrarg.c \
107       ptrfunc.c \
108       rotate1.c \
109       rotate2.c \
110       rotate3.c \
111       rotate4.c \
112       rotate5.c \
113       rotate6.c \
114       rotate7.c \
115       string1.c \
116       struct1.c \
117       sub.c \
118       sub2.c \
119       switch1.c \
120       while.c \
121       xor.c
122
123 COD := $(patsubst %.c, %.cod, $(SRC))
124 ASM := $(patsubst %.c, %.asm, $(SRC))
125 O   := $(patsubst %.c, %.o,   $(SRC))
126 P   := $(patsubst %.c, %.p,   $(SRC))
127 STC := $(patsubst %.c, %.stc, $(SRC))
128 HEX := $(patsubst %.c, %.hex, $(SRC))
129 LST := $(patsubst %.c, %.lst, $(SRC))
130 MAP := $(patsubst %.c, %.map, $(SRC))
131
132 all:    test
133
134
135 # The cod files are generated by sdcc
136 .c.cod:
137         $(Q)-$(CC) $(CFLAGS) $*.c
138
139 # The .stc files are script files for gpsim
140 .cod.stc:
141         $(Q)-./$(CREATESTC) $*.cod $*.stc
142         $(Q)-./$(SIMULATE) $*.stc $(LOGFILE)
143
144 # this will also make .stc files
145 #%.stc : %.cod
146 #       ./create_stc $^ $@
147
148 # now for the dependencies
149
150 cod : $(COD)
151
152 o : $(O)
153
154 asm : $(ASM)
155
156 stc : $(STC)
157         echo $(STC)
158
159 test:   $(STC)
160         $(Q)echo "Done - Results are in $(LOGFILE)"
161
162 cleancod:
163         files="$(COD)" ; \
164         for f in $$files ; do \
165           if [ -f $$f ]; then rm $$f; fi \
166         done ; \
167
168 cleano:
169         files="$(O)" ; \
170         for f in $$files ; do \
171           if [ -f $$f ]; then rm $$f; fi \
172         done ; \
173
174 cleanp:
175         files="$(P)" ; \
176         for f in $$files ; do \
177           if [ -f $$f ]; then rm $$f; fi \
178         done ; \
179
180 cleanasm:
181         files="$(ASM)" ; \
182         for f in $$files ; do \
183           if [ -f $$f ]; then rm $$f; fi \
184         done ; \
185
186 cleanstc:
187         files="$(STC)" ; \
188         for f in $$files ; do \
189           if [ -f $$f ]; then rm $$f; fi \
190         done ; \
191
192 cleanhex:
193         files="$(HEX)" ; \
194         for f in $$files ; do \
195           if [ -f $$f ]; then rm $$f; fi \
196         done ; \
197
198 cleanlst:
199         files="$(LST)" ; \
200         for f in $$files ; do \
201           if [ -f $$f ]; then rm $$f; fi \
202         done ; \
203
204 cleanmap:
205         files="$(MAP)" ; \
206         for f in $$files ; do \
207           if [ -f $$f ]; then rm $$f; fi \
208         done ; \
209
210 clean: cleancod cleanasm cleanstc cleano cleanp cleanhex cleanlst cleanmap
211         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi