Added new regression test add2.c - tests adding lit's to unsigned ints. Literal addit...
[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         bool1.c \
61         call1.c \
62         compare.c \
63         compare2.c \
64         compare3.c \
65         for.c \
66         rotate1.c \
67         rotate2.c \
68         rotate3.c \
69         struct1.c \
70         sub.c \
71         switch1.c \
72         while.c \
73         xor.c
74
75 COD := $(patsubst %.c, %.cod, $(SRC))
76 ASM := $(patsubst %.c, %.asm, $(SRC))
77 STC := $(patsubst %.c, %.stc, $(SRC))
78
79 all:    test
80
81
82 # The asm files are generated by sdcc
83 .c.asm:
84         $(CC) -mpic14 -c $*.c
85
86 # The .cod files are generated by gpasm
87 # these get loaded by gpsim.
88 .asm.cod:
89         gpasm -c $*.asm
90
91 # The .stc files are script files for gpsim
92 .cod.stc:
93         ./$(CREATESTC) $*.cod $*.stc
94
95 # this will also make .stc files
96 #%.stc : %.cod
97 #       ./create_stc $^ $@
98
99 # now for the dependencies
100
101 cod : $(COD)
102
103
104 asm : $(ASM)
105
106 stc : $(STC)
107
108 test:   $(STC)
109         if [ -n "$(STC)" ]; then \
110         stcfiles="$(STC)" ; \
111         for f in $$stcfiles ; do \
112           ./$(SIMULATE) $$f $(LOGFILE); \
113         done ; \
114         fi
115         echo "Done - Results are in $(LOGFILE)"
116
117 cleancod:
118         files="$(COD)" ; \
119         for f in $$files ; do \
120           if [ -f $$f ]; then rm $$f; fi \
121         done ; \
122
123 cleanasm:
124         files="$(ASM)" ; \
125         for f in $$files ; do \
126           if [ -f $$f ]; then rm $$f; fi \
127         done ; \
128
129 cleanstc:
130         files="$(STC)" ; \
131         for f in $$files ; do \
132           if [ -f $$f ]; then rm $$f; fi \
133         done ; \
134
135 clean: cleancod cleanasm cleanstc
136         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi