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
89 # --------------------------------------------------------------------------
90 # Rules how to make each one of the binaries
105 # The Apple machines need the start address adjusted for the mandelbrot demo
106 ifeq "$(SYS)" "apple2"
107 mandelbrot: mandelbrot.o
108 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
110 ifeq "$(SYS)" "apple2enh"
111 mandelbrot: mandelbrot.o
112 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
114 mandelbrot: mandelbrot.o
118 # The Apple ][ needs the start address adjusted for the mousedemo
119 ifeq "$(SYS)" "apple2"
120 mousedemo: mousedemo.o
121 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
123 mousedemo: mousedemo.o
126 multdemo: multidemo.o
127 @$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
131 ovrldemo: overlaydemo.o
132 @$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
138 # The Apple machines need the start address adjusted for the tgidemo
139 ifeq "$(SYS)" "apple2"
141 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
143 ifeq "$(SYS)" "apple2enh"
145 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
151 # --------------------------------------------------------------------------
152 # Rule to make a disk with all samples. Needs the c1541 program that comes
153 # with the VICE emulator.
159 @$(C1541) -format samples,AA d64 $@ > /dev/null
160 @for exe in $(EXELIST); do\
161 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
163 @for mod in $(TGI) $(MOUS); do\
164 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
167 # --------------------------------------------------------------------------
172 $(RM) *~ *.map *.o *.s *.lbl
176 $(RM) $(EXELIST) samples.d64