Heavily simplify franklite steps

Also fixes issues with always reprocessing,
even when obj was unchanged.
This commit is contained in:
Luke Street 2022-04-27 15:30:54 -04:00
parent 0fef366427
commit 8600d9ae82
4 changed files with 13 additions and 64 deletions

View File

@ -22,13 +22,7 @@ endif
NAME := mp1 NAME := mp1
VERSION ?= 0 VERSION ?= 0
# Overkill epilogue fixup strategy. Set to 1 if necessary.
EPILOGUE_PROCESS := 1
BUILD_DIR := build/$(NAME).$(VERSION) BUILD_DIR := build/$(NAME).$(VERSION)
ifeq ($(EPILOGUE_PROCESS),1)
EPILOGUE_DIR := epilogue/$(NAME).$(VERSION)
endif
# Inputs # Inputs
S_FILES := $(wildcard asm/*.s) S_FILES := $(wildcard asm/*.s)
@ -48,9 +42,6 @@ ifeq ($(MAPGENFLAG),1)
endif endif
include obj_files.mk 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) \ O_FILES := $(INIT_O_FILES) $(EXTAB_O_FILES) $(EXTABINDEX_O_FILES) $(METROTRK_FILES) \
$(METROIDPRIME) $(WORLDFORMAT) $(WEAPONS) $(METARENDER) $(GUISYS) $(COLLISION) \ $(METROIDPRIME) $(WORLDFORMAT) $(WEAPONS) $(METARENDER) $(GUISYS) $(COLLISION) \
@ -63,18 +54,11 @@ DEPENDS := $(O_FILES:.o=.d)
# If a specific .o file is passed as a target, also process its deps # If a specific .o file is passed as a target, also process its deps
DEPENDS += $(MAKECMDGOALS:.o=.d) DEPENDS += $(MAKECMDGOALS:.o=.d)
ifeq ($(EPILOGUE_PROCESS),1)
E_FILES := $(EPILOGUE_UNSCHEDULED)
endif
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Tools # Tools
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
MWCC_VERSION := 2.7 MWCC_VERSION := 2.7
ifeq ($(EPILOGUE_PROCESS),1)
MWCC_EPI_VERSION := 1.2.5
MWCC_EPI_EXE := mwcceppc.exe
endif
MWLD_VERSION := 2.6 MWLD_VERSION := 2.6
# Programs # Programs
@ -91,12 +75,9 @@ else
CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P
endif endif
CC = $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwcceppc.exe 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)
endif
LD := $(WINE) tools/mwcc_compiler/$(MWLD_VERSION)/mwldeppc.exe LD := $(WINE) tools/mwcc_compiler/$(MWLD_VERSION)/mwldeppc.exe
ELF2DOL := tools/elf2dol ELF2DOL := tools/elf2dol
SHA1SUM := sha1sum SHA1SUM := shasum -a 1
PYTHON := python3 PYTHON := python3
TRANSFORM_DEP := tools/transform-dep.py TRANSFORM_DEP := tools/transform-dep.py
@ -141,18 +122,10 @@ default: all
all: $(DOL) all: $(DOL)
ALL_DIRS := $(sort $(dir $(O_FILES))) 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 # Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS) 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 .PHONY: tools
$(LDSCRIPT): ldscript.lcf $(LDSCRIPT): ldscript.lcf
@ -172,17 +145,10 @@ tools:
$(MAKE) -C tools $(MAKE) -C tools
# ELF creation makefile instructions # 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) $(ELF): $(O_FILES) $(LDSCRIPT)
@echo Linking ELF $@ @echo Linking ELF $@
$(QUIET) @echo $(O_FILES) > build/o_files $(QUIET) @echo $(O_FILES) > build/o_files
$(QUIET) $(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) @build/o_files $(QUIET) $(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) @build/o_files
endif
%.d.unix: %.d $(TRANSFORM_DEP) %.d.unix: %.d $(TRANSFORM_DEP)
@echo Processing $< @echo Processing $<
@ -194,6 +160,10 @@ $(BUILD_DIR)/%.o: %.s
@echo Assembling $< @echo Assembling $<
$(QUIET) $(AS) $(ASFLAGS) -o $@ $< $(QUIET) $(AS) $(ASFLAGS) -o $@ $<
$(BUILD_DIR)/%.ep.o: $(BUILD_DIR)/%.o
@echo Frank is fixing $<
$(QUIET) $(PYTHON) $(FRANK) $< $@
$(BUILD_DIR)/%.o: %.c $(BUILD_DIR)/%.o: %.c
@echo "Compiling " $< @echo "Compiling " $<
$(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $< $(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $<
@ -206,22 +176,6 @@ $(BUILD_DIR)/%.o: %.cpp
@echo "Compiling " $< @echo "Compiling " $<
$(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $< $(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 ### ### Debug Print ###
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true

View File

@ -1,5 +0,0 @@
# Files with unscheduled epilogues.
EPILOGUE_UNSCHEDULED:=\
$(EPILOGUE_DIR)/src/Dolphin/os/OSAudioSystem.o\

View File

@ -691,7 +691,7 @@ OS_FILES :=\
$(BUILD_DIR)/asm/Dolphin/os/OS.o\ $(BUILD_DIR)/asm/Dolphin/os/OS.o\
$(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\ $(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\
$(BUILD_DIR)/asm/Dolphin/os/OSArena.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/OSCache.o\
$(BUILD_DIR)/asm/Dolphin/os/OSContext.o\ $(BUILD_DIR)/asm/Dolphin/os/OSContext.o\
$(BUILD_DIR)/asm/Dolphin/os/OSError.o\ $(BUILD_DIR)/asm/Dolphin/os/OSError.o\

2
tools/franklite.py Normal file → Executable file
View File

@ -12,7 +12,7 @@ import argparse
BLR_BYTE_SEQ = b"\x4E\x80\x00\x20" BLR_BYTE_SEQ = b"\x4E\x80\x00\x20"
MTLR_BYTE_SEQ = b"\x7C\x08\x03\xA6" 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 = argparse.ArgumentParser()
parser.add_argument("vanilla", help="Path to the vanilla object", type=argparse.FileType('rb')) 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)") parser.add_argument("target", help="Path to the target object (to write)")