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
|
|
|
|
SYS = c64
|
|
|
|
|
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
|
2009-09-28 19:22:02 +00:00
|
|
|
MOUS = /usr/lib/cc65/mou/$(SYS)*.mou
|
|
|
|
TGI = /usr/lib/cc65/tgi/$(SYS)*.tgi
|
|
|
|
ifneq "$(wildcard /usr/local/lib/cc65)" ""
|
|
|
|
MOUS = /usr/local/lib/cc65/mou/$(SYS)*.mou
|
|
|
|
TGI = /usr/local/lib/cc65/tgi/$(SYS)*.tgi
|
|
|
|
endif
|
|
|
|
ifdef CC65_HOME
|
|
|
|
MOUS = $(CC65_HOME)/mou/$(SYS)*.mou
|
|
|
|
TGI = $(CC65_HOME)/tgi/$(SYS)*.tgi
|
|
|
|
endif
|
|
|
|
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 ..)
|
|
|
|
MOUS = ../mou/$(SYS)*.mou
|
|
|
|
TGI = ../tgi/$(SYS)*.tgi
|
|
|
|
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
|
2012-10-15 18:52:40 +00:00
|
|
|
C1541 = c1541
|
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
|
|
|
|
|
|
|
.o:
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2001-09-26 17:55:09 +00:00
|
|
|
# --------------------------------------------------------------------------
|
2005-03-31 07:28:14 +00:00
|
|
|
# List of executables. This list could be made target dependent by checking
|
|
|
|
# $(SYS).
|
|
|
|
|
2012-10-15 18:52:40 +00:00
|
|
|
EXELIST = ascii \
|
|
|
|
diodemo \
|
|
|
|
enumdevdir \
|
|
|
|
fire \
|
|
|
|
gunzip65 \
|
|
|
|
hello \
|
2009-09-28 19:22:02 +00:00
|
|
|
mandelbrot \
|
2013-06-23 15:47:45 +00:00
|
|
|
mousetest \
|
2012-10-15 18:52:40 +00:00
|
|
|
multdemo \
|
|
|
|
nachtm \
|
|
|
|
ovrldemo \
|
|
|
|
plasma \
|
|
|
|
sieve \
|
|
|
|
tgidemo
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2005-03-31 07:28:14 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Rules how to make each one of the binaries
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
.PHONY: all
|
2012-10-15 18:52:40 +00:00
|
|
|
all: $(EXELIST)
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
ascii: ascii.o
|
2003-02-16 14:43:00 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
diodemo: diodemo.o
|
2005-03-31 07:28:14 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
fire: fire.o
|
2002-11-25 14:20:33 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
gunzip65: gunzip65.o
|
2003-10-06 10:54:46 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
hello: hello.o
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2008-03-16 09:37:22 +00:00
|
|
|
# The Apple machines need the start address adjusted for the mandelbrot demo
|
2005-11-20 17:49:44 +00:00
|
|
|
ifeq "$(SYS)" "apple2"
|
2009-09-28 19:22:02 +00:00
|
|
|
mandelbrot: mandelbrot.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
|
2005-11-20 17:49:44 +00:00
|
|
|
else
|
|
|
|
ifeq "$(SYS)" "apple2enh"
|
2009-09-28 19:22:02 +00:00
|
|
|
mandelbrot: mandelbrot.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
|
2005-11-20 17:49:44 +00:00
|
|
|
else
|
2009-09-28 19:22:02 +00:00
|
|
|
mandelbrot: mandelbrot.o
|
2005-11-20 17:49:44 +00:00
|
|
|
endif
|
|
|
|
endif
|
2004-10-08 20:10:58 +00:00
|
|
|
|
2013-06-23 15:47:45 +00:00
|
|
|
# The Apple ][ needs the start address adjusted for the mousetest
|
2006-04-06 19:51:37 +00:00
|
|
|
ifeq "$(SYS)" "apple2"
|
2013-06-23 15:47:45 +00:00
|
|
|
mousetest: mousetest.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
|
2006-04-06 19:51:37 +00:00
|
|
|
else
|
2013-06-23 15:47:45 +00:00
|
|
|
mousetest: mousetest.o
|
2006-04-06 19:51:37 +00:00
|
|
|
endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-08-08 21:23:18 +00:00
|
|
|
multdemo: multidemo.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
|
2012-08-08 21:23:18 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
nachtm: nachtm.o
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2012-06-24 21:15:39 +00:00
|
|
|
ovrldemo: overlaydemo.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
|
2012-06-03 16:16:11 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
plasma: plasma.o
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2009-09-28 19:22:02 +00:00
|
|
|
sieve: sieve.o
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2008-03-16 09:37:22 +00:00
|
|
|
# The Apple machines need the start address adjusted for the tgidemo
|
2005-11-20 17:49:44 +00:00
|
|
|
ifeq "$(SYS)" "apple2"
|
2009-09-28 19:22:02 +00:00
|
|
|
tgidemo: tgidemo.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
|
2005-11-20 17:49:44 +00:00
|
|
|
else
|
|
|
|
ifeq "$(SYS)" "apple2enh"
|
2009-09-28 19:22:02 +00:00
|
|
|
tgidemo: tgidemo.o
|
2013-06-27 14:01:47 +00:00
|
|
|
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
|
2005-11-20 17:49:44 +00:00
|
|
|
else
|
2009-09-28 19:22:02 +00:00
|
|
|
tgidemo: tgidemo.o
|
2005-11-20 17:49:44 +00:00
|
|
|
endif
|
|
|
|
endif
|
2001-09-26 17:55:09 +00:00
|
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Rule to make a disk with all samples. Needs the c1541 program that comes
|
|
|
|
# with the VICE emulator.
|
2001-09-13 15:58:32 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
.PHONY: disk
|
2012-10-15 18:52:40 +00:00
|
|
|
disk: samples.d64
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2001-09-13 15:58:32 +00:00
|
|
|
samples.d64: all
|
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
|
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Cleanup rules
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2003-08-20 11:51:44 +00:00
|
|
|
$(RM) *~ *.map *.o *.s *.lbl
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.PHONY: zap
|
|
|
|
zap: clean
|
2003-08-20 11:51:44 +00:00
|
|
|
$(RM) $(EXELIST) samples.d64
|