- signed/unsigned long comparisons now work.
[fw/sdcc] / src / regression / Makefile
1 # Regression testing Makefile for Pic Port of SDCC
2 #
3 # GPL'd
4 #
5 # T. Scott Dattalo scott@dattalo.com
6 #
7 # This makefile provides a means by which the output
8 # of the SDCC Compiler can be tested. This version
9 # is unique to the PIC (as in Microchip PIC) port.
10 # As such it requires the following software:
11 #
12 #  gpasm version 0.8.10 (or greater)
13 #  gpsim version 0.20.7 (or greater)
14 #
15 # Usage:
16 #
17 # make
18 #  - without any options the whole regression test is
19 #    performed. The results are placed into a log file
20 #    (defined by $LOGFILE).
21 #
22 # make asm
23 #  - Creates .asm files by compiling the .c files
24 #
25 # make cod
26 #  - Creates .cod files by assembling the .asm files
27 #    (.cod files are symbolic files compatible with
28 #    MPASM, Microchip's assembler)
29 #
30 # make stc
31 #  - Creates .stc files which are script files for
32 #    gpsim.
33 #
34 # make clean
35 #  - removes all of the intermediate files created
36 #
37 # make cleancod
38 # make cleanasm
39 # make cleanstc
40 #  - removes either the .stc, .asm, or .cod files
41
42
43 CC = ../../bin/sdcc
44
45 .SUFFIXES: .asm .c .cod .stc
46
47 # Results of the test are placed here:
48 LOGFILE = test.log
49
50 # Script file for creating gpsim scripts
51 CREATESTC = create_stc
52
53 # Script file for invoking gpsim
54 SIMULATE = simulate
55
56 # List the C files to be test here:
57 SRC = b.c \
58         add.c \
59         add2.c \
60         add3.c \
61         bool1.c \
62         call1.c \
63         compare.c \
64         compare2.c \
65         compare3.c \
66         compare4.c \
67         compare5.c \
68         compare6.c \
69         for.c \
70         rotate1.c \
71         rotate2.c \
72         rotate3.c \
73         struct1.c \
74         sub.c \
75         sub2.c \
76         switch1.c \
77         while.c \
78         xor.c
79
80 COD := $(patsubst %.c, %.cod, $(SRC))
81 ASM := $(patsubst %.c, %.asm, $(SRC))
82 STC := $(patsubst %.c, %.stc, $(SRC))
83
84 all:    test
85
86
87 # The asm files are generated by sdcc
88 .c.asm:
89         $(CC) -mpic14 -c $*.c
90
91 # The .cod files are generated by gpasm
92 # these get loaded by gpsim.
93 .asm.cod:
94         gpasm -c $*.asm
95
96 # The .stc files are script files for gpsim
97 .cod.stc:
98         ./$(CREATESTC) $*.cod $*.stc
99
100 # this will also make .stc files
101 #%.stc : %.cod
102 #       ./create_stc $^ $@
103
104 # now for the dependencies
105
106 cod : $(COD)
107
108
109 asm : $(ASM)
110
111 stc : $(STC)
112
113 test:   $(STC)
114         if [ -n "$(STC)" ]; then \
115         stcfiles="$(STC)" ; \
116         for f in $$stcfiles ; do \
117           ./$(SIMULATE) $$f $(LOGFILE); \
118         done ; \
119         fi
120         echo "Done - Results are in $(LOGFILE)"
121
122 cleancod:
123         files="$(COD)" ; \
124         for f in $$files ; do \
125           if [ -f $$f ]; then rm $$f; fi \
126         done ; \
127
128 cleanasm:
129         files="$(ASM)" ; \
130         for f in $$files ; do \
131           if [ -f $$f ]; then rm $$f; fi \
132         done ; \
133
134 cleanstc:
135         files="$(STC)" ; \
136         for f in $$files ; do \
137           if [ -f $$f ]; then rm $$f; fi \
138         done ; \
139
140 clean: cleancod cleanasm cleanstc
141         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi