]> git.sur5r.net Git - cc65/blob - samples/Makefile
7ab37976c5ba28205d759d4679adf1ff1672655f
[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 CRT0    = ../libsrc/$(SYS).o
11 CLIB    = ../libsrc/$(SYS).lib
12 CC      = ../src/cc65/cc65
13 CL      = ../src/cl65/cl65
14 AS      = ../src/ca65/ca65
15 LD      = ../src/ld65/ld65
16 C1541   = c1541
17
18
19 # --------------------------------------------------------------------------
20 # Generic rules
21
22 .c.o:
23         @echo $<
24         @$(CC) -Oirs -T --forget-inc-paths --codesize 500 -g -t $(SYS) -I../include/ $<
25         @$(AS) $(basename $<).s
26
27 .s.o:
28         @echo $<
29         @$(AS) $(basename $<).s
30
31
32 # --------------------------------------------------------------------------
33 # Rules how to make each one of the binaries
34
35 EXELIST=ascii fire gunzip65 hello mousedemo nachtm plasma sieve tgidemo
36
37 .PHONY: all
38 all:    $(EXELIST)
39
40 ascii:          $(CRT0) ascii.o $(CLIB)
41         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
42
43 fire:           $(CRT0) fire.o $(CLIB)
44         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
45
46 gunzip65:       $(CRT0) gunzip65.o $(CLIB)
47         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
48
49 hello:          $(CRT0) hello.o $(CLIB)
50         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
51
52 mandelbrot:             $(CRT0) mandelbrot.o $(CLIB)
53         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
54
55 mousedemo:      $(CRT0) mousedemo.o $(CLIB)
56         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
57
58 nachtm:         $(CRT0) nachtm.o $(CLIB)
59         @$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
60
61 plasma:         $(CRT0) plasma.o $(CLIB)
62         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
63
64 sieve:          $(CRT0) sieve.o $(CLIB)
65         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
66
67 tgidemo:        $(CRT0) tgidemo.o $(CLIB)
68         @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
69
70
71 # --------------------------------------------------------------------------
72 # Rule to make a disk with all samples. Needs the c1541 program that comes
73 # with the VICE emulator.
74
75 .PHONY: disk
76 disk:   samples.d64
77
78 samples.d64:    all
79         @$(C1541) -format samples,AA  d64 $@ > /dev/null
80         @for exe in $(EXELIST); do\
81             $(C1541) -attach $@ -write $$exe > /dev/null;\
82         done;\
83         for tgi in ../libsrc/$(SYS)*.tgi; do\
84             $(C1541) -attach $@ -write $$tgi > /dev/null;\
85         done;
86
87 # --------------------------------------------------------------------------
88 # Cleanup rules
89
90 .PHONY: clean
91 clean:
92         $(RM) *~ *.map *.o *.s *.lbl
93
94 .PHONY: zap
95 zap:    clean
96         $(RM) $(EXELIST) samples.d64
97
98
99
100