added make setup target

This commit is contained in:
farisawan-2000 2021-01-16 16:53:37 -05:00
parent 022720de27
commit d0081fb83e
3 changed files with 26 additions and 16 deletions

View File

@ -123,14 +123,14 @@ CC_TEST := gcc -Wall
######################## Targets ############################# ######################## Targets #############################
NOEXTRACT ?= 0 NOEXTRACT ?= 0
ifeq ($(VERBOSE),1) # ifeq ($(VERBOSE),1)
DUMMY != ./extract_assets.py $(VERSION) >&2 || echo FAIL # DUMMY != ./extract_assets.py $(VERSION) >&2 || echo FAIL
else # else
DUMMY != ./extract_assets.py $(VERSION) CI >&2 || echo FAIL # DUMMY != ./extract_assets.py $(VERSION) CI >&2 || echo FAIL
endif # endif
ifeq ($(DUMMY),FAIL) # ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets) # $(error Failed to extract assets)
endif # endif
ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(ASSET_DIRS) $(SRC_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(UCODE_DIRS)) ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(ASSET_DIRS) $(SRC_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(UCODE_DIRS))
@ -148,10 +148,7 @@ ifeq ($(DUMMY),FAIL)
endif endif
# Making submodules # Making submodules
DUMMY != make -C libreultra -j4
DUMMY != make -C libreultra naudio -j4
DUMMY != make -C tools -j4
DUMMY != make -C f3dex2 VERSION=2.04H ARMIPS=../tools/armips
default: all default: all
@ -216,9 +213,6 @@ $(BUILD_DIR)/data/%.o: data/%.c
# $(CC_TEST) -c $(INCLUDE_CFLAGS) -o $@ $< # $(CC_TEST) -c $(INCLUDE_CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
assets/geo/%.c: assets/geo/%.bin
python3 tools/scut/GeoFromBin.py $< $@
$(BUILD_DIR)/assets/geo/%.o: assets/geo/%.c $(BUILD_DIR)/assets/geo/%.o: assets/geo/%.c
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
@ -256,6 +250,14 @@ test: $(BUILD_DIR)/$(TARGET).z64
load: $(BUILD_DIR)/$(TARGET).z64 load: $(BUILD_DIR)/$(TARGET).z64
$(LOADER) $(LOADER_FLAGS) $< $(LOADER) $(LOADER_FLAGS) $<
setup: $(ASSET_C_FILES)
make -C libreultra -j4
make -C libreultra naudio -j4
make -C tools -j4
make -C f3dex2 VERSION=2.04H ARMIPS=../tools/armips
make -C tools
./extract_assets.py $(VERSION)
.PHONY: all clean default diff test distclean .PHONY: all clean default diff test distclean
# Remove built-in rules, to improve performance # Remove built-in rules, to improve performance

View File

@ -146,7 +146,6 @@ def main():
# Go through the assets in roughly alphabetical order (but assets in the same # Go through the assets in roughly alphabetical order (but assets in the same
# compressed block still go together). # compressed block still go together).
keys = sorted(list(todo.keys()), key=lambda k: todo[k][0][0]) keys = sorted(list(todo.keys()), key=lambda k: todo[k][0][0])
# Import new assets # Import new assets
for key in keys: for key in keys:
assets = todo[key] assets = todo[key]
@ -250,6 +249,11 @@ def main():
else: else:
with open(asset, "wb") as f: with open(asset, "wb") as f:
f.write(input) f.write(input)
if "geo" in asset:
if "bank_0" in asset or "bank_1" in asset or "bank_2" in asset:
asset_c = asset[:-3] + "c"
print("Converting %s to C..." % asset)
subprocess.run("python3 tools/scut/GeoFromBin.py %s %s" % (asset, asset_c), shell=True)
# Remove old assets # Remove old assets
for asset in previous_assets: for asset in previous_assets:

View File

@ -7,6 +7,10 @@ if "--clean" in ''.join(sys.argv):
subprocess.run("rm assets/geo/bank_0/**/block.c", shell=True) subprocess.run("rm assets/geo/bank_0/**/block.c", shell=True)
subprocess.run("rm assets/geo/bank_1/**/block.c", shell=True) subprocess.run("rm assets/geo/bank_1/**/block.c", shell=True)
subprocess.run("rm assets/geo/bank_2/**/block.c", shell=True) subprocess.run("rm assets/geo/bank_2/**/block.c", shell=True)
subprocess.run("rm assets/geo/bank_3/**/block.c", shell=True)
subprocess.run("rm assets/geo/bank_4/**/block.c", shell=True)
subprocess.run("rm assets/geo/bank_6/**/block.c", shell=True)
subprocess.run("rm assets/geo/bank_7/**/block.c", shell=True)
exit(0) exit(0)
for i in sorted(glob.glob("assets/geo/bank_*/**/block.bin")): for i in sorted(glob.glob("assets/geo/bank_*/**/block.bin")):