# 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
# is unique to the PIC (as in Microchip PIC) port.
# As such it requires the following software:
#
-# gpasm version 0.8.10 (or greater)
+# gpasm version 0.11.1 (or greater)
# gpsim version 0.20.7 (or greater)
#
# Usage:
# make cleancod
# make cleanasm
# make cleanstc
-# - removes either the .stc, .asm, or .cod files
-
-
-CC = ../../bin/sdcc
+# make cleano
+# - removes either the .stc, .asm, .cod or .o files
+
+# verboseness
+#Q ?= # be verbose
+Q ?= @ # be quiet
+
+SDCC_SRC=../..
+SDCC_BIN=../..
+
+CC = $(SDCC_BIN)/bin/sdcc
+LINKER = gplink
+USE_PIC16 ?= 0
+ifeq ($(strip $(filter 1 yes,$(USE_PIC16))),)
+TARGETPIC = 16f877
+#TARGETPIC = 16f84
+CFLAGS = -mpic14 -p$(TARGETPIC)
+DIR = pic
+else
+TARGETPIC = 18f452
+CFLAGS = -mpic16 -p$(TARGETPIC)
+DIR = pic16
+endif
+CFLAGS += -Wl,-q
+CFLAGS += -Wl,--map
+CFLAGS += -I $(SDCC_SRC)/device/include/$(DIR)
+CFLAGS += -L $(SDCC_BIN)/device/lib/$(DIR)/bin
+#CFLAGS += --no-pcode-opt
+#CFLAGS += -V
.SUFFIXES: .asm .c .cod .stc
+.NOTPARALLEL:
# Results of the test are placed here:
LOGFILE = test.log
SIMULATE = simulate
# List the C files to be test here:
-SRC = b.c \
- compare.c
+SRC = add.c \
+ add2.c \
+ add3.c \
+ add4.c \
+ and1.c \
+ and2.c \
+ arrays.c \
+ b.c \
+ bank1.c \
+ bool1.c \
+ bool2.c \
+ bool3.c \
+ call1.c \
+ compare.c \
+ compare10.c \
+ compare2.c \
+ compare3.c \
+ compare4.c \
+ compare5.c \
+ compare6.c \
+ compare7.c \
+ compare8.c \
+ compare9.c \
+ configword.c \
+ empty.c \
+ for.c \
+ init0.c \
+ inline.c \
+ mult1.c \
+ nestfor.c \
+ or1.c \
+ pcodeopt.c \
+ pointer1.c \
+ ptrarg.c \
+ ptrfunc.c \
+ rotate1.c \
+ rotate2.c \
+ rotate3.c \
+ rotate4.c \
+ rotate5.c \
+ rotate6.c \
+ rotate7.c \
+ string1.c \
+ struct1.c \
+ sub.c \
+ sub2.c \
+ switch1.c \
+ while.c \
+ xor.c
COD := $(patsubst %.c, %.cod, $(SRC))
ASM := $(patsubst %.c, %.asm, $(SRC))
+O := $(patsubst %.c, %.o, $(SRC))
+P := $(patsubst %.c, %.p, $(SRC))
STC := $(patsubst %.c, %.stc, $(SRC))
+HEX := $(patsubst %.c, %.hex, $(SRC))
+LST := $(patsubst %.c, %.lst, $(SRC))
+MAP := $(patsubst %.c, %.map, $(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 $*.asm
+# The cod files are generated by sdcc
+.c.cod:
+ $(Q)-$(CC) $(CFLAGS) $*.c
# The .stc files are script files for gpsim
.cod.stc:
- ./$(CREATESTC) $*.cod $*.stc
+ $(Q)-./$(CREATESTC) $*.cod $*.stc
+ $(Q)-./$(SIMULATE) $*.stc $(LOGFILE)
# this will also make .stc files
#%.stc : %.cod
cod : $(COD)
+o : $(O)
asm : $(ASM)
stc : $(STC)
+ echo $(STC)
test: $(STC)
- if [ -n "$(STC)" ]; then \
- stcfiles="$(STC)" ; \
- for f in $$stcfiles ; do \
- ./$(SIMULATE) $$f $(LOGFILE); \
- done ; \
- fi
- echo "Done - Results are in $(LOGFILE)"
+ $(Q)echo "Done - Results are in $(LOGFILE)"
cleancod:
files="$(COD)" ; \
if [ -f $$f ]; then rm $$f; fi \
done ; \
+cleano:
+ files="$(O)" ; \
+ for f in $$files ; do \
+ if [ -f $$f ]; then rm $$f; fi \
+ done ; \
+
+cleanp:
+ files="$(P)" ; \
+ 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 ; \
-clean: cleancod cleanasm cleanstc
+cleanhex:
+ files="$(HEX)" ; \
+ for f in $$files ; do \
+ if [ -f $$f ]; then rm $$f; fi \
+ done ; \
+
+cleanlst:
+ files="$(LST)" ; \
+ for f in $$files ; do \
+ if [ -f $$f ]; then rm $$f; fi \
+ done ; \
+
+cleanmap:
+ files="$(MAP)" ; \
+ for f in $$files ; do \
+ if [ -f $$f ]; then rm $$f; fi \
+ done ; \
+
+clean: cleancod cleanasm cleanstc cleano cleanp cleanhex cleanlst cleanmap
if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi