PIC port now supports object files. Applied patch from Craig Franklin that started...
[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
49 CC = ../../bin/sdcc
50 LINKER = gplink
51 TARGETPIC = 16f873
52 CFLAGS = -mpic14 -c -pp$(TARGETPIC)
53
54 .SUFFIXES: .asm .c .cod .stc
55
56 # Results of the test are placed here:
57 LOGFILE = test.log
58
59 # Script file for creating gpsim scripts
60 CREATESTC = create_stc
61
62 # Script file for invoking gpsim
63 SIMULATE = simulate
64
65 # List the C files to be test here:
66 SRC = b.c \
67         add.c \
68         add2.c \
69         add3.c \
70         and1.c \
71         and2.c \
72         bool1.c \
73         bool2.c \
74         bool3.c \
75         call1.c \
76         compare.c \
77         compare2.c \
78         compare3.c \
79         compare4.c \
80         compare5.c \
81         compare6.c \
82         for.c \
83         nestfor.c \
84         or1.c \
85         rotate1.c \
86         rotate2.c \
87         rotate3.c \
88         rotate4.c \
89         rotate5.c \
90         struct1.c \
91         sub.c \
92         sub2.c \
93         switch1.c \
94         while.c \
95         xor.c \
96         ptrfunc.c
97
98 #       mul1.c \
99
100 COD := $(patsubst %.c, %.cod, $(SRC))
101 ASM := $(patsubst %.c, %.asm, $(SRC))
102 O := $(patsubst %.c, %.o, $(SRC))
103 STC := $(patsubst %.c, %.stc, $(SRC))
104 HEX := $(patsubst %.c, %.hex, $(SRC))
105 LST := $(patsubst %.c, %.lst, $(SRC))
106 MAP := $(patsubst %.c, %.map, $(SRC))
107
108 all:    test
109
110
111 # The asm files are generated by sdcc
112 .c.o:
113         $(CC) $(CFLAGS)  $*.c
114
115 # The .cod files are generated by gpasm
116 # these get loaded by gpsim.
117 .o.cod:
118         $(LINKER) --map -c -s $(TARGETPIC).lkr -o $*.o $*.o
119
120 #       gpasm $*.asm
121
122 #       gpasm -c -I $(HEADER) $*.asm
123
124
125 # The .stc files are script files for gpsim
126 .cod.stc:
127         ./$(CREATESTC) $*.cod $*.stc
128         ./$(SIMULATE) $*.stc $(LOGFILE)
129
130 # this will also make .stc files
131 #%.stc : %.cod
132 #       ./create_stc $^ $@
133
134 # now for the dependencies
135
136 cod : $(COD)
137
138 o : $(O)
139
140 asm : $(ASM)
141
142 stc : $(STC)
143
144 test:   $(STC)
145         echo "Done - Results are in $(LOGFILE)"
146
147 cleancod:
148         files="$(COD)" ; \
149         for f in $$files ; do \
150           if [ -f $$f ]; then rm $$f; fi \
151         done ; \
152
153 cleano:
154         files="$(O)" ; \
155         for f in $$files ; do \
156           if [ -f $$f ]; then rm $$f; fi \
157         done ; \
158
159 cleanasm:
160         files="$(ASM)" ; \
161         for f in $$files ; do \
162           if [ -f $$f ]; then rm $$f; fi \
163         done ; \
164
165 cleanstc:
166         files="$(STC)" ; \
167         for f in $$files ; do \
168           if [ -f $$f ]; then rm $$f; fi \
169         done ; \
170
171 cleanhex:
172         files="$(HEX)" ; \
173         for f in $$files ; do \
174           if [ -f $$f ]; then rm $$f; fi \
175         done ; \
176
177 cleanlst:
178         files="$(LST)" ; \
179         for f in $$files ; do \
180           if [ -f $$f ]; then rm $$f; fi \
181         done ; \
182
183 clean: cleancod cleanasm cleanstc cleano cleanhex cleanlst
184         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi