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/target/$(SYS)/drv/mou/$(SYS)*.mou
16 TGI = /usr/lib/cc65/target/$(SYS)/drv/tgi/$(SYS)*.tgi
17 ifneq "$(wildcard /usr/local/lib/cc65)" ""
18 MOUS = /usr/local/lib/cc65/target/$(SYS)/drv/mou/$(SYS)*.mou
19 TGI = /usr/local/lib/cc65/target/$(SYS)/drv/tgi/$(SYS)*.tgi
21 ifneq "$(wildcard /opt/local/share/cc65)" ""
22 MOUS = /opt/local/share/cc65/target/$(SYS)/drv/mou/$(SYS)*.mou
23 TGI = /opt/local/share/cc65/target/$(SYS)/drv/tgi/$(SYS)*.tgi
26 MOUS = $(CC65_HOME)/target/$(SYS)/drv/mou/$(SYS)*.mou
27 TGI = $(CC65_HOME)/target/$(SYS)/drv/tgi/$(SYS)*.tgi
29 CLIB = --lib $(SYS).lib
36 # "samples/" is a part of a complete source tree.
37 export CC65_HOME := $(abspath ..)
38 MOUS = ../target/$(SYS)/drv/mou/$(SYS)*.mou
39 TGI = ../target/$(SYS)/drv/tgi/$(SYS)*.tgi
40 CLIB = ../lib/$(SYS).lib
47 # This one comes with VICE
50 # --------------------------------------------------------------------------
51 # System-dependent settings
53 # The Apple machines need the start address adjusted when using TGI
54 LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000
55 LDFLAGS_tgidemo_apple2 = --start-addr 0x4000
56 LDFLAGS_mandelbrot_apple2enh = --start-addr 0x4000
57 LDFLAGS_tgidemo_apple2enh = --start-addr 0x4000
59 # The Apple ][ needs the start address adjusted for the mousetest
60 LDFLAGS_mousetest_apple2 = --start-addr 0x4000
62 # The atarixl target needs the start address adjusted when using TGI
63 LDFLAGS_mandelbrot_atarixl = --start-addr 0x4000
64 LDFLAGS_tgidemo_atarixl = --start-addr 0x4000
66 # The atari target needs to reserve some memory when using TGI
67 LDFLAGS_mandelbrot_atari = -D __RESERVED_MEMORY__=0x2000
68 LDFLAGS_tgidemo_atari = -D __RESERVED_MEMORY__=0x2000
70 # --------------------------------------------------------------------------
78 @$(CC) $(CFLAGS) -Oirs --codesize 500 -T -g -t $(SYS) $<
83 @$(AS) $(AFLAGS) -t $(SYS) $<
88 @$(LD) $(LDFLAGS_$(@F)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
90 # --------------------------------------------------------------------------
91 # List of executables. This list could be made target-dependent by checking
109 # --------------------------------------------------------------------------
110 # Rules to make the binaries
115 # --------------------------------------------------------------------------
116 # Overlay rules. Overlays need special ld65 configuration files. Also, the
117 # overlay file-names are shortenned to fit the Atari's 8.3-character limit.
119 multdemo: multidemo.o
120 @$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
122 ovrldemo: overlaydemo.o
123 @$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
125 # --------------------------------------------------------------------------
126 # Rule to make a CBM disk with all samples. Needs the c1541 program that comes
127 # with the VICE emulator.
133 @$(C1541) -format samples,AA d64 $@ > /dev/null
134 @for exe in $(EXELIST); do\
135 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
137 @for mod in $(TGI) $(MOUS); do\
138 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
141 # --------------------------------------------------------------------------
146 $(RM) *~ *.map *.o *.s *.lbl
150 $(RM) $(EXELIST) samples.d64
151 $(RM) multdemo.? ovrldemo.?