Clean up terminal output (#163)

* cleanup terminal output

* fixes
This commit is contained in:
Yanis
2025-01-07 17:38:46 +01:00
committed by GitHub
parent ffa9992d5a
commit e6fca950b7
15 changed files with 254 additions and 178 deletions

View File

@@ -20,25 +20,7 @@ else
$(error Unable to detect a suitable MIPS toolchain installed)
endif
# Verbose toggle
V := @
ifeq (VERBOSE, 1)
V=
endif
# Colors
NO_COL := \033[0m
GREEN := \033[0;32m
BLUE := \033[0;36m
YELLOW := \033[0;33m
BLINK := \033[32;5m
PRINT := printf
# Generic print function for make rules
define print
$(V)echo -e "$(GREEN)$(1) $(YELLOW)$(2)$(GREEN) -> $(BLUE)$(3)$(NO_COL)"
endef
-include tools/print_rules.mk
# Enable optimization flags to use GDB on Ares
ARES_GDB := 1

126
Makefile
View File

@@ -650,31 +650,31 @@ endif
all: rom
rom:
$(call print,Building the rom...)
$(call print_no_args,Building the rom...)
$(V)python3 tools/mod_assets.py --oot-version $(VERSION)
$(V)$(MAKE) $(ROM)
compress:
$(call print,Compressing the rom...)
$(call print_no_args,Compressing the rom...)
# make sure z_std_dma.c and spec are up-to-date
$(V)$(shell touch spec)
$(V)$(shell touch src/boot/z_std_dma.c)
$(V)$(MAKE) $(ROMC)
$(call print,Success!)
$(call print_no_args,Success!)
wad:
$(call print,Patching WAD...)
$(call print_no_args,Patching WAD...)
ifeq ("$(wildcard baseroms/$(VERSION)/common-key.bin)", "")
$(error Please provide the common-key.bin file.)
endif
$(V)$(MAKE) compress TARGET=wad
$(V)$(GZINJECT) -a inject -r 1 -k baseroms/$(VERSION)/common-key.bin -w baseroms/$(VERSION)/basewad.wad -m $(ROMC) -o $(WAD) -t "HackerOoT" -i NHOE -p tools/gzinject/patches/NACE.gzi -p tools/gzinject/patches/gz_default_remap.gzi
$(V)$(RM) -r wadextract/
$(call print,Success!)
$(call print_no_args,Success!)
iso:
$(V)$(MAKE) compress TARGET=iso
$(call print,Patching ISO...)
$(call print_no_args,Patching ISO...)
$(V)$(PYTHON) tools/gc_utility.py -v $(VERSION) -c $(COMPRESSION)
$(V)$(GZINJECT) -a extract -s baseroms/$(VERSION)/baseiso.iso
$(V)cp $(BUILD_DIR)/$(DMA_CONFIG_FILE) isoextract/zlj_f.tgc/$(DMA_CONFIG_FILE)
@@ -683,44 +683,44 @@ iso:
$(V)$(FLIPS) --apply tools/gamecube.bps isoextract/zlj_f.tgc/main.dol isoextract/zlj_f.tgc/main.dol
$(V)$(GZINJECT) -a pack -s $(ISO)
$(V)$(RM) -r isoextract/
$(call print,Success!)
$(call print_no_args,Success!)
clean:
$(V)$(RM) -r $(BUILD_DIR)
$(call print,Success!)
$(call print_no_args,Success!)
assetclean:
$(V)$(RM) -r $(EXTRACTED_DIR)
$(call print,Success!)
$(call print_no_args,Success!)
distclean:
$(V)$(RM) -r extracted/
$(V)$(RM) -r build/
$(V)$(MAKE) -C tools distclean
$(V)$(RM) -r F3DEX3/*.code F3DEX3/*.data
$(call print,Success!)
$(call print_no_args,Success!)
venv:
# Create the virtual environment if it doesn't exist.
# Delete the virtual environment directory if creation fails.
$(call print,Preparing the virtual environment...)
$(call print_no_args,Preparing the virtual environment...)
$(V)test -d $(VENV) || python3 -m venv $(VENV) || { rm -rf $(VENV); false; }
$(V)$(PYTHON) -m pip install -U pip
$(V)$(PYTHON) -m pip install -U -r requirements.txt
$(call print,Success!)
$(call print_no_args,Success!)
setup: venv
$(call print,Setup in progress...)
$(call print_no_args,Setup in progress...)
$(V)$(MAKE) -C tools
$(call print,Tools: Done!)
$(call print_no_args,Tools: Done!)
$(V)$(PYTHON) tools/decompress_baserom.py $(VERSION)
$(call print,Decompressing baserom: Done!)
$(call print_no_args,Decompressing baserom: Done!)
$(V)$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION)
$(V)$(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION)
$(V)$(PYTHON) tools/extract_text.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/text -v $(VERSION)
$(V)$(PYTHON) tools/extract_assets.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/assets -v $(VERSION) -j$(N_THREADS)
$(V)$(PYTHON) tools/extract_audio.py -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml
$(call print,Extracting files: Done!)
$(call print_no_args,Extracting files: Done!)
run: rom
ifeq ($(N64_EMULATOR),)
@@ -729,12 +729,12 @@ endif
$(N64_EMULATOR) $(ROM)
patch:
$(call print,Creating BPS patch...)
$(call print_no_args,Creating BPS patch...)
$(V)$(FLIPS) --create --bps $(BASEROM_PATCH) $(ROM) $(BPS)
$(call print,Success!)
$(call print_no_args,Success!)
create_f3dex3_patches: F3DEX3/f3dzex2.code F3DEX3/f3dzex2.data
$(call print,Creating F3DEX3 patches...)
$(call print_no_args,Creating F3DEX3 patches...)
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW.code F3DEX3/F3DEX3_BrW.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW.data F3DEX3/F3DEX3_BrW.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PA.code F3DEX3/F3DEX3_BrW_PA.code.bps
@@ -751,7 +751,7 @@ create_f3dex3_patches: F3DEX3/f3dzex2.code F3DEX3/f3dzex2.data
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PB.data F3DEX3/F3DEX3_BrW_NOC_PB.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PC.code F3DEX3/F3DEX3_BrW_NOC_PC.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PC.data F3DEX3/F3DEX3_BrW_NOC_PC.data.bps
$(call print,Success!)
$(call print_no_args,Success!)
verify:
$(V)$(MAKE) clean
@@ -770,6 +770,8 @@ $(ROM): $(ELF)
@$(PRINT) "==== Build Options ====$(NO_COL)\n"
@$(PRINT) "${GREEN}OoT Version: $(BLUE)$(VERSION)$(NO_COL)\n"
@$(PRINT) "${GREEN}Code Version: $(BLUE)$(PACKAGE_VERSION)$(NO_COL)\n"
@$(PRINT) "${GREEN}Build Author: $(BLUE)$(PACKAGE_AUTHOR)$(NO_COL)\n"
@$(PRINT) "${GREEN}Commit Author: $(BLUE)$(PACKAGE_COMMIT_AUTHOR)$(NO_COL)\n"
ifeq ($(PLATFORM),IQUE)
COMPRESS_ARGS := --format gzip --pad-to 0x4000
@@ -790,7 +792,7 @@ endif
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(UCODE_O_FILES) $(LDSCRIPT) $(BUILD_DIR)/linker_scripts/makerom.ld $(BUILD_DIR)/undefined_syms.txt \
$(SAMPLEBANK_O_FILES) $(SOUNDFONT_O_FILES) $(SEQUENCE_O_FILES) \
$(BUILD_DIR)/assets/audio/sequence_font_table.o $(BUILD_DIR)/assets/audio/audiobank_padding.o
$(call print,Linking:,,$@)
$(call print_one_arg,Linking:,$@)
$(V)$(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/linker_scripts/makerom.ld -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@
$(BUILD_DIR)/linker_scripts/makerom.ld: linker_scripts/makerom.ld
@@ -809,28 +811,28 @@ $(O_FILES): | asset_files
.PHONY: o_files asset_files
$(BUILD_DIR)/$(SPEC): $(SPEC)
$(call print,Preprocessing:,$<,$@)
$(call print_two_args,Preprocessing:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) $< | $(BUILD_DIR_REPLACE) > $@
$(LDSCRIPT): $(BUILD_DIR)/$(SPEC)
$(call print,Creating linker script:,$<,$@)
$(call print_two_args,Creating linker script:,$<,$@)
$(V)$(MKLDSCRIPT) $< $@
$(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt
$(call print,Preprocessing:,$<,$@)
$(call print_two_args,Preprocessing:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) $< > $@
$(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/%
$(call print,Wrapping binary to ELF:,$<,$@)
$(call print_two_args,Wrapping binary to ELF:,$<,$@)
$(V)$(OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/F3DEX3/%.o: F3DEX3/%
$(call print,Wrapping binary to ELF:,$<,$@)
$(call print_two_args,Wrapping binary to ELF:,$<,$@)
$(V)mkdir -p $(BUILD_DIR)/F3DEX3
$(V)$(OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/data/%.o: data/%.s
$(call print,Assembling:,$<,$@)
$(call print_two_args,Assembling:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@
ifeq ($(PLATFORM),IQUE)
@@ -840,11 +842,11 @@ else
endif
$(BUILD_DIR)/assets/text/%.enc.nes.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h $(NES_CHARMAP)
$(call print,Encoding:,$<,$@)
$(call print_two_args,Encoding:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@
$(BUILD_DIR)/assets/text/%.enc.jpn.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.jpn.txt
$(call print,Encoding:,$<,$@)
$(call print_two_args,Encoding:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@
# Dependencies for files including message data headers
@@ -857,7 +859,7 @@ $(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/m
$(BUILD_DIR)/src/code/z_message.o: assets/text/message_data.h assets/text/message_data_staff.h
$(BUILD_DIR)/assets/text/%.o: assets/text/%.c
$(call print,Compiling:,$<,$@)
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(V)$(OBJCOPY) -O binary --only-section .rodata $@ $@.bin
@@ -867,7 +869,7 @@ $(BUILD_DIR)/assets/%.o: assets/%.c
$(V)$(OBJCOPY_CMD)
$(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c
$(call print,Compiling:,$<,$@)
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(V)$(OBJCOPY_CMD)
@@ -882,7 +884,7 @@ $(BUILD_DIR)/src/makerom/ipl3.o: $(EXTRACTED_DIR)/incbin/ipl3
$(V)$(OBJCOPY) -I binary -O elf32-big --rename-section .data=.text $< $@
$(BUILD_DIR)/src/%.o: src/%.s
$(call print,Compiling:,$<,$@)
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $<
$(V)$(POSTPROCESS_OBJ) $@
$(V)$(OBJDUMP_CMD)
@@ -914,7 +916,7 @@ $(BUILD_DIR)/src/%.o: src/%.c
ifneq ($(RUN_CC_CHECK),0)
$(V)$(CC_CHECK) $<
endif
$(call print,Compiling:,$<,$@)
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(V)$(POSTPROCESS_OBJ) $@
$(V)$(OBJDUMP_CMD)
@@ -923,13 +925,13 @@ $(BUILD_DIR)/src/audio/session_init.o: src/audio/session_init.c $(BUILD_DIR)/ass
ifneq ($(RUN_CC_CHECK),0)
$(V)$(CC_CHECK) $<
endif
$(call print,Compiling:,$<,$@)
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $<
$(V)$(LD) -r -T linker_scripts/data_with_rodata.ld -o $@ $(@:.o=.tmp)
$(V)$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
$(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/$(SPEC)
$(call print,Generating Relocation:,$<,$@)
$(call print_two_args,Generating Relocation:,$<,$@)
$(V)$(FADO) $$(tools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d)
$(V)$(AS) $(ASFLAGS) $(@:.o=.s) -o $@
@@ -979,22 +981,22 @@ endif
.PRECIOUS: $(BUILD_DIR)/assets/audio/samples/%.half.aifc
$(BUILD_DIR)/assets/audio/samples/%.half.aifc: assets/audio/samples/%.half.wav
$(call print,Building Sample:,$<,$@)
$(call print_two_args,Building Sample:,$<,$@)
$(V)$(SAMPLECONV) vadpcm-half $< $@
$(BUILD_DIR)/assets/audio/samples/%.half.aifc: $(EXTRACTED_DIR)/assets/audio/samples/%.half.wav
$(call print,Building Sample:,$<,$@)
$(call print_two_args,Building Sample:,$<,$@)
$(V)$(SAMPLECONV) vadpcm-half $< $@
ifeq ($(AUDIO_BUILD_DEBUG),1)
@(cmp $(<D)/aifc/$(<F:.half.wav=.half.aifc) $@ && echo "$(<F) OK") || (mkdir -p NONMATCHINGS/$(<D) && cp $(<D)/aifc/$(<F:.half.wav=.half.aifc) NONMATCHINGS/$(<D)/$(<F:.half.wav=.half.aifc))
endif
$(BUILD_DIR)/assets/audio/samples/%.aifc: assets/audio/samples/%.wav
$(call print,Building Sample:,$<,$@)
$(call print_two_args,Building Sample:,$<,$@)
$(V)$(SAMPLECONV) vadpcm $< $@
$(BUILD_DIR)/assets/audio/samples/%.aifc: $(EXTRACTED_DIR)/assets/audio/samples/%.wav
$(call print,Building Sample:,$<,$@)
$(call print_two_args,Building Sample:,$<,$@)
$(V)$(SAMPLECONV) vadpcm $< $@
ifeq ($(AUDIO_BUILD_DEBUG),1)
@(cmp $(<D)/aifc/$(<F:.wav=.aifc) $@ && echo "$(<F) OK") || (mkdir -p NONMATCHINGS/$(<D) && cp $(<D)/aifc/$(<F:.wav=.aifc) NONMATCHINGS/$(<D)/$(<F:.wav=.aifc))
@@ -1017,58 +1019,58 @@ $(BUILD_DIR)/assets/audio/samplebanks/%.s: $(BUILD_DIR)/assets/audio/samplebanks
-include $(SAMPLEBANK_DEP_FILES)
$(BUILD_DIR)/assets/audio/samplebanks/%.o: $(BUILD_DIR)/assets/audio/samplebanks/%.s
$(call print,Assembling Samplebank:,$<,$@)
$(call print_two_args,Assembling Samplebank:,$<,$@)
$(V)$(AS) $(ASFLAGS) $< -o $@
ifeq ($(AUDIO_BUILD_DEBUG),1)
$(OBJCOPY) -O binary --only-section .rodata $@ $(@:.o=.bin)
$(V)$(OBJCOPY) -O binary --only-section .rodata $@ $(@:.o=.bin)
@cmp $(@:.o=.bin) $(patsubst $(BUILD_DIR)/assets/audio/samplebanks/%,$(EXTRACTED_DIR)/baserom_audiotest/audiotable_files/%,$(@:.o=.bin)) && echo "$(<F) OK"
endif
# also assemble the soundfonts and generate the associated headers...
$(BUILD_DIR)/assets/audio/soundfonts/%.xml: assets/audio/soundfonts/%.xml
cat $< | $(BUILD_DIR_REPLACE) > $@
$(V)cat $< | $(BUILD_DIR_REPLACE) > $@
$(BUILD_DIR)/assets/audio/soundfonts/%.xml: $(EXTRACTED_DIR)/assets/audio/soundfonts/%.xml
cat $< | $(BUILD_DIR_REPLACE) > $@
$(V)cat $< | $(BUILD_DIR_REPLACE) > $@
.PRECIOUS: $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.h $(BUILD_DIR)/assets/audio/soundfonts/%.name
$(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.h $(BUILD_DIR)/assets/audio/soundfonts/%.name: $(BUILD_DIR)/assets/audio/soundfonts/%.xml | $(SAMPLEBANK_BUILD_XMLS) $(AIFC_FILES)
# This rule can be triggered for either the .c or .h file, so $@ may refer to either the .c or .h file. A simple
# substitution $(@:.c=.h) will fail ~50% of the time with -j. Instead, don't assume anything about the suffix of $@.
$(SFC) $(SFCFLAGS) --makedepend $(basename $@).d $< $(basename $@).c $(basename $@).h $(basename $@).name
$(V)$(SFC) $(SFCFLAGS) --makedepend $(basename $@).d $< $(basename $@).c $(basename $@).h $(basename $@).name
-include $(SOUNDFONT_DEP_FILES)
$(BUILD_DIR)/assets/audio/soundfonts/%.o: $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.name
# compile c to unlinked object
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -I include/audio -o $(@:.o=.tmp) $<
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -I include/audio -o $(@:.o=.tmp) $<
# partial link
$(LD) -r -T linker_scripts/soundfont.ld $(@:.o=.tmp) -o $(@:.o=.tmp2)
$(V)$(LD) -r -T linker_scripts/soundfont.ld $(@:.o=.tmp) -o $(@:.o=.tmp2)
# patch defined symbols to be ABS symbols so that they remain file-relative offsets forever
$(SFPATCH) $(@:.o=.tmp2) $(@:.o=.tmp2)
$(V)$(SFPATCH) $(@:.o=.tmp2) $(@:.o=.tmp2)
# write start and size symbols afterwards, filename != symbolic name so source symbolic name from the .name file written by sfc
# also write a .note.name section containing the symbolic name of the soundfont
$(OBJCOPY) --add-symbol $$(cat $(<:.c=.name) | tr -d '\0')_Start=.rodata:0,global --redefine-sym __LEN__=$$(cat $(<:.c=.name) | tr -d '\0')_Size --add-section .note.name=$(<:.c=.name) $(@:.o=.tmp2) $@
$(V)$(OBJCOPY) --add-symbol $$(cat $(<:.c=.name) | tr -d '\0')_Start=.rodata:0,global --redefine-sym __LEN__=$$(cat $(<:.c=.name) | tr -d '\0')_Size --add-section .note.name=$(<:.c=.name) $(@:.o=.tmp2) $@
# cleanup temp files
@$(RM) $(@:.o=.tmp) $(@:.o=.tmp2)
ifeq ($(AUDIO_BUILD_DEBUG),1)
$(LD) $(foreach f,$(SAMPLEBANK_O_FILES),-R $f) -T linker_scripts/soundfont.ld $@ -o $(@:.o=.elf)
$(OBJCOPY) -O binary -j.rodata $(@:.o=.elf) $(@:.o=.bin)
$(V)$(LD) $(foreach f,$(SAMPLEBANK_O_FILES),-R $f) -T linker_scripts/soundfont.ld $@ -o $(@:.o=.elf)
$(V)$(OBJCOPY) -O binary -j.rodata $(@:.o=.elf) $(@:.o=.bin)
@(cmp $(@:.o=.bin) $(patsubst $(BUILD_DIR)/assets/audio/soundfonts/%,$(EXTRACTED_DIR)/baserom_audiotest/audiobank_files/%,$(@:.o=.bin)) && echo "$(<F) OK" || (mkdir -p NONMATCHINGS/soundfonts && cp $(@:.o=.bin) NONMATCHINGS/soundfonts/$(@F:.o=.bin)))
endif
# then assemble the sequences...
$(BUILD_DIR)/assets/audio/sequences/%.o: assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS)
$(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@
$(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@
$(V)$(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@
$(V)$(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@
$(BUILD_DIR)/assets/audio/sequences/%.o: $(EXTRACTED_DIR)/assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS)
$(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@
$(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@
$(V)$(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@
$(V)$(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@
ifeq ($(AUDIO_BUILD_DEBUG),1)
$(OBJCOPY) -O binary -j.data $@ $(@:.o=.aseq)
$(V)$(OBJCOPY) -O binary -j.data $@ $(@:.o=.aseq)
@(cmp $(@:.o=.aseq) $(patsubst $(BUILD_DIR)/assets/audio/sequences/%,$(EXTRACTED_DIR)/baserom_audiotest/audioseq_files/%,$(@:.o=.aseq)) && echo "$(<F) OK" || (mkdir -p NONMATCHINGS/sequences && cp $(@:.o=.aseq) NONMATCHINGS/sequences/$(@F:.o=.aseq)))
endif
@@ -1080,15 +1082,15 @@ $(BUILD_DIR)/assets/audio/samplebank_table.h: $(SAMPLEBANK_BUILD_XMLS)
$(V)$(ATBLGEN) --banks $@ $^
$(BUILD_DIR)/assets/audio/soundfont_table.h: $(SOUNDFONT_BUILD_XMLS) $(SAMPLEBANK_BUILD_XMLS)
$(ATBLGEN) --fonts $@ $(SOUNDFONT_BUILD_XMLS)
$(V)$(ATBLGEN) --fonts $@ $(SOUNDFONT_BUILD_XMLS)
SEQ_ORDER_DEFS := -DDEFINE_SEQUENCE_PTR\(name,seqId,_2,_3,_4\)=*\(name,seqId\) \
-DDEFINE_SEQUENCE\(name,seqId,_2,_3,_4\)=\(name,seqId\)
$(BUILD_DIR)/assets/audio/sequence_order.in: $(SEQUENCE_TABLE)
$(CPP) $(CPPFLAGS) $< $(SEQ_ORDER_DEFS) -o $@
$(V)$(CPP) $(CPPFLAGS) $< $(SEQ_ORDER_DEFS) -o $@
$(BUILD_DIR)/assets/audio/sequence_font_table.s: $(BUILD_DIR)/assets/audio/sequence_order.in $(SEQUENCE_O_FILES)
$(ATBLGEN) --sequences $@ $^
$(V)$(ATBLGEN) --sequences $@ $^
# build the tables into objects, move data -> rodata
@@ -1107,19 +1109,19 @@ endif
@$(RM) $(@:.o=.tmp)
$(BUILD_DIR)/assets/audio/sequence_font_table.o: $(BUILD_DIR)/assets/audio/sequence_font_table.s
$(AS) $(ASFLAGS) $< -o $@
$(V)$(AS) $(ASFLAGS) $< -o $@
# make headers with file sizes and amounts
$(BUILD_DIR)/assets/audio/soundfont_sizes.h: $(SOUNDFONT_O_FILES)
$(AFILE_SIZES) $@ NUM_SOUNDFONTS SOUNDFONT_SIZES .rodata $^
$(V)$(AFILE_SIZES) $@ NUM_SOUNDFONTS SOUNDFONT_SIZES .rodata $^
$(BUILD_DIR)/assets/audio/sequence_sizes.h: $(SEQUENCE_O_FILES)
$(AFILE_SIZES) $@ NUM_SEQUENCES SEQUENCE_SIZES .data $^
$(V)$(AFILE_SIZES) $@ NUM_SEQUENCES SEQUENCE_SIZES .data $^
# Extra audiobank padding that doesn't belong to any soundfont file
$(BUILD_DIR)/assets/audio/audiobank_padding.o:
echo ".section .rodata; .fill 0x20" | $(AS) $(ASFLAGS) -o $@
$(V)echo ".section .rodata; .fill 0x20" | $(AS) $(ASFLAGS) -o $@
-include $(DEP_FILES)

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
#This script creates a debug-optimized binary by default. If you're on Linux, you'll get a faster binary from make.sh.
SRCDIR := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
@@ -69,11 +71,13 @@ ifeq ($(TARGET),gtk)
endif
endif
-include ../print_rules.mk
all: $(FNAME_$(TARGET))
obj:
mkdir obj
$(V)mkdir obj
clean: | obj
rm obj/* || true
$(V)rm obj/* || true
ifeq ($(TARGET),windows)
XFILES += obj/rc.o
@@ -92,28 +96,29 @@ ifeq ($(TARGET),gtk)
endif
$(FNAME_$(TARGET)): $(SOURCES) $(XFILES)
$(CXX) $^ -std=c++98 $(CFLAGS_G) $(MOREFLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) -o$@
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CXX) $^ -std=c++98 $(CFLAGS_G) $(MOREFLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) -o$@
ifeq ($(CFLAGS),-g)
echo 'Compiled Floating IPS in debug mode; for better performance, use ./make.sh instead'
$(V)echo 'Compiled Floating IPS in debug mode; for better performance, use ./make.sh instead'
endif
ifeq ($(TARGET),gtk)
install: all
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(DATAROOTDIR)/applications
mkdir -p $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
mkdir -p $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps
mkdir -p $(DESTDIR)$(DATAROOTDIR)/metainfo
install -p -m755 $(FNAME_$(TARGET)) $(DESTDIR)$(BINDIR)
install -p -m755 $(SRCDIR)/data/com.github.Alcaro.Flips.desktop $(DESTDIR)$(DATAROOTDIR)/applications
install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips-symbolic.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps
install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips.metainfo.xml $(DESTDIR)$(DATAROOTDIR)/metainfo
$(V)mkdir -p $(DESTDIR)$(BINDIR)
$(V)mkdir -p $(DESTDIR)$(DATAROOTDIR)/applications
$(V)mkdir -p $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
$(V)mkdir -p $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps
$(V)mkdir -p $(DESTDIR)$(DATAROOTDIR)/metainfo
$(V)install -p -m755 $(FNAME_$(TARGET)) $(DESTDIR)$(BINDIR)
$(V)install -p -m755 $(SRCDIR)/data/com.github.Alcaro.Flips.desktop $(DESTDIR)$(DATAROOTDIR)/applications
$(V)install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
$(V)install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips-symbolic.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps
$(V)install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips.metainfo.xml $(DESTDIR)$(DATAROOTDIR)/metainfo
uninstall:
rm -f $(DESTDIR)$(BINDIR)/$(FNAME_$(TARGET))
rm -f $(DESTDIR)$(DATAROOTDIR)/applications/com.github.Alcaro.Flips.desktop
rm -f $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/com.github.Alcaro.Flips.svg
rm -f $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps/com.github.Alcaro.Flips-symbolic.svg
rm -f $(DESTDIR)$(DATAROOTDIR)/metainfo/com.github.Alcaro.Flips.metainfo.xml
$(V)rm -f $(DESTDIR)$(BINDIR)/$(FNAME_$(TARGET))
$(V)rm -f $(DESTDIR)$(DATAROOTDIR)/applications/com.github.Alcaro.Flips.desktop
$(V)rm -f $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/com.github.Alcaro.Flips.svg
$(V)rm -f $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps/com.github.Alcaro.Flips-symbolic.svg
$(V)rm -f $(DESTDIR)$(DATAROOTDIR)/metainfo/com.github.Alcaro.Flips.metainfo.xml
endif

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2
PROGRAMS := elf2rom makeromfs mkdmadata mkldscript preprocess_pragmas reloc_prereq
@@ -34,32 +36,40 @@ ifneq ($(LLD),0)
CFLAGS += -fuse-ld=lld
endif
-include print_rules.mk
all: $(PROGRAMS) $(IDO_RECOMP_5_3_DIR) $(IDO_RECOMP_7_1_DIR) $(EGCS_DIR)
$(MAKE) -C ZAPD
$(MAKE) -C fado
$(call print_no_args,Building ZAPD...)
$(V)$(MAKE) -C ZAPD
$(call print_no_args,Building fado...)
$(V)$(MAKE) -C fado
$(call print_no_args,Building gzinject...)
ifeq ($(wildcard ./gzinject/Makefile),)
cd ./gzinject && ./configure
$(V)cd ./gzinject && ./configure
endif
$(MAKE) -C gzinject
$(MAKE) -C z64compress
$(MAKE) -C Flips TARGET=cli
$(MAKE) -C audio
$(V)$(MAKE) -C gzinject
$(call print_no_args,Building z64compress...)
$(V)$(MAKE) -C z64compress
$(call print_no_args,Building Flips...)
$(V)$(MAKE) -C Flips TARGET=cli
$(call print_no_args,Building audio tools...)
$(V)$(MAKE) -C audio
clean:
$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
$(RM) -r ido_recomp egcs
$(MAKE) -C ZAPD clean
$(MAKE) -C fado clean
$(V)$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
$(V)$(RM) -r ido_recomp egcs
$(V)$(MAKE) -C ZAPD clean
$(V)$(MAKE) -C fado clean
ifneq ($(wildcard ./gzinject/Makefile),)
$(MAKE) -C gzinject clean
$(V)$(MAKE) -C gzinject distclean
endif
$(MAKE) -C z64compress clean
$(MAKE) -C Flips clean
rm Flips/flips
$(MAKE) -C audio clean
$(V)$(MAKE) -C z64compress clean
$(V)$(MAKE) -C Flips clean
$(V)rm Flips/flips
$(V)$(MAKE) -C audio clean
distclean: clean
$(MAKE) -C audio distclean
$(V)$(MAKE) -C audio distclean
.PHONY: all clean distclean
@@ -73,20 +83,21 @@ reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c
define COMPILE =
$(1): $($1_SOURCES)
$(CC) $(CFLAGS) $$^ -o $$@
$(call print_two_args,Compiling:,$$^,$$@)
$(V)$(CC) $(CFLAGS) $$^ -o $$@
endef
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))
$(IDO_RECOMP_5_3_DIR):
mkdir -p $@
curl -sL https://github.com/decompals/ido-static-recomp/releases/download/$(IDO_RECOMP_VERSION)/ido-5.3-recomp-$(DETECTED_OS).tar.gz | tar xz -C $@
$(V)mkdir -p $@
$(V)curl -sL https://github.com/decompals/ido-static-recomp/releases/download/$(IDO_RECOMP_VERSION)/ido-5.3-recomp-$(DETECTED_OS).tar.gz | tar xz -C $@
$(IDO_RECOMP_7_1_DIR):
mkdir -p $@
curl -sL https://github.com/decompals/ido-static-recomp/releases/download/$(IDO_RECOMP_VERSION)/ido-7.1-recomp-$(DETECTED_OS).tar.gz | tar xz -C $@
$(V)mkdir -p $@
$(V)curl -sL https://github.com/decompals/ido-static-recomp/releases/download/$(IDO_RECOMP_VERSION)/ido-7.1-recomp-$(DETECTED_OS).tar.gz | tar xz -C $@
$(EGCS_DIR):
mkdir -p $@
curl -sL https://github.com/decompals/mips-binutils-egcs-2.9.5/releases/download/$(EGCS_BINUTILS_VERSION)/mips-binutils-egcs-2.9.5-$(DETECTED_OS).tar.gz | tar xz -C $@
curl -sL https://github.com/decompals/mips-gcc-egcs-2.91.66/releases/download/$(EGCS_GCC_VERSION)/mips-gcc-egcs-2.91.66-$(DETECTED_OS).tar.gz | tar xz -C $@
$(V)mkdir -p $@
$(V)curl -sL https://github.com/decompals/mips-binutils-egcs-2.9.5/releases/download/$(EGCS_BINUTILS_VERSION)/mips-binutils-egcs-2.9.5-$(DETECTED_OS).tar.gz | tar xz -C $@
$(V)curl -sL https://github.com/decompals/mips-gcc-egcs-2.91.66/releases/download/$(EGCS_GCC_VERSION)/mips-gcc-egcs-2.91.66-$(DETECTED_OS).tar.gz | tar xz -C $@

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
# Only used for standalone compilation, usually inherits these from the main makefile
CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17
@@ -11,18 +13,20 @@ LIB := ExporterTest.a
# create build directories
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)))
-include ../../print_rules.mk
all: $(LIB)
clean:
rm -rf build $(LIB)
$(V)rm -rf build $(LIB)
format:
clang-format-14 -i $(CPP_FILES) $(H_FILES)
$(V)clang-format-14 -i $(CPP_FILES) $(H_FILES)
.PHONY: all clean format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(OPTFLAGS) -I ./ -I ../ZAPD -I ../ZAPDUtils -I ../lib/tinyxml2 -c $(OUTPUT_OPTION) $<
$(V)$(CXX) $(CXXFLAGS) $(OPTFLAGS) -I ./ -I ../ZAPD -I ../ZAPDUtils -I ../lib/tinyxml2 -c $(OUTPUT_OPTION) $<
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
$(V)$(AR) rcs $@ $^

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
# use variables in submakes
export
OPTIMIZATION_ON ?= 1
@@ -103,49 +105,51 @@ O_FILES += build/ZAPD/BuildInfo.o
# create build directories
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)))
-include ../print_rules.mk
# Main targets
all: ZAPD.out copycheck
build/ZAPD/BuildInfo.o:
python3 ZAPD/genbuildinfo.py $(COPYCHECK_ARGS)
$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) build/ZAPD/BuildInfo.cpp
$(V)python3 ZAPD/genbuildinfo.py $(COPYCHECK_ARGS)
$(V)$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) build/ZAPD/BuildInfo.cpp
copycheck: ZAPD.out
python3 copycheck.py
$(V)python3 copycheck.py
clean:
rm -rf build ZAPD.out
$(MAKE) -C lib/libgfxd clean
$(MAKE) -C ZAPDUtils clean
$(MAKE) -C ExporterTest clean
$(V)rm -rf build ZAPD.out
$(V)$(MAKE) -C lib/libgfxd clean
$(V)$(MAKE) -C ZAPDUtils clean
$(V)$(MAKE) -C ExporterTest clean
rebuild: clean all
format:
clang-format-14 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES)
$(MAKE) -C ZAPDUtils format
$(MAKE) -C ExporterTest format
$(V)clang-format-14 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES)
$(V)$(MAKE) -C ZAPDUtils format
$(V)$(MAKE) -C ExporterTest format
.PHONY: all build/ZAPD/BuildInfo.o copycheck clean rebuild format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) $<
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) $<
# Submakes
lib/libgfxd/libgfxd.a:
$(MAKE) -C lib/libgfxd
$(V)$(MAKE) -C lib/libgfxd
.PHONY: ExporterTest
ExporterTest:
$(MAKE) -C ExporterTest
$(V)$(MAKE) -C ExporterTest
.PHONY: ZAPDUtils
ZAPDUtils:
$(MAKE) -C ZAPDUtils
$(V)$(MAKE) -C ZAPDUtils
# Linking
ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils
$(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION)
$(V)$(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION)

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
# Only used for standalone compilation, usually inherits these from the main makefile
CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17
@@ -11,18 +13,21 @@ LIB := ZAPDUtils.a
# create build directories
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)))
-include ../../print_rules.mk
all: $(LIB)
clean:
rm -rf build $(LIB)
$(V)rm -rf build $(LIB)
format:
clang-format-14 -i $(CPP_FILES) $(H_FILES)
$(V)clang-format-14 -i $(CPP_FILES) $(H_FILES)
.PHONY: all clean format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(OPTFLAGS) -c $(OUTPUT_OPTION) $<
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CXX) $(CXXFLAGS) $(OPTFLAGS) -c $(OUTPUT_OPTION) $<
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
$(V)$(AR) rcs $@ $^

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
CFLAGS = -Wall -O2 -g
UC_OBJ = uc_f3d.o uc_f3db.o uc_f3dex.o uc_f3dexb.o uc_f3dex2.o
OBJ = gfxd.o $(UC_OBJ)
@@ -6,12 +8,14 @@ LIB = libgfxd.a
CPPFLAGS-$(MT) += -DCONFIG_MT
CPPFLAGS += $(CPPFLAGS-y)
-include ../../print_rules.mk
.PHONY: all
all: $(LIB)
.PHONY: clean
clean:
rm -f $(OBJ) $(LIB)
$(V)rm -f $(OBJ) $(LIB)
.INTERMEDIATE: $(OBJ)
@@ -19,7 +23,7 @@ $(OBJ): gbi.h gfxd.h priv.h
$(UC_OBJ): uc.c uc_argfn.c uc_argtbl.c uc_macrofn.c uc_macrotbl.c
$(LIB): $(OBJ)
$(AR) rcs $@ $^
$(V)$(AR) rcs $@ $^
%.o: %.c
$(COMPILE.c) $(OUTPUT_OPTION) $<
$(V)$(COMPILE.c) $(OUTPUT_OPTION) $<

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
PROGRAMS := afile_sizes atblgen sbc sfc sfpatch
ifeq ($(shell which xml2-config),)
@@ -14,21 +16,23 @@ OPTFLAGS := -O2
XML_CFLAGS := $(shell xml2-config --cflags)
XML_LDFLAGS := $(shell xml2-config --libs)
-include ../print_rules.mk
.PHONY: all clean distclean format
all: $(PROGRAMS)
$(MAKE) -C sampleconv
$(V)$(MAKE) -C sampleconv
clean:
$(RM) $(PROGRAMS)
$(MAKE) -C sampleconv clean
$(V)$(RM) $(PROGRAMS)
$(V)$(MAKE) -C sampleconv clean
distclean: clean
$(MAKE) -C sampleconv distclean
$(V)$(MAKE) -C sampleconv distclean
format:
$(CLANG_FORMAT) $(FORMAT_ARGS) $(shell find . -maxdepth 1 -type f -name "*.[ch]")
$(MAKE) -C sampleconv format
$(V)$(CLANG_FORMAT) $(FORMAT_ARGS) $(shell find . -maxdepth 1 -type f -name "*.[ch]")
$(V)$(MAKE) -C sampleconv format
afile_sizes_SOURCES := afile_sizes.c util.c
atblgen_SOURCES := audio_tablegen.c samplebank.c soundfont.c xml.c util.c
@@ -46,7 +50,7 @@ sfc_LDFLAGS := $(XML_LDFLAGS)
define COMPILE =
$(1): $($1_SOURCES)
$(CC) $(CFLAGS) $($1_CFLAGS) $$^ $($1_LDFLAGS) -o $$@
$(V)$(CC) $(CFLAGS) $($1_CFLAGS) $$^ $($1_LDFLAGS) -o $$@
endef
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))

View File

@@ -1,3 +1,4 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
CC := gcc
CFLAGS := -Wall -Wextra -MMD
@@ -15,22 +16,25 @@ DEP_FILES := $(foreach f,$(C_FILES:.c=.d),build/$f)
$(shell mkdir -p build $(foreach dir,$(SRC_DIRS),build/$(dir)))
-include ../../print_rules.mk
.PHONY: all clean distclean format
all: sampleconv
clean:
$(RM) -rf build sampleconv
$(V)$(RM) -rf build sampleconv
distclean: clean
format:
$(CLANG_FORMAT) $(FORMAT_ARGS) $(C_FILES) $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))
$(V)$(CLANG_FORMAT) $(FORMAT_ARGS) $(C_FILES) $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))
sampleconv: $(O_FILES)
$(CC) $(LDFLAGS) $(O_FILES) -lm -o $@
$(V)$(CC) $(LDFLAGS) $(O_FILES) -lm -o $@
build/src/%.o: src/%.c
$(CC) -c $(CFLAGS) $(OPTFLAGS) $< -o $@
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(OPTFLAGS) $< -o $@
-include $(DEP_FILES)

View File

@@ -10,6 +10,11 @@ from pathlib import Path
import version_config
VERBOSE = False
def log(s):
if VERBOSE:
print(s)
def SignalHandler(sig, frame):
print(f'Signal {sig} received. Aborting...')
@@ -49,7 +54,7 @@ def ExtractFile(assetConfig: version_config.AssetConfig, outputPath: Path, outpu
if globalUnaccounted:
execStr += " -Wunaccounted"
print(execStr)
log(execStr)
exitValue = os.system(execStr)
if exitValue != 0:
globalAbort.set()
@@ -110,7 +115,7 @@ def processZAPDArgs(argsZ):
exit(1)
ZAPDArgs = " ".join(f"-{z}" for z in argsZ)
print("Using extra ZAPD arguments: " + ZAPDArgs)
log("Using extra ZAPD arguments: " + ZAPDArgs)
return ZAPDArgs
def main():
@@ -131,8 +136,12 @@ def main():
parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.")
parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true")
parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append")
parser.add_argument("--verbose", help="verbose output", action="store_true", default=False)
args = parser.parse_args()
global VERBOSE
VERBOSE = args.verbose
baseromSegmentsDir: Path = args.baserom_segments_dir
version: str = args.oot_version
outputDir: Path = args.output_dir

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
DEBUG ?= 0
LLD ?= 0
ASAN ?= 0
@@ -42,14 +44,16 @@ LIB_DIRS := $(shell find lib -type d)
C_LIB_FILES := $(filter-out lib/vc_vector/vc_vector_test.c, $(foreach dir,$(LIB_DIRS),$(wildcard $(dir)/*.c)))
O_LIB_FILES := $(foreach f,$(C_LIB_FILES:.c=.o),build/$f)
-include ../print_rules.mk
# Main targets
all: $(ELF)
clean:
$(RM) -r build $(ELF)
$(V)$(RM) -r build $(ELF)
format:
clang-format-14 -i $(C_FILES) $(H_FILES) lib/fairy/*
$(V)clang-format-14 -i $(C_FILES) $(H_FILES) lib/fairy/*
.PHONY: all clean format
@@ -57,10 +61,12 @@ format:
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)) $(foreach dir,$(LIB_DIRS),build/$(dir)))
$(ELF): $(O_FILES) $(O_LIB_FILES)
$(CC) $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) $(LDFLAGS) -o $@ $^
$(V)$(CC) $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) $(LDFLAGS) -o $@ $^
build/%.o: %.c $(H_FILES)
$(CC) -c $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) -o $@ $<
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) -o $@ $<
build/lib/%.o: lib/%.c
$(CC) -c $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) -o $@ $<
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) -o $@ $<

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
CC = @CC@
LD = @CC@
INSTALL = @INSTALL@
@@ -16,24 +18,27 @@ LIBS =
OBJDIR = obj
OUTDIR = $(OBJDIR)
-include ../print_rules.mk
.PHONY : all install clean distclean
all : $(PROGNAME)
clean :
rm -rf $(PROGNAME) obj
$(V)rm -rf $(PROGNAME) obj
distclean : clean
rm -f Makefile
$(V)rm -f Makefile
install : $(PROGNAME)
$(INSTALL) -p -D --target-directory=$(DESTDIR)$(bindir) $(PROGNAME)
$(V)$(INSTALL) -p -D --target-directory=$(DESTDIR)$(bindir) $(PROGNAME)
$(PROGNAME) : $(COBJ)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)
$(V)$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)
$(OUTDIR) :
mkdir -p $@
$(V)mkdir -p $@
$(COBJ) : $(OBJDIR)/%.o: $(SRCDIR)/% | $(OBJDIR)
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(call print_files,Compiling:,$<,$@)
$(V)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@

26
tools/print_rules.mk Normal file
View File

@@ -0,0 +1,26 @@
# Verbose toggle
V := @
ifeq (VERBOSE, 1)
V=
endif
# Colors
NO_COL := \033[0m
GREEN := \033[0;32m
BLUE := \033[0;36m
YELLOW := \033[0;33m
BLINK := \033[32;5m
PRINT := printf
define print_no_args
$(V)$(PRINT) "$(GREEN)$(1)$(NO_COL)\n"
endef
define print_one_arg
$(V)$(PRINT) "$(GREEN)$(1) $(BLUE)$(2)$(NO_COL)\n"
endef
define print_two_args
$(V)$(PRINT) "$(GREEN)$(1) $(YELLOW)$(2)$(GREEN) -> $(BLUE)$(3)$(NO_COL)\n"
endef

View File

@@ -1,3 +1,5 @@
MAKEFLAGS += --no-builtin-rules --no-print-directory
CC := gcc
CFLAGS := -DNDEBUG -s -Os -flto -Wall -Wextra
@@ -32,6 +34,8 @@ C_FILES := $(foreach dir,$(C_DIRS),$(wildcard $(dir)/*.c))
C_FILES += src/enc/libdeflate/lib/deflate_compress.c src/enc/libdeflate/lib/utils.c
O_FILES := $(foreach f,$(C_FILES:.c=.o),$(OBJ_DIR)/$f)
-include ../print_rules.mk
# Make build directories
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),$(OBJ_DIR)/$(dir)))
@@ -40,10 +44,11 @@ $(shell mkdir -p $(foreach dir,$(SRC_DIRS),$(OBJ_DIR)/$(dir)))
all: z64compress
z64compress: $(O_FILES)
$(CC) $(TARGET_CFLAGS) $(CFLAGS) $(O_FILES) -lm -lpthread -lz $(TARGET_LIBS) -o z64compress
$(V)$(CC) $(TARGET_CFLAGS) $(CFLAGS) $(O_FILES) -lm -lpthread -lz $(TARGET_LIBS) -o z64compress
$(OBJ_DIR)/%.o: %.c
$(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $< -o $@
$(call print_two_args,Compiling:,$<,$@)
$(V)$(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $< -o $@
clean:
$(RM) -rf z64compress bin o
$(V)$(RM) -rf z64compress bin o