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