2000-05-28 13:40:48 +00:00
|
|
|
#
|
|
|
|
# Makefile for cc65 samples
|
|
|
|
#
|
2000-06-06 17:45:06 +00:00
|
|
|
# This Makefile requires GNU make
|
|
|
|
#
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
# Enter the target system here
|
2016-06-01 18:59:33 +00:00
|
|
|
SYS = c64
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2004-11-07 11:33:30 +00:00
|
|
|
# Determine the path to the executables and libraries. If the samples
|
2009-09-28 19:22:02 +00:00
|
|
|
# directory is part of a complete source tree, use the stuff from that
|
|
|
|
# source tree; otherwise, use the "install" directories.
|
2004-11-07 11:33:30 +00:00
|
|
|
ifeq "$(wildcard ../src)" ""
|
|
|
|
# No source tree
|
2016-05-30 15:42:01 +00:00
|
|
|
installdir = /usr/lib/cc65
|
2009-09-28 19:22:02 +00:00
|
|
|
ifneq "$(wildcard /usr/local/lib/cc65)" ""
|
2016-05-30 15:42:01 +00:00
|
|
|
installdir = /usr/local/lib/cc65
|
2016-05-16 17:49:43 +00:00
|
|
|
endif
|
|
|
|
ifneq "$(wildcard /opt/local/share/cc65)" ""
|
2016-05-30 15:42:01 +00:00
|
|
|
installdir = /opt/local/share/cc65
|
2009-09-28 19:22:02 +00:00
|
|
|
endif
|
|
|
|
ifdef CC65_HOME
|
2016-05-30 15:42:01 +00:00
|
|
|
installdir = $(CC65_HOME)
|
2009-09-28 19:22:02 +00:00
|
|
|
endif
|
2016-05-30 15:42:01 +00:00
|
|
|
|
|
|
|
MOUS = $(installdir)/target/$(SYS)/drv/mou/$(SYS)*.mou
|
|
|
|
TGI = $(installdir)/target/$(SYS)/drv/tgi/$(SYS)*.tgi
|
2009-09-28 19:22:02 +00:00
|
|
|
CLIB = --lib $(SYS).lib
|
2004-11-07 11:33:30 +00:00
|
|
|
CL = cl65
|
|
|
|
CC = cc65
|
2007-08-28 19:54:48 +00:00
|
|
|
AS = ca65
|
2004-11-07 11:33:30 +00:00
|
|
|
LD = ld65
|
|
|
|
|
|
|
|
else
|
2009-09-28 19:22:02 +00:00
|
|
|
# "samples/" is a part of a complete source tree.
|
2013-06-27 14:01:47 +00:00
|
|
|
export CC65_HOME := $(abspath ..)
|
2016-05-16 17:49:43 +00:00
|
|
|
MOUS = ../target/$(SYS)/drv/mou/$(SYS)*.mou
|
|
|
|
TGI = ../target/$(SYS)/drv/tgi/$(SYS)*.tgi
|
2013-06-27 14:01:47 +00:00
|
|
|
CLIB = ../lib/$(SYS).lib
|
|
|
|
CL = ../bin/cl65
|
|
|
|
CC = ../bin/cc65
|
|
|
|
AS = ../bin/ca65
|
|
|
|
LD = ../bin/ld65
|
2004-11-07 11:33:30 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# This one comes with VICE
|
2016-06-01 18:59:33 +00:00
|
|
|
C1541 = c1541
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2014-03-22 11:04:16 +00:00
|
|
|
# --------------------------------------------------------------------------
|
2015-07-16 19:31:35 +00:00
|
|
|
# System-dependent settings
|
2014-03-22 11:04:16 +00:00
|
|
|
|
|
|
|
# The Apple machines need the start address adjusted when using TGI
|
|
|
|
LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000
|
|
|
|
LDFLAGS_tgidemo_apple2 = --start-addr 0x4000
|
|
|
|
LDFLAGS_mandelbrot_apple2enh = --start-addr 0x4000
|
|
|
|
LDFLAGS_tgidemo_apple2enh = --start-addr 0x4000
|
|
|
|
|
|
|
|
# The Apple ][ needs the start address adjusted for the mousetest
|
|
|
|
LDFLAGS_mousetest_apple2 = --start-addr 0x4000
|
|
|
|
|
|
|
|
# The atarixl target needs the start address adjusted when using TGI
|
|
|
|
LDFLAGS_mandelbrot_atarixl = --start-addr 0x4000
|
|
|
|
LDFLAGS_tgidemo_atarixl = --start-addr 0x4000
|
|
|
|
|
|
|
|
# The atari target needs to reserve some memory when using TGI
|
|
|
|
LDFLAGS_mandelbrot_atari = -D __RESERVED_MEMORY__=0x2000
|
|
|
|
LDFLAGS_tgidemo_atari = -D __RESERVED_MEMORY__=0x2000
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2001-09-26 17:55:09 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Generic rules
|
|
|
|
|
2013-06-27 14:01:47 +00:00
|
|
|
%: %.c
|
|
|
|
%: %.s
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
.c.o:
|
|
|
|
@echo $<
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(CC) $(CFLAGS) -Oirs --codesize 500 -T -g -t $(SYS) $<
|
|
|
|
@$(AS) $(<:.c=.s)
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.s.o:
|
|
|
|
@echo $<
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(AS) $(AFLAGS) -t $(SYS) $<
|
2009-09-28 19:22:02 +00:00
|
|
|
|
2014-03-22 11:04:16 +00:00
|
|
|
.PRECIOUS: %.o
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2014-03-22 11:04:16 +00:00
|
|
|
.o:
|
2015-07-16 19:31:35 +00:00
|
|
|
@$(LD) $(LDFLAGS_$(@F)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2001-09-26 17:55:09 +00:00
|
|
|
# --------------------------------------------------------------------------
|
2015-07-16 19:31:35 +00:00
|
|
|
# List of executables. This list could be made target-dependent by checking
|
2005-03-31 07:28:14 +00:00
|
|
|
# $(SYS).
|
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
EXELIST = ascii \
|
|
|
|
diodemo \
|
|
|
|
enumdevdir \
|
|
|
|
fire \
|
|
|
|
gunzip65 \
|
|
|
|
hello \
|
|
|
|
mandelbrot \
|
|
|
|
mousetest \
|
|
|
|
multdemo \
|
|
|
|
nachtm \
|
|
|
|
ovrldemo \
|
|
|
|
plasma \
|
|
|
|
sieve \
|
|
|
|
tgidemo
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2005-03-31 07:28:14 +00:00
|
|
|
# --------------------------------------------------------------------------
|
2015-07-16 19:31:35 +00:00
|
|
|
# Rules to make the binaries
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2016-05-30 15:42:01 +00:00
|
|
|
.PHONY: all samples
|
|
|
|
all:
|
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
samples: $(EXELIST)
|
2001-09-26 17:55:09 +00:00
|
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
2015-07-16 19:31:35 +00:00
|
|
|
# Overlay rules. Overlays need special ld65 configuration files. Also, the
|
|
|
|
# overlay file-names are shortenned to fit the Atari's 8.3-character limit.
|
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
multdemo: multidemo.o
|
2015-07-16 19:31:35 +00:00
|
|
|
@$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
|
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
ovrldemo: overlaydemo.o
|
2015-07-16 19:31:35 +00:00
|
|
|
@$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Rule to make a CBM disk with all samples. Needs the c1541 program that comes
|
2001-09-26 17:55:09 +00:00
|
|
|
# with the VICE emulator.
|
2001-09-13 15:58:32 +00:00
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
.PHONY: d64
|
|
|
|
d64: samples.d64
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
samples.d64: samples
|
2002-11-25 14:20:33 +00:00
|
|
|
@$(C1541) -format samples,AA d64 $@ > /dev/null
|
|
|
|
@for exe in $(EXELIST); do\
|
2009-09-28 19:22:02 +00:00
|
|
|
$(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
|
|
|
|
done
|
|
|
|
@for mod in $(TGI) $(MOUS); do\
|
|
|
|
$(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
|
|
|
|
done
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2016-05-30 15:42:01 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Installation rules
|
|
|
|
|
|
|
|
INSTALL = install
|
|
|
|
samplesdir = $(prefix)/share/cc65
|
2016-06-01 18:59:33 +00:00
|
|
|
.PHONY: install
|
2016-05-30 15:42:01 +00:00
|
|
|
install:
|
|
|
|
$(if $(prefix),,$(error variable `prefix' must be set))
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(samplesdir)
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(samplesdir)/geos
|
|
|
|
$(INSTALL) -d $$(DESTDIR)$(samplesdir)/tutorial
|
|
|
|
$(INSTALL) -m0644 *.* $(DESTDIR)$(samplesdir)
|
|
|
|
$(INSTALL) -m0644 README $(DESTDIR)$(samplesdir)
|
|
|
|
$(INSTALL) -m0644 Makefile $(DESTDIR)$(samplesdir)
|
|
|
|
$(INSTALL) -m0644 geos/*.* $(DESTDIR)$(samplesdir)/geos
|
|
|
|
$(INSTALL) -m0644 tutorial/*.* $(DESTDIR)$(samplesdir)/tutorial
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Packaging rules
|
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
.PHONY: zip
|
2016-05-30 15:42:01 +00:00
|
|
|
zip:
|
|
|
|
@cd .. && zip -r cc65 samples/
|
|
|
|
|
2001-09-26 17:55:09 +00:00
|
|
|
# --------------------------------------------------------------------------
|
2015-07-16 19:31:35 +00:00
|
|
|
# Clean-up rules
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-05-30 15:42:01 +00:00
|
|
|
.PHONY: mostlyclean
|
|
|
|
mostlyclean:
|
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
.PHONY: clean
|
2000-05-28 13:40:48 +00:00
|
|
|
clean:
|
2016-06-01 17:41:51 +00:00
|
|
|
$(RM) *.map *.o *.s *.lbl
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
.PHONY: zap
|
|
|
|
zap: clean
|
2003-08-20 11:51:44 +00:00
|
|
|
$(RM) $(EXELIST) samples.d64
|
2015-07-16 19:31:35 +00:00
|
|
|
$(RM) multdemo.? ovrldemo.?
|