]> git.sur5r.net Git - cc65/blob - samples/Makefile
Define a standard driver and mode for tgi graphics and use it in the sample
[cc65] / samples / Makefile
1 #
2 # Makefile for cc65 samples
3 #
4 # This Makefile requires GNU make
5 #
6
7 # Enter the target system here
8 SYS     = c64
9
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)" ""
14 # No source tree
15 CLIB = $(SYS).lib
16 CL   = cl65
17 CC   = cc65
18 AS   = ca65
19 LD   = ld65
20
21 else
22 # Samples is part of a complete source tree
23 CLIB = ../libsrc/$(SYS).lib
24 CL   = ../src/cl65/cl65
25 CC   = ../src/cc65/cc65
26 AS   = ../src/ca65/ca65
27 LD   = ../src/ld65/ld65
28 export CC65_INC = ../include
29 endif
30
31 # This one comes with VICE
32 C1541   = c1541
33
34
35 # --------------------------------------------------------------------------
36 # Generic rules
37
38 .c.o:
39         @echo $<
40         @$(CC) -Oirs -T --forget-inc-paths --codesize 500 -g -t $(SYS) -I../include/ $<
41         @$(AS) $(basename $<).s
42
43 .s.o:
44         @echo $<
45         @$(AS) $(basename $<).s
46
47
48 # --------------------------------------------------------------------------
49 # List of executables. This list could be made target dependent by checking
50 # $(SYS).
51
52 EXELIST =       ascii           \
53                 diodemo         \
54                 fire            \
55                 gunzip65        \
56                 hello           \
57                 mousedemo       \
58                 nachtm          \
59                 plasma          \
60                 sieve           \
61                 tgidemo
62
63 # --------------------------------------------------------------------------
64 # Rules how to make each one of the binaries
65
66 .PHONY: all
67 all:    $(EXELIST)
68
69 ascii:          ascii.o $(CLIB)
70         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
71
72 diodemo:        diodemo.o $(CLIB)
73         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
74
75 fire:           fire.o $(CLIB)
76         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
77
78 gunzip65:       gunzip65.o $(CLIB)
79         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
80
81 hello:          hello.o $(CLIB)
82         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
83
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 $@ $^
88 else
89 ifeq "$(SYS)" "apple2enh"
90 mandelbrot:     mandelbrot.o $(CLIB)
91         @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
92 else
93 mandelbrot:     mandelbrot.o $(CLIB)
94         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
95 endif
96 endif
97
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 $@ $^
102 else
103 mousedemo:      mousedemo.o $(CLIB)
104         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
105 endif
106
107 nachtm:         nachtm.o $(CLIB)
108         @$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
109
110 plasma:         plasma.o $(CLIB)
111         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
112
113 sieve:          sieve.o $(CLIB)
114         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
115
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 $@ $^
120 else
121 ifeq "$(SYS)" "apple2enh"
122 tgidemo:        tgidemo.o $(CLIB)
123         @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
124 else
125 tgidemo:        tgidemo.o $(CLIB)
126         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
127 endif
128 endif
129
130 # --------------------------------------------------------------------------
131 # Rule to make a disk with all samples. Needs the c1541 program that comes
132 # with the VICE emulator.
133
134 .PHONY: disk
135 disk:   samples.d64
136
137 samples.d64:    all
138         @$(C1541) -format samples,AA  d64 $@ > /dev/null
139         @for exe in $(EXELIST); do\
140             $(C1541) -attach $@ -write $$exe > /dev/null;\
141         done;\
142         for tgi in ../libsrc/$(SYS)*.tgi; do\
143             $(C1541) -attach $@ -write $$tgi > /dev/null;\
144         done;
145
146 # --------------------------------------------------------------------------
147 # Cleanup rules
148
149 .PHONY: clean
150 clean:
151         $(RM) *~ *.map *.o *.s *.lbl
152
153 .PHONY: zap
154 zap:    clean
155         $(RM) $(EXELIST) samples.d64
156
157
158
159