summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-07-29 12:52:32 -0400
committerGitHub <noreply@github.com>2023-07-29 12:52:32 -0400
commit632ff4b2abec60e91be7b71e0cf40043bed75f32 (patch)
treec8e53f50d0c681afc2a6542a11cbf442174751f3 /Makefile
parent40cc48fb7a956f94cfd4c0e90a60ee15eefc4f8e (diff)
Build a compressed ROM (#16)
* git subrepo clone (merge) --branch=5da3132606e4fd427a8d72b8428e4f921cd6e56f git@github.com:z64tools/z64compress.git tools/z64compress subrepo: subdir: "tools/z64compress" merged: "5da3132" upstream: origin: "git@github.com:z64tools/z64compress.git" branch: "5da3132606e4fd427a8d72b8428e4f921cd6e56f" commit: "5da3132" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * z64compress_wrapper.py * fixes * dmadata.c * readme * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "01ac556" upstream: origin: "git@github.com:ethteck/splat.git" branch: "master" commit: "01ac556" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * segment_end_before_align: True * Add compressed step to jenkinsfile * TODO * format * remove from boot_variables.h * simplify * Change makefile to match MM
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 19 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index bf4eabd..3643a28 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,8 @@ RUN_CC_CHECK ?= 1
CC_CHECK_COMP ?= gcc
# Dump build object files
OBJDUMP_BUILD ?= 0
+# Number of threads to compress with
+N_THREADS ?= $(shell nproc)
# Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk!
# In nearly all cases, not having 'mips-linux-gnu-*' binaries on the PATH is indicative of missing dependencies
@@ -155,6 +157,11 @@ else
OBJCOPY_BIN = @:
endif
+# rom compression flags
+COMPFLAGS := --threads $(N_THREADS)
+ifeq ($(NON_MATCHING),0)
+ COMPFLAGS += --matching
+endif
#### Files ####
@@ -190,7 +197,7 @@ build/src/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) --
#### Main Targets ###
-all: uncompressed
+all: uncompressed compressed
uncompressed: $(ROM)
ifneq ($(COMPARE),0)
@@ -198,12 +205,11 @@ ifneq ($(COMPARE),0)
@md5sum -c $(TARGET)_uncompressed.$(VERSION).md5
endif
-# TODO
-# compressed: $(ROMC)
-# ifneq ($(COMPARE),0)
-# @md5sum $(ROMC)
-# @md5sum -c $(TARGET).$(VERSION).md5
-# endif
+compressed: $(ROMC)
+ifneq ($(COMPARE),0)
+ @md5sum $(ROMC)
+ @md5sum -c $(TARGET).$(VERSION).md5
+endif
clean:
$(RM) -r $(BUILD_DIR)/asm $(BUILD_DIR)/bin $(BUILD_DIR)/src $(ROM) $(ROMC) $(ELF)
@@ -238,7 +244,7 @@ init:
$(MAKE) diff-init
.PHONY: all compressed uncompressed clean distclean setup extract diff-init init
-.DEFAULT_GOAL := all
+.DEFAULT_GOAL := uncompressed
# Prevent removing intermediate files
.SECONDARY:
@@ -246,7 +252,11 @@ init:
#### Various Recipes ####
$(ROM): $(ELF)
- $(OBJCOPY) -O binary --pad-to=0x1914000 --gap-fill=0xFF $< $@
+ $(OBJCOPY) -O binary --pad-to=0x1914000 --gap-fill=0x00 $< $@
+# TODO: update rom header checksum
+
+$(ROMC): $(ROM)
+ python3 tools/z64compress_wrapper.py $(COMPFLAGS) $< $@ $(ELF) $(SPLAT_YAML)
# TODO: avoid using auto/undefined
$(ELF): $(O_FILES) $(LD_SCRIPT) $(BUILD_DIR)/linker_scripts/$(VERSION)/hardware_regs.ld $(BUILD_DIR)/linker_scripts/$(VERSION)/undefined_syms.ld $(BUILD_DIR)/linker_scripts/common_undef_syms.ld $(BUILD_DIR)/linker_scripts/libultra_syms.ld