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_$(basename $@)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
86 # --------------------------------------------------------------------------
87 # List of executables. This list could be made target dependent by checking
105 # --------------------------------------------------------------------------
106 # Rules how to make each one of the binaries
111 # --------------------------------------------------------------------------
112 # Rule to make a disk with all samples. Needs the c1541 program that comes
113 # with the VICE emulator.
119 @$(C1541) -format samples,AA d64 $@ > /dev/null
120 @for exe in $(EXELIST); do\
121 $(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
123 @for mod in $(TGI) $(MOUS); do\
124 $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
127 # --------------------------------------------------------------------------
132 $(RM) *~ *.map *.o *.s *.lbl
136 $(RM) $(EXELIST) samples.d64