Skip to content

Commit 5785c7a

Browse files
authored
Move roms to build folder (zeldaret#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
1 parent 8db76a2 commit 5785c7a

File tree

12 files changed

+24
-22
lines changed

12 files changed

+24
-22
lines changed

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,11 @@ DISASM_FLAGS += --config-dir $(DISASM_DATA_DIR) --symbol-addrs $(DISASM_DATA_DIR
187187
#### Files ####
188188

189189
# ROM image
190-
ROMC := oot-$(VERSION)-compressed.z64
191-
ROM := oot-$(VERSION).z64
192-
ELF := $(ROM:.z64=.elf)
190+
ROM := $(BUILD_DIR)/oot-$(VERSION).z64
191+
ROMC := $(ROM:.z64=-compressed.z64)
192+
ELF := $(ROM:.z64=.elf)
193+
MAP := $(ROM:.z64=.map)
194+
LDSCRIPT := $(ROM:.z64=.ld)
193195
# description of ROM segments
194196
SPEC := spec
195197

@@ -342,7 +344,7 @@ ifneq ($(COMPARE),0)
342344
endif
343345

344346
clean:
345-
$(RM) -r $(ROMC) $(ROM) $(ELF) $(BUILD_DIR)
347+
$(RM) -r $(BUILD_DIR)
346348

347349
assetclean:
348350
$(RM) -r $(ASSET_BIN_DIRS)
@@ -392,8 +394,8 @@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt
392394
$(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)
393395
$(PYTHON) -m ipl3checksum sum --cic 6105 --update $@
394396

395-
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(BUILD_DIR)/ldscript.txt $(BUILD_DIR)/undefined_syms.txt
396-
$(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 $@
397+
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt
398+
$(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@
397399

398400
## Order-only prerequisites
399401
# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES.
@@ -410,7 +412,7 @@ $(O_FILES): | asset_files
410412
$(BUILD_DIR)/$(SPEC): $(SPEC)
411413
$(CPP) $(CPPFLAGS) $< | $(SPEC_REPLACE_VARS) > $@
412414

413-
$(BUILD_DIR)/ldscript.txt: $(BUILD_DIR)/$(SPEC)
415+
$(LDSCRIPT): $(BUILD_DIR)/$(SPEC)
414416
$(MKLDSCRIPT) $< $@
415417

416418
$(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,16 @@ Make sure your path to the project is not too long, otherwise this process may e
127127
make
128128
```
129129

130-
If all goes well, a new ROM called "oot-gc-eu-mq-dbg.z64" should be built and the following text should be printed:
130+
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:
131131

132132
```bash
133-
oot-gc-eu-mq-dbg.z64: OK
133+
build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64: OK
134134
```
135135

136136
If you instead see the following:
137137

138138
```bash
139-
oot-gc-eu-mq-dbg.z64: FAILED
139+
build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64: FAILED
140140
md5sum: WARNING: 1 computed checksum did NOT match
141141
```
142142

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5831385a7f216370cdbea55616b12fed oot-gc-eu-mq-dbg-compressed.z64
1+
5831385a7f216370cdbea55616b12fed build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg-compressed.z64

baseroms/gc-eu-mq-dbg/checksum.md5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f0b7f35375f9cc8ca1b2d59d78e35405 oot-gc-eu-mq-dbg.z64
1+
f0b7f35375f9cc8ca1b2d59d78e35405 build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1618403427e4344a57833043db5ce3c3 oot-gc-eu-mq-compressed.z64
1+
1618403427e4344a57833043db5ce3c3 build/gc-eu-mq/oot-gc-eu-mq-compressed.z64

baseroms/gc-eu-mq/checksum.md5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1a438f4235f8038856971c14a798122a oot-gc-eu-mq.z64
1+
1a438f4235f8038856971c14a798122a build/gc-eu-mq/oot-gc-eu-mq.z64

diff_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ def add_custom_arguments(parser):
33

44
def apply(config, args):
55
version = args.oot_version
6-
config['mapfile'] = f'build/{version}/z64.map'
7-
config['myimg'] = f'oot-{version}.z64'
6+
config['mapfile'] = f'build/{version}/oot-{version}.map'
7+
config['myimg'] = f'build/{version}/oot-{version}.z64'
88
config['baseimg'] = f'baseroms/{version}/baserom-decompressed.z64'
99
config['makeflags'] = [f'VERSION={version}']
1010
config['source_directories'] = ['src', 'include', 'spec']

docs/retail_versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ code. In order to keep the code readable, we should try to minimize the amount o
5252
```
5353

5454
where `N` is the number of cores on your machine. This will build into
55-
`build/gc-eu-mq` and produce `oot-gc-eu-mq.z64`.
55+
`build/gc-eu-mq` and produce `build/gc-eu-mq/oot-gc-eu-mq.z64`.
5656

5757
If you later want to delete all output files, run
5858

first_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def firstDiffMain():
3737

3838
buildFolder = Path("build") / args.oot_version
3939

40-
BUILTROM = Path(f"oot-{args.oot_version}.z64")
41-
BUILTMAP = buildFolder / "z64.map"
40+
BUILTROM = buildFolder / f"oot-{args.oot_version}.z64"
41+
BUILTMAP = buildFolder / f"oot-{args.oot_version}.map"
4242

4343
EXPECTEDROM = Path(f"baseroms/{args.oot_version}/baserom-decompressed.z64")
4444
EXPECTEDMAP = "expected" / BUILTMAP

progress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def IsCFile(objfile):
6161
srcfile = objfile.strip().replace("build/gc-eu-mq-dbg/", "").replace(".o", ".c")
6262
return os.path.isfile(srcfile)
6363

64-
mapFile = ReadAllLines("build/gc-eu-mq-dbg/z64.map")
64+
mapFile = ReadAllLines("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map")
6565
curSegment = None
6666
src = 0
6767
code = 0

0 commit comments

Comments
 (0)