1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

fix Makefiles for all targets, dive into subdirs like in samples

This commit is contained in:
mrdudz 2022-01-30 19:50:13 +01:00
parent b00cb182d9
commit d8366132c7
9 changed files with 561 additions and 32 deletions

View File

@ -160,6 +160,10 @@ ifeq ($(SYS),vic20)
LDFLAGS+=-Ln $@.lbl LDFLAGS+=-Ln $@.lbl
endif endif
ifeq ($(SYS),pce)
LDFLAGS+=-D__CARTSIZE__=0x8000
endif
.o: .o:
ifeq ($(SYS),vic20) ifeq ($(SYS),vic20)
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib
@ -167,11 +171,17 @@ else
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib
endif endif
# --------------------------------------------------------------------------
# Lists of subdirectories
DIRLIST = accelerator apple2 atari atari5200 cbm gamate pce sym1
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Lists of executables # Lists of executables
# omitted: seek # omitted: seek
EXELIST_c64 = \ EXELIST_c64 = \
minimal \
arg-test \ arg-test \
clock \ clock \
clock-test \ clock-test \
@ -204,8 +214,206 @@ EXELIST_c64 = \
tinyshell \ tinyshell \
uname-test uname-test
# omitted: seek
EXELIST_c128 = \
minimal \
arg-test \
clock \
clock-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mouse-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: seek clock clock-test mouse-test ser-test
EXELIST_c16 = \
minimal \
arg-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: seek ser-test
EXELIST_cbm510 = \
minimal \
arg-test \
clock \
clock-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mouse-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: joy-test mouse-test seek
EXELIST_cbm610 = \
minimal \
arg-test \
clock \
clock-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: clock-test em-test mouse-test seek ser-test
EXELIST_pet = \
minimal \
arg-test \
clock \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: clock-test em-test mouse-test seek
EXELIST_plus4 = \
minimal \
arg-test \
clock \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: seek clock-test mouse-test ser-test # omitted: seek clock-test mouse-test ser-test
EXELIST_vic20 = \ EXELIST_vic20 = \
minimal \
arg-test \ arg-test \
clock \ clock \
conio \ conio \
@ -237,6 +445,7 @@ EXELIST_vic20 = \
# omitted: cpeek-test, clock # omitted: cpeek-test, clock
EXELIST_apple2 = \ EXELIST_apple2 = \
minimal \
arg-test \ arg-test \
clock-test \ clock-test \
conio \ conio \
@ -272,6 +481,7 @@ EXELIST_apple2enh = $(EXELIST_apple2)
# omitted: cpeek-test # omitted: cpeek-test
EXELIST_atari = \ EXELIST_atari = \
minimal \
arg-test \ arg-test \
clock-test \ clock-test \
clock \ clock \
@ -306,11 +516,185 @@ EXELIST_atari = \
EXELIST_atarixl = $(EXELIST_atari) EXELIST_atarixl = $(EXELIST_atari)
# none of the testcode can work on the 2600 # omitted: clock-test clock cpeek-test deb dir-test em-test exec-test1 exec-test2
# EXELIST_atari2600 = # joy-test mouse-test rename-test seek ser-test stroserror-test tinyshell
EXELIST_telestrat = \
minimal \
arg-test \
conio \
cprintf \
cursor \
div-test \
fileio-test \
ft \
getopt-test \
heaptest \
moddiv-test \
mul-test \
posixio-test \
scanf-test \
strdup-test \
strnlen \
strqtok-test \
uname-test
# none of the testcode can work on supervision # omitted: arg-test clock-test clock cpeek-test conio cprintf cursor deb dir-test
# EXELIST_supervision = # em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# stroserror-test tinyshell uname-test
EXELIST_sym1 = \
minimal \
div-test \
moddiv-test \
strnlen \
strqtok-test
# omitted: clock-test cpeek-test conio deb dir-test em-test exec-test1 exec-test2
# fileio-test ft mouse-test posixio-test rename-test seek ser-test tinyshell
EXELIST_atmos = \
minimal \
arg-test \
clock \
cprintf \
cursor \
div-test \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# strnlen stroserror-test strqtok-test tinyshell uname-test
EXELIST_creativision = \
minimal \
cursor
# omitted: cpeek-test seek ser-test
EXELIST_cx16 = \
minimal \
arg-test \
clock-test \
clock \
conio \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mouse-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: arg-test clock-test clock cpeek-test cprintf cursor deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# strnlen stroserror-test strqtok-test tinyshell uname-test
EXELIST_nes = \
minimal \
conio
# omitted: arg-test clock-test clock cpeek-test cprintf cursor deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# strnlen stroserror-test strqtok-test tinyshell uname-test
EXELIST_pce = \
minimal \
conio
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test posixio-test rename-test scanf-test seek ser-test strdup-test strnlen
# stroserror-test strqtok-test tinyshell uname-test
EXELIST_osic1p = \
minimal \
cursor \
mul-test
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test posixio-test rename-test scanf-test seek ser-test strdup-test strnlen
# stroserror-test strqtok-test tinyshell uname-test
EXELIST_geos-apple = \
minimal \
cursor \
mul-test
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test posixio-test rename-test scanf-test seek ser-test strdup-test strnlen
# stroserror-test strqtok-test tinyshell uname-test
EXELIST_geos-cbm = \
minimal \
cursor \
mul-test
# omitted: clock clock-test conio cpeek-test cprintf cursor deb dir-test em-test
# exec-test1 exec-test2 ft heaptest joy-test mouse-test mul-test rename-test seek
# ser-test strdup-test stroserror-test tinyshell uname-test
EXELIST_sim6502 = \
minimal \
arg-test \
div-test \
fileio-test \
getopt-test \
moddiv-test \
posixio-test \
scanf-test \
strnlen \
strqtok-test
EXELIST_sim65c02 = $(EXELIST_sim6502)
EXELIST_atari2600 = \
minimal
EXELIST_atari5200 = \
minimal
EXELIST_gamate = \
minimal
EXELIST_supervision = \
minimal
# none of the testcode can work on the bbc (no library support)
EXELIST_bbc = \
notavailable
# none of the testcode can work on lunix (no library support)
EXELIST_lunix = \
notavailable
# none of the testcode can work on the lynx (library support is broken!)
EXELIST_lynx = \
notavailable
# Unlisted targets will try to build everything. # Unlisted targets will try to build everything.
# That lets us learn what they cannot build, and what settings # That lets us learn what they cannot build, and what settings
@ -319,22 +703,27 @@ ifndef EXELIST_$(SYS)
EXELIST_$(SYS) := ${patsubst %.c,%,$(wildcard *.c)} EXELIST_$(SYS) := ${patsubst %.c,%,$(wildcard *.c)}
endif endif
define SUBDIR_recipe
@$(MAKE) -C $(dir) --no-print-directory $@
endef # SUBDIR_recipe
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Rules to make the binaries and the disk # Rules to make the binaries and the disk
testcode: $(EXELIST_$(SYS)) testcode: $(EXELIST_$(SYS))
$(foreach dir,$(DIRLIST),$(SUBDIR_recipe))
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: generic targettest programs not available for" $(SYS)
endif
disk: $(DISK_$(SYS)) disk: $(DISK_$(SYS))
all: testcode all:
make -C accelerator
make -C apple2
make -C atari
make -C atari5200
make -C cbm SYS=$(SYS)
make -C gamate
make -C pce
make -C sym1
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# some programs link against getsp.o # some programs link against getsp.o
@ -435,11 +824,4 @@ mostlyclean:
clean: mostlyclean clean: mostlyclean
@$(DEL) $(EXELIST_$(SYS)) $(DISK_$(SYS)) 2>$(NULLDEV) @$(DEL) $(EXELIST_$(SYS)) $(DISK_$(SYS)) 2>$(NULLDEV)
make -C accelerator clean $(foreach dir,$(DIRLIST),$(SUBDIR_recipe))
make -C apple2 clean
make -C atari clean
make -C atari5200 clean
make -C cbm SYS=$(SYS) clean
make -C gamate clean
make -C pce clean
make -C sym1 clean

