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 #############################
NOEXTRACT ?= 0
ifeq ($(VERBOSE),1)
DUMMY != ./extract_assets.py $(VERSION) >&2 || echo FAIL
else
DUMMY != ./extract_assets.py $(VERSION) CI >&2 || echo FAIL
endif
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets)
endif
# ifeq ($(VERBOSE),1)
# DUMMY != ./extract_assets.py $(VERSION) >&2 || echo FAIL
# else
# DUMMY != ./extract_assets.py $(VERSION) CI >&2 || echo FAIL
# endif
# ifeq ($(DUMMY),FAIL)
# $(error Failed to extract assets)
# endif
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
# 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
@ -216,9 +213,6 @@ $(BUILD_DIR)/data/%.o: data/%.c
# $(CC_TEST) -c $(INCLUDE_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
$(CC) -c $(CFLAGS) -o $@ $<
@ -256,6 +250,14 @@ test: $(BUILD_DIR)/$(TARGET).z64
load: $(BUILD_DIR)/$(TARGET).z64
$(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
# 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
# compressed block still go together).
keys = sorted(list(todo.keys()), key=lambda k: todo[k][0][0])
# Import new assets
for key in keys:
assets = todo[key]
@ -250,6 +249,11 @@ def main():
else:
with open(asset, "wb") as f:
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
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_1/**/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)
for i in sorted(glob.glob("assets/geo/bank_*/**/block.bin")):