Steve Tell fixed a nested for-loop bug in the PIC Port
[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.8.10 (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 #  - removes either the .stc, .asm, or .cod files
46
47
48 CC = ../../bin/sdcc
49
50 HEADER=/usr/local/share/gpasm/header
51
52 .SUFFIXES: .asm .c .cod .stc
53
54 # Results of the test are placed here:
55 LOGFILE = test.log
56
57 # Script file for creating gpsim scripts
58 CREATESTC = create_stc
59
60 # Script file for invoking gpsim
61 SIMULATE = simulate
62
63 # List the C files to be test here:
64 SRC = b.c \
65         add.c \
66         add2.c \
67         add3.c \
68         and1.c \
69         bool1.c \
70         bool2.c \
71         bool3.c \
72         call1.c \
73         compare.c \
74         compare2.c \
75         compare3.c \
76         compare4.c \
77         compare5.c \
78         compare6.c \
79         for.c \
80         nestfor.c \
81         or1.c \
82         rotate1.c \
83         rotate2.c \
84         rotate3.c \
85         rotate4.c \
86         rotate5.c \
87         struct1.c \
88         sub.c \
89         sub2.c \
90         switch1.c \
91         while.c \
92         xor.c
93
94 #       mul1.c \
95
96 COD := $(patsubst %.c, %.cod, $(SRC))
97 ASM := $(patsubst %.c, %.asm, $(SRC))
98 STC := $(patsubst %.c, %.stc, $(SRC))
99
100 all:    test
101
102
103 # The asm files are generated by sdcc
104 .c.asm:
105         $(CC) -mpic14 -S $*.c
106
107 # The .cod files are generated by gpasm
108 # these get loaded by gpsim.
109 .asm.cod:
110         gpasm -c -I $(HEADER) $*.asm
111
112 # The .stc files are script files for gpsim
113 .cod.stc:
114         ./$(CREATESTC) $*.cod $*.stc
115         ./$(SIMULATE) $*.stc $(LOGFILE)
116
117 # this will also make .stc files
118 #%.stc : %.cod
119 #       ./create_stc $^ $@
120
121 # now for the dependencies
122
123 cod : $(COD)
124
125
126 asm : $(ASM)
127
128 stc : $(STC)
129
130 test:   $(STC)
131         echo "Done - Results are in $(LOGFILE)"
132
133 cleancod:
134         files="$(COD)" ; \
135         for f in $$files ; do \
136           if [ -f $$f ]; then rm $$f; fi \
137         done ; \
138
139 cleanasm:
140         files="$(ASM)" ; \
141         for f in $$files ; do \
142           if [ -f $$f ]; then rm $$f; fi \
143         done ; \
144
145 cleanstc:
146         files="$(STC)" ; \
147         for f in $$files ; do \
148           if [ -f $$f ]; then rm $$f; fi \
149         done ; \
150
151 clean: cleancod cleanasm cleanstc
152         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi