# gcc Makefile for ld65
#
+# ------------------------------------------------------------------------------
+
+# The executable to build
+EXE = ld65
+
# Library dir
COMMON = ../common
-# The linker library search path. Default is "/usr/lib/cc65/lib/" if nothing
-# is defined. You may use CC65_LIB=foo on the command line to override it.
-CC65_LIB = \"/usr/lib/cc65/lib/\"
+# Several search paths. You may redefine these on the command line
+LD65_LIB = \"/usr/lib/cc65/lib/\"
+LD65_OBJ = \"/usr/lib/cc65/lib/\"
+LD65_CFG = \"/usr/lib/cc65/cfg/\"
#
-CFLAGS = -g -O2 -Wall -W -I$(COMMON) -DCC65_LIB=$(CC65_LIB)
-CC=gcc
-EBIND=emxbind
-LDFLAGS=
+CC = gcc
+CFLAGS = -g -O2 -Wall -W -std=c89
+override CFLAGS += -I$(COMMON)
+override CFLAGS += -DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
+EBIND = emxbind
+LDFLAGS =
# Perl script for config file conversion
CVT=cfg/cvt-cfg.pl
# List of all object files
OBJS = asserts.o \
- bin.o \
+ bin.o \
binfmt.o \
+ cfgexpr.o \
condes.o \
config.o \
- dbgfile.o \
- dbginfo.o \
+ dbgfile.o \
dbgsyms.o \
error.o \
exports.o \
extsyms.o \
fileinfo.o \
fileio.o \
- filepath.o \
+ filepath.o \
fragment.o \
global.o \
library.o \
lineinfo.o \
main.o \
mapfile.o \
+ memarea.o \
o65.o \
objdata.o \
objfile.o \
scanner.o \
+ scopes.o \
segments.o \
- spool.o \
- tgtcfg.o
+ span.o \
+ spool.o \
+ tgtcfg.o \
+ tpool.o
# -----------------------------------------------------------------------------
# List of all config includes
INCS = apple2.inc \
apple2enh.inc \
atari.inc \
- atmos.inc \
+ atmos.inc \
bbc.inc \
c128.inc \
c16.inc \
c64.inc \
cbm510.inc \
cbm610.inc \
- geos.inc \
+ geos-apple.inc \
+ geos-cbm.inc \
lunix.inc \
lynx.inc \
- module.inc \
+ module.inc \
nes.inc \
none.inc \
pet.inc \
plus4.inc \
- supervision.inc \
+ supervision.inc \
vic20.inc
-# -----------------------------------------------------------------------------
-#
-
LIBS = $(COMMON)/common.a
-EXECS = ld65
+# ------------------------------------------------------------------------------
+# Makefile targets
+# Main target - must be first
.PHONY: all
ifeq (.depend,$(wildcard .depend))
-all : $(EXECS)
+all: $(EXE)
include .depend
else
all: depend
@$(MAKE) -f make/gcc.mak all
endif
-
-
-ld65: $(INCS) $(OBJS) $(LIBS)
- $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
- @if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
+$(EXE): $(INCS) $(OBJS) $(LIBS)
+ $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
+ @if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
inc: $(INCS)
clean:
- $(RM) *~ core *.map
-
-zap: clean
- $(RM) *.o $(INCS) $(EXECS) .depend
+ $(RM) *~ core.* *.map
+zap: clean
+ $(RM) *.o $(INCS) $(EXE) .depend
# ------------------------------------------------------------------------------
# Make the dependencies
.PHONY: depend dep
-depend dep: $(OBJS:.o=.c)
+depend dep: $(INCS) $(OBJS:.o=.c)
@echo "Creating dependency information"
- $(CC) -I$(COMMON) -MM -MG $^ > .depend
+ $(CC) $(CFLAGS) -MM $(OBJS:.o=.c) > .depend
# -----------------------------------------------------------------------------
# Rules to make config includes
apple2.inc: cfg/apple2.cfg
@$(CVT) $< $@ CfgApple2
-# The apple2enh target uses the same config as the apple2
-apple2enh.inc: cfg/apple2.cfg
+apple2enh.inc: cfg/apple2enh.cfg
@$(CVT) $< $@ CfgApple2Enh
atari.inc: cfg/atari.cfg
cbm610.inc: cfg/cbm610.cfg
@$(CVT) $< $@ CfgCBM610
-geos.inc: cfg/geos.cfg
- @$(CVT) $< $@ CfgGeos
+geos-apple.inc: cfg/geos-apple.cfg
+ @$(CVT) $< $@ CfgGeosApple
+
+geos-cbm.inc: cfg/geos-cbm.cfg
+ @$(CVT) $< $@ CfgGeosCBM
lunix.inc: cfg/lunix.cfg
@$(CVT) $< $@ CfgLunix