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)" ""
23 # Samples is part of a complete source tree
24 CRT0 = ../libsrc/$(SYS).o
25 CLIB = ../libsrc/$(SYS).lib
30 export CC65_INC = ../include
33 # This one comes with VICE
37 # --------------------------------------------------------------------------
42 @$(CC) -Oirs -T --forget-inc-paths --codesize 500 -g -t $(SYS) -I../include/ $<
43 @$(AS) $(basename $<).s
47 @$(AS) $(basename $<).s
50 # --------------------------------------------------------------------------
51 # List of executables. This list could be made target dependent by checking
65 # --------------------------------------------------------------------------
66 # Rules how to make each one of the binaries
71 ascii: $(CRT0) ascii.o $(CLIB)
72 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
74 diodemo: $(CRT0) diodemo.o $(CLIB)
75 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
77 fire: $(CRT0) fire.o $(CLIB)
78 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
80 gunzip65: $(CRT0) gunzip65.o $(CLIB)
81 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
83 hello: $(CRT0) hello.o $(CLIB)
84 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
86 # The apple machines need the start address adjusted for the mandelbrot demo
87 ifeq "$(SYS)" "apple2"
88 mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
89 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
91 ifeq "$(SYS)" "apple2enh"
92 mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
93 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
95 mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
96 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
100 # The Apple ][ needs the start address adjusted for the mousedemo
101 ifeq "$(SYS)" "apple2"
102 mousedemo: $(CRT0) mousedemo.o $(CLIB)
103 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
105 mousedemo: $(CRT0) mousedemo.o $(CLIB)
106 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
109 nachtm: $(CRT0) nachtm.o $(CLIB)
110 @$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
112 plasma: $(CRT0) plasma.o $(CLIB)
113 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
115 sieve: $(CRT0) sieve.o $(CLIB)
116 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
118 # The apple machines need the start address adjusted for the tgidemo
119 ifeq "$(SYS)" "apple2"
120 tgidemo: $(CRT0) tgidemo.o $(CLIB)
121 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
123 ifeq "$(SYS)" "apple2enh"
124 tgidemo: $(CRT0) tgidemo.o $(CLIB)
125 @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
127 tgidemo: $(CRT0) tgidemo.o $(CLIB)
128 @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
132 # --------------------------------------------------------------------------
133 # Rule to make a disk with all samples. Needs the c1541 program that comes
134 # with the VICE emulator.
140 @$(C1541) -format samples,AA d64 $@ > /dev/null
141 @for exe in $(EXELIST); do\
142 $(C1541) -attach $@ -write $$exe > /dev/null;\
144 for tgi in ../libsrc/$(SYS)*.tgi; do\
145 $(C1541) -attach $@ -write $$tgi > /dev/null;\
148 # --------------------------------------------------------------------------
153 $(RM) *~ *.map *.o *.s *.lbl
157 $(RM) $(EXELIST) samples.d64