]> git.sur5r.net Git - cc65/blobdiff - samples/Makefile
Add mouse_setbox/mouse_getbox to the demo.
[cc65] / samples / Makefile
index aabaed14f289ee9762364191121b6adcd82c9167..cd8079a2c8c6fec879249e4e357e6ae53c73b2ff 100644 (file)
@@ -12,16 +12,14 @@ SYS = c64
 # source tree, otherwise use the "official" directories.
 ifeq "$(wildcard ../src)" ""
 # No source tree
-CRT0 = $(SYS).o
 CLIB = $(SYS).lib
 CL   = cl65
 CC   = cc65
-AS   = as65
+AS   = ca65
 LD   = ld65
 
 else
 # Samples is part of a complete source tree
-CRT0 = ../libsrc/$(SYS).o
 CLIB = ../libsrc/$(SYS).lib
 CL   = ../src/cl65/cl65
 CC   = ../src/cc65/cc65
@@ -48,43 +46,86 @@ C1541       = c1541
 
 
 # --------------------------------------------------------------------------
-# Rules how to make each one of the binaries
+# List of executables. This list could be made target dependent by checking
+# $(SYS).
+
+EXELIST        =       ascii           \
+               diodemo         \
+               fire            \
+               gunzip65        \
+               hello           \
+               mousedemo       \
+               nachtm          \
+               plasma          \
+               sieve           \
+               tgidemo
 
-EXELIST=ascii fire gunzip65 hello mousedemo nachtm plasma sieve tgidemo
+# --------------------------------------------------------------------------
+# Rules how to make each one of the binaries
 
 .PHONY:        all
 all:           $(EXELIST)
 
-ascii:                 $(CRT0) ascii.o $(CLIB)
+ascii:                 ascii.o $(CLIB)
+       @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
+
+diodemo:        diodemo.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
 
-fire:                  $(CRT0) fire.o $(CLIB)
+fire:                  fire.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
 
-gunzip65:              $(CRT0) gunzip65.o $(CLIB)
+gunzip65:              gunzip65.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
 
-hello:                 $(CRT0) hello.o $(CLIB)
+hello:                 hello.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
 
-mandelbrot:            $(CRT0) mandelbrot.o $(CLIB)
+# The Apple machines need the start address adjusted for the mandelbrot demo
+ifeq "$(SYS)" "apple2"
+mandelbrot:     mandelbrot.o $(CLIB)
+       @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+ifeq "$(SYS)" "apple2enh"
+mandelbrot:     mandelbrot.o $(CLIB)
+       @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+mandelbrot:     mandelbrot.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
+endif
+endif
 
-mousedemo:             $(CRT0) mousedemo.o $(CLIB)
+# The Apple ][ needs the start address adjusted for the mousedemo
+ifeq "$(SYS)" "apple2"
+mousedemo:             mousedemo.o $(CLIB)
+       @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+mousedemo:             mousedemo.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
+endif
 
-nachtm:                $(CRT0) nachtm.o $(CLIB)
+nachtm:                nachtm.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
 
-plasma:                $(CRT0) plasma.o $(CLIB)
+plasma:                plasma.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
 
-sieve:                 $(CRT0) sieve.o $(CLIB)
+sieve:                 sieve.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
 
-tgidemo:               $(CRT0) tgidemo.o $(CLIB)
+# The Apple machines need the start address adjusted for the tgidemo
+ifeq "$(SYS)" "apple2"
+tgidemo:               tgidemo.o $(CLIB)
+       @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+ifeq "$(SYS)" "apple2enh"
+tgidemo:               tgidemo.o $(CLIB)
+       @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+tgidemo:               tgidemo.o $(CLIB)
        @$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
-
+endif
+endif
 
 # --------------------------------------------------------------------------
 # Rule to make a disk with all samples. Needs the c1541 program that comes