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