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.
35 LD65_CFG = ../src/ld65/cfg
38 MOUS = ../libsrc/$(SYS)*.mou
39 TGI = ../libsrc/$(SYS)*.tgi
40 CLIB = ../libsrc/$(SYS).lib
46 MY_INC = --forget-inc-paths -I . -I $(CC65_INC)
47 MY_ASM = --forget-inc-paths -I . -I $(CA65_INC)
50 # This one comes with VICE
54 # --------------------------------------------------------------------------
59 @$(CC) $(MY_INC) -Oirs --codesize 500 -T -g -t $(SYS) $<
60 @$(AS) $(basename $<).s
64 @$(AS) $(MY_ASM) -t $(SYS) $<
67 @$(LD) -o $@ -t $(SYS) -m $(basename $@).map $^ $(CLIB)
70 # --------------------------------------------------------------------------
71 # List of executables. This list could be made target dependent by checking
88 # --------------------------------------------------------------------------
89 # Rules how to make each one of the binaries
104 # The Apple machines need the start address adjusted for the mandelbrot demo
105 ifeq "$(SYS)" "apple2"
106 mandelbrot: mandelbrot.o
107 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
109 ifeq "$(SYS)" "apple2enh"
110 mandelbrot: mandelbrot.o
111 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
113 mandelbrot: mandelbrot.o
117 # The Apple ][ needs the start address adjusted for the mousedemo
118 ifeq "$(SYS)" "apple2"
119 mousedemo: mousedemo.o
120 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
122 mousedemo: mousedemo.o
125 multdemo: multidemo.o
126 @$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
130 ovrldemo: overlaydemo.o
131 @$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
137 # The Apple machines need the start address adjusted for the tgidemo
138 ifeq "$(SYS)" "apple2"
140 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
142 ifeq "$(SYS)" "apple2enh"
144 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
150 # --------------------------------------------------------------------------
151 # Rule to make a disk with all samples. Needs the c1541 program that comes
152 # with the VICE emulator.
158 @$(C1541) -format samples,AA d64 $@ > /dev/null
159 @for exe in $(EXELIST); do\
160 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
162 @for mod in $(TGI) $(MOUS); do\
163 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
166 # --------------------------------------------------------------------------
171 $(RM) *~ *.map *.o *.s *.lbl
175 $(RM) $(EXELIST) samples.d64