Unified the per port Makefiles
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 20 Jun 2001 04:10:46 +0000 (04:10 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 20 Jun 2001 04:10:46 +0000 (04:10 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@907 4a8a32a2-be11-0410-ad9d-d568d2c75423

16 files changed:
src/avr/Makefile
src/avr/clean.mk [deleted file]
src/avr/peeph.rul
src/clean.mk
src/ds390/Makefile
src/ds390/clean.mk [deleted file]
src/izt/Makefile
src/izt/clean.mk [deleted file]
src/mcs51/Makefile
src/mcs51/clean.mk [deleted file]
src/pic/Makefile
src/pic/clean.mk [deleted file]
src/port.mk [new file with mode: 0644]
src/z80/Makefile
src/z80/clean.mk [deleted file]
src/z80/gbz80.c [deleted file]

index 2cebc54583e98ccaf5c5bbf47b0e15dd5ffb3067..3b85636455228667d661cdeb414b93d2c6d9205c 100644 (file)
@@ -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 (file)
index 07f3ca4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-
-clean:
-       rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
index 84b289dedf1f33c4f5e1f80f511b3e5527dacf8f..c40a8781a575408b5f5543ab6881143227d6726c 100644 (file)
@@ -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 */
+/* <port>/peeph.def instead.     */
 "\n"
 "\n"
 "replace restart {\n"
index b60ad6d7874bb653ed510fe58abad59afaec146d..61be2b99143ff180e984f225b081a1f81f6d1eb9 100644 (file)
@@ -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
 
 
index c269aae762208ca7b7ca0476b85062a04c0eeb10..3b85636455228667d661cdeb414b93d2c6d9205c 100644 (file)
@@ -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 (file)
index 07f3ca4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-
-clean:
-       rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
index a159b4b9d9c598f3868d91a6441e874a8f532742..3b85636455228667d661cdeb414b93d2c6d9205c 100644 (file)
@@ -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 (file)
index 4055fb3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-
-clean:
-       rm -f $(LIB) *.o *~ port.a
-
-# End of src/z80/clean.mk
index 89fa5dc04b4b720727628e818de850a0c43ffc3b..3b85636455228667d661cdeb414b93d2c6d9205c 100644 (file)
@@ -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 (file)
index 07f3ca4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-
-clean:
-       rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
index a0ebe7bf15528e9ad308efb037b56872c974f86a..3b85636455228667d661cdeb414b93d2c6d9205c 100644 (file)
@@ -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 (file)
index 07f3ca4..0000000
+++ /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 (file)
index 0000000..9df7548
--- /dev/null
@@ -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/<portname>
+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)
index 8626cd73f2e3fe0c4c725af1aa3699e217901243..3b85636455228667d661cdeb414b93d2c6d9205c 100644 (file)
@@ -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 (file)
index 4055fb3..0000000
+++ /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 (file)
index 0abc913..0000000
+++ /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 <michaelh@earthling.net> 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 */
-};