mirror of
https://github.com/SAT-R/sa2.git
synced 2026-10-28 09:43:38 +00:00
sa1: use sa2 makefile, fix port
This commit is contained in:
1 parent
7342e21d8c
commit
6dae6451ed
9 files changed
+147
-864
No files matched your search
@@ -153,38 +153,45 @@ ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR)
|
||||
C_SUBDIR = src
|
||||
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
|
||||
|
||||
DATA_ASM_SUBDIR = data/sa2
|
||||
DATA_ASM_SUBDIR = data/$(GAME_NAME)
|
||||
DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
|
||||
|
||||
SONG_SUBDIR = sound/sa2/songs
|
||||
SONG_SUBDIR = sound/$(GAME_NAME)/songs
|
||||
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
|
||||
|
||||
SOUND_ASM_SUBDIR = sound
|
||||
SOUND_ASM_BUILDDIR = $(OBJ_DIR)/$(SOUND_ASM_SUBDIR)
|
||||
|
||||
MID_SUBDIR = sound/sa2/songs/midi
|
||||
MID_SUBDIR = sound/$(GAME_NAME)/songs/midi
|
||||
MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
|
||||
|
||||
SAMPLE_SUBDIR = sound/sa2/direct_sound_samples
|
||||
SAMPLE_SUBDIR = sound/$(GAME_NAME)/direct_sound_samples
|
||||
|
||||
OBJ_TILES_4BPP_SUBDIR = graphics/sa2/obj_tiles/4bpp
|
||||
TILESETS_SUBDIR = graphics/sa2/tilesets/
|
||||
OBJ_TILES_4BPP_SUBDIR = graphics/$(GAME_NAME)/obj_tiles/4bpp
|
||||
TILESETS_SUBDIR = graphics/$(GAME_NAME)/tilesets/
|
||||
|
||||
ifeq ($(GAME), GAME_SA1)
|
||||
C_SRC_IGNORE_PATHS := -not -path "*/sa2/*"
|
||||
else ifeq ($(GAME), GAME_SA2)
|
||||
C_SRC_IGNORE_PATHS := -not -path "*/sa1/*"
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS) -not -path "*/platform/*")
|
||||
else ifeq ($(PLATFORM),sdl)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS) -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
else ifeq ($(PLATFORM),sdl_psp)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS) -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
else ifeq ($(PLATFORM),ps2)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/pret_sdl/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS) -not -path "*/platform/win32/*" -not -path "*/platform/pret_sdl/*")
|
||||
else ifeq ($(PLATFORM),sdl_win32)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS) -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
else ifeq ($(PLATFORM),win32)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/pret_sdl/*" -not -path "*/platform/ps2/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS) -not -path "*/platform/pret_sdl/*" -not -path "*/platform/ps2/*")
|
||||
else
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*")
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" $(C_SRC_IGNORE_PATHS))
|
||||
endif
|
||||
|
||||
C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src)))
|
||||
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
|
||||
|
||||
@@ -245,7 +252,7 @@ ifeq ($(PLATFORM),gba)
|
||||
CPPFLAGS += -D PLATFORM_GBA=1 -D PLATFORM_SDL=0 -D PLATFORM_WIN32=0 -D CPU_ARCH_X86=0 -D CPU_ARCH_ARM=1 -nostdinc -I tools/agbcc/include
|
||||
CC1FLAGS += -fhex-asm
|
||||
|
||||
ifeq ($(BUILD_NAME), sa1)
|
||||
ifeq ($(GAME_NAME), sa1)
|
||||
# It seems this bug was introduced to GCC after SA1 released.
|
||||
PROLOGUE_FIX := -fprologue-bugfix
|
||||
endif # BUILD_NAME == sa1
|
||||
@@ -437,7 +444,6 @@ tool_libs:
|
||||
clean: tidy clean-tools
|
||||
@$(MAKE) clean -C tools/BriBaSA_ex
|
||||
@$(MAKE) clean -C chao_garden
|
||||
@$(MAKE) clean -f sa1_Makefile
|
||||
@$(MAKE) clean -C multi_boot/subgame_bootstrap
|
||||
@$(MAKE) clean -C multi_boot/programs/subgame_loader
|
||||
@$(MAKE) clean -C multi_boot/collect_rings
|
||||
@@ -446,6 +452,10 @@ clean: tidy clean-tools
|
||||
$(RM) $(SAMPLE_SUBDIR)/*.bin $(MID_SUBDIR)/*.s
|
||||
find . \( -iwholename './data/*/maps/*/*/entities/*.bin' -o -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec $(RM) {} +
|
||||
|
||||
ifneq ($(GAME_NAME),sa1)
|
||||
@$(MAKE) clean GAME_NAME=sa1
|
||||
endif
|
||||
|
||||
clean-tools:
|
||||
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
|
||||
|
||||
@@ -478,7 +488,7 @@ win32: ; @$(MAKE) PLATFORM=win32 CPU_ARCH=i386
|
||||
|
||||
#### RECIPES ####
|
||||
|
||||
include songs.mk
|
||||
include $(GAME_NAME)_songs.mk
|
||||
include graphics.mk
|
||||
|
||||
%.s: ;
|
||||
@@ -494,17 +504,17 @@ include graphics.mk
|
||||
chao_garden/mb_chao_garden.gba.lz: chao_garden/mb_chao_garden.gba
|
||||
$(GFX) $< $@ -search 1
|
||||
|
||||
data/sa2/mb_chao_garden_japan.gba.lz: data/sa2/mb_chao_garden_japan.gba
|
||||
data/$(GAME_NAME)/mb_chao_garden_japan.gba.lz: data/$(GAME_NAME)/mb_chao_garden_japan.gba
|
||||
$(GFX) $< $@ -search 1
|
||||
|
||||
%interactables.bin: %interactables.csv
|
||||
$(ENT_POS) $< $@ -entities INTERACTABLES -header "./include/constants/sa2/interactables.h"
|
||||
$(ENT_POS) $< $@ -entities INTERACTABLES -header "./include/constants/$(GAME_NAME)/interactables.h"
|
||||
|
||||
%itemboxes.bin: %itemboxes.csv
|
||||
$(ENT_POS) $< $@ -entities ITEMS -header "./include/constants/sa2/items.h"
|
||||
$(ENT_POS) $< $@ -entities ITEMS -header "./include/constants/$(GAME_NAME)/items.h"
|
||||
|
||||
%enemies.bin: %enemies.csv
|
||||
$(ENT_POS) $< $@ -entities ENEMIES -header "./include/constants/sa2/enemies.h"
|
||||
$(ENT_POS) $< $@ -entities ENEMIES -header "./include/constants/$(GAME_NAME)/enemies.h"
|
||||
|
||||
%rings.bin: %rings.csv
|
||||
$(ENT_POS) $< $@ -entities RINGS
|
||||
@@ -666,7 +676,7 @@ bribasa:
|
||||
@$(MAKE) -C tools/BriBaSA_ex
|
||||
|
||||
sa1:
|
||||
@$(MAKE) -f sa1_Makefile
|
||||
@$(MAKE) GAME_NAME=sa1
|
||||
|
||||
$(TOOLDIRS): tool_libs
|
||||
@$(MAKE) -C $@
|
||||
|
||||
@@ -22,7 +22,13 @@ else
|
||||
$(error unknown arch: $(CPU_ARCH))
|
||||
endif
|
||||
|
||||
LDSCRIPT := ldscript
|
||||
# Default game variables
|
||||
GAME_REVISION ?= 0
|
||||
GAME_VARIANT ?= DEFAULT
|
||||
GAME_NAME ?= sa2
|
||||
DEBUG ?= 0
|
||||
|
||||
LDSCRIPT := $(GAME_NAME)_ldscript
|
||||
|
||||
NON_MATCHING ?= 0
|
||||
ifeq ($(PLATFORM),gba)
|
||||
@@ -50,22 +56,35 @@ else
|
||||
LDSCRIPT := $(LDSCRIPT).txt
|
||||
endif
|
||||
|
||||
# Default game variables
|
||||
GAME_REVISION ?= 0
|
||||
GAME_REGION ?= USA
|
||||
GAME_VARIANT ?= DEFAULT
|
||||
GAME ?= GAME_SA2
|
||||
DEBUG ?= 0
|
||||
|
||||
BUILD_NAME := $(GAME_NAME)
|
||||
|
||||
ifeq ($(GAME_NAME), sa1)
|
||||
# For gbafix
|
||||
MAKER_CODE := 6W
|
||||
|
||||
# Version
|
||||
TITLE := SONIC ADVANC
|
||||
GAME_CODE := ASO
|
||||
GAME := GAME_SA1
|
||||
GAME_REGION := EUROPE
|
||||
|
||||
PS2_GAME_CODE := SLUS_054.02
|
||||
|
||||
# TODO: enable decomp credits
|
||||
ENABLE_DECOMP_CREDITS := 0
|
||||
else ifeq ($(GAME_NAME), sa2)
|
||||
# For gbafix
|
||||
MAKER_CODE := 78
|
||||
|
||||
# Version
|
||||
BUILD_NAME := sa2
|
||||
TITLE := SONICADVANC2
|
||||
GAME_CODE := A2N
|
||||
GAME := GAME_SA2
|
||||
GAME_REGION := USA
|
||||
|
||||
PS2_GAME_CODE := SLUS_054.02
|
||||
endif
|
||||
|
||||
# Revision
|
||||
ifeq ($(GAME_REVISION), 0)
|
||||
@@ -89,10 +108,12 @@ ifeq ($(GAME_REGION), JAPAN)
|
||||
MAKER_CODE := 8P
|
||||
else
|
||||
ifeq ($(GAME_REGION), EUROPE)
|
||||
BUILD_NAME := $(BUILD_NAME)_europe
|
||||
GAME_CODE := $(GAME_CODE)P
|
||||
ifeq ($(GAME_NAME), sa2)
|
||||
BUILD_NAME := $(BUILD_NAME)_europe
|
||||
MAKER_CODE := 8P
|
||||
TITLE := SONIC ADVANC
|
||||
endif
|
||||
else
|
||||
$(error unknown region $(GAME_REGION))
|
||||
endif
|
||||
|
||||
-647
@@ -1,647 +0,0 @@
|
||||
#
|
||||
# NOTE: Overrideable default flags are set in config.mk
|
||||
#
|
||||
include sa1_config.mk
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
# Clear the default suffixes
|
||||
.SUFFIXES:
|
||||
# Don't delete intermediate files
|
||||
.SECONDARY:
|
||||
# Delete files that weren't built properly
|
||||
.DELETE_ON_ERROR:
|
||||
# Secondary expansion is required for dependency variables in object rules.
|
||||
.SECONDEXPANSION:
|
||||
|
||||
# Quotes must remain to ensure that paths with spaces are respected
|
||||
ROOT_DIR := "$(shell dirname "$(realpath $(firstword $(MAKEFILE_LIST)))")"
|
||||
OS := $(shell uname)
|
||||
|
||||
### TOOLCHAIN ###
|
||||
|
||||
# GBA
|
||||
ifeq ($(PLATFORM),gba)
|
||||
TOOLCHAIN := $(DEVKITARM)
|
||||
COMPARE ?= 0
|
||||
|
||||
ifeq (compare,$(MAKECMDGOALS))
|
||||
COMPARE := 1
|
||||
endif
|
||||
|
||||
# don't use dkP's base_tools anymore
|
||||
# because the redefinition of $(CC) conflicts
|
||||
# with when we want to use $(CC) to preprocess files
|
||||
# thus, manually create the variables for the bin
|
||||
# files, or use arm-none-eabi binaries on the system
|
||||
# if dkP is not installed on this system
|
||||
|
||||
ifneq (,$(TOOLCHAIN))
|
||||
ifneq ($(wildcard $(TOOLCHAIN)/bin),)
|
||||
export PATH := $(TOOLCHAIN)/bin:$(PATH)
|
||||
endif
|
||||
endif
|
||||
|
||||
PREFIX := arm-none-eabi-
|
||||
# x86
|
||||
else ifeq ($(CPU_ARCH),i386)
|
||||
ifeq ($(PLATFORM),sdl_win32)
|
||||
TOOLCHAIN := /usr/x86_64-w64-mingw32/
|
||||
PREFIX := x86_64-w64-mingw32-
|
||||
else ifeq ($(PLATFORM),win32)
|
||||
TOOLCHAIN := /usr/x86_64-w64-mingw32/
|
||||
PREFIX := x86_64-w64-mingw32-
|
||||
endif
|
||||
else
|
||||
# Native
|
||||
ifneq ($(PLATFORM),sdl)
|
||||
$(error Unsupported CPU arch for platform '$(CPU_ARCH)', '$(PLATFORM)')
|
||||
endif
|
||||
endif # (PLATFORM == gba)
|
||||
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
EXE := .exe
|
||||
else
|
||||
EXE :=
|
||||
endif
|
||||
|
||||
SHELL := /bin/bash -o pipefail
|
||||
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
CC1 := tools/agbcc/bin/agbcc$(EXE)
|
||||
CC1_OLD := tools/agbcc/bin/old_agbcc$(EXE)
|
||||
else
|
||||
CC1 := $(PREFIX)gcc$(EXE)
|
||||
CC1_OLD := $(CC1)
|
||||
endif
|
||||
|
||||
CPP := $(PREFIX)cpp
|
||||
LD := $(PREFIX)ld
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
AS := $(PREFIX)as
|
||||
|
||||
FORMAT := clang-format-13
|
||||
|
||||
### TOOLS ###
|
||||
GFX := tools/gbagfx/gbagfx$(EXE)
|
||||
ENT_POS := tools/entity_positions/entity_positions$(EXE)
|
||||
AIF := tools/aif2pcm/aif2pcm$(EXE)
|
||||
MID2AGB := tools/mid2agb/mid2agb$(EXE)
|
||||
SCANINC := tools/scaninc/scaninc$(EXE)
|
||||
PREPROC := tools/preproc/preproc$(EXE)
|
||||
RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE)
|
||||
FIX := tools/gbafix/gbafix$(EXE)
|
||||
|
||||
TOOLDIRS := $(filter-out tools/agbcc/ tools/BriBaSA_ex/, $(dir $(wildcard tools/*/Makefile)))
|
||||
TOOLBASE = $(TOOLDIRS:tools/%=%)
|
||||
TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
|
||||
|
||||
### DEPS ###
|
||||
|
||||
SDL_MINGW_PKG := $(ROOT_DIR)/ext/SDL2-2.30.3/x86_64-w64-mingw32
|
||||
SDL_MINGW_INCLUDE := $(SDL_MINGW_PKG)/include/SDL2
|
||||
SDL_MINGW_SDL_DLL := $(SDL_MINGW_PKG)/bin/SDL2.dll
|
||||
SDL_MINGW_LIB := $(SDL_MINGW_PKG)/lib
|
||||
SDL_MINGW_FLAGS := -I$(SDL_MINGW_INCLUDE) -D_THREAD_SAFE
|
||||
SDL_MINGW_LIBS := -L$(SDL_MINGW_LIB) -lSDL2main -lSDL2.dll
|
||||
|
||||
LIBABGSYSCALL_LIBS := -L$(ROOT_DIR)/libagbsyscall/build/gba -lagbsyscall
|
||||
|
||||
### FILES ###
|
||||
|
||||
OBJ_DIR := build/$(PLATFORM)/$(BUILD_NAME)
|
||||
ifeq ($(PLATFORM),gba)
|
||||
ROM := $(BUILD_NAME).gba
|
||||
ELF := $(ROM:.gba=.elf)
|
||||
MAP := $(ROM:.gba=.map)
|
||||
else ifeq ($(PLATFORM),sdl)
|
||||
ROM := $(BUILD_NAME).sdl
|
||||
ELF := $(ROM).elf
|
||||
MAP := $(ROM).map
|
||||
else
|
||||
ROM := $(BUILD_NAME).$(PLATFORM).exe
|
||||
ELF := $(ROM:.exe=.elf)
|
||||
MAP := $(ROM:.exe=.map)
|
||||
endif
|
||||
|
||||
INCLUDE_DIRS = include
|
||||
INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %)
|
||||
INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %)
|
||||
|
||||
SA2_INCLUDE_DIRS = include
|
||||
SA2_INCLUDE_CPP_ARGS := $(SA2_INCLUDE_DIRS:%=-iquote %)
|
||||
SA2_INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %)
|
||||
|
||||
ASM_SUBDIR = asm
|
||||
ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR)
|
||||
|
||||
C_SUBDIR = src
|
||||
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
|
||||
|
||||
DATA_ASM_SUBDIR = data/sa1
|
||||
DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
|
||||
|
||||
SONG_SUBDIR = sound/sa1/songs
|
||||
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
|
||||
|
||||
SOUND_ASM_SUBDIR = sound
|
||||
SOUND_ASM_BUILDDIR = $(OBJ_DIR)/$(SOUND_ASM_SUBDIR)
|
||||
|
||||
MID_SUBDIR = sound/sa1/songs/midi
|
||||
MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
|
||||
|
||||
SAMPLE_SUBDIR = sound/sa1/direct_sound_samples
|
||||
|
||||
OBJ_TILES_4BPP_SUBDIR = graphics/sa1/obj_tiles/4bpp
|
||||
TILESETS_SUBDIR = graphics/sa1/tilesets/
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*" -not -path "*/platform/*")
|
||||
else ifeq ($(PLATFORM),sdl)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
else ifeq ($(PLATFORM),sdl_psp)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
else ifeq ($(PLATFORM),ps2)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*" -not -path "*/platform/win32/*" -not -path "*/platform/pret_sdl/*")
|
||||
else ifeq ($(PLATFORM),sdl_win32)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
|
||||
else ifeq ($(PLATFORM),win32)
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*" -not -path "*/platform/pret_sdl/*" -not -path "*/platform/ps2/*")
|
||||
else
|
||||
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa2/*")
|
||||
endif
|
||||
C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src)))
|
||||
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
|
||||
|
||||
|
||||
# Platform not included as we only need the headers for decomp scratches
|
||||
C_HEADERS := $(shell find $(INCLUDE_DIRS) -name "*.h" -not -path "*/platform/*")
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
C_ASM_SRCS := $(shell find $(C_SUBDIR) -name "*.s")
|
||||
C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS))
|
||||
|
||||
endif
|
||||
|
||||
# TEMP SOLUTION UNTIL MAKEFILES ARE COMBINED
|
||||
# Moves any relevant sa2 c files to the build dir
|
||||
SA2_C_FILES :=
|
||||
|
||||
SA2_C_ASM_FILES :=
|
||||
|
||||
SA2_C_SRCS = $(patsubst %.c,$(OBJ_DIR)/sa2/%.c,$(SA2_C_FILES))
|
||||
SA2_C_OBJS = $(patsubst %.c,%.o,$(SA2_C_SRCS))
|
||||
|
||||
SA2_C_ASM_SRCS = $(patsubst %.s,$(OBJ_DIR)/sa2/%.s,$(SA2_C_ASM_FILES))
|
||||
SA2_C_ASM_OBJS = $(patsubst %.s,%.o,$(SA2_C_ASM_SRCS))
|
||||
|
||||
DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s)
|
||||
DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DATA_ASM_SRCS))
|
||||
|
||||
SONG_SRCS := $(wildcard $(SONG_SUBDIR)/*.s)
|
||||
SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS))
|
||||
|
||||
MID_SRCS := $(wildcard $(MID_SUBDIR)/*.mid)
|
||||
MID_OBJS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_SRCS))
|
||||
|
||||
SOUND_ASM_SRCS := $(wildcard $(SOUND_ASM_SUBDIR)/*.s)
|
||||
SOUND_ASM_OBJS := $(patsubst $(SOUND_ASM_SUBDIR)/%.s,$(SOUND_ASM_BUILDDIR)/%.o,$(SOUND_ASM_SRCS))
|
||||
|
||||
OBJS := $(C_OBJS) $(C_ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(SA2_C_OBJS) $(SA2_C_ASM_OBJS) $(MID_OBJS)
|
||||
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
|
||||
|
||||
FORMAT_SRC_PATHS := $(shell find . -name "*.c" ! -path '*/src/data/*' ! -path '*/build/*' ! -path '*/ext/*')
|
||||
FORMAT_H_PATHS := $(shell find . -name "*.h" ! -path '*/build/*' ! -path '*/ext/*')
|
||||
|
||||
### COMPILER FLAGS ###
|
||||
|
||||
# -P disables line markers (don't EVER use this, if you want proper debug info!)
|
||||
# -I sets an include path
|
||||
# -D defines a symbol
|
||||
CPPFLAGS ?= -D $(GAME_REGION) -D GAME=$(GAME)
|
||||
CC1FLAGS ?= -Wimplicit -Wparentheses -Werror
|
||||
|
||||
ifneq ($(GAME_VARIANT), DEFAULT)
|
||||
CPPFLAGS += -D $(GAME_VARIANT)
|
||||
endif
|
||||
|
||||
# These have to(?) be defined this way, because
|
||||
# the C-preprocessor cannot resolve stuff like:
|
||||
# #if (PLATFORM == gba), where PLATFORM is defined via -D.
|
||||
ifeq ($(PLATFORM),gba)
|
||||
INCLUDE_SCANINC_ARGS += -I tools/agbcc/include
|
||||
CPPFLAGS += -D PLATFORM_GBA=1 -D PLATFORM_SDL=0 -D PLATFORM_WIN32=0 -D CPU_ARCH_X86=0 -D CPU_ARCH_ARM=1 -nostdinc -I tools/agbcc/include
|
||||
CC1FLAGS += -fhex-asm
|
||||
|
||||
ifeq ($(BUILD_NAME), sa1)
|
||||
# It seems this bug was introduced to GCC after SA1 released.
|
||||
PROLOGUE_FIX := -fprologue-bugfix
|
||||
endif # BUILD_NAME == sa1
|
||||
|
||||
else
|
||||
CC1FLAGS += -Wstrict-overflow=1
|
||||
ifeq ($(PLATFORM),sdl)
|
||||
CC1FLAGS += -Wno-parentheses-equality -Wno-unused-value
|
||||
CPPFLAGS += -D TITLE_BAR=$(BUILD_NAME).$(PLATFORM) -D PLATFORM_GBA=0 -D PLATFORM_SDL=1 -D PLATFORM_WIN32=0 $(shell sdl2-config --cflags)
|
||||
else ifeq ($(PLATFORM),sdl_win32)
|
||||
CPPFLAGS += -D TITLE_BAR=$(BUILD_NAME).$(PLATFORM) -D PLATFORM_GBA=0 -D PLATFORM_SDL=1 -D PLATFORM_WIN32=0 $(SDL_MINGW_FLAGS)
|
||||
else ifeq ($(PLATFORM),win32)
|
||||
CPPFLAGS += -D TITLE_BAR=$(BUILD_NAME).$(PLATFORM) -D PLATFORM_GBA=0 -D PLATFORM_SDL=0 -D PLATFORM_WIN32=1
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_ARCH),i386)
|
||||
CPPFLAGS += -D CPU_ARCH_X86=1 -D CPU_ARCH_ARM=0
|
||||
|
||||
# Use the more legible Intel dialect for x86, without underscores
|
||||
CC1FLAGS += -masm=intel
|
||||
else
|
||||
CPPFLAGS += -D CPU_ARCH_X86=0 -D CPU_ARCH_ARM=0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
ASFLAGS += -mcpu=arm7tdmi -mthumb-interwork
|
||||
CC1FLAGS += -mthumb-interwork
|
||||
else
|
||||
ifeq ($(PLATFORM), sdl)
|
||||
# for modern we are using a modern compiler
|
||||
# so instead of CPP we can use gcc -E to "preprocess only"
|
||||
CPP := $(CC1) -E
|
||||
endif
|
||||
# Allow file input through stdin on modern GCC and set it to "compile only"
|
||||
CC1FLAGS += -x c -S
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
CC1FLAGS += -g3 -O0
|
||||
CPPFLAGS += -D DEBUG=1
|
||||
else
|
||||
CC1FLAGS += -O2
|
||||
CPPFLAGS += -D DEBUG=0
|
||||
endif
|
||||
|
||||
ifeq ($(PORTABLE),1)
|
||||
CPPFLAGS += -D PORTABLE=1
|
||||
else
|
||||
CPPFLAGS += -D PORTABLE=0
|
||||
endif
|
||||
|
||||
ifeq ($(TAS_TESTING),1)
|
||||
CPPFLAGS += -D TAS_TESTING=1
|
||||
else
|
||||
CPPFLAGS += -D TAS_TESTING=0
|
||||
endif
|
||||
|
||||
ifeq ($(NON_MATCHING),1)
|
||||
# TODO: We use "#if(n)def NON_MATCHING a lot, maybe we should switch to "#if (!)NON_MATCHING"
|
||||
# CPPFLAGS += -D NON_MATCHING=1
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_DECOMP_CREDITS),0)
|
||||
CPPFLAGS += -D ENABLE_DECOMP_CREDITS=0
|
||||
else
|
||||
CPPFLAGS += -D ENABLE_DECOMP_CREDITS=1
|
||||
endif
|
||||
|
||||
### LINKER FLAGS ###
|
||||
|
||||
# GBA
|
||||
ifeq ($(PLATFORM),gba)
|
||||
MAP_FLAG := -Map
|
||||
# Native
|
||||
else ifeq ($(PLATFORM),sdl)
|
||||
ifeq ($(OS), Darwin)
|
||||
MAP_FLAG := -Wl,-map,
|
||||
else
|
||||
MAP_FLAG := -Xlinker -Map=
|
||||
endif
|
||||
# Win32
|
||||
else
|
||||
MAP_FLAG := -Xlinker -Map=
|
||||
endif
|
||||
|
||||
# Libs
|
||||
ifeq ($(PLATFORM),gba)
|
||||
LIBS := $(ROOT_DIR)/tools/agbcc/lib/libgcc.a $(ROOT_DIR)/tools/agbcc/lib/libc.a $(LIBABGSYSCALL_LIBS)
|
||||
else ifeq ($(PLATFORM),sdl)
|
||||
LIBS := $(shell sdl2-config --cflags --libs)
|
||||
else ifeq ($(PLATFORM),sdl_win32)
|
||||
LIBS := -mwin32 -lkernel32 -lwinmm -lmingw32 -lxinput $(SDL_MINGW_LIBS)
|
||||
else ifeq ($(PLATFORM), win32)
|
||||
LIBS := -mwin32 -lkernel32 -lwinmm -lgdi32 -lxinput -lopengl32 $(LIBABGSYSCALL_LIBS)
|
||||
endif
|
||||
|
||||
#### MAIN TARGETS ####
|
||||
|
||||
# these commands will run regardless of deps being completed
|
||||
.PHONY: clean tools tidy clean-tools $(TOOLDIRS) libagbsyscall
|
||||
|
||||
# Ensure required directories exist
|
||||
$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SOUND_ASM_BUILDDIR) $(SONG_BUILDDIR) $(MID_BUILDDIR))
|
||||
|
||||
# a special command which ensures that stdout and stderr
|
||||
# get printed instead of output into the makefile
|
||||
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
|
||||
|
||||
# Build tools when building the rom
|
||||
# Disable dependency scanning for clean/tidy/tools
|
||||
ifeq (,$(filter-out all rom compare libagbsyscall,$(MAKECMDGOALS)))
|
||||
# if we are doing any of these things, build tools first
|
||||
$(call infoshell, $(MAKE) tools)
|
||||
# ensure that tools did build
|
||||
MAKE_TOOLS_OUTCOME=$(shell $(MAKE) tools > /dev/null 2>&1 && echo 0 || echo 1)
|
||||
ifneq ($(MAKE_TOOLS_OUTCOME),0)
|
||||
$(error Make tools command failed!)
|
||||
endif
|
||||
else
|
||||
NODEP ?= 1
|
||||
endif
|
||||
|
||||
# When not building tools, we should specify this
|
||||
ifneq ($(NODEP),1)
|
||||
# MacOS refuses to link the songs data because some pointers
|
||||
# are not aligned. The music player code reads pointers from raw
|
||||
# bytes, so they don't need to be aligned. But this is a simple
|
||||
# work around which tells the compiler not to care. Once we are
|
||||
# compiling the songs to C, we can cast the pointers to integers
|
||||
# which means the linker will not notice.
|
||||
#
|
||||
# TODO: compile songs to C so that we can work around this.
|
||||
export MACOSX_DEPLOYMENT_TARGET := 11
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
# Use the old compiler for m4a, as it was prebuilt and statically linked to the original codebase
|
||||
# PROLOGUE_FIX has to be set to nothing, since -fprologue-bugfix does not work with oldagbcc
|
||||
$(OBJ_DIR)/src/lib/m4a/m4a.o: CC1 := $(CC1_OLD)
|
||||
$(OBJ_DIR)/src/lib/m4a/m4a.o: PROLOGUE_FIX :=
|
||||
# Use `-O1` for agb_flash libs, as these were also prebuilt
|
||||
$(OBJ_DIR)/src/lib/agb_flash/agb_flash.o: CC1FLAGS := -O1 -mthumb-interwork -Werror
|
||||
$(OBJ_DIR)/src/lib/agb_flash/agb_flash%.o: CC1FLAGS := -O1 -mthumb-interwork -Werror
|
||||
endif
|
||||
|
||||
#### Main Targets ####
|
||||
|
||||
ifeq ($(PLATFORM),gba)
|
||||
all: compare
|
||||
|
||||
compare: rom
|
||||
$(SHA1) $(BUILD_NAME).sha1
|
||||
else
|
||||
all: rom
|
||||
endif
|
||||
|
||||
rom: $(ROM)
|
||||
|
||||
tools: $(TOOLDIRS)
|
||||
|
||||
tool_libs:
|
||||
@$(MAKE) -C tools/_shared
|
||||
|
||||
clean: tidy clean-tools
|
||||
@$(MAKE) clean -C tools/BriBaSA_ex
|
||||
# @$(MAKE) clean -C chao_garden
|
||||
# @$(MAKE) clean -C multi_boot/subgame_bootstrap
|
||||
# @$(MAKE) clean -C multi_boot/programs/subgame_loader
|
||||
# @$(MAKE) clean -C multi_boot/collect_rings
|
||||
@$(MAKE) clean -C libagbsyscall PLATFORM=$(PLATFORM) CPU_ARCH=$(CPU_ARCH)
|
||||
|
||||
$(RM) $(SAMPLE_SUBDIR)/*.bin $(MID_SUBDIR)/*.s
|
||||
find . \( -iwholename './data/*/maps/*/*/entities/*.bin' -o -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec $(RM) {} +
|
||||
|
||||
clean-tools:
|
||||
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
|
||||
|
||||
tidy:
|
||||
$(RM) -r build/*
|
||||
#$(RM) SDL2.dll
|
||||
$(RM) $(BUILD_NAME)*.exe $(BUILD_NAME)*.elf $(BUILD_NAME)*.map $(BUILD_NAME)*.sdl $(BUILD_NAME)*.gba
|
||||
|
||||
japan: ; @$(MAKE) GAME_REGION=JAPAN
|
||||
|
||||
europe: ; @$(MAKE) GAME_REGION=EUROPE
|
||||
|
||||
sdl: ; @$(MAKE) PLATFORM=sdl
|
||||
|
||||
sdl_win32:
|
||||
@$(MAKE) PLATFORM=sdl_win32 CPU_ARCH=i386
|
||||
|
||||
win32: ; @$(MAKE) PLATFORM=win32 CPU_ARCH=i386
|
||||
|
||||
#### RECIPES ####
|
||||
|
||||
include sa1_songs.mk
|
||||
include graphics.mk
|
||||
|
||||
%.png: ;
|
||||
%.pal: ;
|
||||
|
||||
%.1bpp: %.png ; $(GFX) $< $@
|
||||
%.4bpp: %.png ; $(GFX) $< $@
|
||||
%.8bpp: %.png ; $(GFX) $< $@
|
||||
%.gbapal: %.pal ; $(GFX) $< $@
|
||||
%.gbapal: %.png ; $(GFX) $< $@
|
||||
|
||||
chao_garden/mb_chao_garden.gba.lz: chao_garden/mb_chao_garden.gba
|
||||
$(GFX) $< $@ -search 1
|
||||
|
||||
data/sa1/mb_chao_garden_japan.gba.lz: data/sa1/mb_chao_garden_japan.gba
|
||||
$(GFX) $< $@ -search 1
|
||||
|
||||
%interactables.bin: %interactables.csv
|
||||
$(ENT_POS) $< $@ -entities INTERACTABLES -header "include/constants/sa1/interactables.h"
|
||||
|
||||
%itemboxes.bin: %itemboxes.csv
|
||||
$(ENT_POS) $< $@ -entities ITEMS -header "include/constants/sa1/items.h"
|
||||
|
||||
%enemies.bin: %enemies.csv
|
||||
$(ENT_POS) $< $@ -entities ENEMIES -header "include/constants/sa1/enemies.h"
|
||||
|
||||
%rings.bin: %rings.csv
|
||||
$(ENT_POS) $< $@ -entities RINGS
|
||||
|
||||
%.gba.lz: %.gba
|
||||
$(GFX) $< $@
|
||||
%.bin.lz: %.bin
|
||||
$(GFX) $< $@
|
||||
|
||||
%.lz: % ; $(GFX) $< $@
|
||||
%.rl: % ; $(GFX) $< $@
|
||||
|
||||
%.bin: %.aif ; $(AIF) $< $@
|
||||
|
||||
$(ELF): $(OBJS) libagbsyscall
|
||||
ifeq ($(PLATFORM),gba)
|
||||
@echo "$(LD) -T $(LDSCRIPT) $(MAP_FLAG) $(MAP) <objects> <lib> -o $@"
|
||||
@$(CPP) -P $(CPPFLAGS) $(LDSCRIPT) > $(OBJ_DIR)/$(LDSCRIPT)
|
||||
@cd $(OBJ_DIR) && $(LD) -T $(LDSCRIPT) $(MAP_FLAG) $(ROOT_DIR)/$(MAP) $(OBJS_REL) $(LIBS) -o $(ROOT_DIR)/$@
|
||||
else
|
||||
@echo "$(CC1) $(MAP_FLAG)$(MAP) <objects> <lib> -o $@"
|
||||
@touch $(ROOT_DIR)/$(MAP)
|
||||
@cd $(OBJ_DIR) && $(CC1) $(MAP_FLAG)$(ROOT_DIR)/$(MAP) $(OBJS_REL) $(LIBS) -o $(ROOT_DIR)/$@
|
||||
endif
|
||||
|
||||
$(ROM): $(ELF)
|
||||
ifeq ($(PLATFORM),gba)
|
||||
$(OBJCOPY) -O binary --pad-to 0x8400000 $< $@
|
||||
$(FIX) $@ -p -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent
|
||||
else ifeq ($(PLATFORM),sdl)
|
||||
cp $< $@
|
||||
else
|
||||
$(OBJCOPY) -O pei-x86-64 $< $@
|
||||
endif
|
||||
|
||||
# Copy files from SA2
|
||||
$(OBJ_DIR)/sa2/%.c: %.c
|
||||
$(shell mkdir -p $(shell dirname '$@'))
|
||||
cp $< $@
|
||||
|
||||
$(OBJ_DIR)/sa2/%.s: %.s
|
||||
$(shell mkdir -p $(shell dirname '$@'))
|
||||
cp $< $@
|
||||
|
||||
# TODO: remove once we are building sources from the same makefile
|
||||
# Build C and ASM sources from SA2
|
||||
$(OBJ_DIR)/sa2/%.o: $(OBJ_DIR)/sa2/%.c
|
||||
@echo "$(CC1) <flags> -o $@ $<"
|
||||
@$(shell mkdir -p $(shell dirname '$(OBJ_DIR)/sa2/$*.i'))
|
||||
@$(CPP) $(CPPFLAGS) $(SA2_INCLUDE_CPP_ARGS) $< -o $(OBJ_DIR)/sa2/$*.i
|
||||
@$(PREPROC) $(OBJ_DIR)/sa2/$*.i $(PLATFORM) "" | $(CC1) $(PROLOGUE_FIX) $(CC1FLAGS) -o $(OBJ_DIR)/sa2/$*.s -
|
||||
@printf ".text\n\t.align\t2, 0\n" >> $(OBJ_DIR)/sa2/$*.s
|
||||
@$(AS) $(ASFLAGS) $(OBJ_DIR)/sa2/$*.s -o $@
|
||||
|
||||
$(OBJ_DIR)/sa2/%.d: $(OBJ_DIR)/sa2/%.c
|
||||
@$(shell mkdir -p $(shell dirname '$(OBJ_DIR)/sa2/$*.d'))
|
||||
$(SCANINC) -M $@ $(SA2_INCLUDE_SCANINC_ARGS) $<
|
||||
|
||||
$(OBJ_DIR)/sa2/%.o: $(OBJ_DIR)/sa2/%.s
|
||||
@echo "$(AS) <flags> -o $@ $<"
|
||||
@$(shell mkdir -p $(shell dirname '$(OBJ_DIR)/$*.s'))
|
||||
@$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
# Build c sources, and ensure alignment
|
||||
$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c
|
||||
@echo "$(CC1) <flags> -o $@ $<"
|
||||
@$(shell mkdir -p $(shell dirname '$(C_BUILDDIR)/$*.i'))
|
||||
@$(CPP) $(CPPFLAGS) $(INCLUDE_CPP_ARGS) $< -o $(C_BUILDDIR)/$*.i
|
||||
@$(PREPROC) $(C_BUILDDIR)/$*.i $(PLATFORM) "" | $(CC1) $(PROLOGUE_FIX) $(CC1FLAGS) -o $(C_BUILDDIR)/$*.s -
|
||||
ifeq ($(PLATFORM), gba)
|
||||
@printf ".text\n\t.align\t2, 0\n" >> $(C_BUILDDIR)/$*.s
|
||||
endif
|
||||
@$(AS) $(ASFLAGS) $(C_BUILDDIR)/$*.s -o $@
|
||||
|
||||
# Scan the src dependencies to determine if any dependent files have changed
|
||||
$(C_BUILDDIR)/%.d: $(C_SUBDIR)/%.c
|
||||
@$(shell mkdir -p $(shell dirname '$(C_BUILDDIR)/$*.d'))
|
||||
$(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) $<
|
||||
|
||||
# rule for sources from the src dir (parts of libraries)
|
||||
$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s
|
||||
@echo "$(AS) <flags> -o $@ $<"
|
||||
@$(shell mkdir -p $(shell dirname '$(C_BUILDDIR)/$*.s'))
|
||||
@$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s
|
||||
@echo "$(AS) <flags> -o $@ $<"
|
||||
@$(PREPROC) $< $(PLATFORM) "" | $(CPP) $(CPPFLAGS) $(INCLUDE_CPP_ARGS) - | $(AS) $(ASFLAGS) -o $@ -
|
||||
|
||||
# Scan the ASM data dependencies to determine if any .inc files have changed
|
||||
$(DATA_ASM_BUILDDIR)/%.d: $(DATA_ASM_SUBDIR)/%.s
|
||||
$(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) $<
|
||||
|
||||
ifneq ($(NODEP),1)
|
||||
-include $(addprefix $(OBJ_DIR)/,$(C_SRCS:.c=.d))
|
||||
-include $(SA2_C_SRCS:.c=.d)
|
||||
-include $(addprefix $(OBJ_DIR)/,$(DATA_ASM_SRCS:.s=.d))
|
||||
endif
|
||||
|
||||
$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s
|
||||
@echo "$(AS) <flags> -o $@ $<"
|
||||
@$(PREPROC) $< $(PLATFORM) "" | $(CPP) $(CPPFLAGS) $(INCLUDE_CPP_ARGS) - | $(AS) $(ASFLAGS) -o $@ -
|
||||
|
||||
### SUB-PROGRAMS ###
|
||||
|
||||
chao_garden/mb_chao_garden.gba:
|
||||
ifeq ($(PLATFORM), gba)
|
||||
@$(MAKE) -C chao_garden DEBUG=0
|
||||
else
|
||||
@echo "Not building on the chao garden rom, as platform is $(PLATFORM)"
|
||||
@printf "1" > chao_garden/mb_chao_garden.gba
|
||||
endif
|
||||
|
||||
chao_garden: tools
|
||||
@$(MAKE) -C chao_garden DEBUG=0
|
||||
|
||||
# Dependency here is already explicit, but we sometimes get a race condition if this
|
||||
# is not specified
|
||||
multi_boot/subgame_bootstrap/subgame_bootstrap.gba: multi_boot/programs/subgame_loader/subgame_loader.bin
|
||||
ifeq ($(PLATFORM), gba)
|
||||
@$(MAKE) -C multi_boot/subgame_bootstrap DEBUG=0
|
||||
else
|
||||
@echo "Not building on the subgame bootstrap rom, as platform is $(PLATFORM)"
|
||||
@printf "1" > multi_boot/subgame_bootstrap/subgame_bootstrap.gba
|
||||
endif
|
||||
|
||||
multi_boot/programs/subgame_loader/subgame_loader.bin:
|
||||
ifeq ($(PLATFORM), gba)
|
||||
@$(MAKE) -C multi_boot/programs/subgame_loader DEBUG=0
|
||||
else
|
||||
@echo "Not building on the subgame loader rom, as platform is $(PLATFORM)"
|
||||
@printf "1" > multi_boot/programs/subgame_loader/subgame_loader.bin
|
||||
endif
|
||||
|
||||
multi_boot/collect_rings/mb_signed_collect_rings.gba:
|
||||
ifeq ($(PLATFORM), gba)
|
||||
@$(MAKE) -C multi_boot/collect_rings DEBUG=0
|
||||
else
|
||||
@echo "Not building on the collect the rings rom, as platform is $(PLATFORM)"
|
||||
@printf "1" > multi_boot/collect_rings/mb_signed_collect_rings.gba
|
||||
endif
|
||||
|
||||
subgame_bootstrap: tools
|
||||
@$(MAKE) -C multi_boot/subgame_bootstrap DEBUG=0
|
||||
|
||||
subgame_loader: tools
|
||||
@$(MAKE) -C multi_boot/programs/subgame_loader DEBUG=0
|
||||
|
||||
collect_rings: tools
|
||||
@$(MAKE) -C multi_boot/collect_rings DEBUG=0
|
||||
|
||||
libagbsyscall:
|
||||
@$(MAKE) -C libagbsyscall MODERN=0 PLATFORM=$(PLATFORM) CPU_ARCH=$(CPU_ARCH)
|
||||
|
||||
bribasa:
|
||||
@$(MAKE) -C tools/BriBaSA_ex
|
||||
|
||||
$(TOOLDIRS): tool_libs
|
||||
@$(MAKE) -C $@
|
||||
|
||||
### DEPS INSTALL COMMANDS ###
|
||||
|
||||
$(SDL_MINGW_LIB):
|
||||
@mkdir -p ext
|
||||
cd ext && wget -qO- https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-devel-2.30.3-mingw.zip | bsdtar -xvf-
|
||||
|
||||
SDL2.dll: $(SDL_MINGW_LIB)
|
||||
cp $(SDL_MINGW_SDL_DLL) SDL2.dll
|
||||
|
||||
### FORMATTER ###
|
||||
|
||||
format:
|
||||
@echo $(FORMAT) -i -style=file "**/*.c" "**/*.h"
|
||||
@$(FORMAT) -i --verbose -style=file $(FORMAT_SRC_PATHS) $(FORMAT_H_PATHS)
|
||||
|
||||
check_format:
|
||||
@echo $(FORMAT) -i -style=file --dry-run --Werror "**/*.c" "**/*.h"
|
||||
@$(FORMAT) -i --verbose -style=file --dry-run --Werror $(FORMAT_SRC_PATHS) $(FORMAT_H_PATHS)
|
||||
|
||||
|
||||
### DECOMP TOOLS ###
|
||||
|
||||
CONTEXT_FLAGS := -DM2C -DPLATFORM_GBA=1 -DGEN_CTX=1 -Dsize_t=int -D "offsetof(TYPE, MEMBER)"="((size_t)&((TYPE *)0)->MEMBER)"
|
||||
|
||||
ctx.c: $(C_HEADERS)
|
||||
@for header in $(C_HEADERS); do echo "#include \"$$header\""; done > ctx.h
|
||||
gcc -P -E -dD -undef -I ./tools/agbcc/include -I include $(CONTEXT_FLAGS) ctx.h | sed '/^\/\/ TODO: Remove M2C occurences EVERYWHERE once ctx is not needed anymore!/d' | sed '/#undef/d' | sed '/typedef unsigned long int int;/d' | sed 's/__attribute__((.*))//' | sed '/^#define __STDC/d' > ctx.c
|
||||
@@ -1,99 +0,0 @@
|
||||
### Build Configuration ###
|
||||
|
||||
# Default platform variables
|
||||
PLATFORM ?= gba
|
||||
CPU_ARCH ?= arm
|
||||
MIDI_COMMENTS := "arm"
|
||||
THUMB_SUPPORT ?= 1 # Supports ARM's Thumb instruction set
|
||||
COMPARE ?= 1
|
||||
|
||||
|
||||
ifeq ($(CPU_ARCH),arm)
|
||||
ifneq ($(PLATFORM),gba)
|
||||
THUMB_SUPPORT ?= 0
|
||||
endif
|
||||
|
||||
MIDI_COMMENTS := "arm"
|
||||
# This is 'i386' because that's the arch's name in GNU Linker scripts
|
||||
else ifeq ($(CPU_ARCH),i386)
|
||||
THUMB_SUPPORT ?= 0
|
||||
MIDI_COMMENTS := "x86"
|
||||
else
|
||||
$(error unknown arch: $(CPU_ARCH))
|
||||
endif
|
||||
|
||||
LDSCRIPT := sa1_ldscript
|
||||
|
||||
NON_MATCHING ?= 0
|
||||
ifeq ($(PLATFORM),gba)
|
||||
ifeq ($(DEBUG),1)
|
||||
# Debug
|
||||
PORTABLE := 0
|
||||
NON_MATCHING := 1
|
||||
ENABLE_DECOMP_CREDITS := 1
|
||||
COMPARE ?= 0
|
||||
LDSCRIPT := $(LDSCRIPT).txt
|
||||
else
|
||||
# Original
|
||||
PORTABLE := 0
|
||||
NON_MATCHING := 0
|
||||
ENABLE_DECOMP_CREDITS := 0
|
||||
COMPARE ?= 1
|
||||
LDSCRIPT := $(LDSCRIPT).txt
|
||||
endif
|
||||
else
|
||||
# Other
|
||||
PORTABLE := 1
|
||||
NON_MATCHING := 1
|
||||
ENABLE_DECOMP_CREDITS := 1
|
||||
COMPARE ?= 0
|
||||
LDSCRIPT := $(LDSCRIPT).txt
|
||||
endif
|
||||
|
||||
# Default game variables
|
||||
GAME_REVISION ?= 0
|
||||
GAME_REGION ?= EUROPE
|
||||
GAME_VARIANT ?= DEFAULT
|
||||
GAME ?= GAME_SA1
|
||||
DEBUG ?= 0
|
||||
|
||||
# For gbafix
|
||||
MAKER_CODE := 6W
|
||||
|
||||
# Version
|
||||
BUILD_NAME := sa1
|
||||
TITLE := SONIC ADVANC
|
||||
GAME_CODE := ASO
|
||||
|
||||
|
||||
# Revision
|
||||
ifeq ($(GAME_REVISION), 0)
|
||||
BUILD_NAME := $(BUILD_NAME)
|
||||
else
|
||||
$(error unknown revision $(GAME_REVISION))
|
||||
endif
|
||||
|
||||
# Region
|
||||
ifeq ($(GAME_REGION), USA)
|
||||
BUILD_NAME := $(BUILD_NAME)_usa
|
||||
GAME_CODE := $(GAME_CODE)E
|
||||
else
|
||||
ifeq ($(GAME_REGION), EUROPE)
|
||||
BUILD_NAME := $(BUILD_NAME)
|
||||
GAME_CODE := $(GAME_CODE)P
|
||||
else
|
||||
$(error unknown region $(GAME_REGION))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CREATE_PDB),1)
|
||||
# If the user wants a PDB, the output needs to include debug info
|
||||
# TODO: Is there a way to ECHO here?
|
||||
DEBUG := 1
|
||||
endif
|
||||
|
||||
# Debug
|
||||
ifeq ($(DEBUG), 1)
|
||||
COMPARE := 0
|
||||
BUILD_NAME := $(BUILD_NAME)_debug
|
||||
endif
|
||||
+85
-1
@@ -599,7 +599,91 @@ SECTIONS {
|
||||
IWRAM (NOLOAD) :
|
||||
ALIGN(4)
|
||||
{
|
||||
INCLUDE "../../../sa1_sym_iwram.txt"
|
||||
/**** bss ****/
|
||||
src/lib/m4a/m4a.o(.bss.code);
|
||||
|
||||
. = 0x0000400;
|
||||
src/multi_boot.o(.bss);
|
||||
src/game/shared/stage/terrain_collision.o(.bss);
|
||||
|
||||
. = 0x00000424;
|
||||
src/lib/agb_flash/agb_flash.o(.bss);
|
||||
|
||||
. = 0x00000440;
|
||||
*libgcc.a:(.bss);
|
||||
|
||||
. = 0x00000470;
|
||||
src/core.o(.data);
|
||||
|
||||
. = 0x00004C60;
|
||||
src/multi_sio.o(.data);
|
||||
src/sio32_multi_load.o(COMMON);
|
||||
|
||||
. = 0x00004FE0;
|
||||
src/game/globals.o(.data);
|
||||
|
||||
. = 0x00005154;
|
||||
src/game/sa1/special_stage/main.o(.data);
|
||||
|
||||
. = 0x00005160; gLoadedSaveGame = .;
|
||||
|
||||
. = 0x000055A0; gUnknown_030055A0 = .;
|
||||
. = 0x000055E0; gUnknown_030055E0 = .;
|
||||
. = 0x000055F0; gUnknown_030055F0 = .;
|
||||
. = 0x00005630; gUnknown_03005630 = .;
|
||||
. = 0x00005670; gUnknown_03005670 = .;
|
||||
. = 0x00005690; gUnknown_03005690 = .;
|
||||
. = 0x000056F0; gUnknown_030056F0 = .;
|
||||
|
||||
. = 0x00005730;
|
||||
src/game/sa1/stage/temporary_sound_play_task.o(.data);
|
||||
|
||||
. = 0x00005740; gUnknown_03005740 = .;
|
||||
. = 0x00005780; gUnknown_03005780 = .;
|
||||
. = 0x000057A0; gUnknown_030057A0 = .;
|
||||
. = 0x000057E0; gUnknown_030057E0 = .; /* s8[] */
|
||||
. = 0x00005800; gUnknown_03005800 = .;
|
||||
. = 0x00005840; gUnknown_03005840 = .;
|
||||
. = 0x00005860;
|
||||
src/game/sa1/stage/enemies/boss_6_egg_snake.o(COMMON);
|
||||
. = 0x00005890; gUnknown_03005890 = .;
|
||||
. = 0x000058A8;
|
||||
src/game/sa1/multiplayer/chao_message.o(.bss);
|
||||
src/game/dummy_task.o(.data);
|
||||
|
||||
. = 0x000058C0;
|
||||
src/game/shared/stage/stage.o(.data);
|
||||
|
||||
. = 0x000058D0; gStageBackgroundsRam = .;
|
||||
. = 0x000059D0; gCamera = .;
|
||||
. = 0x00005A0C; gRefCollision = .;
|
||||
. = 0x00005A10; gDustEffectBrakingTask = .;
|
||||
. = 0x00005A18; gRingsScatterTask = .;
|
||||
|
||||
. = 0x00005A20;
|
||||
src/game/shared/stage/player.o(.data);
|
||||
src/game/sa1/stage/player_super_sonic.o(.data);
|
||||
src/game/shared/stage/underwater_effects.o(.data);
|
||||
|
||||
. = 0x00005C80;
|
||||
src/game/shared/stage/water_effects.o(.data);
|
||||
|
||||
. = 0x000060D0;
|
||||
src/input_recorder.o(.data);
|
||||
src/game/sa1/stage/player_controls.o(.data);
|
||||
src/game/sa1/stage/enemies/boss_xtra_super_egg_robot.o(.data);
|
||||
|
||||
. = 0x00006240;
|
||||
src/game/sa1/stage/ui_rendering.o(.data);
|
||||
|
||||
. = 0x00006414;
|
||||
src/lib/agb_flash/agb_flash.o(.data);
|
||||
|
||||
iwram_end = .;
|
||||
|
||||
. = 0x00007FF0; gUnknown_03007FF0 = .;
|
||||
. = 0x00007FF8; gUnknown_03007FF8 = .;
|
||||
. = 0x00007FFA; SOFT_RESET_DIRECT_BUF = .; /* refd in libagbsyscall */
|
||||
}
|
||||
|
||||
/* DWARF debug sections.
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
|
||||
/**** bss ****/
|
||||
src/lib/m4a/m4a.o(.bss.code);
|
||||
|
||||
. = 0x0000400;
|
||||
src/multi_boot.o(.bss);
|
||||
src/game/shared/stage/terrain_collision.o(.bss);
|
||||
|
||||
. = 0x00000424;
|
||||
src/lib/agb_flash/agb_flash.o(.bss);
|
||||
|
||||
. = 0x00000440;
|
||||
*libgcc.a:(.bss);
|
||||
|
||||
. = 0x00000470;
|
||||
src/core.o(.data);
|
||||
|
||||
. = 0x00004C60;
|
||||
src/multi_sio.o(.data);
|
||||
src/sio32_multi_load.o(COMMON);
|
||||
|
||||
. = 0x00004FE0;
|
||||
src/game/globals.o(.data);
|
||||
|
||||
. = 0x00005154;
|
||||
src/game/sa1/special_stage/main.o(.data);
|
||||
|
||||
. = 0x00005160; gLoadedSaveGame = .;
|
||||
|
||||
. = 0x000055A0; gUnknown_030055A0 = .;
|
||||
. = 0x000055E0; gUnknown_030055E0 = .;
|
||||
. = 0x000055F0; gUnknown_030055F0 = .;
|
||||
. = 0x00005630; gUnknown_03005630 = .;
|
||||
. = 0x00005670; gUnknown_03005670 = .;
|
||||
. = 0x00005690; gUnknown_03005690 = .;
|
||||
. = 0x000056F0; gUnknown_030056F0 = .;
|
||||
|
||||
. = 0x00005730;
|
||||
src/game/sa1/stage/temporary_sound_play_task.o(.data);
|
||||
|
||||
. = 0x00005740; gUnknown_03005740 = .;
|
||||
. = 0x00005780; gUnknown_03005780 = .;
|
||||
. = 0x000057A0; gUnknown_030057A0 = .;
|
||||
. = 0x000057E0; gUnknown_030057E0 = .; /* s8[] */
|
||||
. = 0x00005800; gUnknown_03005800 = .;
|
||||
. = 0x00005840; gUnknown_03005840 = .;
|
||||
. = 0x00005860;
|
||||
src/game/sa1/stage/enemies/boss_6_egg_snake.o(COMMON);
|
||||
. = 0x00005890; gUnknown_03005890 = .;
|
||||
. = 0x000058A8;
|
||||
src/game/sa1/multiplayer/chao_message.o(.bss);
|
||||
src/game/dummy_task.o(.data);
|
||||
|
||||
. = 0x000058C0;
|
||||
src/game/shared/stage/stage.o(.data);
|
||||
|
||||
. = 0x000058D0; gStageBackgroundsRam = .;
|
||||
. = 0x000059D0; gCamera = .;
|
||||
. = 0x00005A0C; gRefCollision = .;
|
||||
. = 0x00005A10; gDustEffectBrakingTask = .;
|
||||
. = 0x00005A18; gRingsScatterTask = .;
|
||||
|
||||
. = 0x00005A20;
|
||||
src/game/shared/stage/player.o(.data);
|
||||
src/game/sa1/stage/player_super_sonic.o(.data);
|
||||
src/game/shared/stage/underwater_effects.o(.data);
|
||||
|
||||
. = 0x00005C80;
|
||||
src/game/shared/stage/water_effects.o(.data);
|
||||
|
||||
. = 0x000060D0;
|
||||
src/input_recorder.o(.data);
|
||||
src/game/sa1/stage/player_controls.o(.data);
|
||||
src/game/sa1/stage/enemies/boss_xtra_super_egg_robot.o(.data);
|
||||
|
||||
. = 0x00006240;
|
||||
src/game/sa1/stage/ui_rendering.o(.data);
|
||||
|
||||
. = 0x00006414;
|
||||
src/lib/agb_flash/agb_flash.o(.data);
|
||||
|
||||
iwram_end = .;
|
||||
|
||||
. = 0x00007FF0; gUnknown_03007FF0 = .;
|
||||
. = 0x00007FF8; gUnknown_03007FF8 = .;
|
||||
. = 0x00007FFA; SOFT_RESET_DIRECT_BUF = .; /* refd in libagbsyscall */
|
||||
File renamed without changes.
File renamed without changes.
@@ -63,7 +63,7 @@ void CreateDemoManager(void)
|
||||
Sprite *s;
|
||||
#if (GAME == GAME_SA1)
|
||||
const AnimId arr[2];
|
||||
memcpy(&arr, gPressStartTiles, sizeof(arr));
|
||||
memcpy((void *)&arr, gPressStartTiles, sizeof(arr));
|
||||
#endif
|
||||
blendCtrl = gBldRegs.bldCnt & 0xC0;
|
||||
#if (GAME == GAME_SA2)
|
||||
|
||||
Reference in new issue
Block a user