Update Makefile rules to correctly detect changes in berry fix mb
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
COMPARE ?= 0
|
||||||
|
|
||||||
AS := tools/binutils/bin/arm-none-eabi-as
|
AS := tools/binutils/bin/arm-none-eabi-as
|
||||||
CPP := $(CC) -E
|
CPP := $(CC) -E
|
||||||
LD := tools/binutils/bin/arm-none-eabi-ld
|
LD := tools/binutils/bin/arm-none-eabi-ld
|
||||||
@@ -84,8 +86,6 @@ JSONPROC := tools/jsonproc/jsonproc
|
|||||||
# Secondary expansion is required for dependency variables in object rules.
|
# Secondary expansion is required for dependency variables in object rules.
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
.PHONY: rom tools clean compare tidy
|
|
||||||
|
|
||||||
$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SONG_BUILDDIR))
|
$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SONG_BUILDDIR))
|
||||||
|
|
||||||
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
|
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
|
||||||
@@ -113,6 +113,12 @@ SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS))
|
|||||||
OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS)
|
OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS)
|
||||||
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
|
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
|
||||||
|
|
||||||
|
TOOLDIRS := $(filter-out tools/agbcc tools/binutils,$(wildcard tools/*))
|
||||||
|
TOOLBASE = $(TOOLDIRS:tools/%=%)
|
||||||
|
TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
|
||||||
|
|
||||||
|
.PHONY: all rom tools clean-tools mostlyclean clean compare tidy berry_fix $(TOOLDIRS)
|
||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
AUTO_GEN_TARGETS :=
|
AUTO_GEN_TARGETS :=
|
||||||
@@ -120,25 +126,20 @@ AUTO_GEN_TARGETS :=
|
|||||||
all: rom
|
all: rom
|
||||||
|
|
||||||
rom: $(ROM)
|
rom: $(ROM)
|
||||||
|
ifeq ($(COMPARE),1)
|
||||||
|
@$(SHA1) rom.sha1
|
||||||
|
endif
|
||||||
|
|
||||||
tools:
|
tools: $(TOOLDIRS)
|
||||||
@$(MAKE) -C tools/gbagfx
|
|
||||||
@$(MAKE) -C tools/scaninc
|
$(TOOLDIRS):
|
||||||
@$(MAKE) -C tools/preproc
|
@$(MAKE) -C $@
|
||||||
@$(MAKE) -C tools/bin2c
|
|
||||||
@$(MAKE) -C tools/rsfont
|
|
||||||
@$(MAKE) -C tools/aif2pcm
|
|
||||||
@$(MAKE) -C tools/ramscrgen
|
|
||||||
@$(MAKE) -C tools/mid2agb
|
|
||||||
@$(MAKE) -C tools/gbafix
|
|
||||||
@$(MAKE) -C tools/mapjson
|
|
||||||
@$(MAKE) -C tools/jsonproc
|
|
||||||
|
|
||||||
# For contributors to make sure a change didn't affect the contents of the ROM.
|
# For contributors to make sure a change didn't affect the contents of the ROM.
|
||||||
compare: rom
|
compare:
|
||||||
@$(SHA1) rom.sha1
|
@$(MAKE) COMPARE=1
|
||||||
|
|
||||||
clean: tidy
|
mostlyclean: tidy
|
||||||
rm -f sound/direct_sound_samples/*.bin
|
rm -f sound/direct_sound_samples/*.bin
|
||||||
rm -f $(SONG_OBJS)
|
rm -f $(SONG_OBJS)
|
||||||
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
|
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
|
||||||
@@ -147,17 +148,11 @@ clean: tidy
|
|||||||
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
|
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
|
||||||
rm -f $(AUTO_GEN_TARGETS)
|
rm -f $(AUTO_GEN_TARGETS)
|
||||||
@$(MAKE) clean -C berry_fix
|
@$(MAKE) clean -C berry_fix
|
||||||
@$(MAKE) clean -C tools/gbagfx
|
|
||||||
@$(MAKE) clean -C tools/scaninc
|
clean-tools:
|
||||||
@$(MAKE) clean -C tools/preproc
|
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
|
||||||
@$(MAKE) clean -C tools/bin2c
|
|
||||||
@$(MAKE) clean -C tools/rsfont
|
clean: mostlyclean clean-tools
|
||||||
@$(MAKE) clean -C tools/aif2pcm
|
|
||||||
@$(MAKE) clean -C tools/ramscrgen
|
|
||||||
@$(MAKE) clean -C tools/mid2agb
|
|
||||||
@$(MAKE) clean -C tools/gbafix
|
|
||||||
@$(MAKE) clean -C tools/mapjson
|
|
||||||
@$(MAKE) clean -C tools/jsonproc
|
|
||||||
|
|
||||||
tidy:
|
tidy:
|
||||||
rm -f $(ROM) $(ELF) $(MAP)
|
rm -f $(ROM) $(ELF) $(MAP)
|
||||||
@@ -242,12 +237,14 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
|
|||||||
$(OBJ_DIR)/ld_script.ld: ld_script.txt $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
|
$(OBJ_DIR)/ld_script.ld: ld_script.txt $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
|
||||||
cd $(OBJ_DIR) && sed -f ../../ld_script.sed ../../$< | sed "s#tools/#../../tools/#g" > ld_script.ld
|
cd $(OBJ_DIR) && sed -f ../../ld_script.sed ../../$< | sed "s#tools/#../../tools/#g" > ld_script.ld
|
||||||
|
|
||||||
$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)
|
$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) berry_fix
|
||||||
cd $(OBJ_DIR) && ../../$(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(LIB)
|
cd $(OBJ_DIR) && ../../$(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(LIB)
|
||||||
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
|
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
|
||||||
|
|
||||||
$(ROM): $(ELF)
|
$(ROM): $(ELF)
|
||||||
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@
|
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@
|
||||||
|
|
||||||
berry_fix/berry_fix.gba:
|
berry_fix/berry_fix.gba: berry_fix
|
||||||
@$(MAKE) -C berry_fix
|
|
||||||
|
berry_fix:
|
||||||
|
@$(MAKE) -C berry_fix COMPARE=$(COMPARE)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
OBJDUMP="./tools/binutils/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb"
|
OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb"
|
||||||
OPTIONS="--start-address=$1 --stop-address=$2"
|
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
|
||||||
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
|
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
|
||||||
$OBJDUMP $OPTIONS pokefirered.gba > pokefirered.dump
|
$OBJDUMP $OPTIONS pokefirered.gba > pokefirered.dump
|
||||||
diff -u baserom.dump pokefirered.dump
|
diff -u baserom.dump pokefirered.dump
|
||||||
+13
-6
@@ -1,3 +1,5 @@
|
|||||||
|
COMPARE ?= 0
|
||||||
|
|
||||||
AS := ../tools/binutils/bin/arm-none-eabi-as
|
AS := ../tools/binutils/bin/arm-none-eabi-as
|
||||||
CPP := $(CC) -E
|
CPP := $(CC) -E
|
||||||
LD := ../tools/binutils/bin/arm-none-eabi-ld
|
LD := ../tools/binutils/bin/arm-none-eabi-ld
|
||||||
@@ -57,7 +59,7 @@ FIX := ../tools/gbafix/gbafix$(EXE)
|
|||||||
# Secondary expansion is required for dependency variables in object rules.
|
# Secondary expansion is required for dependency variables in object rules.
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
.PHONY: rom clean compare tidy
|
.PHONY: all rom clean compare tidy payload
|
||||||
|
|
||||||
C_SRCS := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
|
C_SRCS := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
|
||||||
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
|
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
|
||||||
@@ -81,11 +83,16 @@ SUBDIRS := $(sort $(dir $(OBJS)))
|
|||||||
|
|
||||||
$(shell mkdir -p $(SUBDIRS))
|
$(shell mkdir -p $(SUBDIRS))
|
||||||
|
|
||||||
|
all: payload rom
|
||||||
|
@:
|
||||||
|
|
||||||
rom: $(ROM)
|
rom: $(ROM)
|
||||||
|
ifeq ($(COMPARE),1)
|
||||||
|
@$(SHA1) rom.sha1
|
||||||
|
endif
|
||||||
|
|
||||||
# For contributors to make sure a change didn't affect the contents of the ROM.
|
# For contributors to make sure a change didn't affect the contents of the ROM.
|
||||||
compare: $(ROM)
|
compare: ; @$(MAKE) COMPARE=1
|
||||||
@$(SHA1) rom.sha1
|
|
||||||
|
|
||||||
clean: tidy
|
clean: tidy
|
||||||
rm -f sound/direct_sound_samples/*.bin
|
rm -f sound/direct_sound_samples/*.bin
|
||||||
@@ -138,10 +145,10 @@ else
|
|||||||
$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) $(DATA_ASM_SUBDIR)/$*.s)
|
$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) $(DATA_ASM_SUBDIR)/$*.s)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
payload: data/payload.gba.lz
|
payload:
|
||||||
|
@$(MAKE) -C payload COMPARE=$(COMPARE)
|
||||||
|
|
||||||
payload/payload.gba:
|
payload/payload.gba: payload
|
||||||
$(MAKE) -C payload/
|
|
||||||
|
|
||||||
data/payload.gba.lz: payload/payload.gba
|
data/payload.gba.lz: payload/payload.gba
|
||||||
$(GFX) $< $@ -search 1
|
$(GFX) $< $@ -search 1
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
COMPARE ?= 0
|
||||||
|
|
||||||
AS := ../../tools/binutils/bin/arm-none-eabi-as
|
AS := ../../tools/binutils/bin/arm-none-eabi-as
|
||||||
CPP := $(CC) -E
|
CPP := $(CC) -E
|
||||||
LD := ../../tools/binutils/bin/arm-none-eabi-ld
|
LD := ../../tools/binutils/bin/arm-none-eabi-ld
|
||||||
@@ -85,11 +87,17 @@ $(C_BUILDDIR)/agb_flash_1m.o: CC1FLAGS := -O1 -mthumb-interwork
|
|||||||
$(C_BUILDDIR)/agb_flash_mx.o: CC1FLAGS := -O1 -mthumb-interwork
|
$(C_BUILDDIR)/agb_flash_mx.o: CC1FLAGS := -O1 -mthumb-interwork
|
||||||
$(C_BUILDDIR)/agb_flash_le.o: CC1FLAGS := -O1 -mthumb-interwork
|
$(C_BUILDDIR)/agb_flash_le.o: CC1FLAGS := -O1 -mthumb-interwork
|
||||||
|
|
||||||
|
all: rom
|
||||||
|
@:
|
||||||
|
|
||||||
rom: $(ROM)
|
rom: $(ROM)
|
||||||
|
ifeq ($(COMPARE),1)
|
||||||
|
@$(SHA1) rom.sha1
|
||||||
|
endif
|
||||||
|
|
||||||
# For contributors to make sure a change didn't affect the contents of the ROM.
|
# For contributors to make sure a change didn't affect the contents of the ROM.
|
||||||
compare: $(ROM)
|
compare:
|
||||||
@$(SHA1) rom.sha1
|
@$(MAKE) COMPARE=1
|
||||||
|
|
||||||
clean: tidy
|
clean: tidy
|
||||||
rm -f sound/direct_sound_samples/*.bin
|
rm -f sound/direct_sound_samples/*.bin
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
CC := gcc
|
CC := gcc
|
||||||
CFLAGS := -O3
|
CFLAGS := -O3
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
all: br_ips ips_patch
|
all: br_ips ips_patch
|
||||||
|
@:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f br_ips ips_patch br_ips.exe ips_patch.exe
|
rm -f br_ips ips_patch br_ips.exe ips_patch.exe
|
||||||
|
|||||||
Reference in New Issue
Block a user