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