From 56410369ae2f6f011f61b474631db7fa66c19376 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 27 Apr 2022 15:30:54 -0400 Subject: [PATCH] Heavily simplify franklite steps Also fixes issues with always reprocessing, even when obj was unchanged. Former-commit-id: 8600d9ae82bba9ef15b4faee21e7195c388c5e18 --- Makefile | 68 ++++++++-------------------------------------- e_files.mk | 5 ---- obj_files.mk | 2 +- tools/franklite.py | 2 +- 4 files changed, 13 insertions(+), 64 deletions(-) delete mode 100644 e_files.mk mode change 100644 => 100755 tools/franklite.py diff --git a/Makefile b/Makefile index f169c081..20c7ebd2 100644 --- a/Makefile +++ b/Makefile @@ -22,13 +22,7 @@ endif NAME := mp1 VERSION ?= 0 -# Overkill epilogue fixup strategy. Set to 1 if necessary. -EPILOGUE_PROCESS := 1 - BUILD_DIR := build/$(NAME).$(VERSION) -ifeq ($(EPILOGUE_PROCESS),1) -EPILOGUE_DIR := epilogue/$(NAME).$(VERSION) -endif # Inputs S_FILES := $(wildcard asm/*.s) @@ -48,9 +42,6 @@ ifeq ($(MAPGENFLAG),1) endif include obj_files.mk -ifeq ($(EPILOGUE_PROCESS),1) -include e_files.mk -endif O_FILES := $(INIT_O_FILES) $(EXTAB_O_FILES) $(EXTABINDEX_O_FILES) $(METROTRK_FILES) \ $(METROIDPRIME) $(WORLDFORMAT) $(WEAPONS) $(METARENDER) $(GUISYS) $(COLLISION) \ @@ -63,40 +54,30 @@ DEPENDS := $(O_FILES:.o=.d) # If a specific .o file is passed as a target, also process its deps DEPENDS += $(MAKECMDGOALS:.o=.d) -ifeq ($(EPILOGUE_PROCESS),1) -E_FILES := $(EPILOGUE_UNSCHEDULED) -endif #------------------------------------------------------------------------------- # Tools #------------------------------------------------------------------------------- MWCC_VERSION := 2.7 -ifeq ($(EPILOGUE_PROCESS),1) -MWCC_EPI_VERSION := 1.2.5 -MWCC_EPI_EXE := mwcceppc.exe -endif MWLD_VERSION := 2.6 # Programs export WINEDEBUG ?= -all ifeq ($(WINDOWS),1) - WINE := + WINE := AS := $(DEVKITPPC)/bin/powerpc-eabi-as.exe CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp.exe -P else - WINE ?= wine + WINE ?= wine DEVKITPPC ?= /opt/devkitpro/devkitPPC - DEPENDS := $(DEPENDS:.d=.d.unix) - AS := $(DEVKITPPC)/bin/powerpc-eabi-as - CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P -endif -CC = $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwcceppc.exe -ifeq ($(EPILOGUE_PROCESS),1) -CC_EPI = $(WINE) tools/mwcc_compiler/$(MWCC_EPI_VERSION)/$(MWCC_EPI_EXE) + DEPENDS := $(DEPENDS:.d=.d.unix) + AS := $(DEVKITPPC)/bin/powerpc-eabi-as + CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P endif +CC = $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwcceppc.exe LD := $(WINE) tools/mwcc_compiler/$(MWLD_VERSION)/mwldeppc.exe ELF2DOL := tools/elf2dol -SHA1SUM := sha1sum +SHA1SUM := shasum -a 1 PYTHON := python3 TRANSFORM_DEP := tools/transform-dep.py @@ -141,18 +122,10 @@ default: all all: $(DOL) ALL_DIRS := $(sort $(dir $(O_FILES))) -ifeq ($(EPILOGUE_PROCESS),1) -EPI_DIRS := $(sort $(dir $(E_FILES))) -endif # Make sure build directory exists before compiling anything DUMMY != mkdir -p $(ALL_DIRS) -# ifeq ($(EPILOGUE_PROCESS),1) -# Make sure profile directory exists before compiling anything -# DUMMY != mkdir -p $(EPI_DIRS) -# endif - .PHONY: tools $(LDSCRIPT): ldscript.lcf @@ -172,17 +145,10 @@ tools: $(MAKE) -C tools # ELF creation makefile instructions -ifeq ($(EPILOGUE_PROCESS),1) - @echo Linking ELF $@ -$(ELF): $(O_FILES) $(E_FILES) $(LDSCRIPT) - $(QUIET) @echo $(O_FILES) > build/o_files - $(QUIET) $(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) @build/o_files -else $(ELF): $(O_FILES) $(LDSCRIPT) @echo Linking ELF $@ $(QUIET) @echo $(O_FILES) > build/o_files $(QUIET) $(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) @build/o_files -endif %.d.unix: %.d $(TRANSFORM_DEP) @echo Processing $< @@ -194,6 +160,10 @@ $(BUILD_DIR)/%.o: %.s @echo Assembling $< $(QUIET) $(AS) $(ASFLAGS) -o $@ $< +$(BUILD_DIR)/%.ep.o: $(BUILD_DIR)/%.o + @echo Frank is fixing $< + $(QUIET) $(PYTHON) $(FRANK) $< $@ + $(BUILD_DIR)/%.o: %.c @echo "Compiling " $< $(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $< @@ -206,22 +176,6 @@ $(BUILD_DIR)/%.o: %.cpp @echo "Compiling " $< $(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $< -ifeq ($(EPILOGUE_PROCESS),1) -$(EPILOGUE_DIR)/%.o: %.c $(BUILD_DIR)/%.o - @echo Frank is fixing $< - $(QUIET) $(PYTHON) $(FRANK) $(word 2,$^) $(word 2,$^) - -$(EPILOGUE_DIR)/%.o: %.cp $(BUILD_DIR)/%.o - @echo Frank is fixing $< - $(QUIET) $(PYTHON) $(FRANK) $(word 2,$^) $(word 2,$^) - -$(EPILOGUE_DIR)/%.o: %.cpp $(BUILD_DIR)/%.o - @echo Frank is fixing $< - $(QUIET) $(PYTHON) $(FRANK) $(word 2,$^) $(word 2,$^) -endif -# If we need Frank, add the following after the @echo -# $(QUIET) $(CC_EPI) $(CFLAGS) -c -o $@ $< - ### Debug Print ### print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true diff --git a/e_files.mk b/e_files.mk deleted file mode 100644 index 7b5f1ed0..00000000 --- a/e_files.mk +++ /dev/null @@ -1,5 +0,0 @@ -# Files with unscheduled epilogues. - - -EPILOGUE_UNSCHEDULED:=\ - $(EPILOGUE_DIR)/src/Dolphin/os/OSAudioSystem.o\ diff --git a/obj_files.mk b/obj_files.mk index 471c5c57..2a5f5a0e 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -691,7 +691,7 @@ OS_FILES :=\ $(BUILD_DIR)/asm/Dolphin/os/OS.o\ $(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\ $(BUILD_DIR)/asm/Dolphin/os/OSArena.o\ - $(BUILD_DIR)/src/Dolphin/os/OSAudioSystem.o\ + $(BUILD_DIR)/src/Dolphin/os/OSAudioSystem.ep.o\ $(BUILD_DIR)/asm/Dolphin/os/OSCache.o\ $(BUILD_DIR)/asm/Dolphin/os/OSContext.o\ $(BUILD_DIR)/asm/Dolphin/os/OSError.o\ diff --git a/tools/franklite.py b/tools/franklite.py old mode 100644 new mode 100755 index ef8f2c8a..b8c9d009 --- a/tools/franklite.py +++ b/tools/franklite.py @@ -12,7 +12,7 @@ import argparse BLR_BYTE_SEQ = b"\x4E\x80\x00\x20" MTLR_BYTE_SEQ = b"\x7C\x08\x03\xA6" -# Example invocation: ./frank.py vanilla.o profile.o output.o +# Example invocation: ./frank.py vanilla.o target.o parser = argparse.ArgumentParser() parser.add_argument("vanilla", help="Path to the vanilla object", type=argparse.FileType('rb')) parser.add_argument("target", help="Path to the target object (to write)")