-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
+++ /dev/null
-#
-
-clean:
- rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
-/* 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"
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
-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
+++ /dev/null
-#
-
-clean:
- rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
-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
+++ /dev/null
-#
-
-clean:
- rm -f $(LIB) *.o *~ port.a
-
-# End of src/z80/clean.mk
-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
+++ /dev/null
-#
-
-clean:
- rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
-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
+++ /dev/null
-#
-
-clean:
- rm -f $(LIB) *.o *~ port.a
-
-# End of src/mcs51/clean.mk
--- /dev/null
+# 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)
-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
+++ /dev/null
-#
-
-clean:
- rm -f $(LIB) *.o *~ port.a
-
-# End of src/z80/clean.mk
+++ /dev/null
-/** @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 */
-};