# Shared variables used by per-target Makefile fragments. # # Source this only via the per-target make file (make/iigs.mk etc). REPO_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) # Tool paths (AMIGA_CC, LLVM816_ROOT, LIBXMP_DIR, ...) come from the file # install.sh generates; it is the only place they are defined. -include $(REPO_DIR)/toolchains/config.mk # $(call requireTool,FILE,INSTALL-TARGET): stop with a clear message when a # port's compiler is missing, instead of letting recipes run an empty # command. Goals that only clean need no toolchain. The missing path is not # printed: with nothing installed it is empty or a bare suffix, and # `./install.sh doctor` names exactly what is wrong. requireTool = $(if $(filter-out clean%,$(or $(MAKECMDGOALS),all)),$(if $(wildcard $(1)),,$(error $(2) is not installed; run: ./install.sh install $(2)))) # Space Taxi's levels are extracted from the original C64 game image, which # is not part of the repository (the owner's private bundle provides it; see # ./install.sh import). Without it every port still builds the # STAXI binary and skips only the data derived from the image. STAXI_RAW_DUMP := $(REPO_DIR)/stuff/spacetaxi/raw.bin ROMTOLEVEL_BIN := $(REPO_DIR)/examples/spacetaxi/assets/romToLevel.py STAXI_LEVEL_NUMS := 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 HAVE_STAXI_DATA := $(if $(wildcard $(STAXI_RAW_DUMP)),1) # $(call staxiData,TARGETS): TARGETS, or nothing (with a note, once per make # process) without the image. staxiData = $(if $(HAVE_STAXI_DATA),$(1),$(staxiNote)) staxiNote = $(if $(staxiNoted),,$(eval staxiNoted := 1)$(info note: Space Taxi data skipped: stuff/spacetaxi/raw.bin is not present)) INCLUDE_DIR := $(REPO_DIR)/include # Machine-specific code lives in src// (iigs, amiga, atarist, dos, # x68000, dvx); code shared across machines of one CPU lives in a processor # folder (src/m68k, src/x86). SRC_DIR := $(REPO_DIR)/src SRC_CORE := $(REPO_DIR)/src/core SRC_CG := $(REPO_DIR)/src/codegen SRC_68K := $(REPO_DIR)/src/m68k SRC_X86 := $(REPO_DIR)/src/x86 EXAMPLES := $(REPO_DIR)/examples # The tile-bank example (examples/tilebank) loads the host gate's fixture, so # the host (scripts/check-tilebank.sh) and every port share one expected hash. # Each port stages its DATA/tilebank with TILEBANK_STAGE: its own bake, every # other target's bake (to be refused) and the expected pixels. TILEBANK_PNG := $(REPO_DIR)/tests/host/tileBank.png TILEBANK_STAGE := $(REPO_DIR)/tests/host/tileBankStage.py TILEBANK_BAKE_DEPS := $(TILEBANK_PNG) $(TILEBANK_STAGE) $(REPO_DIR)/tools/assetbake/assetbake.py # Portable C sources for libjoey -- present on every target. CORE_C_SRCS := $(wildcard $(SRC_CORE)/*.c) # Generic portable-C op defaults (the src/generic backend) -- present on every # target. spriteEmitStub.c is excluded: it is the no-codegen template and # redefines jlSpriteCompile / spriteCompiledDraw, which the real # src/codegen/spriteCompile.c already provides. GENERIC_C_SRCS := $(filter-out %/spriteEmitStub.c, $(wildcard $(SRC_DIR)/generic/*.c)) # Common include flags. Per-port code can include port.h / surfaceInternal.h # directly because SRC_CORE is in the include path. EXTRA_CFLAGS is the one # command-line hook for extra flags on every port (make EXTRA_CFLAGS=-DX); # make/iigs.mk, which does not use COMMON_CFLAGS, honours it too. COMMON_CFLAGS := -I$(INCLUDE_DIR) -I$(SRC_CORE) -Wall -Wextra -Werror -O2 $(EXTRA_CFLAGS)