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.
33 export CC65_HOME := $(abspath ..)
34 MOUS = ../mou/$(SYS)*.mou
35 TGI = ../tgi/$(SYS)*.tgi
36 CLIB = ../lib/$(SYS).lib
43 # This one comes with VICE
46 # --------------------------------------------------------------------------
47 # System-dependent settings
49 # The Apple machines need the start address adjusted when using TGI
50 LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000
51 LDFLAGS_tgidemo_apple2 = --start-addr 0x4000
52 LDFLAGS_mandelbrot_apple2enh = --start-addr 0x4000
53 LDFLAGS_tgidemo_apple2enh = --start-addr 0x4000
55 # The Apple ][ needs the start address adjusted for the mousetest
56 LDFLAGS_mousetest_apple2 = --start-addr 0x4000
58 # The atarixl target needs the start address adjusted when using TGI
59 LDFLAGS_mandelbrot_atarixl = --start-addr 0x4000
60 LDFLAGS_tgidemo_atarixl = --start-addr 0x4000
62 # The atari target needs to reserve some memory when using TGI
63 LDFLAGS_mandelbrot_atari = -D __RESERVED_MEMORY__=0x2000
64 LDFLAGS_tgidemo_atari = -D __RESERVED_MEMORY__=0x2000
66 # --------------------------------------------------------------------------
74 @$(CC) $(CFLAGS) -Oirs --codesize 500 -T -g -t $(SYS) $<
79 @$(AS) $(AFLAGS) -t $(SYS) $<
84 @$(LD) $(LDFLAGS_$(@F)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
86 # --------------------------------------------------------------------------
87 # List of executables. This list could be made target-dependent by checking
105 # --------------------------------------------------------------------------
106 # Rules to make the binaries
111 # --------------------------------------------------------------------------
112 # Overlay rules. Overlays need special ld65 configuration files. Also, the
113 # overlay file-names are shortenned to fit the Atari's 8.3-character limit.
115 multdemo: multidemo.o
116 @$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
118 ovrldemo: overlaydemo.o
119 @$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
121 # --------------------------------------------------------------------------
122 # Rule to make a CBM disk with all samples. Needs the c1541 program that comes
123 # with the VICE emulator.
129 @$(C1541) -format samples,AA d64 $@ > /dev/null
130 @for exe in $(EXELIST); do\
131 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
133 @for mod in $(TGI) $(MOUS); do\
134 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
137 # --------------------------------------------------------------------------
142 $(RM) *~ *.map *.o *.s *.lbl
146 $(RM) $(EXELIST) samples.d64
147 $(RM) multdemo.? ovrldemo.?