From dc1495e26bde46b7ba0c4b83ffd1cb6bdeab4dea Mon Sep 17 00:00:00 2001 From: michaelh Date: Wed, 20 Jun 2001 04:10:46 +0000 Subject: [PATCH] Unified the per port Makefiles git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@907 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/avr/Makefile | 24 +------- src/avr/clean.mk | 6 -- src/avr/peeph.rul | 6 +- src/clean.mk | 2 +- src/ds390/Makefile | 24 +------- src/ds390/clean.mk | 6 -- src/izt/Makefile | 27 +-------- src/izt/clean.mk | 6 -- src/mcs51/Makefile | 25 +------- src/mcs51/clean.mk | 6 -- src/pic/Makefile | 30 +--------- src/pic/clean.mk | 6 -- src/port.mk | 47 +++++++++++++++ src/z80/Makefile | 24 +------- src/z80/clean.mk | 6 -- src/z80/gbz80.c | 138 --------------------------------------------- 16 files changed, 63 insertions(+), 320 deletions(-) delete mode 100644 src/avr/clean.mk delete mode 100644 src/ds390/clean.mk delete mode 100644 src/izt/clean.mk delete mode 100644 src/mcs51/clean.mk delete mode 100644 src/pic/clean.mk create mode 100644 src/port.mk delete mode 100644 src/z80/clean.mk delete mode 100644 src/z80/gbz80.c diff --git a/src/avr/Makefile b/src/avr/Makefile index 2cebc545..3b856364 100644 --- a/src/avr/Makefile +++ b/src/avr/Makefile @@ -1,22 +1,2 @@ -PRJDIR = ../.. - -include $(PRJDIR)/Makefile.common - -OBJ = ralloc.o main.o gen.o -LIB = port.a - -CFLAGS += -I.. -I. -I../.. - -all: $(LIB) - -main.o: main.c peeph.rul - -$(LIB): peeph.rul $(OBJ) - rm -f $(LIB) - ar r $(LIB) $(OBJ) - $(RANLIB) $(LIB) - -peeph.rul: peeph.def - $(AWK) -f ../SDCCpeeph.awk peeph.def > peeph.rul - -include clean.mk +# Make all in this directory +include ../port.mk diff --git a/src/avr/clean.mk b/src/avr/clean.mk deleted file mode 100644 index 07f3ca43..00000000 --- a/src/avr/clean.mk +++ /dev/null @@ -1,6 +0,0 @@ -# - -clean: - rm -f $(LIB) *.o *~ port.a - -# End of src/mcs51/clean.mk diff --git a/src/avr/peeph.rul b/src/avr/peeph.rul index 84b289de..c40a8781 100644 --- a/src/avr/peeph.rul +++ b/src/avr/peeph.rul @@ -1,6 +1,6 @@ -/* Generated file DO NOT Edit */ -/* To Make changes to rules */ -/* edit file SDCCpeeph.def */ +/* Generated file, DO NOT Edit! */ +/* To Make changes to rules edit */ +/* /peeph.def instead. */ "\n" "\n" "replace restart {\n" diff --git a/src/clean.mk b/src/clean.mk index b60ad6d7..61be2b99 100644 --- a/src/clean.mk +++ b/src/clean.mk @@ -5,7 +5,7 @@ clean: rm -f .[a-z]*~ \#* rm -f $(PRJDIR)/bin/sdcc sdcc for port in $(PORTS) ; do\ - $(MAKE) -C $$port -f clean.mk clean ;\ + $(MAKE) -C $$port clean ;\ done diff --git a/src/ds390/Makefile b/src/ds390/Makefile index c269aae7..3b856364 100644 --- a/src/ds390/Makefile +++ b/src/ds390/Makefile @@ -1,22 +1,2 @@ -PRJDIR = ../.. - -include $(PRJDIR)/Makefile.common - -OBJ = gen.o ralloc.o main.o -LIB = port.a - -CFLAGS += -I.. -I. - -all: $(LIB) - -main.o: main.c peeph.rul - -$(LIB): peeph.rul $(OBJ) - rm -f $(LIB) - ar r $(LIB) $(OBJ) - $(RANLIB) $(LIB) - -peeph.rul: peeph.def - $(AWK) -f ../SDCCpeeph.awk peeph.def > peeph.rul - -include clean.mk +# Make all in this directory +include ../port.mk diff --git a/src/ds390/clean.mk b/src/ds390/clean.mk deleted file mode 100644 index 07f3ca43..00000000 --- a/src/ds390/clean.mk +++ /dev/null @@ -1,6 +0,0 @@ -# - -clean: - rm -f $(LIB) *.o *~ port.a - -# End of src/mcs51/clean.mk diff --git a/src/izt/Makefile b/src/izt/Makefile index a159b4b9..3b856364 100644 --- a/src/izt/Makefile +++ b/src/izt/Makefile @@ -1,25 +1,2 @@ -PRJDIR = ../.. - -include $(PRJDIR)/Makefile.common - -OBJ = i186.o ralloc.o gen.o tlcs900h.o gen_generic.o aop.o util.o -LIB = port.a - -CFLAGS += -I.. -I. -I../.. -LDFLAGS = -ggdb - -all: $(LIB) - -$(LIB): $(OBJ) - rm -f $(LIB) - ar r $(LIB) $(OBJ) - $(RANLIB) $(LIB) - -%.rul: %.def - $(AWK) -f ../SDCCpeeph.awk $< > $@ - -main.o: main.c peeph.rul peeph-z80.rul peeph-gbz80.rul mappings.i - -i186.o: i186.c i186_mappings.i - -include clean.mk +# Make all in this directory +include ../port.mk diff --git a/src/izt/clean.mk b/src/izt/clean.mk deleted file mode 100644 index 4055fb30..00000000 --- a/src/izt/clean.mk +++ /dev/null @@ -1,6 +0,0 @@ -# - -clean: - rm -f $(LIB) *.o *~ port.a - -# End of src/z80/clean.mk diff --git a/src/mcs51/Makefile b/src/mcs51/Makefile index 89fa5dc0..3b856364 100644 --- a/src/mcs51/Makefile +++ b/src/mcs51/Makefile @@ -1,23 +1,2 @@ -PRJDIR = ../.. - -include $(PRJDIR)/Makefile.common - -OBJ = gen.o ralloc.o main.o -LIB = port.a - -#CFLAGS += -I.. -I. -I../.. -CFLAGS += -I$(PRJDIR)/src -I$(PRJDIR)/support/Util - -all: $(LIB) - -main.o: main.c peeph.rul - -$(LIB): peeph.rul $(OBJ) - rm -f $(LIB) - ar r $(LIB) $(OBJ) - $(RANLIB) $(LIB) - -peeph.rul: peeph.def - $(AWK) -f ../SDCCpeeph.awk peeph.def > peeph.rul - -include clean.mk +# Make all in this directory +include ../port.mk diff --git a/src/mcs51/clean.mk b/src/mcs51/clean.mk deleted file mode 100644 index 07f3ca43..00000000 --- a/src/mcs51/clean.mk +++ /dev/null @@ -1,6 +0,0 @@ -# - -clean: - rm -f $(LIB) *.o *~ port.a - -# End of src/mcs51/clean.mk diff --git a/src/pic/Makefile b/src/pic/Makefile index a0ebe7bf..3b856364 100644 --- a/src/pic/Makefile +++ b/src/pic/Makefile @@ -1,28 +1,2 @@ -PRJDIR = ../.. - -include $(PRJDIR)/Makefile.common - -OBJ = gen.o genarith.o ralloc.o main.o glue.o pcode.o pcodepeep.o -LIB = port.a - -CFLAGS = -ggdb -Wall -O2 -CFLAGS += -I.. -I. -I../.. - -all: $(LIB) - -#hmm, now why don't we use automake instead of hardcoding -#the dependencies? -pcode.o: pcode.h -gen.o: pcode.h - -main.o: main.c peeph.rul - -$(LIB): peeph.rul $(OBJ) - rm -f $(LIB) - ar r $(LIB) $(OBJ) - ranlib $(LIB) - -peeph.rul: peeph.def - $(AWK) -f ../SDCCpeeph.awk peeph.def > peeph.rul - -include clean.mk +# Make all in this directory +include ../port.mk diff --git a/src/pic/clean.mk b/src/pic/clean.mk deleted file mode 100644 index 07f3ca43..00000000 --- a/src/pic/clean.mk +++ /dev/null @@ -1,6 +0,0 @@ -# - -clean: - rm -f $(LIB) *.o *~ port.a - -# End of src/mcs51/clean.mk diff --git a/src/port.mk b/src/port.mk new file mode 100644 index 00000000..9df7548e --- /dev/null +++ b/src/port.mk @@ -0,0 +1,47 @@ +# Common Makefile for all ports. +# Input: SOURCES - list of C files included in the project +# SPECIAL - list of special files that should be included in dependencies +# PEEPRULES - list of all peephole rules (.rul) derrived files +# PREBUILD - list of special files to build before deps. + +# Ports are always located in sdcc/src/ +PRJDIR = ../.. +# Output +LIB = port.a +# Include the sdcc/src directory +INCLUDEFLAGS = -I.. + +# If the sources aren't specified, assume all in this directory. +ifndef SOURCES +SOURCES = $(wildcard *.c) +endif + +# If the peephole rules aren't specified, assume all. +ifndef PEEPRULES +PEEPDEFS = $(wildcard *.def) +PEEPRULES = $(PEEPDEFS:.def=.rul) +endif + +PREBUILD += $(PEEPRULES) + +all: $(PREBUILD) dep $(LIB) + +include $(PRJDIR)/Makefile.common + +$(LIB): $(OBJ) + rm -f $(LIB) + ar r $(LIB) $(OBJ) + $(RANLIB) $(LIB) + +%.rul: %.def + $(AWK) -f ../SDCCpeeph.awk $< > $@ + +dep: Makefile.dep + +Makefile.dep: $(PREBUILD) Makefile $(SOURCES) $(SPECIAL) *.h $(PRJDIR)/*.h $(PRJDIR)/src/*.h + $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) >Makefile.dep + +include Makefile.dep + +clean: + rm -f $(LIB) *.o *~ port.a $(CLEANSPEC) diff --git a/src/z80/Makefile b/src/z80/Makefile index 8626cd73..3b856364 100644 --- a/src/z80/Makefile +++ b/src/z80/Makefile @@ -1,22 +1,2 @@ -PRJDIR = ../.. - -include $(PRJDIR)/Makefile.common - -OBJ = gen.o ralloc.o main.o support.o -LIB = port.a - -CFLAGS += -I.. -I. -I../.. - -all: $(LIB) - -$(LIB): peeph.rul peeph-z80.rul peeph-gbz80.rul $(OBJ) - rm -f $(LIB) - ar r $(LIB) $(OBJ) - $(RANLIB) $(LIB) - -%.rul: %.def - $(AWK) -f ../SDCCpeeph.awk $< > $@ - -main.o: main.c peeph.rul peeph-z80.rul peeph-gbz80.rul mappings.i - -include clean.mk +# Make all in this directory +include ../port.mk diff --git a/src/z80/clean.mk b/src/z80/clean.mk deleted file mode 100644 index 4055fb30..00000000 --- a/src/z80/clean.mk +++ /dev/null @@ -1,6 +0,0 @@ -# - -clean: - rm -f $(LIB) *.o *~ port.a - -# End of src/z80/clean.mk diff --git a/src/z80/gbz80.c b/src/z80/gbz80.c deleted file mode 100644 index 0abc913f..00000000 --- a/src/z80/gbz80.c +++ /dev/null @@ -1,138 +0,0 @@ -/** @file z80/gbz80.c - Extra bits ontop of the z80 port to target the Gameboy's Z80 like - processor. - - Michael Hope 2000 -*/ - -#include "z80.h" - -static char _defaultRules[] = -{ -#include "peeph.rul" -#include "peeph-gbz80.rul" -}; - -static char *_gbz80_keywords[] = -{NULL}; - -static bool -_gbz80_parseOptions (int *pargc, char **argv, int *i) -{ - return FALSE; -} - -static void -_gbz80_init (void) -{ - z80_opts.sub = SUB_GBZ80; -} - -static void -_gbz80_finaliseOptions (void) -{ - port->mem.default_local_map = data; - port->mem.default_globl_map = data; -} - -static void -_gbz80_setDefaultOptions (void) -{ - options.genericPtr = 1; /* default on */ - options.nopeep = 0; - options.stackAuto = 1; - options.mainreturn = 1; - /* first the options part */ - options.intlong_rent = 1; - - optimize.global_cse = 1; - optimize.label1 = 1; - optimize.label2 = 1; - optimize.label3 = 1; - optimize.label4 = 1; - optimize.loopInvariant = 1; - optimize.loopInduction = 0; -} - -static const char * -_gbz80_getRegName (struct regs *reg) -{ - if (reg) - return reg->name; - assert (0); - return "err"; -} - -/** $1 is always the basename. - $2 is always the output file. - $3 varies - $l is the list of extra options that should be there somewhere... - MUST be terminated with a NULL. -*/ -static const char *_linkCmd[] = -{ - "link-gbz80", "-nf", "$1", NULL -}; - -static const char *_asmCmd[] = -{ - "as-gbz80", "-plosgff", "$1.o", "$1.asm", NULL -}; - -/* Globals */ -PORT gbz80_port = -{ - "gbz80", - "Gameboy Z80-like", /* Target name */ - { - FALSE, - }, - { - _asmCmd, - "-plosgff", /* Options with debug */ - "-plosgff", /* Options without debug */ - 0, - ".asm" - }, - { - _linkCmd - }, - { - _defaultRules - }, - { - /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */ - 1, 1, 2, 4, 2, 2, 2, 1, 4, 4 - }, - { - "_XSEG", - "_STACK", - "_CODE", - "_DATA", - "_ISEG", - "_XSEG", - "_BSEG", - "_RSEG", - "_GSINIT", - "_OVERLAY", - "_GSFINAL", - NULL, - NULL - }, - { - -1, 0, 0, 4, 0 - }, - /* Z80 has no native mul/div commands */ - { - 0 - }, - _gbz80_init, - _gbz80_parseOptions, - _gbz80_finaliseOptions, - _gbz80_setDefaultOptions, - z80_assignRegisters, - _gbz80_getRegName, - _gbz80_keywords, - 0, /* no assembler preamble */ - 0, /* no local IVT generation code */ -}; -- 2.39.5