Improved Makefile by Greg King.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4258 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
102
samples/Makefile
102
samples/Makefile
@@ -8,24 +8,43 @@
|
|||||||
SYS = c64
|
SYS = c64
|
||||||
|
|
||||||
# Determine the path to the executables and libraries. If the samples
|
# Determine the path to the executables and libraries. If the samples
|
||||||
# directory is part of a complete source tree, use the stuff from this
|
# directory is part of a complete source tree, use the stuff from that
|
||||||
# source tree, otherwise use the "official" directories.
|
# source tree; otherwise, use the "install" directories.
|
||||||
ifeq "$(wildcard ../src)" ""
|
ifeq "$(wildcard ../src)" ""
|
||||||
# No source tree
|
# No source tree
|
||||||
CLIB = $(SYS).lib
|
MOUS = /usr/lib/cc65/mou/$(SYS)*.mou
|
||||||
|
TGI = /usr/lib/cc65/tgi/$(SYS)*.tgi
|
||||||
|
ifneq "$(wildcard /usr/local/lib/cc65)" ""
|
||||||
|
MOUS = /usr/local/lib/cc65/mou/$(SYS)*.mou
|
||||||
|
TGI = /usr/local/lib/cc65/tgi/$(SYS)*.tgi
|
||||||
|
endif
|
||||||
|
ifdef CC65_HOME
|
||||||
|
MOUS = $(CC65_HOME)/mou/$(SYS)*.mou
|
||||||
|
TGI = $(CC65_HOME)/tgi/$(SYS)*.tgi
|
||||||
|
endif
|
||||||
|
CLIB = --lib $(SYS).lib
|
||||||
CL = cl65
|
CL = cl65
|
||||||
CC = cc65
|
CC = cc65
|
||||||
AS = ca65
|
AS = ca65
|
||||||
LD = ld65
|
LD = ld65
|
||||||
|
|
||||||
else
|
else
|
||||||
# Samples is part of a complete source tree
|
# "samples/" is a part of a complete source tree.
|
||||||
|
CA65_INC = ../asminc
|
||||||
|
CC65_INC = ../include
|
||||||
|
LD65_CFG = ../src/ld65/cfg
|
||||||
|
LD65_LIB = ../libsrc
|
||||||
|
LD65_OBJ = ../libsrc
|
||||||
|
MOUS = ../libsrc/$(SYS)*.mou
|
||||||
|
TGI = ../libsrc/$(SYS)*.tgi
|
||||||
CLIB = ../libsrc/$(SYS).lib
|
CLIB = ../libsrc/$(SYS).lib
|
||||||
CL = ../src/cl65/cl65
|
CL = ../src/cl65/cl65
|
||||||
CC = ../src/cc65/cc65
|
CC = ../src/cc65/cc65
|
||||||
AS = ../src/ca65/ca65
|
AS = ../src/ca65/ca65
|
||||||
LD = ../src/ld65/ld65
|
LD = ../src/ld65/ld65
|
||||||
export CC65_INC = ../include
|
|
||||||
|
MY_INC = --forget-inc-paths -I . -I $(CC65_INC)
|
||||||
|
MY_ASM = --forget-inc-paths -I . -I $(CA65_INC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# This one comes with VICE
|
# This one comes with VICE
|
||||||
@@ -37,12 +56,15 @@ C1541 = c1541
|
|||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@echo $<
|
@echo $<
|
||||||
@$(CC) -Oirs -T --forget-inc-paths --codesize 500 -g -t $(SYS) -I../include/ $<
|
@$(CC) $(MY_INC) -Oirs --codesize 500 -T -g -t $(SYS) $<
|
||||||
@$(AS) $(basename $<).s
|
@$(AS) $(basename $<).s
|
||||||
|
|
||||||
.s.o:
|
.s.o:
|
||||||
@echo $<
|
@echo $<
|
||||||
@$(AS) $(basename $<).s
|
@$(AS) $(MY_ASM) -t $(SYS) $<
|
||||||
|
|
||||||
|
.o:
|
||||||
|
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^ $(CLIB)
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@@ -54,6 +76,7 @@ EXELIST = ascii \
|
|||||||
fire \
|
fire \
|
||||||
gunzip65 \
|
gunzip65 \
|
||||||
hello \
|
hello \
|
||||||
|
mandelbrot \
|
||||||
mousedemo \
|
mousedemo \
|
||||||
nachtm \
|
nachtm \
|
||||||
plasma \
|
plasma \
|
||||||
@@ -66,64 +89,53 @@ EXELIST = ascii \
|
|||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(EXELIST)
|
all: $(EXELIST)
|
||||||
|
|
||||||
ascii: ascii.o $(CLIB)
|
ascii: ascii.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
diodemo: diodemo.o $(CLIB)
|
diodemo: diodemo.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
fire: fire.o $(CLIB)
|
fire: fire.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
gunzip65: gunzip65.o $(CLIB)
|
gunzip65: gunzip65.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
hello: hello.o $(CLIB)
|
hello: hello.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
# The Apple machines need the start address adjusted for the mandelbrot demo
|
# The Apple machines need the start address adjusted for the mandelbrot demo
|
||||||
ifeq "$(SYS)" "apple2"
|
ifeq "$(SYS)" "apple2"
|
||||||
mandelbrot: mandelbrot.o $(CLIB)
|
mandelbrot: mandelbrot.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
|
||||||
else
|
else
|
||||||
ifeq "$(SYS)" "apple2enh"
|
ifeq "$(SYS)" "apple2enh"
|
||||||
mandelbrot: mandelbrot.o $(CLIB)
|
mandelbrot: mandelbrot.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
|
||||||
else
|
else
|
||||||
mandelbrot: mandelbrot.o $(CLIB)
|
mandelbrot: mandelbrot.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The Apple ][ needs the start address adjusted for the mousedemo
|
# The Apple ][ needs the start address adjusted for the mousedemo
|
||||||
ifeq "$(SYS)" "apple2"
|
ifeq "$(SYS)" "apple2"
|
||||||
mousedemo: mousedemo.o $(CLIB)
|
mousedemo: mousedemo.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
|
||||||
else
|
else
|
||||||
mousedemo: mousedemo.o $(CLIB)
|
mousedemo: mousedemo.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
nachtm: nachtm.o $(CLIB)
|
nachtm: nachtm.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -Ln $(basename $@).lbl -o $@ $^
|
|
||||||
|
|
||||||
plasma: plasma.o $(CLIB)
|
plasma: plasma.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
sieve: sieve.o $(CLIB)
|
sieve: sieve.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
|
|
||||||
# The Apple machines need the start address adjusted for the tgidemo
|
# The Apple machines need the start address adjusted for the tgidemo
|
||||||
ifeq "$(SYS)" "apple2"
|
ifeq "$(SYS)" "apple2"
|
||||||
tgidemo: tgidemo.o $(CLIB)
|
tgidemo: tgidemo.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
|
||||||
else
|
else
|
||||||
ifeq "$(SYS)" "apple2enh"
|
ifeq "$(SYS)" "apple2enh"
|
||||||
tgidemo: tgidemo.o $(CLIB)
|
tgidemo: tgidemo.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
|
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
|
||||||
else
|
else
|
||||||
tgidemo: tgidemo.o $(CLIB)
|
tgidemo: tgidemo.o
|
||||||
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -137,11 +149,11 @@ disk: samples.d64
|
|||||||
samples.d64: all
|
samples.d64: all
|
||||||
@$(C1541) -format samples,AA d64 $@ > /dev/null
|
@$(C1541) -format samples,AA d64 $@ > /dev/null
|
||||||
@for exe in $(EXELIST); do\
|
@for exe in $(EXELIST); do\
|
||||||
$(C1541) -attach $@ -write $$exe > /dev/null;\
|
$(C1541) -attach $@ -write $$exe > /dev/null || exit $$?;\
|
||||||
done;\
|
done
|
||||||
for tgi in ../libsrc/$(SYS)*.tgi; do\
|
@for mod in $(TGI) $(MOUS); do\
|
||||||
$(C1541) -attach $@ -write $$tgi > /dev/null;\
|
$(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\
|
||||||
done;
|
done
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Cleanup rules
|
# Cleanup rules
|
||||||
@@ -155,5 +167,3 @@ zap: clean
|
|||||||
$(RM) $(EXELIST) samples.d64
|
$(RM) $(EXELIST) samples.d64
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user