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
86 # --------------------------------------------------------------------------
87 # Rules how to make each one of the binaries
102 # The Apple machines need the start address adjusted for the mandelbrot demo
103 ifeq "$(SYS)" "apple2"
104 mandelbrot: mandelbrot.o
105 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
107 ifeq "$(SYS)" "apple2enh"
108 mandelbrot: mandelbrot.o
109 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
111 mandelbrot: mandelbrot.o
115 # The Apple ][ needs the start address adjusted for the mousedemo
116 ifeq "$(SYS)" "apple2"
117 mousedemo: mousedemo.o
118 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
120 mousedemo: mousedemo.o
129 # The Apple machines need the start address adjusted for the tgidemo
130 ifeq "$(SYS)" "apple2"
132 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
134 ifeq "$(SYS)" "apple2enh"
136 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
142 # --------------------------------------------------------------------------
143 # Rule to make a disk with all samples. Needs the c1541 program that comes
144 # with the VICE emulator.
150 @$(C1541) -format samples,AA d64 $@ > /dev/null
151 @for exe in $(EXELIST); do\
152 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
154 @for mod in $(TGI) $(MOUS); do\
155 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
158 # --------------------------------------------------------------------------
163 $(RM) *~ *.map *.o *.s *.lbl
167 $(RM) $(EXELIST) samples.d64