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
87 # --------------------------------------------------------------------------
88 # Rules how to make each one of the binaries
103 # The Apple machines need the start address adjusted for the mandelbrot demo
104 ifeq "$(SYS)" "apple2"
105 mandelbrot: mandelbrot.o
106 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
108 ifeq "$(SYS)" "apple2enh"
109 mandelbrot: mandelbrot.o
110 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
112 mandelbrot: mandelbrot.o
116 # The Apple ][ needs the start address adjusted for the mousedemo
117 ifeq "$(SYS)" "apple2"
118 mousedemo: mousedemo.o
119 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
121 mousedemo: mousedemo.o
126 ovrldemo: overlaydemo.o
127 @$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
133 # The Apple machines need the start address adjusted for the tgidemo
134 ifeq "$(SYS)" "apple2"
136 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
138 ifeq "$(SYS)" "apple2enh"
140 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
146 # --------------------------------------------------------------------------
147 # Rule to make a disk with all samples. Needs the c1541 program that comes
148 # with the VICE emulator.
154 @$(C1541) -format samples,AA d64 $@ > /dev/null
155 @for exe in $(EXELIST); do\
156 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
158 @for mod in $(TGI) $(MOUS); do\
159 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
162 # --------------------------------------------------------------------------
167 $(RM) *~ *.map *.o *.s *.lbl
171 $(RM) $(EXELIST) samples.d64