joeylib2/Makefile

114 lines
3.8 KiB
Makefile

# JoeyLib top-level Makefile.
#
# Usage:
# make builds every target whose toolchain is installed
# make iigs builds Apple IIgs only
# make amiga builds Commodore Amiga only
# make atarist builds Atari ST only
# make dos builds MS-DOS only
# make x68000 builds Sharp X68000 only
# make docs renders the manual to build/docs (HTML + PDF)
# make verify-audio runs every port's audio gate (needs emulators)
# make clean removes all build outputs
#
# Cross tools come from ./install.sh, which records their paths in
# toolchains/config.mk; every makefile reads that file itself, so no
# environment setup is needed first.
REPO_DIR := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
-include $(REPO_DIR)/toolchains/config.mk
# A port is available when its real compiler binary is installed.
HAVE_IIGS := $(if $(wildcard $(LLVM816_ROOT)/tools/llvm-mos-build/bin/clang),1)
HAVE_AMIGA := $(if $(wildcard $(AMIGA_CC)),1)
HAVE_ATARIST := $(if $(wildcard $(ST_CC)),1)
HAVE_DOS := $(if $(wildcard $(DOS_CC)),1)
HAVE_X68000 := $(if $(wildcard $(X68K_ROOT)/bin/m68k-xelf-gcc),1)
ALL_TARGETS :=
ifeq ($(HAVE_IIGS),1)
ALL_TARGETS += iigs
endif
ifeq ($(HAVE_AMIGA),1)
ALL_TARGETS += amiga
endif
ifeq ($(HAVE_ATARIST),1)
ALL_TARGETS += atarist
endif
ifeq ($(HAVE_DOS),1)
ALL_TARGETS += dos
endif
ifeq ($(HAVE_X68000),1)
ALL_TARGETS += x68000
endif
.PHONY: all iigs iigs-disk iigs-verify amiga atarist dos x68000 blank-check tools clean help status verify-audio docs
all: $(ALL_TARGETS) tools
ifeq ($(ALL_TARGETS),)
@echo "No toolchains detected. Run: ./install.sh install toolchains"
@exit 1
endif
tools:
@$(MAKE) -f $(REPO_DIR)/make/tools.mk
iigs:
@$(MAKE) -f $(REPO_DIR)/make/iigs.mk
iigs-disk:
@$(MAKE) -f $(REPO_DIR)/make/iigs.mk iigs-disk
iigs-verify:
@$(MAKE) -f $(REPO_DIR)/make/iigs.mk iigs-verify
amiga:
@$(MAKE) -f $(REPO_DIR)/make/amiga.mk
atarist:
@$(MAKE) -f $(REPO_DIR)/make/atarist.mk
dos:
@$(MAKE) -f $(REPO_DIR)/make/dos.mk
x68000:
@$(MAKE) -f $(REPO_DIR)/make/x68000.mk
# Compile + link-check the new-port template (src/blank/blank.c) with the host
# cc. No toolchain needed; keeps the template from bit-rotting as the lib grows.
blank-check:
@$(REPO_DIR)/scripts/check-blank.sh
# The manual: docs/Manual.adoc plus its chapter includes -> build/docs.
# Needs asciidoctor and asciidoctor-pdf, no cross toolchain.
# make docs FORMAT=html renders only the web version (much faster).
docs:
@$(REPO_DIR)/scripts/build-docs.sh $(FORMAT)
# Every port's audio gate, run sequentially (the recording gates grade
# fixed time windows, so a competing emulator can slide a phase boundary).
# Exits 1 on a real failure and 3 if a gate SKIPPED for an unbuilt port --
# non-zero on purpose, so a run that tested nothing cannot look green.
# Takes a subset: make verify-audio PORTS="atarist amiga"
verify-audio:
@$(REPO_DIR)/scripts/verify-audio-all.sh $(PORTS)
clean:
rm -rf $(REPO_DIR)/build
status:
@echo "Toolchain availability:"
@echo " iigs: $(if $(HAVE_IIGS),yes,NO)"
@echo " amiga: $(if $(HAVE_AMIGA),yes,NO)"
@echo " atarist: $(if $(HAVE_ATARIST),yes,NO)"
@echo " dos: $(if $(HAVE_DOS),yes,NO)"
@echo " x68000: $(if $(HAVE_X68000),yes,NO)"
help:
@echo "Targets: iigs amiga atarist dos x68000 all clean status help"
@echo " iigs-disk iigs-verify (IIgs MAME visual check)"
@echo " blank-check (host-cc smoke test of the new-port template + gnu89 lint)"
@echo " verify-audio (all 5 audio gates; PORTS=\"atarist amiga\" for a subset)"
@echo " docs (manual to build/docs; FORMAT=html for HTML only)"
@echo "Install toolchains first: ./install.sh install toolchains"