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