View File

@ -26,9 +26,32 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \ EXELIST_c64 = \
c64-c128-test.prg c128-test.prg chameleon-test.prg \ c64-scpu-test.prg \
c65-test.prg turbomaster-test.prg c128-scpu-test.prg \
c64dtv-test.prg \
c64-c128-test.prg \
chameleon-test.prg \
c65-test.prg \
turbomaster-test.prg
EXELIST_c128 = \
c128-test.prg
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: accelerator tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
c64-scpu-test.prg: c64-c128-scpu-test.c c64-scpu-test.prg: c64-c128-scpu-test.c
$(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg $(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg

View File

@ -29,7 +29,25 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: hgrshow hgrtest dhgrshow EXELIST_apple2 = \
hgrshow \
hgrtest \
dhgrshow
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: apple2 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
disk: hgr.dsk dhgr.dsk disk: hgr.dsk dhgr.dsk

View File

@ -27,8 +27,30 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: charmapping.xex defdev.xex displaylist.xex mem.xex multi.xex ostype.xex \ EXELIST_atari = \
scrcode.com sys.xex charmapping.xex \
defdev.xex \
displaylist.xex \
mem.xex \
multi.xex \
ostype.xex \
scrcode.com \
sys.xex
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: atari tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
charmapping.xex: charmapping.c charmapping.xex: charmapping.c
$(CL) -t atari -o charmapping.xex charmapping.c $(CL) -t atari -o charmapping.xex charmapping.c

View File

@ -27,7 +27,23 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: hello EXELIST_atari5200 = \
hello
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: atari 5200 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
hello: hello.c hello: hello.c
$(CL) -t atari5200 -o hello hello.c $(CL) -t atari5200 -o hello hello.c

View File

@ -30,7 +30,27 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: petscii.prg cbmdir-test.prg EXELIST_c64 = \
petscii.prg \
cbmdir-test.prg
EXELIST_vic20 = \
cbmdir-test.prg
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: cbm tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
ifeq ($(SYS),c64) ifeq ($(SYS),c64)
petscii.prg: petscii.c petscii.prg: petscii.c

View File

@ -27,7 +27,23 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: audiotest.bin lcdtest.bin ctest.bin EXELIST_gamate = \
audiotest.bin lcdtest.bin ctest.bin
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: gamate tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
audiotest.bin: audiotest.s audiotest.bin: audiotest.s
$(CL) -l audiotest.lst -t gamate -o audiotest.bin audiotest.s $(CL) -l audiotest.lst -t gamate -o audiotest.bin audiotest.s

View File

@ -42,7 +42,23 @@ else
COUNT := 1 COUNT := 1
endif endif
all: conio.bin EXELIST_pce = \
conio.bin
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: pce tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
%.bin: %.c %.bin: %.c
$(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@ $(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@

View File

@ -26,7 +26,23 @@ else
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif endif
all: symHello.bin symTiny.bin symDisplay.bin symIO.bin symNotepad.bin EXELIST_sym1 = \
symHello.bin symTiny.bin symDisplay.bin symIO.bin symNotepad.bin
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: sym1 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
symHello.bin: symHello.c symHello.bin: symHello.c
$(CL) -t sym1 -O -o symHello.bin symHello.c $(CL) -t sym1 -O -o symHello.bin symHello.c