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
|
|
|
|
# directory is part of a complete source tree, use the stuff from this
|
|
|
|
# source tree, otherwise use the "official" directories.
|
|
|
|
ifeq "$(wildcard ../src)" ""
|
|
|
|
# No source tree
|
|
|
|
CRT0 = $(SYS).o
|
|
|
|
CLIB = $(SYS).lib
|
|
|
|
CL = cl65
|
|
|
|
CC = cc65
|
|
|
|
AS = as65
|
|
|
|
LD = ld65
|
|
|
|
|
|
|
|
else
|
|
|
|
# Samples is part of a complete source tree
|
|
|
|
CRT0 = ../libsrc/$(SYS).o
|
|
|
|
CLIB = ../libsrc/$(SYS).lib
|
|
|
|
CL = ../src/cl65/cl65
|
|
|
|
CC = ../src/cc65/cc65
|
|
|
|
AS = ../src/ca65/ca65
|
|
|
|
LD = ../src/ld65/ld65
|
|
|
|
export CC65_INC = ../include
|
|
|
|
endif
|
|
|
|
|
|
|
|
# This one comes with VICE
|
2000-05-28 13:40:48 +00:00
|
|
|
C1541 = c1541
|
|
|
|
|
|
|
|
|
2001-09-26 17:55:09 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Generic rules
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
.c.o:
|
|
|
|
@echo $<
|
2003-08-20 11:48:49 +00:00
|
|
|
@$(CC) -Oirs -T --forget-inc-paths --codesize 500 -g -t $(SYS) -I../include/ $<
|
2000-06-14 21:14:47 +00:00
|
|
|
@$(AS) $(basename $<).s
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.s.o:
|
|
|
|
@echo $<
|
2000-06-14 21:14:47 +00:00
|
|
|
@$(AS) $(basename $<).s
|
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).
|
|
|
|
|
|
|
|
EXELIST = ascii \
|
2005-11-20 17:49:44 +00:00
|
|
|
diodemo \
|
|
|
|
fire \
|
|
|
|
gunzip65 \
|
|
|
|
hello \
|
|
|
|
mousedemo \
|
|
|
|
nachtm \
|
|
|
|
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
|
2001-09-26 17:55:09 +00:00
|
|
|
all: $(EXELIST)
|
|
|
|
|
2003-10-06 10:54:46 +00:00
|
|
|
ascii: $(CRT0) ascii.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2003-02-16 14:43:00 +00:00
|
|
|
|
2006-04-06 19:51:37 +00:00
|
|
|
diodemo: $(CRT0) diodemo.o $(CLIB)
|
2005-03-31 07:28:14 +00:00
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
|
|
|
2003-10-06 10:54:46 +00:00
|
|
|
fire: $(CRT0) fire.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2002-11-25 14:20:33 +00:00
|
|
|
|
2003-10-06 10:54:46 +00:00
|
|
|
gunzip65: $(CRT0) gunzip65.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
|
|
|
|
|
|
hello: $(CRT0) hello.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2001-09-26 17:55:09 +00:00
|
|
|
|
2005-11-20 17:49:44 +00:00
|
|
|
# The apple machines need the start address adjusted for the mandelbrot demo
|
|
|
|
ifeq "$(SYS)" "apple2"
|
2006-04-06 19:51:37 +00:00
|
|
|
mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
|
2005-11-20 17:49:44 +00:00
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
|
|
|
else
|
|
|
|
ifeq "$(SYS)" "apple2enh"
|
2006-04-06 19:51:37 +00:00
|
|
|
mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
|
2005-11-20 17:49:44 +00:00
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
|
|
|
else
|
2006-04-06 19:51:37 +00:00
|
|
|
mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
|
2004-10-08 20:10:58 +00:00
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2005-11-20 17:49:44 +00:00
|
|
|
endif
|
|
|
|
endif
|
2004-10-08 20:10:58 +00:00
|
|
|
|
2006-04-06 19:51:37 +00:00
|
|
|
# The Apple ][ needs the start address adjusted for the mousedemo
|
|
|
|
ifeq "$(SYS)" "apple2"
|
|
|
|
mousedemo: $(CRT0) mousedemo.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
|
|
|
else
|
2001-09-26 17:55:09 +00:00
|
|
|
mousedemo: $(CRT0) mousedemo.o $(CLIB)
|
2003-10-06 10:54:46 +00:00
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2006-04-06 19:51:37 +00:00
|
|
|
endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-10-06 10:54:46 +00:00
|
|
|
nachtm: $(CRT0) nachtm.o $(CLIB)
|
2004-10-08 20:10:58 +00:00
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-10-06 10:54:46 +00:00
|
|
|
plasma: $(CRT0) plasma.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-10-06 10:54:46 +00:00
|
|
|
sieve: $(CRT0) sieve.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-11-22 23:14:19 +00:00
|
|
|
# The apple machines need the start address adjusted for the tgidemo
|
2005-11-20 17:49:44 +00:00
|
|
|
ifeq "$(SYS)" "apple2"
|
|
|
|
tgidemo: $(CRT0) tgidemo.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
|
|
|
else
|
|
|
|
ifeq "$(SYS)" "apple2enh"
|
|
|
|
tgidemo: $(CRT0) tgidemo.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
|
|
|
else
|
2003-10-06 10:54:46 +00:00
|
|
|
tgidemo: $(CRT0) tgidemo.o $(CLIB)
|
|
|
|
@$(LD) -t $(SYS) -m $(basename $@).map -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
|
2001-09-13 15:58:32 +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\
|
|
|
|
$(C1541) -attach $@ -write $$exe > /dev/null;\
|
|
|
|
done;\
|
2002-12-13 00:24:22 +00:00
|
|
|
for tgi in ../libsrc/$(SYS)*.tgi; do\
|
2002-11-25 14:20:33 +00:00
|
|
|
$(C1541) -attach $@ -write $$tgi > /dev/null;\
|
|
|
|
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
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|