Skip to content

Commit

Permalink
Sync Berry Fix makefiles with pokeemerald
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Mar 10, 2021
1 parent b2f0efc commit bf6e808
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ $(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) -I . $(DATA_ASM_SUBDIR)/
endif

berry_fix:
@$(MAKE) -C berry_fix COMPARE=$(COMPARE)
@$(MAKE) -C berry_fix COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN)

berry_fix/berry_fix.gba: berry_fix

Expand Down
30 changes: 25 additions & 5 deletions berry_fix/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
include $(DEVKITARM)/base_tools
TOOLCHAIN := $(DEVKITARM)
COMPARE ?= 0

CPP := $(CC) -E
LD := $(DEVKITARM)/bin/arm-none-eabi-ld
ifeq ($(CC),)
HOSTCC := gcc
else
HOSTCC := $(CC)
endif

ifeq ($(CXX),)
HOSTCXX := g++
else
HOSTCXX := $(CXX)
endif

ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
include $(TOOLCHAIN)/base_tools
else
export PATH := $(TOOLCHAIN)/bin:$(PATH)
PREFIX := arm-none-eabi-
OBJCOPY := $(PREFIX)objcopy
export CC := $(PREFIX)gcc
export AS := $(PREFIX)as
endif
export CPP := $(PREFIX)cpp
export LD := $(PREFIX)ld

ifeq ($(OS),Windows_NT)
EXE := .exe
Expand Down Expand Up @@ -145,7 +166,7 @@ $(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) $(DATA_ASM_SUBDIR)/$*.s)
endif

payload:
@$(MAKE) -C payload COMPARE=$(COMPARE)
@$(MAKE) -C payload COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN)

payload/payload.gba: payload

Expand All @@ -164,4 +185,3 @@ $(ELF): ld_script.txt $(OBJS)
$(ROM): $(ELF)
$(OBJCOPY) -O binary $< $@
$(FIX) $@ -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent

35 changes: 27 additions & 8 deletions berry_fix/payload/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
include $(DEVKITARM)/base_tools
TOOLCHAIN := $(DEVKITARM)
COMPARE ?= 0

CPP := $(CC) -E
LD := $(DEVKITARM)/bin/arm-none-eabi-ld
ifeq ($(CC),)
HOSTCC := gcc
else
HOSTCC := $(CC)
endif

ifeq ($(CXX),)
HOSTCXX := g++
else
HOSTCXX := $(CXX)
endif

ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
include $(TOOLCHAIN)/base_tools
else
export PATH := $(TOOLCHAIN)/bin:$(PATH)
PREFIX := arm-none-eabi-
OBJCOPY := $(PREFIX)objcopy
export CC := $(PREFIX)gcc
export AS := $(PREFIX)as
endif
export CPP := $(PREFIX)cpp
export LD := $(PREFIX)ld

ifeq ($(OS),Windows_NT)
EXE := .exe
Expand Down Expand Up @@ -56,7 +77,7 @@ FIX := ../../tools/gbafix/gbafix$(EXE)
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:

.PHONY: rom clean compare tidy
.PHONY: all rom clean compare tidy

C_SRCS := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
Expand Down Expand Up @@ -95,8 +116,7 @@ ifeq ($(COMPARE),1)
endif

# For contributors to make sure a change didn't affect the contents of the ROM.
compare:
@$(MAKE) COMPARE=1
compare: ; @$(MAKE) COMPARE=1

clean: tidy
rm -f sound/direct_sound_samples/*.bin
Expand Down Expand Up @@ -158,7 +178,7 @@ $(OBJ_DIR)/sym_bss.ld: sym_bss.txt
$(RAMSCRGEN) .bss $< ENGLISH > $@

$(OBJ_DIR)/sym_common.ld: sym_common.txt $(C_OBJS) $(wildcard common_syms/*.txt)
$(RAMSCRGEN) COMMON $< ENGLISH -c $(C_BUILDDIR),common_syms,../../tools/agbcc/lib > $@
$(RAMSCRGEN) COMMON $< ENGLISH -c $(C_BUILDDIR),common_syms > $@

$(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
Expand All @@ -171,4 +191,3 @@ $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)

$(ROM): $(ELF)
$(OBJCOPY) -O binary $< $@

0 comments on commit bf6e808

Please sign in to comment.