fix asset_table.o generation

This commit is contained in:
Alex Bates 2020-10-22 18:41:52 +01:00
parent 61665d1066
commit c9a0f1b7d9
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706

View File

@ -14,6 +14,7 @@ INCLUDE_DIRS := include include/PR src
DATA_DIRS := $(shell mkdir -p bin && find bin -type d -not -name Yay0)
YAY0_DIRS := bin/Yay0
ASSETS_FS_DIRS := assets/fs
ASSETS_FS_BIN := $(BUILD_DIR)/assets/fs.bin
# Source code files
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
@ -26,10 +27,11 @@ YAY0_FILES := $(foreach dir,$(YAY0_DIRS),$(wildcard $(dir)/*.bin))
ASSETS_FS_FILES := $(foreach dir,$(ASSETS_FS_DIRS),$(wildcard $(dir)/*.*))
# Object files
ASSETS_FS_O := $(ASSETS_FS_BIN:.bin=.o)
O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.c.o)) \
$(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.s.o)) \
$(foreach file,$(DATA_FILES),$(BUILD_DIR)/$(file:.bin=.bin.o)) \
$(foreach dir,$(ASSETS_FS_DIRS),$(BUILD_DIR)/$(dir).o) \
$(ASSETS_FS_O) \
$(foreach file,$(YAY0_FILES),$(BUILD_DIR)/$(file:.bin=.Yay0.o))
####################### Tools #########################
@ -65,11 +67,11 @@ all: $(TARGET).ld $(BUILD_DIR) $(TARGET).z64 verify
clean:
rm -rf $(BUILD_DIR) $(TARGET).z64
@mkdir -p $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(DATA_DIRS) $(ASSETS_FS_DIRS),build/$(dir))
make $(BUILD_DIR)
clean-code:
rm -rf $(BUILD_DIR)/src $(TARGET).z64
@mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))
make $(BUILD_DIR)
submodules:
git submodule update --init --recursive
@ -87,6 +89,7 @@ print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
@mkdir -p $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(DATA_DIRS) $(ASSETS_FS_DIRS),build/$(dir))
$(BUILD_DIR)/%.s.o: %.s
$(AS) $(ASFLAGS) -o $@ $<
@ -97,13 +100,14 @@ $(BUILD_DIR)/%.c.o: %.c $(H_FILES)
$(BUILD_DIR)/%.bin.o: %.bin
$(LD) -r -b binary -o $@ $<
$(BUILD_DIR)/assets/fs/%: $(ASSETS_FS_FILES)
$(BUILD_DIR)/assets/fs/%: assets/fs/%
@rm -f $@
$(TOOLS)/build_assets_fs.py $*
$(BUILD_DIR)/assets/fs.bin: assets/fs.json $(TOOLS)/build_assets_fs.py $(foreach file,$(ASSETS_FS_FILES),build/$(file))
$(TOOLS)/build_assets_fs.py
$(BUILD_DIR)/assets/fs.o: $(BUILD_DIR)/assets/fs.bin
$(ASSETS_FS_O): $(ASSETS_FS_BIN)
$(LD) -r -b binary -o $@ $<
$(BUILD_DIR)/%.Yay0.o: %.bin
@ -128,4 +132,4 @@ $(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin
verify: $(TARGET).z64
sha1sum -c checksum.sha1
.PHONY: all clean default
.PHONY: all clean default $(BUILD_DIR)