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