2024-05-17 06:35:01 -07:00
MAKEFLAGS += --no-builtin-rules --no-print-directory
2020-03-17 00:31:30 -04:00
2022-05-01 00:03:22 +01:00
# Ensure the build fails if a piped command fails
2025-01-28 15:45:56 -08:00
SHELL = /usr/bin/env bash
2022-05-01 00:03:22 +01:00
.SHELLFLAGS = -o pipefail -c
2024-10-14 16:49:40 -07:00
#### Build options ####
2020-07-19 21:42:05 +02:00
2024-10-14 16:49:40 -07:00
# Build options can be changed by modifying them below, or by appending 'SETTING=value' to all 'make' commands
# (e.g. 'make setup VERSION=ntsc-1.0' and 'make VERSION=ntsc-1.0' to build the NTSC 1.0 version).
# Alternatively, you can create a file called .make_options.mk (gitignored by default) and add 'SETTING=value'
# there to avoid modifying the Makefile directly.
2024-01-31 17:51:33 +01:00
2024-08-06 13:32:34 -04:00
- i n c l u d e . m a k e _ o p t i o n s . m k
2024-01-31 17:51:33 +01:00
2024-10-17 15:50:29 +02:00
# HackerOoT options
- i n c l u d e . m a k e _ h a c k e r o o t . m k
2024-02-04 01:45:13 +01:00
2024-08-08 20:24:58 +02:00
COMPILER ?= gcc
2024-10-17 15:50:29 +02:00
2024-10-14 16:49:40 -07:00
# Target game version. Ensure the corresponding input ROM is placed in baseroms/$(VERSION)/baserom.z64.
# Currently the following versions are supported:
2024-11-12 14:39:08 -08:00
# ntsc-1.0 N64 NTSC 1.0 (Japan/US depending on REGION)
# ntsc-1.1 N64 NTSC 1.1 (Japan/US depending on REGION)
2024-09-28 17:52:45 -07:00
# pal-1.0 N64 PAL 1.0 (Europe)
2024-09-12 11:10:43 -07:00
# ntsc-1.2 N64 NTSC 1.2 (Japan/US depending on REGION)
2024-09-28 17:52:45 -07:00
# pal-1.1 N64 PAL 1.1 (Europe)
2024-08-09 17:58:46 -07:00
# gc-jp GameCube Japan
# gc-jp-mq GameCube Japan Master Quest
2024-08-08 00:26:48 -07:00
# gc-us GameCube US
2024-09-17 12:40:50 -07:00
# gc-us-mq GameCube US Master Quest
# gc-eu-mq-dbg GameCube Europe/PAL Master Quest Debug (default)
2024-06-24 06:22:39 -07:00
# gc-eu GameCube Europe/PAL
2024-04-19 21:12:26 -07:00
# gc-eu-mq GameCube Europe/PAL Master Quest
2024-09-17 12:40:50 -07:00
# gc-jp-ce GameCube Japan (Collector's Edition disc)
2025-02-04 11:55:04 +00:00
# ique-cn iQue Player (Simplified Chinese)
2024-08-08 20:24:58 +02:00
# hackeroot-mq HackerOoT, based on gc-eu-mq-dbg (default)
#
# Note: choosing hackeroot-mq will enable HackerOoT features,
# if another version is chosen, this repo will be like
# zeldaret/main decomp but without the disassembly, decompilation
# and matching tools, including the IDO compiler
VERSION ?= hackeroot-mq
2024-10-14 16:49:40 -07:00
# Number of threads to extract and compress with.
2024-08-06 13:32:34 -04:00
N_THREADS ?= $( shell nproc)
2024-10-14 16:49:40 -07:00
# Check code syntax with host compiler.
2024-08-06 13:32:34 -04:00
RUN_CC_CHECK ?= 1
2024-12-28 20:18:45 +00:00
# If DEBUG_OBJECTS is 1, produce additional debugging files such as objdump output or raw binaries for assets
DEBUG_OBJECTS ?= 0
2024-08-06 13:32:34 -04:00
# Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk!
2024-10-14 16:49:40 -07:00
# In nearly all cases, not having 'mips-linux-gnu-*' binaries on the PATH indicates missing dependencies.
2024-08-06 13:32:34 -04:00
MIPS_BINUTILS_PREFIX ?= mips-linux-gnu-
2024-10-14 16:49:40 -07:00
# Emulator w/ flags for 'make run'.
2024-08-06 13:32:34 -04:00
N64_EMULATOR ?=
2024-10-14 16:49:40 -07:00
# Set to override game region in the ROM header (options: JP, US, EU). This can be used to build a fake US version
# of the debug ROM for better emulator compatibility, or to build US versions of NTSC N64 ROMs.
2024-08-06 13:32:34 -04:00
# REGION ?= US
2024-11-17 17:02:07 -05:00
# Set to enable debug features regardless of ROM version.
# Note that by enabling debug features on non-debug ROM versions, some debug ROM specific assets will not be included.
# This means the debug test scenes and some debug graphics in the elf_msg actors will not work as expected.
# This may also be used to disable debug features on debug ROMs by setting DEBUG_FEATURES to 0
# DEBUG_FEATURES ?= 1
2022-02-19 16:50:56 -05:00
CFLAGS ?=
CPPFLAGS ?=
2024-05-08 11:58:56 +02:00
CFLAGS_IDO ?=
Merge decomp/main (#141)
* Match retail BSS ordering (#1927)
* Match retail BSS ordering
* Revert moving some global variables to headers
* Adjust block numbers after header changes
* Fix debug build
* Overlay bss ordering
* Fix BSS ordering after header changes
* gc-eu-mq OK
* Implement preprocessor for #pragma increment_block_number
* Transfer usage comment from reencode.sh
* Use temporary directory instead of temporary file
* Move ColChkMassType back
* Player: Document "WaitForPutAway" (#1936)
* document put away delay
* functions.txt
* add a note on delaying indefinitely
* format
* typo
* delay -> wait for put away
* revert unintended formatting change
* add comment to struct member
* format
* fix functions.txt
* Set up gc-eu and match all code (#1938)
* Set up gc-eu and match all code
* Format
* Mark gc-eu-mq as WIP until it builds OK
* Move original/MQ map mark data to separate files
* Add #includes to .inc.c files to help out VS Code
* Use #if in spec instead of .inc.c files
* Delete disassembly data for gc-eu-mq (#1942)
* Player Docs: "sUpperBodyIsBusy" (#1944)
* document upperbodybusy
* change wording for comment and rename upperanimblendweight
* format
* review
* Fix miscategorized scenes (#1946)
* Fix miscategorized scenes
* Sort includes
* Player Docs: Action Interrupt (#1947)
* document action interrupt
* format
* new function comment
* format
* add a note about items
* format
* Add gc-eu-mq to CI (#1943)
* Add gc-eu-mq to CI
* Give up on scripting
* Revert quotes changes
* Player Docs: Name some high level update calls (#1593)
* name some low hanging fruit
* revert burn and shock, doing in seperate pr
* add some function comments
* yaw func
* adjust comment
* some review
* unname UpdateZTarget
* Player_DetectRumbleSecrets
* fix dive do action name
* Player Docs: Control stick buffers (#1945)
* name vars and add enum
* name some spin attack stuff
* fix right and left
* forward/backward
* format
* fix retail bss
* sControlStickWorldYaw
* Force string.o to be in boot for gcc builds (#1948)
In retail builds, memcpy is linked in code, not boot, but GCC likes to call memcpy when copying structs so currently GCC builds immediately crash in __osInitialize_common.
* Rename yDistToWater -> depthInWater (#1950)
* Rename yDistToWater -> yDistUnderWater
* yDistUnderWater -> depthInWater
* Check baserom hash before decompression (#1952)
* Remove Cygwin support (#1951)
* Document pause page switching (#1550)
* Document pause page switching
* document initial scroll left setup, when opening the pause menu
* `PAUSE_MAIN_STATE_1` -> `PAUSE_MAIN_STATE_SWITCHING_PAGE`
* try a diagram of the pages layout in world space as a comment
* expand `nextPageMode` comment
* touch up pause camera header comments
* expand comment on irrelevant init `mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE`
* expand doc on `sKaleidoSetup*` data
* expand docs on `gPageSwitchNextButtonStatus`
* add some doc on `sPageSwitch*` arrays
* SwitchPage -> PageSwitch
* add `PAGE_SWITCH_NSTEPS`
* `SWITCH_PAGE_*_PT` -> `PAGE_SWITCH_PT_*`
* peepoArtist
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
* Fix LensMode Enum Names (#1954)
* Change linker script so gGameOverTimer can be in z_game_over.c (#1939)
* Change linker script so gGameOverTimer can be in z_game_over.c
* gGameOverTimer -> sGameOverTimer
* include_data_only_with_rodata -> include_data_only_within_rodata
* fix build issues
* Check buffers segment in check_ordering.py (#1960)
* Delete unused yaz0tool (#1959)
* Revamp "AnimationContext" Docs, now called "AnimTaskQueue" (#1941)
* start using task terminology
* more docs
* format
* cleanups
* MoveActor -> ActorMove
* missed a couple
* hopefully the last changes
* comment explaining the group change
* some review
* dragorn review
* remove accidental file
* fix matching issue, now use while loop
* Experiment: remove global.h dependency from sys_math, sys_math3d, z_lib (#1956)
* split sys_math, sys_math3d, z_lib from global.h
* suggestions
* forgot this
* more math stuff
* nit fix
* re-add ichain.h
* resolve tharo's comments
* Fix check_ordering.py checking for shifted/nonmatching-besides-relocs (#1961)
* Run CC_CHECK with the correct CPP defines (#1963)
* Run CC_CHECK with the correct CPP defines
* Add "CPP_DEFINES ?="
---------
Co-authored-by: cadmic <cadmic24@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
2024-06-22 22:36:26 +02:00
CPP_DEFINES ?=
2024-05-08 11:58:56 +02:00
2024-01-05 14:27:19 -08:00
# Version-specific settings
2024-10-14 16:49:40 -07:00
REGIONAL_CHECKSUM := 0
2024-10-09 05:22:57 -07:00
i f e q ( $( VERSION ) , n t s c - 1 . 0 )
REGIONAL_CHECKSUM := 1
REGION ?= JP
PLATFORM := N64
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd44
2024-12-14 01:28:28 +00:00
BUILD_DATE := 98-10-21
BUILD_TIME := 04:56:31
REVISION := 0
2024-10-09 05:22:57 -07:00
e l s e i f e q ( $( VERSION ) , n t s c - 1 . 1 )
REGIONAL_CHECKSUM := 1
2024-08-09 17:58:46 -07:00
REGION ?= JP
2024-08-11 03:20:43 -07:00
PLATFORM := N64
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd44
2024-12-14 01:28:28 +00:00
BUILD_DATE := 98-10-26
BUILD_TIME := 10:58:45
REVISION := 1
2024-10-09 05:22:57 -07:00
e l s e i f e q ( $( VERSION ) , p a l - 1 . 0 )
2024-09-26 12:19:23 -07:00
REGION ?= EU
PLATFORM := N64
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd44
2024-12-14 01:28:28 +00:00
BUILD_DATE := 98-11-10
BUILD_TIME := 14:34:22
REVISION := 0
2024-09-26 12:19:23 -07:00
e l s e i f e q ( $( VERSION ) , n t s c - 1 . 2 )
2024-08-15 00:53:39 +02:00
REGIONAL_CHECKSUM := 1
2024-08-09 17:58:46 -07:00
REGION ?= JP
2024-08-11 03:20:43 -07:00
PLATFORM := N64
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd44
2024-12-14 01:28:28 +00:00
BUILD_DATE := 98-11-12
BUILD_TIME := 18:17:03
REVISION := 2
2024-09-26 12:19:23 -07:00
e l s e i f e q ( $( VERSION ) , p a l - 1 . 1 )
REGION ?= EU
PLATFORM := N64
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd44
2024-12-14 01:28:28 +00:00
BUILD_DATE := 98-11-18
BUILD_TIME := 17:36:49
REVISION := 1
2024-08-11 03:20:43 -07:00
e l s e i f e q ( $( VERSION ) , g c - j p )
REGION ?= JP
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 02-10-29
BUILD_TIME := 23:49:53
REVISION := 15
2024-08-09 17:58:46 -07:00
e l s e i f e q ( $( VERSION ) , g c - j p - m q )
REGION ?= JP
2024-08-11 03:20:43 -07:00
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 02-10-30
BUILD_TIME := 00:15:15
REVISION := 15
2024-08-09 17:58:46 -07:00
e l s e i f e q ( $( VERSION ) , g c - u s )
2024-08-06 13:32:34 -04:00
REGION ?= US
2024-08-11 03:20:43 -07:00
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 02-12-19
BUILD_TIME := 13:28:09
REVISION := 15
2024-08-09 17:58:46 -07:00
e l s e i f e q ( $( VERSION ) , g c - u s - m q )
REGION ?= US
2024-08-11 03:20:43 -07:00
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 02-12-19
BUILD_TIME := 14:05:42
REVISION := 15
2024-09-17 12:40:50 -07:00
e l s e i f e q ( $( VERSION ) , g c - e u - m q - d b g )
REGION ?= EU
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 1
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 03-02-21
BUILD_TIME := 00:16:31
REVISION := 15
2024-06-26 03:22:26 -07:00
e l s e i f e q ( $( VERSION ) , g c - e u )
2024-08-06 13:32:34 -04:00
REGION ?= EU
2024-08-11 03:20:43 -07:00
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 03-02-21
BUILD_TIME := 20:12:23
REVISION := 15
2024-05-10 18:21:07 +02:00
e l s e i f e q ( $( VERSION ) , g c - e u - m q )
2024-08-06 13:32:34 -04:00
REGION ?= EU
2024-08-11 03:20:43 -07:00
PLATFORM := GC
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 03-02-21
BUILD_TIME := 20:37:19
REVISION := 15
2024-09-17 12:40:50 -07:00
e l s e i f e q ( $( VERSION ) , g c - j p - c e )
REGION ?= JP
2024-08-11 03:20:43 -07:00
PLATFORM := GC
2024-09-17 12:40:50 -07:00
DEBUG := 0
2024-11-17 17:02:07 -05:00
DEBUG_FEATURES ?= 0
2024-12-21 11:13:56 -08:00
BUILD_CREATOR := zelda@srd022j
2024-12-14 01:28:28 +00:00
BUILD_DATE := 03-10-08
BUILD_TIME := 21:53:00
REVISION := 15
2024-12-21 11:13:56 -08:00
e l s e i f e q ( $( VERSION ) , i q u e - c n )
REGION ?= US
PLATFORM := IQUE
DEBUG_FEATURES ?= 0
BUILD_CREATOR := build@toad.routefree.com
BUILD_DATE := 03-10-22
BUILD_TIME := 16:23:19
REVISION := 0
2024-02-04 12:30:03 +01:00
e l s e i f e q ( $( VERSION ) , h a c k e r o o t - m q )
2024-07-30 00:36:11 +02:00
REGION := NULL
2024-08-14 15:55:05 +02:00
PLATFORM := GC
2024-07-18 01:10:34 +01:00
DEBUG := 1
2024-11-29 20:36:21 +01:00
DEBUG_FEATURES ?= 1
2025-01-06 02:32:45 +01:00
BUILD_CREATOR := none
BUILD_DATE := none
BUILD_TIME := none
i f e q ( $( TARGET ) , i s o )
REVISION := 0
e l s e i f e q ( $( TARGET ) , w a d )
REVISION := 0
e l s e
REVISION := 15
e n d i f
2024-01-05 14:27:19 -08:00
e l s e
$( error Unsupported version $ ( VERSION ) )
e n d i f
2024-08-08 20:24:58 +02:00
i f e q ( $( VERSION ) , h a c k e r o o t - m q )
HACKEROOT := 1
e l s e
HACKEROOT := 0
2024-08-06 13:32:34 -04:00
e n d i f
i f e q ( $( COMPILER ) , g c c )
2024-08-08 20:24:58 +02:00
CPP_DEFINES += -DCOMPILER_GCC -DNON_MATCHING -DAVOID_UB -std= gnu11
e l s e
$( error Unsupported compiler. Please use gcc as the COMPILER variable.)
2024-08-06 13:32:34 -04:00
e n d i f
2020-03-17 00:31:30 -04:00
PROJECT_DIR := $( dir $( realpath $( firstword $( MAKEFILE_LIST) ) ) )
2024-01-05 14:27:19 -08:00
BUILD_DIR := build/$( VERSION)
2024-01-28 09:09:03 -08:00
EXPECTED_DIR := expected/$( BUILD_DIR)
2024-02-04 19:59:09 -08:00
BASEROM_DIR := baseroms/$( VERSION)
2024-03-02 04:09:57 +01:00
EXTRACTED_DIR := extracted/$( VERSION)
2024-01-24 16:39:13 -08:00
VENV := .venv
2020-03-17 00:31:30 -04:00
2020-09-21 03:00:28 -04:00
MAKE = make
2024-12-21 11:13:56 -08:00
i f e q ( $( PLATFORM ) , N 6 4 )
CPP_DEFINES += -DPLATFORM_N64= 1 -DPLATFORM_GC= 0 -DPLATFORM_IQUE= 0
LIBULTRA_VERSION := I
LIBULTRA_PATCH := 1
e l s e i f e q ( $( PLATFORM ) , G C )
CPP_DEFINES += -DPLATFORM_N64= 0 -DPLATFORM_GC= 1 -DPLATFORM_IQUE= 0
LIBULTRA_VERSION := L
LIBULTRA_PATCH := 0
e l s e i f e q ( $( PLATFORM ) , I Q U E )
2025-01-10 23:54:02 +00:00
CPP_DEFINES += -DPLATFORM_N64= 0 -DPLATFORM_GC= 0 -DPLATFORM_IQUE= 1
2024-12-21 11:13:56 -08:00
LIBULTRA_VERSION := L
LIBULTRA_PATCH := 0
e l s e
$( error Unsupported platform $ ( PLATFORM ) )
e n d i f
2020-09-21 03:00:28 -04:00
2025-01-02 18:14:50 +01:00
# Set PACKAGE_NAME define for printing commit name
i f e q ( $( origin PACKAGE_NAME ) , u n d e f i n e d )
2025-01-06 16:40:04 +01:00
PACKAGE_NAME := " $( shell git log -1 --pretty= %s | tr -d '()`"\n' | tr -d "'" | sed 's/\"/\\\"/g' ) "
2025-01-02 18:14:50 +01:00
ifeq ( $( PACKAGE_NAME) ,"" )
PACKAGE_NAME := "Unknown name"
endif
e n d i f
# Set PACKAGE_COMMIT_AUTHOR for printing commit author
i f e q ( $( origin PACKAGE_COMMIT_AUTHOR ) , u n d e f i n e d )
PACKAGE_COMMIT_AUTHOR := " $( shell git log -1 --pretty= format:'%an' | tr -d '\n' | sed 's/\"/\\\"/g' ) "
ifeq ( $( PACKAGE_COMMIT_AUTHOR) ,"" )
PACKAGE_COMMIT_AUTHOR := "Unknown author"
endif
e n d i f
# Set PACKAGE_AUTHOR define for printing author's git name
i f e q ( $( origin PACKAGE_AUTHOR ) , u n d e f i n e d )
PACKAGE_AUTHOR := " $( shell git config --get user.name | tr -d '\n' | sed 's/\"/\\\"/g' ) "
ifeq ( $( PACKAGE_AUTHOR) ,"" )
PACKAGE_AUTHOR := "Unknown author"
endif
e n d i f
2024-01-31 17:51:33 +01:00
# Set PACKAGE_VERSION define for printing commit hash
i f e q ( $( origin PACKAGE_VERSION ) , u n d e f i n e d )
2025-01-02 18:14:50 +01:00
PACKAGE_VERSION := " $( shell git log -1 --pretty= %h | tr -d '\n' | sed 's/\"/\\\"/g' ) "
ifeq ( $( PACKAGE_VERSION) ,"" )
PACKAGE_VERSION := "Unknown version"
2024-01-31 17:51:33 +01:00
endif
e n d i f
2024-08-26 08:43:59 -07:00
# Converts e.g. ntsc-1.0 to NTSC_1_0
2024-09-09 04:26:31 +02:00
i f e q ( $( VERSION ) , h a c k e r o o t - m q )
2025-01-06 02:44:08 +01:00
CPP_DEFINES += -DOOT_VERSION= GC_EU_MQ_DBG -DOOT_REVISION= $( REVISION)
2024-09-09 04:26:31 +02:00
e l s e
2024-08-26 08:43:59 -07:00
VERSION_MACRO := $( shell echo $( VERSION) | tr a-z-. A-Z__)
2024-12-14 01:28:28 +00:00
CPP_DEFINES += -DOOT_VERSION= $( VERSION_MACRO) -DOOT_REVISION= $( REVISION)
2024-09-09 04:26:31 +02:00
e n d i f
2024-07-27 21:46:55 -07:00
CPP_DEFINES += -DOOT_REGION= REGION_$( REGION)
2024-12-14 01:28:28 +00:00
CPP_DEFINES += -DLIBULTRA_VERSION= LIBULTRA_VERSION_$( LIBULTRA_VERSION)
CPP_DEFINES += -DLIBULTRA_PATCH= $( LIBULTRA_PATCH)
2025-01-06 07:23:23 +00:00
i f e q ( $( PLATFORM ) , I Q U E )
CPP_DEFINES += -DBBPLAYER
2024-08-11 03:20:43 -07:00
e n d i f
2024-02-04 12:30:03 +01:00
i f e q ( $( VERSION ) , h a c k e r o o t - m q )
Merge decomp/main (#141)
* Match retail BSS ordering (#1927)
* Match retail BSS ordering
* Revert moving some global variables to headers
* Adjust block numbers after header changes
* Fix debug build
* Overlay bss ordering
* Fix BSS ordering after header changes
* gc-eu-mq OK
* Implement preprocessor for #pragma increment_block_number
* Transfer usage comment from reencode.sh
* Use temporary directory instead of temporary file
* Move ColChkMassType back
* Player: Document "WaitForPutAway" (#1936)
* document put away delay
* functions.txt
* add a note on delaying indefinitely
* format
* typo
* delay -> wait for put away
* revert unintended formatting change
* add comment to struct member
* format
* fix functions.txt
* Set up gc-eu and match all code (#1938)
* Set up gc-eu and match all code
* Format
* Mark gc-eu-mq as WIP until it builds OK
* Move original/MQ map mark data to separate files
* Add #includes to .inc.c files to help out VS Code
* Use #if in spec instead of .inc.c files
* Delete disassembly data for gc-eu-mq (#1942)
* Player Docs: "sUpperBodyIsBusy" (#1944)
* document upperbodybusy
* change wording for comment and rename upperanimblendweight
* format
* review
* Fix miscategorized scenes (#1946)
* Fix miscategorized scenes
* Sort includes
* Player Docs: Action Interrupt (#1947)
* document action interrupt
* format
* new function comment
* format
* add a note about items
* format
* Add gc-eu-mq to CI (#1943)
* Add gc-eu-mq to CI
* Give up on scripting
* Revert quotes changes
* Player Docs: Name some high level update calls (#1593)
* name some low hanging fruit
* revert burn and shock, doing in seperate pr
* add some function comments
* yaw func
* adjust comment
* some review
* unname UpdateZTarget
* Player_DetectRumbleSecrets
* fix dive do action name
* Player Docs: Control stick buffers (#1945)
* name vars and add enum
* name some spin attack stuff
* fix right and left
* forward/backward
* format
* fix retail bss
* sControlStickWorldYaw
* Force string.o to be in boot for gcc builds (#1948)
In retail builds, memcpy is linked in code, not boot, but GCC likes to call memcpy when copying structs so currently GCC builds immediately crash in __osInitialize_common.
* Rename yDistToWater -> depthInWater (#1950)
* Rename yDistToWater -> yDistUnderWater
* yDistUnderWater -> depthInWater
* Check baserom hash before decompression (#1952)
* Remove Cygwin support (#1951)
* Document pause page switching (#1550)
* Document pause page switching
* document initial scroll left setup, when opening the pause menu
* `PAUSE_MAIN_STATE_1` -> `PAUSE_MAIN_STATE_SWITCHING_PAGE`
* try a diagram of the pages layout in world space as a comment
* expand `nextPageMode` comment
* touch up pause camera header comments
* expand comment on irrelevant init `mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE`
* expand doc on `sKaleidoSetup*` data
* expand docs on `gPageSwitchNextButtonStatus`
* add some doc on `sPageSwitch*` arrays
* SwitchPage -> PageSwitch
* add `PAGE_SWITCH_NSTEPS`
* `SWITCH_PAGE_*_PT` -> `PAGE_SWITCH_PT_*`
* peepoArtist
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
* Fix LensMode Enum Names (#1954)
* Change linker script so gGameOverTimer can be in z_game_over.c (#1939)
* Change linker script so gGameOverTimer can be in z_game_over.c
* gGameOverTimer -> sGameOverTimer
* include_data_only_with_rodata -> include_data_only_within_rodata
* fix build issues
* Check buffers segment in check_ordering.py (#1960)
* Delete unused yaz0tool (#1959)
* Revamp "AnimationContext" Docs, now called "AnimTaskQueue" (#1941)
* start using task terminology
* more docs
* format
* cleanups
* MoveActor -> ActorMove
* missed a couple
* hopefully the last changes
* comment explaining the group change
* some review
* dragorn review
* remove accidental file
* fix matching issue, now use while loop
* Experiment: remove global.h dependency from sys_math, sys_math3d, z_lib (#1956)
* split sys_math, sys_math3d, z_lib from global.h
* suggestions
* forgot this
* more math stuff
* nit fix
* re-add ichain.h
* resolve tharo's comments
* Fix check_ordering.py checking for shifted/nonmatching-besides-relocs (#1961)
* Run CC_CHECK with the correct CPP defines (#1963)
* Run CC_CHECK with the correct CPP defines
* Add "CPP_DEFINES ?="
---------
Co-authored-by: cadmic <cadmic24@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
2024-06-22 22:36:26 +02:00
CPP_DEFINES += -DENABLE_HACKEROOT= 1
2024-01-31 17:51:33 +01:00
OPTFLAGS := -Os
ifeq ( $( RELEASE) ,1)
2024-11-29 21:20:12 +01:00
CPP_DEFINES += -DRELEASE_ROM= 1 -DDEBUG_FEATURES= 0 -DNDEBUG
CFLAGS_IDO += -DDEBUG_FEATURES= 0
2024-01-31 17:51:33 +01:00
else
2024-11-29 21:20:12 +01:00
CPP_DEFINES += -DRELEASE_ROM= 0 -DDEBUG_FEATURES= 1
2024-01-31 17:51:33 +01:00
endif
2024-01-29 09:20:54 -08:00
e l s e
2024-11-29 20:36:21 +01:00
ifeq ( $( DEBUG_FEATURES) ,1)
CPP_DEFINES += -DDEBUG_FEATURES= 1
2024-01-31 17:51:33 +01:00
OPTFLAGS := -O2
else
2024-11-29 20:36:21 +01:00
CPP_DEFINES += -DDEBUG_FEATURES= 0 -DNDEBUG
2024-01-31 17:51:33 +01:00
OPTFLAGS := -O2 -g3
endif
Merge decomp/main (#141)
* Match retail BSS ordering (#1927)
* Match retail BSS ordering
* Revert moving some global variables to headers
* Adjust block numbers after header changes
* Fix debug build
* Overlay bss ordering
* Fix BSS ordering after header changes
* gc-eu-mq OK
* Implement preprocessor for #pragma increment_block_number
* Transfer usage comment from reencode.sh
* Use temporary directory instead of temporary file
* Move ColChkMassType back
* Player: Document "WaitForPutAway" (#1936)
* document put away delay
* functions.txt
* add a note on delaying indefinitely
* format
* typo
* delay -> wait for put away
* revert unintended formatting change
* add comment to struct member
* format
* fix functions.txt
* Set up gc-eu and match all code (#1938)
* Set up gc-eu and match all code
* Format
* Mark gc-eu-mq as WIP until it builds OK
* Move original/MQ map mark data to separate files
* Add #includes to .inc.c files to help out VS Code
* Use #if in spec instead of .inc.c files
* Delete disassembly data for gc-eu-mq (#1942)
* Player Docs: "sUpperBodyIsBusy" (#1944)
* document upperbodybusy
* change wording for comment and rename upperanimblendweight
* format
* review
* Fix miscategorized scenes (#1946)
* Fix miscategorized scenes
* Sort includes
* Player Docs: Action Interrupt (#1947)
* document action interrupt
* format
* new function comment
* format
* add a note about items
* format
* Add gc-eu-mq to CI (#1943)
* Add gc-eu-mq to CI
* Give up on scripting
* Revert quotes changes
* Player Docs: Name some high level update calls (#1593)
* name some low hanging fruit
* revert burn and shock, doing in seperate pr
* add some function comments
* yaw func
* adjust comment
* some review
* unname UpdateZTarget
* Player_DetectRumbleSecrets
* fix dive do action name
* Player Docs: Control stick buffers (#1945)
* name vars and add enum
* name some spin attack stuff
* fix right and left
* forward/backward
* format
* fix retail bss
* sControlStickWorldYaw
* Force string.o to be in boot for gcc builds (#1948)
In retail builds, memcpy is linked in code, not boot, but GCC likes to call memcpy when copying structs so currently GCC builds immediately crash in __osInitialize_common.
* Rename yDistToWater -> depthInWater (#1950)
* Rename yDistToWater -> yDistUnderWater
* yDistUnderWater -> depthInWater
* Check baserom hash before decompression (#1952)
* Remove Cygwin support (#1951)
* Document pause page switching (#1550)
* Document pause page switching
* document initial scroll left setup, when opening the pause menu
* `PAUSE_MAIN_STATE_1` -> `PAUSE_MAIN_STATE_SWITCHING_PAGE`
* try a diagram of the pages layout in world space as a comment
* expand `nextPageMode` comment
* touch up pause camera header comments
* expand comment on irrelevant init `mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE`
* expand doc on `sKaleidoSetup*` data
* expand docs on `gPageSwitchNextButtonStatus`
* add some doc on `sPageSwitch*` arrays
* SwitchPage -> PageSwitch
* add `PAGE_SWITCH_NSTEPS`
* `SWITCH_PAGE_*_PT` -> `PAGE_SWITCH_PT_*`
* peepoArtist
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
* Fix LensMode Enum Names (#1954)
* Change linker script so gGameOverTimer can be in z_game_over.c (#1939)
* Change linker script so gGameOverTimer can be in z_game_over.c
* gGameOverTimer -> sGameOverTimer
* include_data_only_with_rodata -> include_data_only_within_rodata
* fix build issues
* Check buffers segment in check_ordering.py (#1960)
* Delete unused yaz0tool (#1959)
* Revamp "AnimationContext" Docs, now called "AnimTaskQueue" (#1941)
* start using task terminology
* more docs
* format
* cleanups
* MoveActor -> ActorMove
* missed a couple
* hopefully the last changes
* comment explaining the group change
* some review
* dragorn review
* remove accidental file
* fix matching issue, now use while loop
* Experiment: remove global.h dependency from sys_math, sys_math3d, z_lib (#1956)
* split sys_math, sys_math3d, z_lib from global.h
* suggestions
* forgot this
* more math stuff
* nit fix
* re-add ichain.h
* resolve tharo's comments
* Fix check_ordering.py checking for shifted/nonmatching-besides-relocs (#1961)
* Run CC_CHECK with the correct CPP defines (#1963)
* Run CC_CHECK with the correct CPP defines
* Add "CPP_DEFINES ?="
---------
Co-authored-by: cadmic <cadmic24@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
2024-06-22 22:36:26 +02:00
CPP_DEFINES += -DENABLE_HACKEROOT= 0
2024-01-31 17:51:33 +01:00
e n d i f
2024-12-28 20:18:45 +00:00
ASOPTFLAGS := -O1
2024-01-31 17:51:33 +01:00
2024-11-29 20:36:21 +01:00
2024-01-31 17:51:33 +01:00
# Override optimization flags if using GDB
i f e q ( $( ARES_GDB ) , 1 )
OPTFLAGS := -Og -ggdb3
2024-01-29 09:20:54 -08:00
e n d i f
2024-01-31 17:51:33 +01:00
# Define author and package version for every OoT version
# Note: this won't be used if not using HackerOoT
2025-01-02 18:14:50 +01:00
CPP_DEFINES += -DCOMPRESS_$( COMPRESSION_TYPE) = 1 -DPACKAGE_VERSION= '$(PACKAGE_VERSION)' -DPACKAGE_NAME= '$(PACKAGE_NAME)' -DPACKAGE_COMMIT_AUTHOR= '$(PACKAGE_COMMIT_AUTHOR)' -DPACKAGE_AUTHOR= '$(PACKAGE_AUTHOR)'
2024-01-31 17:51:33 +01:00
OPTFLAGS += -ffast-math -fno-unsafe-math-optimizations
2020-09-21 03:00:28 -04:00
i f e q ( $( OS ) , W i n d o w s _ N T )
2021-01-20 20:46:25 +01:00
DETECTED_OS = windows
2020-09-21 03:00:28 -04:00
e l s e
UNAME_S := $( shell uname -s)
ifeq ( $( UNAME_S) ,Linux)
DETECTED_OS = linux
endif
ifeq ( $( UNAME_S) ,Darwin)
DETECTED_OS = macos
MAKE = gmake
endif
e n d i f
2020-03-17 00:31:30 -04:00
#### Tools ####
2022-01-19 18:57:39 -05:00
i f n e q ( $( shell type $ ( MIPS_BINUTILS_PREFIX ) ld >/dev /null 2>/dev /null ; echo $ $ ?) , 0 )
2023-03-20 15:07:18 +00:00
$( error Unable to find $( MIPS_BINUTILS_PREFIX) ld. Please install or build MIPS binutils, commonly mips-linux-gnu. ( or set MIPS_BINUTILS_PREFIX if your MIPS binutils install uses another prefix) )
2020-03-17 00:31:30 -04:00
e n d i f
2022-02-19 16:50:56 -05:00
# Detect compiler and set variables appropriately.
i f e q ( $( COMPILER ) , g c c )
CC := $( MIPS_BINUTILS_PREFIX) gcc
2024-12-28 20:18:45 +00:00
CCAS := $( CC) -x assembler-with-cpp
2022-02-19 16:50:56 -05:00
e l s e
2024-01-31 17:51:33 +01:00
$( error Unsupported compiler . Please use gcc as the COMPILER variable .)
2020-03-17 00:31:30 -04:00
e n d i f
2025-01-03 04:42:28 +00:00
# EGCS Compiler
2025-01-02 00:35:22 -08:00
EGCS_PREFIX := tools/egcs/$( DETECTED_OS) /
EGCS_CC := $( EGCS_PREFIX) gcc -B $( EGCS_PREFIX)
2025-01-03 04:42:28 +00:00
EGCS_CCAS := $( EGCS_CC) -x assembler-with-cpp
2025-01-02 00:35:22 -08:00
2024-01-09 18:49:12 +01:00
AS := $( MIPS_BINUTILS_PREFIX) as
LD := $( MIPS_BINUTILS_PREFIX) ld
OBJCOPY := $( MIPS_BINUTILS_PREFIX) objcopy
OBJDUMP := $( MIPS_BINUTILS_PREFIX) objdump
2024-01-24 15:00:10 -03:00
NM := $( MIPS_BINUTILS_PREFIX) nm
2024-12-28 20:18:45 +00:00
STRIP := $( MIPS_BINUTILS_PREFIX) strip
2024-01-09 18:49:12 +01:00
2025-01-08 07:33:49 -08:00
# Command prefix to preprocess a file before running the compiler
PREPROCESS :=
2025-01-05 22:45:12 -08:00
# Command to patch certain object files after they are built
POSTPROCESS_OBJ := @:
2024-12-15 14:53:07 -08:00
# The default iconv on macOS has some differences from GNU iconv, so we use the Homebrew version instead
i f e q ( $( UNAME_S ) , D a r w i n )
ICONV := $( shell brew --prefix) /opt/libiconv/bin/iconv
e l s e
ICONV := iconv
e n d i f
2024-01-09 18:49:12 +01:00
2024-03-02 04:09:57 +01:00
INC := -Iinclude -Iinclude/libc -Isrc -I$( BUILD_DIR) -I. -I$( EXTRACTED_DIR)
2021-09-18 09:07:51 -03:00
2020-03-23 23:15:45 +01:00
# Check code syntax with host compiler
2022-06-16 02:15:44 +02:00
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces
2024-07-18 17:58:59 +01:00
CHECK_WARNINGS += -Werror= implicit-int -Werror= implicit-function-declaration -Werror= int-conversion -Werror= incompatible-pointer-types
2020-03-17 00:31:30 -04:00
2024-03-29 08:03:28 -07:00
# The `cpp` command behaves differently on macOS (it behaves as if
# `-traditional-cpp` was passed) so we use `gcc -E` instead.
CPP := gcc -E
2020-03-17 00:31:30 -04:00
MKLDSCRIPT := tools/mkldscript
2021-11-30 23:29:09 +00:00
MKDMADATA := tools/mkdmadata
2020-03-17 00:31:30 -04:00
ELF2ROM := tools/elf2rom
2025-02-17 22:09:42 +00:00
BIN2C := tools/bin2c
N64TEXCONV := tools/assets/n64texconv/n64texconv
2022-02-06 19:40:26 +00:00
FADO := tools/fado/fado.elf
2024-01-24 16:39:13 -08:00
PYTHON ?= $( VENV) /bin/python3
2024-02-04 13:04:13 +01:00
FLIPS := tools/Flips/flips
2024-05-08 11:58:56 +02:00
GZINJECT := tools/gzinject/gzinject
2025-01-06 02:32:45 +01:00
CC_IDO := tools/ido_recomp/$( DETECTED_OS) /5.3/cc
2020-03-17 00:31:30 -04:00
2024-08-15 01:54:31 +01:00
# Command to replace $(BUILD_DIR) in some files with the build path.
# We can't use the C preprocessor for this because it won't substitute inside string literals.
BUILD_DIR_REPLACE := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g'
2024-01-05 14:27:19 -08:00
2024-08-08 05:11:39 +01:00
# Audio tools
2024-08-11 16:41:33 +01:00
SAMPLECONV := tools/audio/sampleconv/sampleconv
2024-08-15 01:54:31 +01:00
SBC := tools/audio/sbc
2024-08-28 02:09:59 +01:00
SFC := tools/audio/sfc
SFPATCH := tools/audio/sfpatch
2024-08-17 22:42:15 +01:00
ATBLGEN := tools/audio/atblgen
2024-12-14 00:26:36 +00:00
AFILE_SIZES := tools/audio/afile_sizes
2024-09-15 23:26:27 +01:00
# We want linemarkers in sequence assembly files for better assembler error messages
SEQ_CPP := $( CPP) -x assembler-with-cpp -fno-dollars-in-identifiers
2024-09-21 04:30:52 -07:00
SEQ_CPPFLAGS := -D_LANGUAGE_ASEQ -DMML_VERSION= MML_VERSION_OOT $( CPP_DEFINES) -I include -I include/audio -I include/tables/sfx -I $( BUILD_DIR) /assets/audio/soundfonts
2024-08-15 01:54:31 +01:00
SBCFLAGS := --matching
2024-08-28 02:09:59 +01:00
SFCFLAGS := --matching
2024-08-08 05:11:39 +01:00
Merge decomp/main (#141)
* Match retail BSS ordering (#1927)
* Match retail BSS ordering
* Revert moving some global variables to headers
* Adjust block numbers after header changes
* Fix debug build
* Overlay bss ordering
* Fix BSS ordering after header changes
* gc-eu-mq OK
* Implement preprocessor for #pragma increment_block_number
* Transfer usage comment from reencode.sh
* Use temporary directory instead of temporary file
* Move ColChkMassType back
* Player: Document "WaitForPutAway" (#1936)
* document put away delay
* functions.txt
* add a note on delaying indefinitely
* format
* typo
* delay -> wait for put away
* revert unintended formatting change
* add comment to struct member
* format
* fix functions.txt
* Set up gc-eu and match all code (#1938)
* Set up gc-eu and match all code
* Format
* Mark gc-eu-mq as WIP until it builds OK
* Move original/MQ map mark data to separate files
* Add #includes to .inc.c files to help out VS Code
* Use #if in spec instead of .inc.c files
* Delete disassembly data for gc-eu-mq (#1942)
* Player Docs: "sUpperBodyIsBusy" (#1944)
* document upperbodybusy
* change wording for comment and rename upperanimblendweight
* format
* review
* Fix miscategorized scenes (#1946)
* Fix miscategorized scenes
* Sort includes
* Player Docs: Action Interrupt (#1947)
* document action interrupt
* format
* new function comment
* format
* add a note about items
* format
* Add gc-eu-mq to CI (#1943)
* Add gc-eu-mq to CI
* Give up on scripting
* Revert quotes changes
* Player Docs: Name some high level update calls (#1593)
* name some low hanging fruit
* revert burn and shock, doing in seperate pr
* add some function comments
* yaw func
* adjust comment
* some review
* unname UpdateZTarget
* Player_DetectRumbleSecrets
* fix dive do action name
* Player Docs: Control stick buffers (#1945)
* name vars and add enum
* name some spin attack stuff
* fix right and left
* forward/backward
* format
* fix retail bss
* sControlStickWorldYaw
* Force string.o to be in boot for gcc builds (#1948)
In retail builds, memcpy is linked in code, not boot, but GCC likes to call memcpy when copying structs so currently GCC builds immediately crash in __osInitialize_common.
* Rename yDistToWater -> depthInWater (#1950)
* Rename yDistToWater -> yDistUnderWater
* yDistUnderWater -> depthInWater
* Check baserom hash before decompression (#1952)
* Remove Cygwin support (#1951)
* Document pause page switching (#1550)
* Document pause page switching
* document initial scroll left setup, when opening the pause menu
* `PAUSE_MAIN_STATE_1` -> `PAUSE_MAIN_STATE_SWITCHING_PAGE`
* try a diagram of the pages layout in world space as a comment
* expand `nextPageMode` comment
* touch up pause camera header comments
* expand comment on irrelevant init `mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE`
* expand doc on `sKaleidoSetup*` data
* expand docs on `gPageSwitchNextButtonStatus`
* add some doc on `sPageSwitch*` arrays
* SwitchPage -> PageSwitch
* add `PAGE_SWITCH_NSTEPS`
* `SWITCH_PAGE_*_PT` -> `PAGE_SWITCH_PT_*`
* peepoArtist
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
* Fix LensMode Enum Names (#1954)
* Change linker script so gGameOverTimer can be in z_game_over.c (#1939)
* Change linker script so gGameOverTimer can be in z_game_over.c
* gGameOverTimer -> sGameOverTimer
* include_data_only_with_rodata -> include_data_only_within_rodata
* fix build issues
* Check buffers segment in check_ordering.py (#1960)
* Delete unused yaz0tool (#1959)
* Revamp "AnimationContext" Docs, now called "AnimTaskQueue" (#1941)
* start using task terminology
* more docs
* format
* cleanups
* MoveActor -> ActorMove
* missed a couple
* hopefully the last changes
* comment explaining the group change
* some review
* dragorn review
* remove accidental file
* fix matching issue, now use while loop
* Experiment: remove global.h dependency from sys_math, sys_math3d, z_lib (#1956)
* split sys_math, sys_math3d, z_lib from global.h
* suggestions
* forgot this
* more math stuff
* nit fix
* re-add ichain.h
* resolve tharo's comments
* Fix check_ordering.py checking for shifted/nonmatching-besides-relocs (#1961)
* Run CC_CHECK with the correct CPP defines (#1963)
* Run CC_CHECK with the correct CPP defines
* Add "CPP_DEFINES ?="
---------
Co-authored-by: cadmic <cadmic24@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
2024-06-22 22:36:26 +02:00
CFLAGS += $( CPP_DEFINES)
CPPFLAGS += $( CPP_DEFINES)
CFLAGS_IDO += $( CPP_DEFINES)
2024-12-28 20:18:45 +00:00
# Extra debugging steps
i f e q ( $( DEBUG_OBJECTS ) , 1 )
OBJDUMP_CMD = @$( OBJDUMP) $( OBJDUMP_FLAGS) $@ > $( @:.o= .s)
OBJCOPY_CMD = @$( OBJCOPY) -O binary $@ $( @:.o= .bin)
e l s e
OBJDUMP_CMD = @:
OBJCOPY_CMD = @:
e n d i f
2024-08-11 03:20:43 -07:00
GBI_DEFINES := -DF3DEX_GBI_2
2024-12-26 05:54:26 -08:00
i f n e q ( $( PLATFORM ) , N 6 4 )
2024-08-11 03:20:43 -07:00
GBI_DEFINES += -DF3DEX_GBI_PL -DGBI_DOWHILE
e n d i f
2024-11-17 17:02:07 -05:00
i f e q ( $( DEBUG_FEATURES ) , 1 )
2024-06-24 22:14:03 +02:00
GBI_DEFINES += -DGBI_DEBUG
e n d i f
2025-01-02 00:35:22 -08:00
CPPFLAGS += -P -xc -fno-dollars-in-identifiers $( CPP_DEFINES)
ASFLAGS += -march= vr4300 -32 -no-pad-sections -Iinclude -I$( EXTRACTED_DIR)
2020-03-17 00:31:30 -04:00
2022-02-19 16:50:56 -05:00
i f e q ( $( COMPILER ) , g c c )
2025-01-02 00:35:22 -08:00
CFLAGS += $( CPP_DEFINES) $( GBI_DEFINES) -G 0 -nostdinc $( INC) -march= vr4300 -mfix4300 -mabi= 32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $( CHECK_WARNINGS)
CCASFLAGS += $( CPP_DEFINES) $( GBI_DEFINES) -G 0 -nostdinc $( INC) -march= vr4300 -mfix4300 -mabi= 32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections
2022-02-19 16:50:56 -05:00
MIPS_VERSION := -mips3
2024-02-01 21:08:45 +01:00
RUN_CC_CHECK := 0
2020-03-17 00:31:30 -04:00
e n d i f
2022-05-20 07:27:54 +01:00
OBJDUMP_FLAGS := -d -r -z -Mreg-names= 32
2020-03-17 00:31:30 -04:00
#### Files ####
# ROM image
2024-02-04 12:30:03 +01:00
i f e q ( $( VERSION ) , h a c k e r o o t - m q )
ROM := $( BUILD_DIR) /$( VERSION) .z64
e l s e
ROM := $( BUILD_DIR) /oot-$( VERSION) .z64
e n d i f
2024-02-06 03:18:50 +01:00
ROMC := $( ROM:.z64= -compressed-$( COMPRESSION) .z64)
2024-02-03 17:40:34 +01:00
WAD := $( ROM:.z64= .wad)
2024-05-08 11:58:56 +02:00
ISO := $( ROM:.z64= .iso)
2024-02-04 13:04:13 +01:00
BPS := $( ROM:.z64= .bps)
2024-02-02 13:34:20 -08:00
ELF := $( ROM:.z64= .elf)
MAP := $( ROM:.z64= .map)
LDSCRIPT := $( ROM:.z64= .ld)
2024-05-08 11:58:56 +02:00
DMA_CONFIG_FILE := dma_config.txt
2025-01-11 19:44:14 -08:00
2020-03-17 00:31:30 -04:00
# description of ROM segments
2025-01-28 17:23:01 +01:00
SPEC := spec/spec
SPEC_INCLUDES := $( wildcard spec/*.inc)
2020-03-17 00:31:30 -04:00
2024-02-04 13:04:13 +01:00
# Baserom to use when creating BPS patches
BASEROM_PATCH ?= baseroms/$( VERSION) /baserom.z64
2020-05-01 03:49:35 +02:00
SRC_DIRS := $( shell find src -type d)
2025-01-10 04:03:51 -08:00
UNDECOMPILED_DATA_DIRS := $( shell find data -type d)
2022-02-19 16:50:56 -05:00
2024-08-11 16:41:33 +01:00
i f n e q ( $( wildcard $ ( EXTRACTED_DIR ) /assets /audio ) , )
SAMPLE_EXTRACT_DIRS := $( shell find $( EXTRACTED_DIR) /assets/audio/samples -type d)
2024-08-15 01:54:31 +01:00
SAMPLEBANK_EXTRACT_DIRS := $( shell find $( EXTRACTED_DIR) /assets/audio/samplebanks -type d)
2024-08-28 02:09:59 +01:00
SOUNDFONT_EXTRACT_DIRS := $( shell find $( EXTRACTED_DIR) /assets/audio/soundfonts -type d)
2024-09-15 23:26:27 +01:00
SEQUENCE_EXTRACT_DIRS := $( shell find $( EXTRACTED_DIR) /assets/audio/sequences -type d)
2024-08-11 16:41:33 +01:00
e l s e
SAMPLE_EXTRACT_DIRS :=
2024-08-15 01:54:31 +01:00
SAMPLEBANK_EXTRACT_DIRS :=
2024-08-28 02:09:59 +01:00
SOUNDFONT_EXTRACT_DIRS :=
2024-09-15 23:26:27 +01:00
SEQUENCE_EXTRACT_DIRS :=
2024-08-11 16:41:33 +01:00
e n d i f
i f n e q ( $( wildcard assets /audio /samples ) , )
SAMPLE_DIRS := $( shell find assets/audio/samples -type d)
e l s e
SAMPLE_DIRS :=
e n d i f
2024-08-15 01:54:31 +01:00
i f n e q ( $( wildcard assets /audio /samplebanks ) , )
SAMPLEBANK_DIRS := $( shell find assets/audio/samplebanks -type d)
e l s e
SAMPLEBANK_DIRS :=
e n d i f
2024-08-28 02:09:59 +01:00
i f n e q ( $( wildcard assets /audio /soundfonts ) , )
SOUNDFONT_DIRS := $( shell find assets/audio/soundfonts -type d)
e l s e
SOUNDFONT_DIRS :=
e n d i f
2024-09-15 23:26:27 +01:00
i f n e q ( $( wildcard assets /audio /sequences ) , )
SEQUENCE_DIRS := $( shell find assets/audio/sequences -type d)
e l s e
SEQUENCE_DIRS :=
e n d i f
2024-08-11 16:41:33 +01:00
SAMPLE_FILES := $( foreach dir,$( SAMPLE_DIRS) ,$( wildcard $( dir) /*.wav) )
SAMPLE_EXTRACT_FILES := $( foreach dir,$( SAMPLE_EXTRACT_DIRS) ,$( wildcard $( dir) /*.wav) )
AIFC_FILES := $( foreach f,$( SAMPLE_FILES) ,$( BUILD_DIR) /$( f:.wav= .aifc) ) $( foreach f,$( SAMPLE_EXTRACT_FILES:.wav= .aifc) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) )
2024-08-15 01:54:31 +01:00
SAMPLEBANK_XMLS := $( foreach dir,$( SAMPLEBANK_DIRS) ,$( wildcard $( dir) /*.xml) )
SAMPLEBANK_EXTRACT_XMLS := $( foreach dir,$( SAMPLEBANK_EXTRACT_DIRS) ,$( wildcard $( dir) /*.xml) )
SAMPLEBANK_BUILD_XMLS := $( foreach f,$( SAMPLEBANK_XMLS) ,$( BUILD_DIR) /$f ) $( foreach f,$( SAMPLEBANK_EXTRACT_XMLS) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) )
SAMPLEBANK_O_FILES := $( foreach f,$( SAMPLEBANK_BUILD_XMLS) ,$( f:.xml= .o) )
SAMPLEBANK_DEP_FILES := $( foreach f,$( SAMPLEBANK_O_FILES) ,$( f:.o= .d) )
2024-08-28 02:09:59 +01:00
SOUNDFONT_XMLS := $( foreach dir,$( SOUNDFONT_DIRS) ,$( wildcard $( dir) /*.xml) )
SOUNDFONT_EXTRACT_XMLS := $( foreach dir,$( SOUNDFONT_EXTRACT_DIRS) ,$( wildcard $( dir) /*.xml) )
SOUNDFONT_BUILD_XMLS := $( foreach f,$( SOUNDFONT_XMLS) ,$( BUILD_DIR) /$f ) $( foreach f,$( SOUNDFONT_EXTRACT_XMLS) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) )
SOUNDFONT_O_FILES := $( foreach f,$( SOUNDFONT_BUILD_XMLS) ,$( f:.xml= .o) )
SOUNDFONT_HEADERS := $( foreach f,$( SOUNDFONT_BUILD_XMLS) ,$( f:.xml= .h) )
SOUNDFONT_DEP_FILES := $( foreach f,$( SOUNDFONT_O_FILES) ,$( f:.o= .d) )
2024-09-15 23:26:27 +01:00
SEQUENCE_FILES := $( foreach dir,$( SEQUENCE_DIRS) ,$( wildcard $( dir) /*.seq) )
SEQUENCE_EXTRACT_FILES := $( foreach dir,$( SEQUENCE_EXTRACT_DIRS) ,$( wildcard $( dir) /*.seq) )
SEQUENCE_O_FILES := $( foreach f,$( SEQUENCE_FILES) ,$( BUILD_DIR) /$( f:.seq= .o) ) $( foreach f,$( SEQUENCE_EXTRACT_FILES:.seq= .o) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) )
SEQUENCE_DEP_FILES := $( foreach f,$( SEQUENCE_O_FILES) ,$( f:.o= .d) )
SEQUENCE_TABLE := include/tables/sequence_table.h
2024-06-24 06:22:39 -07:00
2024-09-11 07:51:53 -06:00
# create extracted directory
$( shell mkdir -p $ ( EXTRACTED_DIR ) )
2024-06-24 06:22:39 -07:00
2024-09-12 13:37:13 -07:00
i f n e q ( $( wildcard $ ( EXTRACTED_DIR ) /assets ) , )
ASSET_BIN_DIRS_EXTRACTED := $( shell find $( EXTRACTED_DIR) /assets -type d)
e l s e
ASSET_BIN_DIRS_EXTRACTED :=
e n d i f
2024-09-15 23:26:27 +01:00
ASSET_BIN_DIRS_COMMITTED := $( shell find assets -type d -not -path "assets/xml*" -not -path "assets/audio*" -not -path assets/text)
2024-07-23 23:47:00 +01:00
ASSET_BIN_DIRS := $( ASSET_BIN_DIRS_EXTRACTED) $( ASSET_BIN_DIRS_COMMITTED)
2024-06-24 23:37:48 +02:00
2024-07-23 23:47:00 +01:00
ASSET_FILES_BIN_EXTRACTED := $( foreach dir,$( ASSET_BIN_DIRS_EXTRACTED) ,$( wildcard $( dir) /*.bin) )
ASSET_FILES_BIN_COMMITTED := $( foreach dir,$( ASSET_BIN_DIRS_COMMITTED) ,$( wildcard $( dir) /*.bin) )
ASSET_FILES_OUT := $( foreach f,$( ASSET_FILES_BIN_EXTRACTED:.bin= .bin.inc.c) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) ) \
2025-01-10 10:47:09 -08:00
$( foreach f,$( ASSET_FILES_BIN_COMMITTED:.bin= .bin.inc.c) ,$( BUILD_DIR) /$f )
2020-12-26 06:39:52 -05:00
2025-01-10 04:03:51 -08:00
# Find all .o files included in the spec
2025-01-28 17:23:01 +01:00
SPEC_O_FILES := $( shell $( CPP) $( CPPFLAGS) -I. $( SPEC) | $( BUILD_DIR_REPLACE) | sed -n -E 's/^[ \t]*include[ \t]*"([a-zA-Z0-9/_.-]+\.o)"/\1/p' )
2022-06-03 21:33:18 +01:00
2025-01-10 04:03:51 -08:00
# Split out reloc files
O_FILES := $( filter-out %_reloc.o,$( SPEC_O_FILES) )
OVL_RELOC_FILES := $( filter %_reloc.o,$( SPEC_O_FILES) )
2024-08-28 13:09:20 +02:00
2024-05-17 06:35:01 -07:00
UCODE_PATCHES := $( wildcard F3DEX3/*.bps)
UCODE_FILES := $( foreach f,$( UCODE_PATCHES:.bps= ) ,$f )
UCODE_O_FILES := $( foreach f,$( UCODE_FILES) ,$( BUILD_DIR) /$f .o)
2020-12-26 06:39:52 -05:00
2021-05-02 22:21:27 +02:00
# Automatic dependency files
2022-02-06 19:40:26 +00:00
# (Only asm_processor dependencies and reloc dependencies are handled for now)
DEP_FILES := $( O_FILES:.o= .asmproc.d) $( OVL_RELOC_FILES:.o= .d)
2024-07-23 23:47:00 +01:00
TEXTURE_FILES_PNG_EXTRACTED := $( foreach dir,$( ASSET_BIN_DIRS_EXTRACTED) ,$( wildcard $( dir) /*.png) )
TEXTURE_FILES_PNG_COMMITTED := $( foreach dir,$( ASSET_BIN_DIRS_COMMITTED) ,$( wildcard $( dir) /*.png) )
TEXTURE_FILES_JPG_EXTRACTED := $( foreach dir,$( ASSET_BIN_DIRS_EXTRACTED) ,$( wildcard $( dir) /*.jpg) )
TEXTURE_FILES_JPG_COMMITTED := $( foreach dir,$( ASSET_BIN_DIRS_COMMITTED) ,$( wildcard $( dir) /*.jpg) )
TEXTURE_FILES_OUT := $( foreach f,$( TEXTURE_FILES_PNG_EXTRACTED:.png= .inc.c) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) ) \
$( foreach f,$( TEXTURE_FILES_PNG_COMMITTED:.png= .inc.c) ,$( BUILD_DIR) /$f ) \
$( foreach f,$( TEXTURE_FILES_JPG_EXTRACTED:.jpg= .jpg.inc.c) ,$( f:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) ) \
$( foreach f,$( TEXTURE_FILES_JPG_COMMITTED:.jpg= .jpg.inc.c) ,$( BUILD_DIR) /$f )
2020-03-17 00:31:30 -04:00
# create build directories
2024-07-29 22:16:53 +01:00
$( shell mkdir -p $ ( BUILD_DIR ) /baserom \
2025-01-03 04:42:28 +00:00
$( BUILD_DIR) /assets/text \
$( BUILD_DIR) /linker_scripts)
2024-08-15 01:54:31 +01:00
$( shell mkdir -p $ ( foreach dir , \
2024-07-29 22:16:53 +01:00
$( SRC_DIRS) \
$( UNDECOMPILED_DATA_DIRS) \
2024-08-15 01:54:31 +01:00
$( SAMPLE_DIRS) \
$( SAMPLEBANK_DIRS) \
2024-08-28 02:09:59 +01:00
$( SOUNDFONT_DIRS) \
2024-09-15 23:26:27 +01:00
$( SEQUENCE_DIRS) \
2024-07-29 22:16:53 +01:00
$( ASSET_BIN_DIRS_COMMITTED) , \
2024-08-15 01:54:31 +01:00
$( BUILD_DIR) /$( dir) ) )
i f n e q ( $( wildcard $ ( EXTRACTED_DIR ) /assets ) , )
$( shell mkdir -p $ ( foreach dir , \
$( SAMPLE_EXTRACT_DIRS) \
$( SAMPLEBANK_EXTRACT_DIRS) \
2024-08-28 02:09:59 +01:00
$( SOUNDFONT_EXTRACT_DIRS) \
2024-09-15 23:26:27 +01:00
$( SEQUENCE_EXTRACT_DIRS) \
2024-07-29 22:16:53 +01:00
$( ASSET_BIN_DIRS_EXTRACTED) , \
$( dir:$( EXTRACTED_DIR) /%= $( BUILD_DIR) /%) ) )
2024-08-15 01:54:31 +01:00
e n d i f
2020-03-17 00:31:30 -04:00
2025-01-10 15:05:10 -08:00
$(BUILD_DIR)/src/boot/build.o : CPP_DEFINES += -DBUILD_CREATOR ="\"$( BUILD_CREATOR ) \"" -DBUILD_DATE ="\"$( BUILD_DATE ) \"" -DBUILD_TIME ="\"$( BUILD_TIME ) \""
2025-02-25 13:16:50 +01:00
$(BUILD_DIR)/src/audio/lib/seqplayer.o : CPP_DEFINES += -DMML_VERSION =MML_VERSION_OOT
2025-01-10 15:05:10 -08:00
2024-01-31 17:51:33 +01:00
i f e q ( $( COMPILER ) , g c c )
2024-02-29 20:11:54 +00:00
# Note that if adding additional assets directories for modding reasons these flags must also be used there
2024-03-05 16:35:42 +01:00
$( BUILD_DIR) /assets/%.o: CFLAGS += -fno-zero-initialized-in-bss -fno-toplevel-reorder
$( BUILD_DIR) /src/%.o: CFLAGS += -fexec-charset= utf-8
2024-01-31 17:51:33 +01:00
$( BUILD_DIR) /src/libultra/libc/ll.o: OPTFLAGS := -Ofast
2024-03-05 16:35:42 +01:00
$( BUILD_DIR) /src/overlays/%.o: CFLAGS += -fno-merge-constants -mno-explicit-relocs -mno-split-addresses
2024-01-05 14:27:19 -08:00
2024-01-31 17:51:33 +01:00
$( BUILD_DIR) /src/overlays/actors/ovl_Item_Shield/%.o: OPTFLAGS := -O2
$( BUILD_DIR) /src/overlays/actors/ovl_En_Part/%.o: OPTFLAGS := -O2
$( BUILD_DIR) /src/overlays/actors/ovl_Item_B_Heart/%.o: OPTFLAGS := -O0
$( BUILD_DIR) /src/overlays/actors/ovl_Bg_Mori_Hineri/%.o: OPTFLAGS := -O0
2024-05-08 11:58:56 +02:00
# library overrides for Gamecube
i f e q ( $( TARGET ) , i s o )
MIPS_VERSION_IDO := -mips2
CFLAGS_IDO += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $( INC) -Wab,-r4300_mul -woff 516,609,649,838,712
$( BUILD_DIR) /src/libultra/io/viswapbuf.o: OPTFLAGS := -O2
$( BUILD_DIR) /src/libultra/io/viswapbuf.o: MIPS_VERSION := $( MIPS_VERSION_IDO)
$( BUILD_DIR) /src/libultra/io/viswapbuf.o: CFLAGS := $( CFLAGS_IDO)
$( BUILD_DIR) /src/libultra/io/viswapbuf.o: CC := $( CC_IDO)
$( BUILD_DIR) /src/libultra/gu/sinf.o: OPTFLAGS := -O2
$( BUILD_DIR) /src/libultra/gu/sinf.o: MIPS_VERSION := $( MIPS_VERSION_IDO)
$( BUILD_DIR) /src/libultra/gu/sinf.o: CFLAGS := $( CFLAGS_IDO)
$( BUILD_DIR) /src/libultra/gu/sinf.o: CC := $( CC_IDO)
$( BUILD_DIR) /src/libultra/gu/cosf.o: OPTFLAGS := -O2
$( BUILD_DIR) /src/libultra/gu/cosf.o: MIPS_VERSION := $( MIPS_VERSION_IDO)
$( BUILD_DIR) /src/libultra/gu/cosf.o: CFLAGS := $( CFLAGS_IDO)
$( BUILD_DIR) /src/libultra/gu/cosf.o: CC := $( CC_IDO)
$( BUILD_DIR) /src/libultra/gu/perspective.o: OPTFLAGS := -O2
$( BUILD_DIR) /src/libultra/gu/perspective.o: MIPS_VERSION := $( MIPS_VERSION_IDO)
$( BUILD_DIR) /src/libultra/gu/perspective.o: CFLAGS := $( CFLAGS_IDO)
$( BUILD_DIR) /src/libultra/gu/perspective.o: CC := $( CC_IDO)
$( BUILD_DIR) /src/libultra/os/getmemsize.o: OPTFLAGS := -O1
$( BUILD_DIR) /src/libultra/os/getmemsize.o: MIPS_VERSION := $( MIPS_VERSION_IDO)
$( BUILD_DIR) /src/libultra/os/getmemsize.o: CFLAGS := $( CFLAGS_IDO)
$( BUILD_DIR) /src/libultra/os/getmemsize.o: CC := $( CC_IDO)
$( BUILD_DIR) /src/libultra/os/aisetnextbuf.o: OPTFLAGS := -O1
$( BUILD_DIR) /src/libultra/os/aisetnextbuf.o: MIPS_VERSION := $( MIPS_VERSION_IDO)
$( BUILD_DIR) /src/libultra/os/aisetnextbuf.o: CFLAGS := $( CFLAGS_IDO)
$( BUILD_DIR) /src/libultra/os/aisetnextbuf.o: CC := $( CC_IDO)
e n d i f
2022-02-19 16:50:56 -05:00
e n d i f
2020-04-16 20:08:23 +02:00
2020-03-17 00:31:30 -04:00
#### Main Targets ###
2024-04-18 19:37:37 +02:00
all : rom
2024-01-24 16:39:13 -08:00
2024-04-18 19:37:37 +02:00
rom :
2025-01-07 17:38:46 +01:00
$( call print_no_args,Building the rom...)
2024-06-24 23:37:48 +02:00
$( V) python3 tools/mod_assets.py --oot-version $( VERSION)
2024-04-21 19:59:53 +02:00
$( V) $( MAKE) $( ROM)
2024-01-24 15:00:10 -03:00
2024-02-06 03:18:50 +01:00
compress :
2025-01-07 17:38:46 +01:00
$( call print_no_args,Compressing the rom...)
2024-02-06 03:18:50 +01:00
# make sure z_std_dma.c and spec are up-to-date
2024-04-20 02:23:18 +02:00
$( V) $( shell touch spec)
$( V) $( shell touch src/boot/z_std_dma.c)
$( V) $( MAKE) $( ROMC)
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2024-01-31 17:51:33 +01:00
wad :
2025-01-07 17:38:46 +01:00
$( call print_no_args,Patching WAD...)
2024-02-04 01:45:13 +01:00
i f e q ( "$(wildcard baseroms/$(VERSION)/common-key.bin)" , "" )
2024-01-31 17:51:33 +01:00
$( error Please provide the common-key.bin file.)
2020-07-19 21:42:05 +02:00
e n d i f
2024-05-08 11:58:56 +02:00
$( V) $( MAKE) compress TARGET = wad
$( V) $( GZINJECT) -a inject -r 1 -k baseroms/$( VERSION) /common-key.bin -w baseroms/$( VERSION) /basewad.wad -m $( ROMC) -o $( WAD) -t "HackerOoT" -i NHOE -p tools/gzinject/patches/NACE.gzi -p tools/gzinject/patches/gz_default_remap.gzi
2024-04-20 02:23:18 +02:00
$( V) $( RM) -r wadextract/
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2020-03-17 00:31:30 -04:00
2024-05-08 11:58:56 +02:00
iso :
$( V) $( MAKE) compress TARGET = iso
2025-01-07 17:38:46 +01:00
$( call print_no_args,Patching ISO...)
2024-05-08 11:58:56 +02:00
$( V) $( PYTHON) tools/gc_utility.py -v $( VERSION) -c $( COMPRESSION)
$( V) $( GZINJECT) -a extract -s baseroms/$( VERSION) /baseiso.iso
$( V) cp $( BUILD_DIR) /$( DMA_CONFIG_FILE) isoextract/zlj_f.tgc/$( DMA_CONFIG_FILE)
$( V) cp $( ROMC) isoextract/zlj_f.tgc/zlj_f.n64
$( V) $( RM) -r isoextract/S_*.tgc/ isoextract/zlj_f.tgc/*.thp
$( V) $( FLIPS) --apply tools/gamecube.bps isoextract/zlj_f.tgc/main.dol isoextract/zlj_f.tgc/main.dol
$( V) $( GZINJECT) -a pack -s $( ISO)
$( V) $( RM) -r isoextract/
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2024-05-08 11:58:56 +02:00
2020-03-17 00:31:30 -04:00
clean :
2024-04-20 02:23:18 +02:00
$( V) $( RM) -r $( BUILD_DIR)
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2020-03-17 00:31:30 -04:00
2021-05-17 13:50:19 -04:00
assetclean :
2024-04-20 02:23:18 +02:00
$( V) $( RM) -r $( EXTRACTED_DIR)
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2021-05-17 13:50:19 -04:00
2024-06-24 23:37:48 +02:00
distclean :
2024-04-20 02:23:18 +02:00
$( V) $( RM) -r extracted/
$( V) $( RM) -r build/
$( V) $( MAKE) -C tools distclean
2024-05-17 06:35:01 -07:00
$( V) $( RM) -r F3DEX3/*.code F3DEX3/*.data
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2021-03-14 13:07:46 -03:00
2024-01-24 16:39:13 -08:00
venv :
2024-01-27 16:40:29 -08:00
# Create the virtual environment if it doesn't exist.
# Delete the virtual environment directory if creation fails.
2025-01-07 17:38:46 +01:00
$( call print_no_args,Preparing the virtual environment...)
2024-04-20 02:23:18 +02:00
$( V) test -d $( VENV) || python3 -m venv $( VENV) || { rm -rf $( VENV) ; false; }
$( V) $( PYTHON) -m pip install -U pip
$( V) $( PYTHON) -m pip install -U -r requirements.txt
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2024-01-24 16:39:13 -08:00
setup : venv
2025-01-07 17:38:46 +01:00
$( call print_no_args,Setup in progress...)
2024-04-20 02:23:18 +02:00
$( V) $( MAKE) -C tools
2025-01-07 17:38:46 +01:00
$( call print_no_args,Tools: Done!)
2024-04-20 02:23:18 +02:00
$( V) $( PYTHON) tools/decompress_baserom.py $( VERSION)
2025-01-07 17:38:46 +01:00
$( call print_no_args,Decompressing baserom: Done!)
2024-09-05 02:37:03 +02:00
$( V) $( PYTHON) tools/extract_baserom.py $( BASEROM_DIR) /baserom-decompressed.z64 $( EXTRACTED_DIR) /baserom -v $( VERSION)
$( V) $( PYTHON) tools/extract_incbins.py $( EXTRACTED_DIR) /baserom $( EXTRACTED_DIR) /incbin -v $( VERSION)
2025-01-06 02:32:45 +01:00
$( V) $( PYTHON) tools/extract_text.py $( EXTRACTED_DIR) /baserom $( EXTRACTED_DIR) /text -v $( VERSION)
$( V) $( PYTHON) tools/extract_assets.py $( EXTRACTED_DIR) /baserom $( EXTRACTED_DIR) /assets -v $( VERSION) -j$( N_THREADS)
2025-03-30 13:41:26 +02:00
$( V) $( PYTHON) tools/extract_audio.py -b $( EXTRACTED_DIR) /baserom -o $( EXTRACTED_DIR) -v $( VERSION) --read-xml
2025-01-07 17:38:46 +01:00
$( call print_no_args,Extracting files: Done!)
2020-03-17 00:31:30 -04:00
2024-04-21 19:59:53 +02:00
run : rom
2024-01-09 18:49:12 +01:00
i f e q ( $( N 64_EMULATOR ) , )
$( error Emulator path not set. Set N64_EMULATOR in the Makefile or define it as an environment variable)
2023-08-28 18:48:52 -04:00
e n d i f
2024-04-21 19:59:53 +02:00
$( N64_EMULATOR) $( ROM)
2020-12-21 16:14:25 -08:00
2024-02-04 13:04:13 +01:00
patch :
2025-01-07 17:38:46 +01:00
$( call print_no_args,Creating BPS patch...)
2024-04-20 02:23:18 +02:00
$( V) $( FLIPS) --create --bps $( BASEROM_PATCH) $( ROM) $( BPS)
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2022-02-06 19:40:26 +00:00
2024-05-17 06:35:01 -07:00
create_f3dex3_patches : F 3DEX 3/f 3dzex 2.code F 3DEX 3/f 3dzex 2.data
2025-01-07 17:38:46 +01:00
$( call print_no_args,Creating F3DEX3 patches...)
2024-05-17 06:35:01 -07:00
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW.code F3DEX3/F3DEX3_BrW.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW.data F3DEX3/F3DEX3_BrW.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PA.code F3DEX3/F3DEX3_BrW_PA.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_PA.data F3DEX3/F3DEX3_BrW_PA.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PB.code F3DEX3/F3DEX3_BrW_PB.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_PB.data F3DEX3/F3DEX3_BrW_PB.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PC.code F3DEX3/F3DEX3_BrW_PC.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_PC.data F3DEX3/F3DEX3_BrW_PC.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC.code F3DEX3/F3DEX3_BrW_NOC.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC.data F3DEX3/F3DEX3_BrW_NOC.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PA.code F3DEX3/F3DEX3_BrW_NOC_PA.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PA.data F3DEX3/F3DEX3_BrW_NOC_PA.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PB.code F3DEX3/F3DEX3_BrW_NOC_PB.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PB.data F3DEX3/F3DEX3_BrW_NOC_PB.data.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PC.code F3DEX3/F3DEX3_BrW_NOC_PC.code.bps
$( V) $( FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PC.data F3DEX3/F3DEX3_BrW_NOC_PC.data.bps
2025-01-07 17:38:46 +01:00
$( call print_no_args,Success!)
2024-02-04 14:29:13 +01:00
2024-04-22 19:55:44 +02:00
verify :
$( V) $( MAKE) clean
$( V) $( MAKE) rom
@md5sum $( ROM)
2024-05-17 06:35:01 -07:00
.PHONY : all rom compress clean assetclean distclean venv setup run wad iso patch create_f 3dex 3_patches verify
2024-01-24 15:00:10 -03:00
.DEFAULT_GOAL := rom
2020-12-21 16:14:25 -08:00
2020-03-17 00:31:30 -04:00
#### Various Recipes ####
2025-02-11 17:05:12 +01:00
i f e q ( $( COMPRESSION ) , g z i p )
2024-12-27 07:34:45 -08:00
COMPRESS_ARGS := --format gzip --pad-to 0x4000
CIC = 6102
2025-02-11 17:05:12 +01:00
USE_WRAPPER = 0
2024-12-27 07:34:45 -08:00
e l s e
2025-02-11 17:05:12 +01:00
i f e q ( $( COMPRESSION ) , y a z )
2024-12-27 07:34:45 -08:00
COMPRESS_ARGS := --format yaz0 --pad-to 0x800000 --fill-padding-bytes
CIC = 6105
2025-02-11 17:05:12 +01:00
USE_WRAPPER = 0
e l s e
USE_WRAPPER = 1
e n d i f
2024-12-27 07:34:45 -08:00
e n d i f
2022-02-06 19:40:26 +00:00
$(ROM) : $( ELF )
2025-02-11 17:05:12 +01:00
$( V) $( ELF2ROM) -cic $( CIC) $< $@
2024-04-20 02:23:18 +02:00
@$( PRINT) " ${ BLINK } Build succeeded.\n $( NO_COL) "
@$( PRINT) " ==== Build Options ==== $( NO_COL) \n "
@$( PRINT) " ${ GREEN } OoT Version: $( BLUE) $( VERSION) $( NO_COL) \n "
@$( PRINT) " ${ GREEN } Code Version: $( BLUE) $( PACKAGE_VERSION) $( NO_COL) \n "
2025-01-07 17:38:46 +01:00
@$( PRINT) " ${ GREEN } Build Author: $( BLUE) $( PACKAGE_AUTHOR) $( NO_COL) \n "
@$( PRINT) " ${ GREEN } Commit Author: $( BLUE) $( PACKAGE_COMMIT_AUTHOR) $( NO_COL) \n "
2022-02-06 19:40:26 +00:00
2024-01-24 15:00:10 -03:00
$(ROMC) : $( ROM ) $( ELF ) $( BUILD_DIR ) /compress_ranges .txt
2025-02-11 17:05:12 +01:00
i f e q ( $( USE_WRAPPER ) , 0 )
2025-01-06 02:32:45 +01:00
$( V) $( PYTHON) tools/compress.py --in $( ROM) --out $@ --dmadata-start ` ./tools/dmadata_start.sh $( NM) $( ELF) ` --compress ` cat $( BUILD_DIR) /compress_ranges.txt` --threads $( N_THREADS) $( COMPRESS_ARGS)
2024-02-04 01:45:13 +01:00
e l s e
2024-04-20 02:23:18 +02:00
$( V) $( PYTHON) tools/z64compress_wrapper.py --codec $( COMPRESSION) --cache $( BUILD_DIR) /cache --threads $( N_THREADS) $< $@ $( ELF) $( BUILD_DIR) /$( SPEC)
2024-02-04 01:45:13 +01:00
e n d i f
2025-01-06 02:44:08 +01:00
$( V) $( PYTHON) -m ipl3checksum sum --cic $( CIC) --update $@
2024-01-24 15:00:10 -03:00
2025-02-04 11:55:04 +00:00
COM_PLUGIN := tools/com-plugin/common-plugin.so
LDFLAGS := -T $( LDSCRIPT) -T $( BUILD_DIR) /linker_scripts/makerom.ld -T $( BUILD_DIR) /undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $( MAP)
i f e q ( $( PLATFORM ) , I Q U E )
2025-03-02 00:20:06 +00:00
ifeq ( $( NON_MATCHING) ,0)
LDFLAGS += -plugin $( COM_PLUGIN) -plugin-opt order = $( BASEROM_DIR) /bss-order.txt
$( ELF) : $( BASEROM_DIR) /bss-order.txt
endif
2025-02-04 11:55:04 +00:00
e n d i f
2025-01-06 02:32:45 +01:00
$(ELF) : $( TEXTURE_FILES_OUT ) $( ASSET_FILES_OUT ) $( O_FILES ) $( OVL_RELOC_FILES ) $( UCODE_O_FILES ) $( LDSCRIPT ) $( BUILD_DIR ) /linker_scripts /makerom .ld $( BUILD_DIR ) /undefined_syms .txt \
2024-09-15 23:26:27 +01:00
$( SAMPLEBANK_O_FILES) $( SOUNDFONT_O_FILES) $( SEQUENCE_O_FILES) \
$( BUILD_DIR) /assets/audio/sequence_font_table.o $( BUILD_DIR) /assets/audio/audiobank_padding.o
2025-02-11 17:21:23 +01:00
$( call print_one_arg,Linking:,$@ )
2025-02-11 17:05:12 +01:00
$( V) $( LD) $( LDFLAGS) -o $@
2025-01-03 04:42:28 +00:00
$(BUILD_DIR)/linker_scripts/makerom.ld : linker_scripts /makerom .ld
2025-01-06 02:32:45 +01:00
$( V) $( CPP) -I include $( CPPFLAGS) $< > $@
2022-02-06 19:40:26 +00:00
2023-02-26 17:26:07 +01:00
## Order-only prerequisites
2022-02-06 19:40:26 +00:00
# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES.
# The intermediate phony targets avoid quadratically-many dependencies between the targets and prerequisites.
o_files : $( O_FILES )
$(OVL_RELOC_FILES) : | o_files
asset_files : $( TEXTURE_FILES_OUT ) $( ASSET_FILES_OUT )
$(O_FILES) : | asset_files
.PHONY : o_files asset_files
2025-01-28 17:23:01 +01:00
$(BUILD_DIR)/spec : $( SPEC ) $( SPEC_INCLUDES )
2025-01-07 17:38:46 +01:00
$( call print_two_args,Preprocessing:,$<,$@ )
2025-02-11 17:05:12 +01:00
$( V) $( CPP) $( CPPFLAGS) -I. $< | $( BUILD_DIR_REPLACE) > $@
2022-02-06 19:40:26 +00:00
2025-01-28 17:23:01 +01:00
$(LDSCRIPT) : $( BUILD_DIR ) /spec
2025-01-07 17:38:46 +01:00
$( call print_two_args,Creating linker script:,$<,$@ )
2024-04-20 02:23:18 +02:00
$( V) $( MKLDSCRIPT) $< $@
2022-02-06 19:40:26 +00:00
2024-01-05 14:27:19 -08:00
$(BUILD_DIR)/undefined_syms.txt : undefined_syms .txt
2025-01-07 17:38:46 +01:00
$( call print_two_args,Preprocessing:,$<,$@ )
2024-04-20 02:23:18 +02:00
$( V) $( CPP) $( CPPFLAGS) $< > $@
2022-02-06 19:40:26 +00:00
2024-03-04 16:06:26 -08:00
$(BUILD_DIR)/baserom/%.o : $( EXTRACTED_DIR ) /baserom /%
2025-01-07 17:38:46 +01:00
$( call print_two_args,Wrapping binary to ELF:,$<,$@ )
2024-05-17 06:35:01 -07:00
$( V) $( OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/F3DEX3/%.o : F 3DEX 3/%
2025-01-07 17:38:46 +01:00
$( call print_two_args,Wrapping binary to ELF:,$<,$@ )
2024-05-17 06:35:01 -07:00
$( V) mkdir -p $( BUILD_DIR) /F3DEX3
2024-04-20 02:23:18 +02:00
$( V) $( OBJCOPY) -I binary -O elf32-big $< $@
2020-03-17 00:31:30 -04:00
2024-01-05 14:27:19 -08:00
$(BUILD_DIR)/data/%.o : data /%.s
2025-01-07 17:38:46 +01:00
$( call print_two_args,Assembling:,$<,$@ )
2024-07-30 00:36:11 +02:00
$( V) $( CPP) $( CPPFLAGS) -Iinclude $< | $( AS) $( ASFLAGS) -o $@
2020-03-17 00:31:30 -04:00
2024-12-25 17:07:08 +00:00
i f e q ( $( PLATFORM ) , I Q U E )
NES_CHARMAP := assets/text/charmap.chn.txt
e l s e
NES_CHARMAP := assets/text/charmap.nes.txt
e n d i f
$(BUILD_DIR)/assets/text/%.enc.nes.h : assets /text /%.h $( EXTRACTED_DIR ) /text /%.h $( NES_CHARMAP )
2025-01-07 17:38:46 +01:00
$( call print_two_args,Encoding:,$<,$@ )
2025-01-06 02:32:45 +01:00
$( V) $( CPP) $( CPPFLAGS) -I$( EXTRACTED_DIR) $< | $( PYTHON) tools/msgenc.py --encoding utf-8 --charmap $( NES_CHARMAP) - $@
2024-07-03 03:42:52 +01:00
2024-12-25 17:07:08 +00:00
$(BUILD_DIR)/assets/text/%.enc.jpn.h : assets /text /%.h $( EXTRACTED_DIR ) /text /%.h assets /text /charmap .jpn .txt
2025-01-07 17:38:46 +01:00
$( call print_two_args,Encoding:,$<,$@ )
2025-01-06 02:32:45 +01:00
$( V) $( CPP) $( CPPFLAGS) -I$( EXTRACTED_DIR) $< | $( PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
2023-10-20 18:14:52 +01:00
# Dependencies for files including message data headers
# TODO remove when full header dependencies are used.
2024-07-03 03:42:52 +01:00
$(BUILD_DIR)/assets/text/jpn_message_data_static.o : $( BUILD_DIR ) /assets /text /message_data .enc .jpn .h
$(BUILD_DIR)/assets/text/nes_message_data_static.o : $( BUILD_DIR ) /assets /text /message_data .enc .nes .h
$(BUILD_DIR)/assets/text/ger_message_data_static.o : $( BUILD_DIR ) /assets /text /message_data .enc .nes .h
$(BUILD_DIR)/assets/text/fra_message_data_static.o : $( BUILD_DIR ) /assets /text /message_data .enc .nes .h
$(BUILD_DIR)/assets/text/staff_message_data_static.o : $( BUILD_DIR ) /assets /text /message_data_staff .enc .nes .h
2024-07-06 12:38:31 -07:00
$(BUILD_DIR)/src/code/z_message.o : assets /text /message_data .h assets /text /message_data_staff .h
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
2024-06-24 23:37:48 +02:00
$(BUILD_DIR)/assets/text/%.o : assets /text /%.c
2025-01-07 17:38:46 +01:00
$( call print_two_args,Compiling:,$<,$@ )
2024-06-24 23:37:48 +02:00
$( V) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -o $@ $<
2024-08-19 13:06:37 +02:00
$( V) $( OBJCOPY) -O binary --only-section .rodata $@ $@ .bin
2024-06-24 23:37:48 +02:00
2024-07-23 23:47:00 +01:00
$(BUILD_DIR)/assets/%.o : assets /%.c
2025-01-06 02:32:45 +01:00
$( call print,Compiling:,$<,$@ )
$( V) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -o $@ $<
$( V) $( OBJCOPY_CMD)
2024-07-23 23:47:00 +01:00
2024-06-24 23:37:48 +02:00
$(BUILD_DIR)/assets/%.o : $( EXTRACTED_DIR ) /assets /%.c
2025-01-07 17:38:46 +01:00
$( call print_two_args,Compiling:,$<,$@ )
2024-04-20 02:23:18 +02:00
$( V) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -o $@ $<
2025-01-06 02:32:45 +01:00
$( V) $( OBJCOPY_CMD)
2024-12-28 20:18:45 +00:00
# Assemble the ROM header with GNU AS always
$(BUILD_DIR)/src/makerom/rom_header.o : src /makerom /rom_header .s
2025-01-06 02:32:45 +01:00
$( call print,Compiling:,$<,$@ )
$( V) $( CCAS) -c $( CCASFLAGS) $( MIPS_VERSION) $( ASOPTFLAGS) -o $@ $<
$( V) $( OBJDUMP_CMD)
2024-12-28 20:18:45 +00:00
$(BUILD_DIR)/src/makerom/ipl3.o : $( EXTRACTED_DIR ) /incbin /ipl 3
2025-01-06 02:32:45 +01:00
$( call print,Compiling:,$<,$@ )
$( V) $( OBJCOPY) -I binary -O elf32-big --rename-section .data= .text $< $@
2020-03-17 00:31:30 -04:00
2024-01-05 14:27:19 -08:00
$(BUILD_DIR)/src/%.o : src /%.s
2025-01-07 17:38:46 +01:00
$( call print_two_args,Compiling:,$<,$@ )
2025-01-06 02:32:45 +01:00
$( V) $( CCAS) -c $( CCASFLAGS) $( MIPS_VERSION) $( ASOPTFLAGS) -o $@ $<
2025-01-06 12:34:01 +01:00
$( V) $( POSTPROCESS_OBJ) $@
2025-01-06 02:32:45 +01:00
$( V) $( OBJDUMP_CMD)
2022-06-03 21:33:18 +01:00
2024-08-19 09:16:04 -07:00
# Incremental link to move z_message and z_game_over data into rodata
$(BUILD_DIR)/src/code/z_message_z_game_over.o : $( BUILD_DIR ) /src /code /z_message .o $( BUILD_DIR ) /src /code /z_game_over .o
2025-02-11 17:05:12 +01:00
$( V) $( LD) -r -G 0 -T linker_scripts/data_with_rodata.ld -o $@ $^
$( V) $( PYTHON) tools/patch_data_with_rodata_mdebug.py $@
2024-08-19 09:16:04 -07:00
2025-01-28 17:23:01 +01:00
$(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt : $( BUILD_DIR ) /spec
2024-04-20 02:23:18 +02:00
$( V) $( MKDMADATA) $< $( BUILD_DIR) /dmadata_table_spec.h $( BUILD_DIR) /compress_ranges.txt
2021-11-30 23:29:09 +00:00
2023-10-20 18:14:52 +01:00
# Dependencies for files that may include the dmadata header automatically generated from the spec file
2024-01-05 14:27:19 -08:00
$(BUILD_DIR)/src/boot/z_std_dma.o : $( BUILD_DIR ) /dmadata_table_spec .h
$(BUILD_DIR)/src/dmadata/dmadata.o : $( BUILD_DIR ) /dmadata_table_spec .h
2021-11-30 23:29:09 +00:00
2023-10-20 18:14:52 +01:00
# Dependencies for files including from include/tables/
# TODO remove when full header dependencies are used.
2024-01-05 14:27:19 -08:00
$(BUILD_DIR)/src/code/graph.o : include /tables /gamestate_table .h
$(BUILD_DIR)/src/code/object_table.o : include /tables /object_table .h
$(BUILD_DIR)/src/code/z_actor.o : include /tables /actor_table .h # so uses of ACTOR_ID_MAX update when the table length changes
$(BUILD_DIR)/src/code/z_actor_dlftbls.o : include /tables /actor_table .h
$(BUILD_DIR)/src/code/z_effect_soft_sprite_dlftbls.o : include /tables /effect_ss_table .h
$(BUILD_DIR)/src/code/z_game_dlftbls.o : include /tables /gamestate_table .h
$(BUILD_DIR)/src/code/z_scene_table.o : include /tables /scene_table .h include /tables /entrance_table .h
2024-09-15 23:26:27 +01:00
$(BUILD_DIR)/src/audio/general.o : $( SEQUENCE_TABLE ) include /tables /sfx /*.h
$(BUILD_DIR)/src/audio/sfx_params.o : include /tables /sfx /*.h
2024-01-05 14:27:19 -08:00
$(BUILD_DIR)/src/%.o : src /%.c
2024-02-01 21:08:45 +01:00
i f n e q ( $( RUN_CC_CHECK ) , 0 )
2024-04-20 02:23:18 +02:00
$( V) $( CC_CHECK) $<
2024-02-01 21:08:45 +01:00
e n d i f
2025-01-07 17:38:46 +01:00
$( call print_two_args,Compiling:,$<,$@ )
2025-02-11 17:05:12 +01:00
$( V) $( PREPROCESS) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -o $@ $<
2025-01-06 12:34:01 +01:00
$( V) $( POSTPROCESS_OBJ) $@
2025-01-06 02:32:45 +01:00
$( V) $( OBJDUMP_CMD)
2021-01-31 11:27:50 -07:00
2024-12-21 01:41:14 +00:00
$(BUILD_DIR)/src/audio/session_init.o : src /audio /session_init .c $( BUILD_DIR ) /assets /audio /soundfont_sizes .h $( BUILD_DIR ) /assets /audio /sequence_sizes .h
2024-02-01 21:08:45 +01:00
i f n e q ( $( RUN_CC_CHECK ) , 0 )
2024-04-20 02:23:18 +02:00
$( V) $( CC_CHECK) $<
2024-02-01 21:08:45 +01:00
e n d i f
2025-01-07 17:38:46 +01:00
$( call print_two_args,Compiling:,$<,$@ )
2025-01-06 02:32:45 +01:00
$( V) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -o $( @:.o= .tmp) $<
$( V) $( LD) -r -T linker_scripts/data_with_rodata.ld -o $@ $( @:.o= .tmp)
2025-02-11 17:05:12 +01:00
$( V) $( PYTHON) tools/patch_data_with_rodata_mdebug.py $@
2024-12-21 01:41:14 +00:00
@$( OBJDUMP) $( OBJDUMP_FLAGS) $@ > $( @:.o= .s)
2025-02-04 11:55:04 +00:00
i f e q ( $( PLATFORM ) , I Q U E )
i f n e q ( $( NON_MATCHING ) , 1 )
$(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/ovl_kaleido_scope_reloc.o : POSTPROCESS_OBJ := $( PYTHON ) tools /patch_ique_kaleido_reloc .py
e n d i f
e n d i f
2020-05-27 00:48:07 -07:00
2025-01-28 17:23:01 +01:00
$(BUILD_DIR)/src/overlays/%_reloc.o : $( BUILD_DIR ) /spec
2025-01-07 17:38:46 +01:00
$( call print_two_args,Generating Relocation:,$<,$@ )
2024-04-20 02:23:18 +02:00
$( V) $( FADO) $$ ( tools/reloc_prereq $< $( notdir $* ) ) -n $( notdir $* ) -o $( @:.o= .s) -M $( @:.o= .d)
2025-02-11 17:05:12 +01:00
$( V) $( POSTPROCESS_OBJ) $( @:.o= .s)
2024-04-20 02:23:18 +02:00
$( V) $( AS) $( ASFLAGS) $( @:.o= .s) -o $@
2022-02-06 19:40:26 +00:00
2024-07-23 23:47:00 +01:00
$(BUILD_DIR)/assets/%.inc.c : assets /%.png
2025-02-19 15:55:51 +01:00
$( V) $( N64TEXCONV) $( subst .,,$( suffix $* ) ) " $( findstring u32,$( subst .,,$( suffix $( basename $* ) ) ) ) " $< $@ $( @:.inc.c= .pal.inc.c)
2024-07-23 23:47:00 +01:00
2024-06-24 23:37:48 +02:00
$(BUILD_DIR)/assets/%.inc.c : $( EXTRACTED_DIR ) /assets /%.png
2025-02-19 15:55:51 +01:00
$( V) $( N64TEXCONV) $( subst .,,$( suffix $* ) ) " $( findstring u32,$( subst .,,$( suffix $( basename $* ) ) ) ) " $< $@ $( @:.inc.c= .pal.inc.c)
2020-03-17 00:31:30 -04:00
2024-07-23 23:47:00 +01:00
$(BUILD_DIR)/assets/%.bin.inc.c : assets /%.bin
2025-02-19 15:55:51 +01:00
$( V) $( BIN2C) -t 1 $< $@
2024-07-23 23:47:00 +01:00
2024-06-24 23:37:48 +02:00
$(BUILD_DIR)/assets/%.bin.inc.c : $( EXTRACTED_DIR ) /assets /%.bin
2025-02-19 15:55:51 +01:00
$( V) $( BIN2C) -t 1 $< $@
2021-04-02 19:07:29 -03:00
2024-07-23 23:47:00 +01:00
$(BUILD_DIR)/assets/%.jpg.inc.c : assets /%.jpg
2025-02-19 15:55:51 +01:00
$( V) $( N64TEXCONV) JFIF "" $< $@
2024-07-23 23:47:00 +01:00
2024-06-24 23:37:48 +02:00
$(BUILD_DIR)/assets/%.jpg.inc.c : $( EXTRACTED_DIR ) /assets /%.jpg
2025-02-19 15:55:51 +01:00
$( V) $( N64TEXCONV) JFIF "" $< $@
2021-05-02 22:21:27 +02:00
2024-05-17 06:35:01 -07:00
F3DEX3/f3dzex2.code :
$( V) $( PYTHON) tools/data_extractor.py --start 0xBCD0F0 --size 0x1630 --input $( BASEROM_DIR) /baserom-decompressed.z64 --output $@
F3DEX3/f3dzex2.data :
$( V) $( PYTHON) tools/data_extractor.py --start 0xBCE720 --size 0x420 --input $( BASEROM_DIR) /baserom-decompressed.z64 --output $@
F3DEX3/F3DEX3%.code : F 3DEX 3/F 3DEX 3%.code .bps F 3DEX 3/f 3dzex 2.code
$( V) $( FLIPS) --apply F3DEX3/F3DEX3$* .code.bps F3DEX3/f3dzex2.code $@
F3DEX3/F3DEX3%.data : F 3DEX 3/F 3DEX 3%.data .bps F 3DEX 3/f 3dzex 2.data
$( V) $( FLIPS) --apply F3DEX3/F3DEX3$* .data.bps F3DEX3/f3dzex2.data $@
.PRECIOUS : $( UCODE_FILES )
2024-08-11 16:41:33 +01:00
# Audio
AUDIO_BUILD_DEBUG ?= 0
2024-08-28 02:09:59 +01:00
i f e q ( $( AUDIO_BUILD_DEBUG ) , 1 )
# for debugging only, make soundfonts depend on samplebanks so they can be linked against
$( BUILD_DIR) /assets/audio/soundfonts/%.o: $( SAMPLEBANK_O_FILES)
e n d i f
2024-08-11 16:41:33 +01:00
# first build samples...
2024-08-15 01:54:31 +01:00
.PRECIOUS : $( BUILD_DIR ) /assets /audio /samples /%.aifc
.PRECIOUS : $( BUILD_DIR ) /assets /audio /samples /%.half .aifc
2024-08-11 16:41:33 +01:00
$(BUILD_DIR)/assets/audio/samples/%.half.aifc : assets /audio /samples /%.half .wav
2025-01-07 17:38:46 +01:00
$( call print_two_args,Building Sample:,$<,$@ )
2024-08-19 13:06:37 +02:00
$( V) $( SAMPLECONV) vadpcm-half $< $@
2024-08-11 16:41:33 +01:00
$(BUILD_DIR)/assets/audio/samples/%.half.aifc : $( EXTRACTED_DIR ) /assets /audio /samples /%.half .wav
2025-01-07 17:38:46 +01:00
$( call print_two_args,Building Sample:,$<,$@ )
2024-08-19 13:06:37 +02:00
$( V) $( SAMPLECONV) vadpcm-half $< $@
2024-08-11 16:41:33 +01:00
i f e q ( $( AUDIO_BUILD_DEBUG ) , 1 )
@( cmp $( <D) /aifc/$( <F:.half.wav= .half.aifc) $@ && echo " $( <F) OK " ) || ( mkdir -p NONMATCHINGS/$( <D) && cp $( <D) /aifc/$( <F:.half.wav= .half.aifc) NONMATCHINGS/$( <D) /$( <F:.half.wav= .half.aifc) )
e n d i f
$(BUILD_DIR)/assets/audio/samples/%.aifc : assets /audio /samples /%.wav
2025-01-07 17:38:46 +01:00
$( call print_two_args,Building Sample:,$<,$@ )
2024-08-19 13:06:37 +02:00
$( V) $( SAMPLECONV) vadpcm $< $@
2024-08-11 16:41:33 +01:00
$(BUILD_DIR)/assets/audio/samples/%.aifc : $( EXTRACTED_DIR ) /assets /audio /samples /%.wav
2025-01-07 17:38:46 +01:00
$( call print_two_args,Building Sample:,$<,$@ )
2024-08-19 13:06:37 +02:00
$( V) $( SAMPLECONV) vadpcm $< $@
2024-08-11 16:41:33 +01:00
i f e q ( $( AUDIO_BUILD_DEBUG ) , 1 )
@( cmp $( <D) /aifc/$( <F:.wav= .aifc) $@ && echo " $( <F) OK " ) || ( mkdir -p NONMATCHINGS/$( <D) && cp $( <D) /aifc/$( <F:.wav= .aifc) NONMATCHINGS/$( <D) /$( <F:.wav= .aifc) )
e n d i f
2024-08-15 01:54:31 +01:00
# then assemble the samplebanks...
.PRECIOUS : $( BUILD_DIR ) /assets /audio /samplebanks /%.xml
$(BUILD_DIR)/assets/audio/samplebanks/%.xml : assets /audio /samplebanks /%.xml
2024-08-19 13:06:37 +02:00
$( V) cat $< | $( BUILD_DIR_REPLACE) > $@
2024-08-15 01:54:31 +01:00
$(BUILD_DIR)/assets/audio/samplebanks/%.xml : $( EXTRACTED_DIR ) /assets /audio /samplebanks /%.xml
2024-08-19 13:06:37 +02:00
$( V) cat $< | $( BUILD_DIR_REPLACE) > $@
2024-08-15 01:54:31 +01:00
.PRECIOUS : $( BUILD_DIR ) /assets /audio /samplebanks /%.s
$(BUILD_DIR)/assets/audio/samplebanks/%.s : $( BUILD_DIR ) /assets /audio /samplebanks /%.xml | $( AIFC_FILES )
2024-08-19 13:06:37 +02:00
$( V) $( SBC) $( SBCFLAGS) --makedepend $( @:.s= .d) $< $@
2024-08-15 01:54:31 +01:00
- i n c l u d e $( SAMPLEBANK_DEP_FILES )
$(BUILD_DIR)/assets/audio/samplebanks/%.o : $( BUILD_DIR ) /assets /audio /samplebanks /%.s
2025-01-07 17:38:46 +01:00
$( call print_two_args,Assembling Samplebank:,$<,$@ )
2024-08-19 13:06:37 +02:00
$( V) $( AS) $( ASFLAGS) $< -o $@
2024-08-15 01:54:31 +01:00
i f e q ( $( AUDIO_BUILD_DEBUG ) , 1 )
2025-01-07 17:38:46 +01:00
$( V) $( OBJCOPY) -O binary --only-section .rodata $@ $( @:.o= .bin)
2024-08-15 01:54:31 +01:00
@cmp $( @:.o= .bin) $( patsubst $( BUILD_DIR) /assets/audio/samplebanks/%,$( EXTRACTED_DIR) /baserom_audiotest/audiotable_files/%,$( @:.o= .bin) ) && echo " $( <F) OK "
e n d i f
2024-08-28 02:09:59 +01:00
# also assemble the soundfonts and generate the associated headers...
$(BUILD_DIR)/assets/audio/soundfonts/%.xml : assets /audio /soundfonts /%.xml
2025-01-07 17:38:46 +01:00
$( V) cat $< | $( BUILD_DIR_REPLACE) > $@
2024-08-28 02:09:59 +01:00
$(BUILD_DIR)/assets/audio/soundfonts/%.xml : $( EXTRACTED_DIR ) /assets /audio /soundfonts /%.xml
2025-01-07 17:38:46 +01:00
$( V) cat $< | $( BUILD_DIR_REPLACE) > $@
2024-08-28 02:09:59 +01:00
.PRECIOUS : $( BUILD_DIR ) /assets /audio /soundfonts /%.c $( BUILD_DIR ) /assets /audio /soundfonts /%.h $( BUILD_DIR ) /assets /audio /soundfonts /%.name
$(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.h $(BUILD_DIR)/assets/audio/soundfonts/%.name : $( BUILD_DIR ) /assets /audio /soundfonts /%.xml | $( SAMPLEBANK_BUILD_XMLS ) $( AIFC_FILES )
# This rule can be triggered for either the .c or .h file, so $@ may refer to either the .c or .h file. A simple
# substitution $(@:.c=.h) will fail ~50% of the time with -j. Instead, don't assume anything about the suffix of $@.
2025-01-07 17:38:46 +01:00
$( V) $( SFC) $( SFCFLAGS) --makedepend $( basename $@ ) .d $< $( basename $@ ) .c $( basename $@ ) .h $( basename $@ ) .name
2024-08-28 02:09:59 +01:00
- i n c l u d e $( SOUNDFONT_DEP_FILES )
$(BUILD_DIR)/assets/audio/soundfonts/%.o : $( BUILD_DIR ) /assets /audio /soundfonts /%.c $( BUILD_DIR ) /assets /audio /soundfonts /%.name
# compile c to unlinked object
2025-01-07 17:38:46 +01:00
$( V) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -I include/audio -o $( @:.o= .tmp) $<
2024-08-28 02:09:59 +01:00
# partial link
2025-01-07 17:38:46 +01:00
$( V) $( LD) -r -T linker_scripts/soundfont.ld $( @:.o= .tmp) -o $( @:.o= .tmp2)
2024-08-28 02:09:59 +01:00
# patch defined symbols to be ABS symbols so that they remain file-relative offsets forever
2025-01-07 17:38:46 +01:00
$( V) $( SFPATCH) $( @:.o= .tmp2) $( @:.o= .tmp2)
2024-08-28 02:09:59 +01:00
# write start and size symbols afterwards, filename != symbolic name so source symbolic name from the .name file written by sfc
2024-12-14 00:26:36 +00:00
# also write a .note.name section containing the symbolic name of the soundfont
2025-01-07 17:38:46 +01:00
$( V) $( OBJCOPY) --add-symbol $$ ( cat $( <:.c= .name) | tr -d '\0' ) _Start = .rodata:0,global --redefine-sym __LEN__ = $$ ( cat $( <:.c= .name) | tr -d '\0' ) _Size --add-section .note.name= $( <:.c= .name) $( @:.o= .tmp2) $@
2024-08-28 02:09:59 +01:00
# cleanup temp files
@$( RM) $( @:.o= .tmp) $( @:.o= .tmp2)
i f e q ( $( AUDIO_BUILD_DEBUG ) , 1 )
2025-01-07 17:38:46 +01:00
$( V) $( LD) $( foreach f,$( SAMPLEBANK_O_FILES) ,-R $f ) -T linker_scripts/soundfont.ld $@ -o $( @:.o= .elf)
$( V) $( OBJCOPY) -O binary -j.rodata $( @:.o= .elf) $( @:.o= .bin)
2024-08-28 02:09:59 +01:00
@( cmp $( @:.o= .bin) $( patsubst $( BUILD_DIR) /assets/audio/soundfonts/%,$( EXTRACTED_DIR) /baserom_audiotest/audiobank_files/%,$( @:.o= .bin) ) && echo " $( <F) OK " || ( mkdir -p NONMATCHINGS/soundfonts && cp $( @:.o= .bin) NONMATCHINGS/soundfonts/$( @F:.o= .bin) ) )
e n d i f
2024-09-15 23:26:27 +01:00
# then assemble the sequences...
$(BUILD_DIR)/assets/audio/sequences/%.o : assets /audio /sequences /%.seq include /audio /aseq .h $( SEQUENCE_TABLE ) | $( SOUNDFONT_HEADERS )
2025-01-07 17:38:46 +01:00
$( V) $( SEQ_CPP) $( SEQ_CPPFLAGS) $< -o $( @:.o= .s) -MMD -MT $@
$( V) $( AS) $( ASFLAGS) -I $( BUILD_DIR) /assets/audio/soundfonts -I include/audio -I $( dir $<) $( @:.o= .s) -o $@
2024-09-15 23:26:27 +01:00
$(BUILD_DIR)/assets/audio/sequences/%.o : $( EXTRACTED_DIR ) /assets /audio /sequences /%.seq include /audio /aseq .h $( SEQUENCE_TABLE ) | $( SOUNDFONT_HEADERS )
2025-01-07 17:38:46 +01:00
$( V) $( SEQ_CPP) $( SEQ_CPPFLAGS) $< -o $( @:.o= .s) -MMD -MT $@
$( V) $( AS) $( ASFLAGS) -I $( BUILD_DIR) /assets/audio/soundfonts -I include/audio -I $( dir $<) $( @:.o= .s) -o $@
2024-09-15 23:26:27 +01:00
i f e q ( $( AUDIO_BUILD_DEBUG ) , 1 )
2025-01-07 17:38:46 +01:00
$( V) $( OBJCOPY) -O binary -j.data $@ $( @:.o= .aseq)
2024-09-15 23:26:27 +01:00
@( cmp $( @:.o= .aseq) $( patsubst $( BUILD_DIR) /assets/audio/sequences/%,$( EXTRACTED_DIR) /baserom_audiotest/audioseq_files/%,$( @:.o= .aseq) ) && echo " $( <F) OK " || ( mkdir -p NONMATCHINGS/sequences && cp $( @:.o= .aseq) NONMATCHINGS/sequences/$( @F:.o= .aseq) ) )
e n d i f
- i n c l u d e $( SEQUENCE_DEP_FILES )
2024-08-17 22:42:15 +01:00
# put together the tables
$(BUILD_DIR)/assets/audio/samplebank_table.h : $( SAMPLEBANK_BUILD_XMLS )
2024-08-19 13:06:37 +02:00
$( V) $( ATBLGEN) --banks $@ $^
2024-08-17 22:42:15 +01:00
2024-08-28 02:09:59 +01:00
$(BUILD_DIR)/assets/audio/soundfont_table.h : $( SOUNDFONT_BUILD_XMLS ) $( SAMPLEBANK_BUILD_XMLS )
2025-01-07 17:38:46 +01:00
$( V) $( ATBLGEN) --fonts $@ $( SOUNDFONT_BUILD_XMLS)
2024-08-28 02:09:59 +01:00
2024-09-15 23:26:27 +01:00
SEQ_ORDER_DEFS := -DDEFINE_SEQUENCE_PTR\( name,seqId,_2,_3,_4\) = *\( name,seqId\) \
-DDEFINE_SEQUENCE\( name,seqId,_2,_3,_4\) = \( name,seqId\)
$(BUILD_DIR)/assets/audio/sequence_order.in : $( SEQUENCE_TABLE )
2025-01-07 17:38:46 +01:00
$( V) $( CPP) $( CPPFLAGS) $< $( SEQ_ORDER_DEFS) -o $@
2024-09-15 23:26:27 +01:00
$(BUILD_DIR)/assets/audio/sequence_font_table.s : $( BUILD_DIR ) /assets /audio /sequence_order .in $( SEQUENCE_O_FILES )
2025-01-07 17:38:46 +01:00
$( V) $( ATBLGEN) --sequences $@ $^
2024-09-15 23:26:27 +01:00
2024-08-17 22:42:15 +01:00
# build the tables into objects, move data -> rodata
$(BUILD_DIR)/src/audio/tables/samplebank_table.o : src /audio /tables /samplebank_table .c $( BUILD_DIR ) /assets /audio /samplebank_table .h
2024-08-28 02:09:59 +01:00
$(BUILD_DIR)/src/audio/tables/soundfont_table.o : src /audio /tables /soundfont_table .c $( BUILD_DIR ) /assets /audio /soundfont_table .h $( SOUNDFONT_HEADERS )
2024-09-15 23:26:27 +01:00
$(BUILD_DIR)/src/audio/tables/sequence_table.o : src /audio /tables /sequence_table .c $( SEQUENCE_TABLE )
$(BUILD_DIR)/src/audio/tables/sequence_table.o : CFLAGS += -I include /tables
$(BUILD_DIR)/src/audio/tables/%.o : src /audio /tables /%.c
2024-08-17 22:42:15 +01:00
i f n e q ( $( RUN_CC_CHECK ) , 0 )
2024-08-19 13:06:37 +02:00
$( V) $( CC_CHECK) $<
2024-08-17 22:42:15 +01:00
e n d i f
2024-08-19 13:06:37 +02:00
$( V) $( CC) -c $( CFLAGS) $( MIPS_VERSION) $( OPTFLAGS) -o $( @:.o= .tmp) $<
2024-08-28 13:09:20 +02:00
$( V) $( LD) -r -T linker_scripts/data_with_rodata.ld $( @:.o= .tmp) -o $@
2025-02-11 17:05:12 +01:00
$( V) $( PYTHON) tools/patch_data_with_rodata_mdebug.py $@
2024-08-17 22:42:15 +01:00
@$( RM) $( @:.o= .tmp)
2024-09-15 23:26:27 +01:00
$(BUILD_DIR)/assets/audio/sequence_font_table.o : $( BUILD_DIR ) /assets /audio /sequence_font_table .s
2025-01-07 17:38:46 +01:00
$( V) $( AS) $( ASFLAGS) $< -o $@
2024-08-28 02:09:59 +01:00
2024-12-14 00:26:36 +00:00
# make headers with file sizes and amounts
$(BUILD_DIR)/assets/audio/soundfont_sizes.h : $( SOUNDFONT_O_FILES )
2025-01-07 17:38:46 +01:00
$( V) $( AFILE_SIZES) $@ NUM_SOUNDFONTS SOUNDFONT_SIZES .rodata $^
2024-12-14 00:26:36 +00:00
$(BUILD_DIR)/assets/audio/sequence_sizes.h : $( SEQUENCE_O_FILES )
2025-01-07 17:38:46 +01:00
$( V) $( AFILE_SIZES) $@ NUM_SEQUENCES SEQUENCE_SIZES .data $^
2024-12-14 00:26:36 +00:00
2024-08-28 02:09:59 +01:00
# Extra audiobank padding that doesn't belong to any soundfont file
$(BUILD_DIR)/assets/audio/audiobank_padding.o :
2025-01-07 17:38:46 +01:00
$( V) echo ".section .rodata; .fill 0x20" | $( AS) $( ASFLAGS) -o $@
2024-08-28 02:09:59 +01:00
2021-05-02 22:21:27 +02:00
- i n c l u d e $( DEP_FILES )
2024-01-24 15:00:10 -03:00
# Print target for debugging
print-% : ; $( info $ * is a $ ( flavor $ *) variable set to [$ ( $ *) ]) @true