PIC port now supports object files. Applied patch from Craig Franklin that started...
[fw/sdcc] / src / regression / Makefile
index 2a3aadc2113445228315825ec5df8f5427d557fa..50df1b67b2262a16dace8edeaab5fc63c9165108 100644 (file)
@@ -14,7 +14,7 @@
 # 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
+# make cleano
+#  - removes either the .stc, .asm, .cod or .o files
 
 
 CC = ../../bin/sdcc
-
-HEADER=/usr/local/share/gpasm/header
+LINKER = gplink
+TARGETPIC = 16f873
+CFLAGS = -mpic14 -c -pp$(TARGETPIC)
 
 .SUFFIXES: .asm .c .cod .stc
 
@@ -90,25 +92,35 @@ SRC = b.c \
        sub2.c \
        switch1.c \
        while.c \
-       xor.c
+       xor.c \
+       ptrfunc.c
 
 #      mul1.c \
 
 COD := $(patsubst %.c, %.cod, $(SRC))
 ASM := $(patsubst %.c, %.asm, $(SRC))
+O := $(patsubst %.c, %.o, $(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 -S $*.c
+.c.o:
+       $(CC) $(CFLAGS)  $*.c
 
 # The .cod files are generated by gpasm
 # these get loaded by gpsim.
-.asm.cod:
-       gpasm -c -I $(HEADER) $*.asm
+.o.cod:
+       $(LINKER) --map -c -s $(TARGETPIC).lkr -o $*.o $*.o
+
+#      gpasm $*.asm
+
+#      gpasm -c -I $(HEADER) $*.asm
+
 
 # The .stc files are script files for gpsim
 .cod.stc:
@@ -123,6 +135,7 @@ all:        test
 
 cod : $(COD)
 
+o : $(O)
 
 asm : $(ASM)
 
@@ -137,6 +150,12 @@ cleancod:
          if [ -f $$f ]; then rm $$f; fi \
        done ; \
 
+cleano:
+       files="$(O)" ; \
+       for f in $$files ; do \
+         if [ -f $$f ]; then rm $$f; fi \
+       done ; \
+
 cleanasm:
        files="$(ASM)" ; \
        for f in $$files ; do \
@@ -149,5 +168,17 @@ cleanstc:
          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 ; \
+
+clean: cleancod cleanasm cleanstc cleano cleanhex cleanlst
        if [ -f "$(LOGFILE)" ]; then rm $(LOGFILE); fi