From 8eda4d97311367a8e63120fec11bac80fb99206d Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 12 Jan 2025 18:01:42 -0800 Subject: [PATCH] Move spec to spec folder --- Makefile | 21 +++++++++++---------- spec => spec/spec | 0 tools/disasm/disasm.py | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) rename spec => spec/spec (100%) diff --git a/Makefile b/Makefile index 38b60cb6de..d8a346e5cb 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,8 @@ ELF := $(ROM:.z64=.elf) MAP := $(ROM:.z64=.map) LDSCRIPT := $(ROM:.z64=.ld) # description of ROM segments -SPEC := spec +SPEC := spec/spec +SPEC_INCLUDES := $(wildcard spec/*.inc) # create asm directories $(shell mkdir -p asm data extracted) @@ -316,11 +317,11 @@ ASSET_C_FILES_EXTRACTED := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS_E ASSET_C_FILES_COMMITTED := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.c))) C_FILES := $(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS_C_FILES),$(wildcard $(dir)/*.c)) S_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.s)) \ - $(shell grep -F "\$$(BUILD_DIR)/asm" spec | sed 's/.*$$(BUILD_DIR)\/// ; s/\.o\".*/.s/') \ - $(shell grep -F "\$$(BUILD_DIR)/data" spec | sed 's/.*$$(BUILD_DIR)\/// ; s/\.o\".*/.s/') + $(shell grep -F "\$$(BUILD_DIR)/asm" $(SPEC) | sed 's/.*$$(BUILD_DIR)\/// ; s/\.o\".*/.s/') \ + $(shell grep -F "\$$(BUILD_DIR)/data" $(SPEC) | sed 's/.*$$(BUILD_DIR)\/// ; s/\.o\".*/.s/') SCHEDULE_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.schl)) -BASEROM_FILES := $(shell grep -F "\$$(BUILD_DIR)/baserom" spec | sed 's/.*$$(BUILD_DIR)\/// ; s/\.o\".*//') -ARCHIVES_O := $(shell grep -F ".yar.o" spec | sed 's/.*include "// ; s/.*$$(BUILD_DIR)\/// ; s/\.o\".*/.o/') +BASEROM_FILES := $(shell grep -F "\$$(BUILD_DIR)/baserom" $(SPEC) | sed 's/.*$$(BUILD_DIR)\/// ; s/\.o\".*//') +ARCHIVES_O := $(shell grep -F ".yar.o" $(SPEC) | sed 's/.*include "// ; s/.*$$(BUILD_DIR)\/// ; s/\.o\".*/.o/') O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(ASSET_C_FILES_EXTRACTED:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \ @@ -533,13 +534,13 @@ all: rom compress $(BUILD_DIR)/%.ld: %.ld $(CPP) $(CPPFLAGS) $(IINC) $< > $@ -$(BUILD_DIR)/$(SPEC): $(SPEC) - $(CPP) $(CPPFLAGS) $< | $(BUILD_DIR_REPLACE) > $@ +$(BUILD_DIR)/spec: $(SPEC) $(SPEC_INCLUDES) + $(CPP) $(CPPFLAGS) -I. $< | $(BUILD_DIR_REPLACE) > $@ -$(LDSCRIPT): $(BUILD_DIR)/$(SPEC) +$(LDSCRIPT): $(BUILD_DIR)/spec $(MKLDSCRIPT) $< $@ -$(BUILD_DIR)/dmadata/dmadata_table_spec.h $(BUILD_DIR)/dmadata/compress_ranges.txt &: $(BUILD_DIR)/$(SPEC) +$(BUILD_DIR)/dmadata/dmadata_table_spec.h $(BUILD_DIR)/dmadata/compress_ranges.txt &: $(BUILD_DIR)/spec $(MKDMADATA) $< $(BUILD_DIR)/dmadata/dmadata_table_spec.h $(BUILD_DIR)/dmadata/compress_ranges.txt # Dependencies for files that may include the dmadata header automatically generated from the spec file @@ -581,7 +582,7 @@ $(BUILD_DIR)/assets/text/message_data_static.o: $(BUILD_DIR)/assets/text/message $(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.h $(BUILD_DIR)/src/code/z_message.o: $(BUILD_DIR)/assets/text/message_data.enc.h $(BUILD_DIR)/assets/text/message_data_staff.enc.h -$(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/$(SPEC) +$(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/spec $(FADO) $$(tools/buildtools/reloc_prereq $< $(*F)) -n $(*F) -o $(@:.o=.s) -M $(@:.o=.d) $(AS) $(ASFLAGS) $(ENDIAN) $(IINC) $(@:.o=.s) -o $@ diff --git a/spec b/spec/spec similarity index 100% rename from spec rename to spec/spec diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py index 2a6e1ae633..1f0295cffc 100755 --- a/tools/disasm/disasm.py +++ b/tools/disasm/disasm.py @@ -57,7 +57,7 @@ def discard_decomped_files(files_spec, include_files): root_path = Path(__file__).parent.parent.parent - with open(root_path / "spec", "r") as f: + with open(root_path / "spec/spec", "r") as f: spec = f.read() # No need to check anything beyond here spec = spec[: spec.find('name "gameplay_keep"')].splitlines()[:-2]