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