From 5785c7adfbcb6f1d9125fd29e05679af76207b73 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Fri, 2 Feb 2024 13:34:20 -0800 Subject: [PATCH] Move roms to build folder (#1651) * Move built roms to build directory, along with rename map and linker script * PR review * sym_info fix * Revert docs/tutorial/data.md change --- Makefile | 16 +++++++++------- README.md | 6 +++--- baseroms/gc-eu-mq-dbg/checksum-compressed.md5 | 2 +- baseroms/gc-eu-mq-dbg/checksum.md5 | 2 +- baseroms/gc-eu-mq/checksum-compressed.md5 | 2 +- baseroms/gc-eu-mq/checksum.md5 | 2 +- diff_settings.py | 4 ++-- docs/retail_versions.md | 2 +- first_diff.py | 4 ++-- progress.py | 2 +- sym_info.py | 2 +- tools/assist.py | 2 +- 12 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 248895ed2f..b28d555d90 100644 --- a/Makefile +++ b/Makefile @@ -187,9 +187,11 @@ DISASM_FLAGS += --config-dir $(DISASM_DATA_DIR) --symbol-addrs $(DISASM_DATA_DIR #### Files #### # ROM image -ROMC := oot-$(VERSION)-compressed.z64 -ROM := oot-$(VERSION).z64 -ELF := $(ROM:.z64=.elf) +ROM := $(BUILD_DIR)/oot-$(VERSION).z64 +ROMC := $(ROM:.z64=-compressed.z64) +ELF := $(ROM:.z64=.elf) +MAP := $(ROM:.z64=.map) +LDSCRIPT := $(ROM:.z64=.ld) # description of ROM segments SPEC := spec @@ -342,7 +344,7 @@ ifneq ($(COMPARE),0) endif clean: - $(RM) -r $(ROMC) $(ROM) $(ELF) $(BUILD_DIR) + $(RM) -r $(BUILD_DIR) assetclean: $(RM) -r $(ASSET_BIN_DIRS) @@ -392,8 +394,8 @@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt $(PYTHON) tools/compress.py --in $(ROM) --out $@ --dma-range `./tools/dmadata_range.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS) $(PYTHON) -m ipl3checksum sum --cic 6105 --update $@ -$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(BUILD_DIR)/ldscript.txt $(BUILD_DIR)/undefined_syms.txt - $(LD) -T $(BUILD_DIR)/undefined_syms.txt -T $(BUILD_DIR)/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(BUILD_DIR)/z64.map -o $@ +$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt + $(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@ ## Order-only prerequisites # These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES. @@ -410,7 +412,7 @@ $(O_FILES): | asset_files $(BUILD_DIR)/$(SPEC): $(SPEC) $(CPP) $(CPPFLAGS) $< | $(SPEC_REPLACE_VARS) > $@ -$(BUILD_DIR)/ldscript.txt: $(BUILD_DIR)/$(SPEC) +$(LDSCRIPT): $(BUILD_DIR)/$(SPEC) $(MKLDSCRIPT) $< $@ $(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt diff --git a/README.md b/README.md index f58d22d95f..8e9b44817b 100644 --- a/README.md +++ b/README.md @@ -127,16 +127,16 @@ Make sure your path to the project is not too long, otherwise this process may e make ``` -If all goes well, a new ROM called "oot-gc-eu-mq-dbg.z64" should be built and the following text should be printed: +If all goes well, a new ROM should be built at `build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64`, and the following text printed: ```bash -oot-gc-eu-mq-dbg.z64: OK +build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64: OK ``` If you instead see the following: ```bash -oot-gc-eu-mq-dbg.z64: FAILED +build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64: FAILED md5sum: WARNING: 1 computed checksum did NOT match ``` diff --git a/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 b/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 index 260d2cc4e4..181bb40418 100644 --- a/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 +++ b/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 @@ -1 +1 @@ -5831385a7f216370cdbea55616b12fed oot-gc-eu-mq-dbg-compressed.z64 +5831385a7f216370cdbea55616b12fed build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg-compressed.z64 diff --git a/baseroms/gc-eu-mq-dbg/checksum.md5 b/baseroms/gc-eu-mq-dbg/checksum.md5 index 016512c1e2..55af8fae8a 100644 --- a/baseroms/gc-eu-mq-dbg/checksum.md5 +++ b/baseroms/gc-eu-mq-dbg/checksum.md5 @@ -1 +1 @@ -f0b7f35375f9cc8ca1b2d59d78e35405 oot-gc-eu-mq-dbg.z64 +f0b7f35375f9cc8ca1b2d59d78e35405 build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64 diff --git a/baseroms/gc-eu-mq/checksum-compressed.md5 b/baseroms/gc-eu-mq/checksum-compressed.md5 index 44abceb266..baf83abd59 100644 --- a/baseroms/gc-eu-mq/checksum-compressed.md5 +++ b/baseroms/gc-eu-mq/checksum-compressed.md5 @@ -1 +1 @@ -1618403427e4344a57833043db5ce3c3 oot-gc-eu-mq-compressed.z64 +1618403427e4344a57833043db5ce3c3 build/gc-eu-mq/oot-gc-eu-mq-compressed.z64 diff --git a/baseroms/gc-eu-mq/checksum.md5 b/baseroms/gc-eu-mq/checksum.md5 index 9c86b485ee..6c33e9d3ef 100644 --- a/baseroms/gc-eu-mq/checksum.md5 +++ b/baseroms/gc-eu-mq/checksum.md5 @@ -1 +1 @@ -1a438f4235f8038856971c14a798122a oot-gc-eu-mq.z64 +1a438f4235f8038856971c14a798122a build/gc-eu-mq/oot-gc-eu-mq.z64 diff --git a/diff_settings.py b/diff_settings.py index fb930183d6..66eb4e7335 100644 --- a/diff_settings.py +++ b/diff_settings.py @@ -3,8 +3,8 @@ def add_custom_arguments(parser): def apply(config, args): version = args.oot_version - config['mapfile'] = f'build/{version}/z64.map' - config['myimg'] = f'oot-{version}.z64' + config['mapfile'] = f'build/{version}/oot-{version}.map' + config['myimg'] = f'build/{version}/oot-{version}.z64' config['baseimg'] = f'baseroms/{version}/baserom-decompressed.z64' config['makeflags'] = [f'VERSION={version}'] config['source_directories'] = ['src', 'include', 'spec'] diff --git a/docs/retail_versions.md b/docs/retail_versions.md index e39a047c84..535238fd9e 100644 --- a/docs/retail_versions.md +++ b/docs/retail_versions.md @@ -52,7 +52,7 @@ code. In order to keep the code readable, we should try to minimize the amount o ``` where `N` is the number of cores on your machine. This will build into - `build/gc-eu-mq` and produce `oot-gc-eu-mq.z64`. + `build/gc-eu-mq` and produce `build/gc-eu-mq/oot-gc-eu-mq.z64`. If you later want to delete all output files, run diff --git a/first_diff.py b/first_diff.py index ab2db2f1cc..5c16b76203 100755 --- a/first_diff.py +++ b/first_diff.py @@ -37,8 +37,8 @@ def firstDiffMain(): buildFolder = Path("build") / args.oot_version - BUILTROM = Path(f"oot-{args.oot_version}.z64") - BUILTMAP = buildFolder / "z64.map" + BUILTROM = buildFolder / f"oot-{args.oot_version}.z64" + BUILTMAP = buildFolder / f"oot-{args.oot_version}.map" EXPECTEDROM = Path(f"baseroms/{args.oot_version}/baserom-decompressed.z64") EXPECTEDMAP = "expected" / BUILTMAP diff --git a/progress.py b/progress.py index 6b05f7a648..0556ae6f77 100755 --- a/progress.py +++ b/progress.py @@ -61,7 +61,7 @@ def IsCFile(objfile): srcfile = objfile.strip().replace("build/gc-eu-mq-dbg/", "").replace(".o", ".c") return os.path.isfile(srcfile) -mapFile = ReadAllLines("build/gc-eu-mq-dbg/z64.map") +mapFile = ReadAllLines("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map") curSegment = None src = 0 code = 0 diff --git a/sym_info.py b/sym_info.py index 35abec975d..1ef09b2fc4 100755 --- a/sym_info.py +++ b/sym_info.py @@ -14,7 +14,7 @@ def symInfoMain(): args = parser.parse_args() - BUILTMAP = Path("build") / args.oot_version / "z64.map" + BUILTMAP = Path("build") / args.oot_version / f"oot-{args.oot_version}.map" mapPath = BUILTMAP if args.use_expected: diff --git a/tools/assist.py b/tools/assist.py index 666232ffac..6afecbdea4 100755 --- a/tools/assist.py +++ b/tools/assist.py @@ -162,7 +162,7 @@ parser.add_argument("--num-out", help="number of functions to display", type=int args = parser.parse_args() rom_bytes = read_rom() -map_syms = parse_map(build_dir + "z64.map") +map_syms = parse_map(build_dir + "oot-gc-eu-mq-dbg.map") map_offsets = get_map_offsets(map_syms) s_files = get_all_s_files()