* src/regression/add.c, src/regression/add2.c, src/regression/add3.c,
[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 = -I ../../device/include/pic -mpic14 -c -pp$(TARGETPIC)
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 = b.c \
70         add.c \
71         add2.c \
72         add3.c \
73         and1.c \
74         and2.c \
75         bool1.c \
76         bool2.c \
77         bool3.c \
78         call1.c \
79         compare.c \
80         compare2.c \
81         compare3.c \
82         compare4.c \
83         compare5.c \
84         compare6.c \
85         for.c \
86         nestfor.c \
87         or1.c \
88         rotate1.c \
89         rotate2.c \
90         rotate3.c \
91         rotate4.c \
92         rotate5.c \
93         sub.c \
94         sub2.c \
95         switch1.c \
96         while.c \
97         xor.c \
98         ptrfunc.c
99
100 #       struct1.c \
101 #       mul1.c \
102
103 COD := $(patsubst %.c, %.cod, $(SRC))
104 ASM := $(patsubst %.c, %.asm, $(SRC))
105 O := $(patsubst %.c, %.o, $(SRC))
106 STC := $(patsubst %.c, %.stc, $(SRC))
107 HEX := $(patsubst %.c, %.hex, $(SRC))
108 LST := $(patsubst %.c, %.lst, $(SRC))
109 MAP := $(patsubst %.c, %.map, $(SRC))
110
111 all:    test
112
113
114 # The asm files are generated by sdcc
115 .c.o:
116         $(Q)$(CC) $(CFLAGS)  $*.c
117
118 # The .cod files are generated by gpasm
119 # these get loaded by gpsim.
120 .o.cod:
121         $(Q)$(LINKER) --map -c -o $*.o $*.o
122
123 #       gpasm $*.asm
124
125 #       gpasm -c -I $(HEADER) $*.asm
126
127
128 # The .stc files are script files for gpsim
129 .cod.stc:
130         $(Q)./$(CREATESTC) $*.cod $*.stc
131         $(Q)./$(SIMULATE) $*.stc $(LOGFILE)
132
133 # this will also make .stc files
134 #%.stc : %.cod
135 #       ./create_stc $^ $@
136
137 # now for the dependencies
138
139 cod : $(COD)
140
141 o : $(O)
142
143 asm : $(ASM)
144
145 stc : $(STC)
146         echo $(STC)
147
148 test:   $(STC)
149         $(Q)echo "Done - Results are in $(LOGFILE)"
150
151 cleancod:
152         files="$(COD)" ; \
153         for f in $$files ; do \
154           if [ -f $$f ]; then rm $$f; fi \
155         done ; \
156
157 cleano:
158         files="$(O)" ; \
159         for f in $$files ; do \
160           if [ -f $$f ]; then rm $$f; fi \
161         done ; \
162
163 cleanasm:
164         files="$(ASM)" ; \
165         for f in $$files ; do \
166           if [ -f $$f ]; then rm $$f; fi \
167         done ; \
168
169 cleanstc:
170         files="$(STC)" ; \
171         for f in $$files ; do \
172           if [ -f $$f ]; then rm $$f; fi \
173         done ; \
174
175 cleanhex:
176         files="$(HEX)" ; \
177         for f in $$files ; do \
178           if [ -f $$f ]; then rm $$f; fi \
179         done ; \
180
181 cleanlst:
182         files="$(LST)" ; \
183         for f in $$files ; do \
184           if [ -f $$f ]; then rm $$f; fi \
185         done ; \
186
187 clean: cleancod cleanasm cleanstc cleano cleanhex cleanlst
188         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi