Applied patch from Kevin L. Pauba that added the #pragma memory declaration feature...
[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         rotate4.c \
83         rotate5.c \
84         struct1.c \
85         sub.c \
86         sub2.c \
87         switch1.c \
88         while.c \
89         xor.c
90
91 #       mul1.c \
92
93 COD := $(patsubst %.c, %.cod, $(SRC))
94 ASM := $(patsubst %.c, %.asm, $(SRC))
95 STC := $(patsubst %.c, %.stc, $(SRC))
96
97 all:    test
98
99
100 # The asm files are generated by sdcc
101 .c.asm:
102         $(CC) -mpic14 -S $*.c
103
104 # The .cod files are generated by gpasm
105 # these get loaded by gpsim.
106 .asm.cod:
107         gpasm -c -I $(HEADER) $*.asm
108
109 # The .stc files are script files for gpsim
110 .cod.stc:
111         ./$(CREATESTC) $*.cod $*.stc
112         ./$(SIMULATE) $*.stc $(LOGFILE)
113
114 # this will also make .stc files
115 #%.stc : %.cod
116 #       ./create_stc $^ $@
117
118 # now for the dependencies
119
120 cod : $(COD)
121
122
123 asm : $(ASM)
124
125 stc : $(STC)
126
127 test:   $(STC)
128         echo "Done - Results are in $(LOGFILE)"
129
130 cleancod:
131         files="$(COD)" ; \
132         for f in $$files ; do \
133           if [ -f $$f ]; then rm $$f; fi \
134         done ; \
135
136 cleanasm:
137         files="$(ASM)" ; \
138         for f in $$files ; do \
139           if [ -f $$f ]; then rm $$f; fi \
140         done ; \
141
142 cleanstc:
143         files="$(STC)" ; \
144         for f in $$files ; do \
145           if [ -f $$f ]; then rm $$f; fi \
146         done ; \
147
148 clean: cleancod cleanasm cleanstc
149         if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi