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
|
|
|
|
2016-06-01 20:14:30 +00:00
|
|
|
ifneq ($(shell echo),)
|
|
|
|
CMD_EXE = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CMD_EXE
|
|
|
|
NULLDEV = nul:
|
|
|
|
DEL = -del /f
|
|
|
|
else
|
|
|
|
NULLDEV = /dev/null
|
|
|
|
DEL = $(RM)
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
|
|
2016-06-01 20:50:42 +00:00
|
|
|
.PHONY: all mostlyclean clean install zip samples d64
|
2016-06-01 19:08:47 +00:00
|
|
|
|
2013-06-27 14:01:47 +00:00
|
|
|
%: %.c
|
|
|
|
%: %.s
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
.c.o:
|
2016-06-01 21:00:37 +00:00
|
|
|
$(CC) $(CFLAGS) -Oirs --codesize 500 -T -g -t $(SYS) $<
|
|
|
|
$(AS) $(<:.c=.s)
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.s.o:
|
2016-06-01 21:00:37 +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:
|
2016-06-01 21:00:37 +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
|
|
|
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
|
2016-06-01 21:00:37 +00:00
|
|
|
$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
|
2015-07-16 19:31:35 +00:00
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
ovrldemo: overlaydemo.o
|
2016-06-01 21:00:37 +00:00
|
|
|
$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
|
2015-07-16 19:31:35 +00:00
|
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# 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
|
|
|
d64: samples.d64
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-06-01 18:59:33 +00:00
|
|
|
samples.d64: samples
|
2016-06-01 20:14:30 +00:00
|
|
|
@$(C1541) -format samples,AA d64 $@ >$(NULLDEV)
|
2002-11-25 14:20:33 +00:00
|
|
|
@for exe in $(EXELIST); do\
|
2016-06-01 20:14:30 +00:00
|
|
|
$(C1541) -attach $@ -write $$exe >$(NULLDEV) || exit $$?;\
|
2009-09-28 19:22:02 +00:00
|
|
|
done
|
|
|
|
@for mod in $(TGI) $(MOUS); do\
|
2016-06-01 20:14:30 +00:00
|
|
|
$(C1541) -attach $@ -write $$mod >$(NULLDEV) || exit $$?;\
|
2009-09-28 19:22:02 +00:00
|
|
|
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 19:08:47 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
mostlyclean:
|
2016-06-01 21:04:46 +00:00
|
|
|
@$(DEL) *.map *.o *.s 2>$(NULLDEV)
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-06-01 20:50:42 +00:00
|
|
|
clean: mostlyclean
|
2016-06-01 20:14:30 +00:00
|
|
|
@$(DEL) $(EXELIST) samples.d64 2>$(NULLDEV)
|
|
|
|
@$(DEL) multdemo.? ovrldemo.? 2>$(NULLDEV)
|