147 lines
2.7 KiB
Makefile
147 lines
2.7 KiB
Makefile
# Regression testing Makefile for Pic Port of SDCC
|
|
#
|
|
# note that this regression suite was started before
|
|
# the one in sdcc/regression. The regression suite in
|
|
# sdcc/regression is better suited for testing mature
|
|
# ports.
|
|
#
|
|
# GPL'd
|
|
#
|
|
# T. Scott Dattalo scott@dattalo.com
|
|
#
|
|
# This makefile provides a means by which the output
|
|
# of the SDCC Compiler can be tested. This version
|
|
# is unique to the PIC (as in Microchip PIC) port.
|
|
# As such it requires the following software:
|
|
#
|
|
# gpasm version 0.8.10 (or greater)
|
|
# gpsim version 0.20.7 (or greater)
|
|
#
|
|
# Usage:
|
|
#
|
|
# make
|
|
# - without any options the whole regression test is
|
|
# performed. The results are placed into a log file
|
|
# (defined by $LOGFILE).
|
|
#
|
|
# make asm
|
|
# - Creates .asm files by compiling the .c files
|
|
#
|
|
# make cod
|
|
# - Creates .cod files by assembling the .asm files
|
|
# (.cod files are symbolic files compatible with
|
|
# MPASM, Microchip's assembler)
|
|
#
|
|
# make stc
|
|
# - Creates .stc files which are script files for
|
|
# gpsim.
|
|
#
|
|
# make clean
|
|
# - removes all of the intermediate files created
|
|
#
|
|
# make cleancod
|
|
# make cleanasm
|
|
# make cleanstc
|
|
# - removes either the .stc, .asm, or .cod files
|
|
|
|
|
|
CC = ../../bin/sdcc
|
|
|
|
HEADER=/usr/local/share/gpasm/header
|
|
|
|
.SUFFIXES: .asm .c .cod .stc
|
|
|
|
# Results of the test are placed here:
|
|
LOGFILE = test.log
|
|
|
|
# Script file for creating gpsim scripts
|
|
CREATESTC = create_stc
|
|
|
|
# Script file for invoking gpsim
|
|
SIMULATE = simulate
|
|
|
|
# List the C files to be test here:
|
|
SRC = b.c \
|
|
add.c \
|
|
add2.c \
|
|
add3.c \
|
|
and1.c \
|
|
bool1.c \
|
|
call1.c \
|
|
compare.c \
|
|
compare2.c \
|
|
compare3.c \
|
|
compare4.c \
|
|
compare5.c \
|
|
compare6.c \
|
|
for.c \
|
|
or1.c \
|
|
rotate1.c \
|
|
rotate2.c \
|
|
rotate3.c \
|
|
struct1.c \
|
|
sub.c \
|
|
sub2.c \
|
|
switch1.c \
|
|
while.c \
|
|
xor.c
|
|
|
|
COD := $(patsubst %.c, %.cod, $(SRC))
|
|
ASM := $(patsubst %.c, %.asm, $(SRC))
|
|
STC := $(patsubst %.c, %.stc, $(SRC))
|
|
|
|
all: test
|
|
|
|
|
|
# The asm files are generated by sdcc
|
|
.c.asm:
|
|
$(CC) -mpic14 -c $*.c
|
|
|
|
# The .cod files are generated by gpasm
|
|
# these get loaded by gpsim.
|
|
.asm.cod:
|
|
gpasm -c -I $(HEADER) $*.asm
|
|
|
|
# The .stc files are script files for gpsim
|
|
.cod.stc:
|
|
./$(CREATESTC) $*.cod $*.stc
|
|
echo "Created $*.stc"
|
|
./$(SIMULATE) $*.stc $(LOGFILE)
|
|
|
|
# this will also make .stc files
|
|
#%.stc : %.cod
|
|
# ./create_stc $^ $@
|
|
|
|
# now for the dependencies
|
|
|
|
cod : $(COD)
|
|
|
|
|
|
asm : $(ASM)
|
|
|
|
stc : $(STC)
|
|
|
|
test: $(STC)
|
|
echo "Done - Results are in $(LOGFILE)"
|
|
|
|
cleancod:
|
|
files="$(COD)" ; \
|
|
for f in $$files ; do \
|
|
if [ -f $$f ]; then rm $$f; fi \
|
|
done ; \
|
|
|
|
cleanasm:
|
|
files="$(ASM)" ; \
|
|
for f in $$files ; do \
|
|
if [ -f $$f ]; then rm $$f; fi \
|
|
done ; \
|
|
|
|
cleanstc:
|
|
files="$(STC)" ; \
|
|
for f in $$files ; do \
|
|
if [ -f $$f ]; then rm $$f; fi \
|
|
done ; \
|
|
|
|
clean: cleancod cleanasm cleanstc
|
|
if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi
|