2 # Makefile for cc65 samples
4 # This Makefile requires GNU make
7 # Enter the target system here
10 # Determine the path to the executables and libraries. If the samples
11 # directory is part of a complete source tree, use the stuff from that
12 # source tree; otherwise, use the "install" directories.
13 ifeq "$(wildcard ../src)" ""
15 MOUS = /usr/lib/cc65/mou/$(SYS)*.mou
16 TGI = /usr/lib/cc65/tgi/$(SYS)*.tgi
17 ifneq "$(wildcard /usr/local/lib/cc65)" ""
18 MOUS = /usr/local/lib/cc65/mou/$(SYS)*.mou
19 TGI = /usr/local/lib/cc65/tgi/$(SYS)*.tgi
22 MOUS = $(CC65_HOME)/mou/$(SYS)*.mou
23 TGI = $(CC65_HOME)/tgi/$(SYS)*.tgi
25 CLIB = --lib $(SYS).lib
32 # "samples/" is a part of a complete source tree.
33 export CC65_HOME := $(abspath ..)
34 MOUS = ../mou/$(SYS)*.mou
35 TGI = ../tgi/$(SYS)*.tgi
36 CLIB = ../lib/$(SYS).lib
43 # This one comes with VICE
47 # --------------------------------------------------------------------------
55 @$(CC) $(CFLAGS) -Oirs --codesize 500 -T -g -t $(SYS) $<
60 @$(AS) $(AFLAGS) -t $(SYS) $<
63 @$(LD) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
66 # --------------------------------------------------------------------------
67 # List of executables. This list could be made target dependent by checking
85 # --------------------------------------------------------------------------
86 # Rules how to make each one of the binaries
101 # The Apple machines need the start address adjusted for the mandelbrot demo
102 ifeq "$(SYS)" "apple2"
103 mandelbrot: mandelbrot.o
104 @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
106 ifeq "$(SYS)" "apple2enh"
107 mandelbrot: mandelbrot.o
108 @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
110 mandelbrot: mandelbrot.o
114 # The Apple ][ needs the start address adjusted for the mousetest
115 ifeq "$(SYS)" "apple2"
116 mousetest: mousetest.o
117 @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
119 mousetest: mousetest.o
122 multdemo: multidemo.o
123 @$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
127 ovrldemo: overlaydemo.o
128 @$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
134 # The Apple machines need the start address adjusted for the tgidemo
135 ifeq "$(SYS)" "apple2"
137 @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
139 ifeq "$(SYS)" "apple2enh"
141 @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
147 # --------------------------------------------------------------------------
148 # Rule to make a disk with all samples. Needs the c1541 program that comes
149 # with the VICE emulator.
155 @$(C1541) -format samples,AA d64 $@ > /dev/null
156 @for exe in $(EXELIST); do\
157 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
159 @for mod in $(TGI) $(MOUS); do\
160 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
163 # --------------------------------------------------------------------------
168 $(RM) *~ *.map *.o *.s *.lbl
172 $(RM) $(EXELIST) samples.d64