Remove unnecessary linker script preprocessing

The previous build process ran sed against the linker scripts twice:
once to replace <X> with the contents of sym_x.ld, a second time to
correct any paths referencing tools/.

The first can be replaced with INCLUDE commands, as was done in
pret/pokeemerald@7c57699 (in 2018).

The second has been unnecessary since 942c248 (also 2018).

With both of these removed there is no longer a need to have a build
step for them, and $(ELF) can take the sym_x.ld files as prerequisites
instead.
This commit is contained in:
Sophia
2023-05-21 03:32:06 +01:00
parent cea26f20c5
commit cb6409224f
5 changed files with 7 additions and 26 deletions
+4 -8
View File
@@ -327,19 +327,15 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
ifeq ($(MODERN),0)
LD_SCRIPT := ld_script.txt
LD_SCRIPT := ld_script.ld
LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
else
LD_SCRIPT := ld_script_modern.txt
LD_SCRIPT := ld_script_modern.ld
LD_SCRIPT_DEPS :=
endif
$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS)
cd $(OBJ_DIR) && sed -f ../../ld_script.sed ../../$< | sed "s#tools/#../../tools/#g" > ld_script.ld
$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)
@echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ <objects> <lib>"
@cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB)
$(ELF): $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJS)
@cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< -o ../../$@ $(OBJS_REL) $(LIB)
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent
$(ROM): $(ELF)