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 this
12 # source tree, otherwise use the "official" directories.
13 ifeq "$(wildcard ../src)" ""
22 # Samples is part of a complete source tree
23 CLIB = ../libsrc/$(SYS).lib
28 export CC65_INC = ../include
31 # This one comes with VICE
35 # --------------------------------------------------------------------------
40 @$(CC) -Oirs -T --forget-inc-paths --codesize 500 -g -t $(SYS) -I../include/ $<
41 @$(AS) $(basename $<).s
45 @$(AS) $(basename $<).s
48 # --------------------------------------------------------------------------
49 # List of executables. This list could be made target dependent by checking
63 # --------------------------------------------------------------------------
64 # Rules how to make each one of the binaries
69 ascii: ascii.o $(CLIB)
70 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
72 diodemo: diodemo.o $(CLIB)
73 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
76 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
78 gunzip65: gunzip65.o $(CLIB)
79 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
81 hello: hello.o $(CLIB)
82 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
84 # The Apple machines need the start address adjusted for the mandelbrot demo
85 ifeq "$(SYS)" "apple2"
86 mandelbrot: mandelbrot.o $(CLIB)
87 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
89 ifeq "$(SYS)" "apple2enh"
90 mandelbrot: mandelbrot.o $(CLIB)
91 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
93 mandelbrot: mandelbrot.o $(CLIB)
94 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
98 # The Apple ][ needs the start address adjusted for the mousedemo
99 ifeq "$(SYS)" "apple2"
100 mousedemo: mousedemo.o $(CLIB)
101 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
103 mousedemo: mousedemo.o $(CLIB)
104 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
107 nachtm: nachtm.o $(CLIB)
108 @$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
110 plasma: plasma.o $(CLIB)
111 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
113 sieve: sieve.o $(CLIB)
114 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
116 # The Apple machines need the start address adjusted for the tgidemo
117 ifeq "$(SYS)" "apple2"
118 tgidemo: tgidemo.o $(CLIB)
119 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
121 ifeq "$(SYS)" "apple2enh"
122 tgidemo: tgidemo.o $(CLIB)
123 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
125 tgidemo: tgidemo.o $(CLIB)
126 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
130 # --------------------------------------------------------------------------
131 # Rule to make a disk with all samples. Needs the c1541 program that comes
132 # with the VICE emulator.
138 @$(C1541) -format samples,AA d64 $@ > /dev/null
139 @for exe in $(EXELIST); do\
140 $(C1541) -attach $@ -write $$exe > /dev/null;\
142 for tgi in ../libsrc/$(SYS)*.tgi; do\
143 $(C1541) -attach $@ -write $$tgi > /dev/null;\
146 # --------------------------------------------------------------------------
151 $(RM) *~ *.map *.o *.s *.lbl
155 $(RM) $(EXELIST) samples.d64