mirror of
https://github.com/StewBC/cc65-Chess.git
synced 2026-10-22 12:02:19 +00:00
Own startup and a chunky frame flipped onto bitplanes, booted under FS-UAE with the cursor keys left for the menu.
204 lines
7.5 KiB
Makefile
204 lines
7.5 KiB
Makefile
# cc65 Chess — one dispatcher, many ports, more than one compiler.
|
|
#
|
|
# make every default port whose compiler is on PATH
|
|
# make list available vs skipped
|
|
# make c64 one port
|
|
# make apple2 po binary + disk image
|
|
# make spectrum z88dk
|
|
# make spectrum test
|
|
# make term host curses → build/term/chessterm
|
|
# make mac68k Retro68 → build/mac68k/*.bin *.APPL *.dsk
|
|
# make check native suite in tests/
|
|
#
|
|
# products land in build/<port>/. objects in build/obj/<port>/.
|
|
# a new compiler is a toolchain file plus a thin port file — see make/.
|
|
#
|
|
# the cc65 compile rules are descended from oliver schmidt's generic makefile
|
|
# (v1.3.0, with patryk łogiewa). the abstraction is now "port", not "cl65 -t".
|
|
|
|
include make/common.mk
|
|
include $(sort $(wildcard make/ports/*.mk))
|
|
|
|
# --- availability --------------------------------------------------------
|
|
|
|
apple2_AVAILABLE := $(HAVE_CL65)
|
|
atari_AVAILABLE := $(HAVE_CL65)
|
|
atmos_AVAILABLE := $(HAVE_CL65)
|
|
c64_AVAILABLE := $(HAVE_CL65)
|
|
c64.chr_AVAILABLE := $(HAVE_CL65)
|
|
plus4_AVAILABLE := $(HAVE_CL65)
|
|
cx16_AVAILABLE := $(HAVE_CL65)
|
|
rp6502_AVAILABLE := $(HAVE_RP6502)
|
|
spectrum_AVAILABLE := $(HAVE_ZCC)
|
|
term_AVAILABLE := $(HAVE_CC)
|
|
mac68k_AVAILABLE := $(HAVE_RETRO68)
|
|
ti99_AVAILABLE := $(HAVE_TMS9900)
|
|
coco3_AVAILABLE := $(HAVE_CMOC)
|
|
agon_AVAILABLE := $(HAVE_AGONDEV)
|
|
archie_AVAILABLE := $(HAVE_ARCHIE)
|
|
mega65_AVAILABLE := $(HAVE_LLVM_MOS)
|
|
amiga_AVAILABLE := $(HAVE_AMIGA)
|
|
|
|
apple2_SKIP := cl65 not on PATH
|
|
atari_SKIP := cl65 not on PATH
|
|
atmos_SKIP := cl65 not on PATH
|
|
c64_SKIP := cl65 not on PATH
|
|
c64.chr_SKIP := cl65 not on PATH
|
|
plus4_SKIP := cl65 not on PATH
|
|
cx16_SKIP := cl65 not on PATH
|
|
rp6502_SKIP := cl65 has no rp6502 target (needs the picocomputer fork)
|
|
spectrum_SKIP := zcc not on PATH
|
|
term_SKIP := $(CC) not on PATH
|
|
mac68k_SKIP := Retro68 not found (set RETRO68= or put m68k-apple-macos-gcc on PATH)
|
|
ti99_SKIP := tms9900-gcc not on PATH
|
|
coco3_SKIP := cmoc not on PATH
|
|
agon_SKIP := agondev-config not on PATH
|
|
archie_SKIP := ArchieSDK not found (set ARCHIESDK=)
|
|
mega65_SKIP := LLVM-MOS not found (set LLVM_MOS_SDK=)
|
|
amiga_SKIP := Bartman gcc not found (install the Amiga extension, or set AMIGA_GCC and AMIGA_ELF2HUNK)
|
|
|
|
OPTIONAL_DEFAULTS := $(if $(HAVE_ZCC),spectrum) $(if $(HAVE_RETRO68),mac68k) $(if $(HAVE_TMS9900),ti99) $(if $(HAVE_CMOC),coco3) $(if $(HAVE_AGONDEV),agon) $(if $(HAVE_ARCHIE),archie) $(if $(HAVE_AMIGA),amiga)
|
|
BUILD_PORTS := $(strip $(foreach p,$(DEFAULT_PORTS) $(OPTIONAL_DEFAULTS),$(if $($(p)_AVAILABLE),$(p))))
|
|
|
|
# `make spectrum` (and `make spectrum test`) selects that port. TARGETS= on
|
|
# the command line still wins, so the recursive $(MAKE) TARGETS=$t keeps working.
|
|
ifeq ($(origin TARGETS),command line)
|
|
TARGETLIST := $(subst $(COMMA),$(SPACE),$(TARGETS))
|
|
else
|
|
FIRSTGOAL := $(firstword $(MAKECMDGOALS))
|
|
ifneq ($(filter $(FIRSTGOAL),$(PORT_NAMES)),)
|
|
TARGETLIST := $(FIRSTGOAL)
|
|
else
|
|
TARGETLIST := $(BUILD_PORTS)
|
|
endif
|
|
endif
|
|
|
|
include make/toolchains/cc65.mk
|
|
include make/toolchains/z88dk.mk
|
|
include make/toolchains/host.mk
|
|
include make/toolchains/retro68.mk
|
|
include make/toolchains/tms9900.mk
|
|
include make/toolchains/cmoc.mk
|
|
include make/toolchains/agondev.mk
|
|
include make/toolchains/archiesdk.mk
|
|
include make/toolchains/llvm-mos.mk
|
|
include make/toolchains/amiga.mk
|
|
|
|
# port files declare packaging first (po, atr, ...). without this, a bare
|
|
# `make TARGETS=c64` builds the first of those instead of the c64 binary.
|
|
.DEFAULT_GOAL := all
|
|
|
|
.PHONY: all test clean zap tidy love help list check $(PORT_NAMES)
|
|
|
|
# a port name only selects the port — `all` does the work. the empty recipe
|
|
# is what stops make printing "Nothing to be done for `plus4'" in front of a
|
|
# `make plus4 test` that is about to run perfectly well
|
|
$(PORT_NAMES): all
|
|
@:
|
|
|
|
# --- single port vs many -------------------------------------------------
|
|
|
|
ifeq ($(words $(TARGETLIST)),1)
|
|
|
|
ifeq ($($(TARGETLIST)_AVAILABLE),1)
|
|
|
|
test: all $($(TARGETLIST)_TEST_DEPS)
|
|
$(PREEMUCMD)
|
|
$($(TARGETLIST)_EMUCMD) $(if $(filter undefined,$(origin $(TARGETLIST)_TEST_ARG)),$(PROGRAM),$($(TARGETLIST)_TEST_ARG))
|
|
$(POSTEMUCMD)
|
|
|
|
else
|
|
|
|
all test:
|
|
@echo "port $(TARGETLIST): $($(TARGETLIST)_SKIP)" >&2
|
|
@false
|
|
|
|
clean:
|
|
@true
|
|
|
|
endif
|
|
|
|
else # many ports, or none
|
|
|
|
all:
|
|
ifeq ($(strip $(TARGETLIST)),)
|
|
@echo "no compilers found. install cl65 and/or zcc, or run make list" >&2
|
|
@false
|
|
else
|
|
$(foreach t,$(TARGETLIST),$(MAKE) TARGETS=$t all$(NEWLINE))
|
|
endif
|
|
|
|
test:
|
|
@echo "name a port: make c64 test or make TARGETS=c64 test" >&2
|
|
@false
|
|
|
|
clean:
|
|
$(foreach t,$(TARGETLIST),$(MAKE) TARGETS=$t clean$(NEWLINE))
|
|
|
|
endif
|
|
|
|
# --- always --------------------------------------------------------------
|
|
|
|
help:
|
|
@echo "cc65 Chess"
|
|
@echo
|
|
@echo " make default ports whose compiler is here"
|
|
@echo " make list available vs skipped, and why"
|
|
@echo " make help this text"
|
|
@echo " make <port> one port (apple2 atari atmos c64 c64.chr"
|
|
@echo " plus4 cx16 rp6502 spectrum term"
|
|
@echo " mac68k ti99 coco3 agon archie mega65 amiga)"
|
|
@echo " make apple2 po Apple II + ProDOS image"
|
|
@echo " make atari atr Atari + ATR"
|
|
@echo " make c64 d64 C64 + D64 (also: prg cprg cxprg tap rom dsk)"
|
|
@echo " make spectrum ZX Spectrum tap + sna (z88dk)"
|
|
@echo " make spectrum test build and run ZEsarUX"
|
|
@echo " make term host curses binary"
|
|
@echo " make mac68k Macintosh 68k (Retro68) — .bin .APPL .dsk"
|
|
@echo " make ti99 TI-99/4A (tms9900-gcc) — .ea5 .rpk"
|
|
@echo " make ti99 test build and run Homebrew MAME with 32K"
|
|
@echo " make coco3 Color Computer 3 (CMOC) — .bin .dsk"
|
|
@echo " make coco3 test build and run XRoar coco3"
|
|
@echo " make agon Agon Light (agondev) — /bin/chess.bin"
|
|
@echo " make agon test build and run Fab Agon emulator"
|
|
@echo " make archie Acorn A3010 (ArchieSDK) — RISC OS app + ZIPs"
|
|
@echo " make archie test build and run private Arculator A3010 copy"
|
|
@echo " make mega65 native MEGA65 PRG (LLVM_MOS_SDK)"
|
|
@echo " make mega65 test build and run Xemu in native mode"
|
|
@echo " make mega65 mega65-bench search benchmark at all four budgets"
|
|
@echo " make amiga Amiga 500 hunk (Bartman m68k-amiga-elf-gcc)"
|
|
@echo " make amiga test build and boot under FS-UAE"
|
|
@echo " make check native suite (tests/)"
|
|
@echo " make clean this selection's products"
|
|
@echo " make tidy leftover binaries in the repo root"
|
|
@echo " make zap build/ and leftover root binaries"
|
|
@echo
|
|
@echo "products: build/<port>/"
|
|
@echo "objects: build/obj/<port>/"
|
|
@echo "cc65 options persist in build/.options (default: optsize)"
|
|
@echo "new compiler: make/toolchains/<family>.mk + make/ports/<name>.mk"
|
|
|
|
list:
|
|
@printf '%-10s %-8s %s\n' "port" "family" "status"
|
|
@$(foreach p,$(PORT_NAMES),printf '%-10s %-8s %s\n' \
|
|
'$(p)' '$($(p)_FAMILY)' \
|
|
'$(if $($(p)_AVAILABLE),available,skipped — $($(p)_SKIP))';)
|
|
|
|
check:
|
|
$(MAKE) -C tests test
|
|
|
|
tidy:
|
|
-$(call RMFILES,$(ROOT_LEFTOVERS))
|
|
-rm -rf obj atari.atr 2>/dev/null || true
|
|
|
|
zap:
|
|
-$(call RMFILES,$(addprefix $(BUILDDIR)/,$(foreach p,$(PORT_NAMES),$(p)/*)))
|
|
-$(call RMFILES,$(addprefix $(OBJDIR)/,$(foreach p,$(PORT_NAMES),$(p)/*)))
|
|
-$(call RMFILES,$(STATEFILE))
|
|
-$(call RMFILES,$(ROOT_LEFTOVERS))
|
|
-$(call RMFILES,$(wildcard $(OBJDIR)/*/*))
|
|
-rm -rf $(BUILDDIR) obj atari.atr 2>/dev/null || true
|
|
|
|
love:
|
|
@echo "Not war, eh?"
|