Pointers - Applied function ptr patch from Steve Tell. Fixed bugs with
[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         and2.c \
70         bool1.c \
71         bool2.c \
72         bool3.c \
73         call1.c \
74         compare.c \
75         compare2.c \
76         compare3.c \
77         compare4.c \
78         compare5.c \
79         compare6.c \
80         for.c \
81         nestfor.c \
82         or1.c \
83         rotate1.c \
84         rotate2.c \
85         rotate3.c \
86         rotate4.c \
87         rotate5.c \
88         struct1.c \
89         sub.c \
90         sub2.c \
91         switch1.c \
92         while.c \
93         xor.c \
94         ptrfunc.c
95
96 #       mul1.c \
97
98 COD := $(patsubst %.c, %.cod, $(SRC))
99 ASM := $(patsubst %.c, %.asm, $(SRC))
100 STC := $(patsubst %.c, %.stc, $(SRC))
101
102 all:    test
103
104
105 # The asm files are generated by sdcc
106 .c.asm:
107         $(CC) -mpic14 -S $*.c
108
109 # The .cod files are generated by gpasm
110 # these get loaded by gpsim.
111 .asm.cod:
112         gpasm $*.asm
113
114 #       gpasm -c -I $(HEADER) $*.asm
115
116
117 # The .stc files are script files for gpsim
118 .cod.stc:
119         ./$(CREATESTC) $*.cod $*.stc
120         ./$(SIMULATE) $*.stc $(LOGFILE)
121
122 # this will also make .stc files
123 #%.stc : %.cod
124 #       ./create_stc $^ $@
125
126 # now for the dependencies
127
128 cod : $(COD)
129
130
131 asm : $(ASM)
132
133 stc : $(STC)
134
135 test:   $(STC)
136         echo "Done - Results are in $(LOGFILE)"
137
138 cleancod:
139         files="$(COD)" ; \
140         for f in $$files ; do \
141           if [ -f $$f ]; then rm $$f; fi \
142         done ; \
143
144 cleanasm:
145         files="$(ASM)" ; \
146         for f in $$files ; do \
147           if [ -f $$f ]; then rm $$f; fi \
148         done ; \
149
150 cleanstc:
151         files="$(STC)" ; \
152         for f in $$files ; do \
153           if [ -f $$f ]; then rm $$f; fi \
154         done ; \
155
156 clean: cleancod cleanasm cleanstc
157         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi