From cbda9a6b87292341f33f56099ac34894a58fe133 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Thu, 31 Mar 2016 19:41:40 -0700 Subject: [PATCH] Allow including binary files on targets other than 3DS. --- make_base | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/make_base b/make_base index 4607e7f..d78cafb 100644 --- a/make_base +++ b/make_base @@ -74,7 +74,6 @@ ifeq ($(TARGET),3DS) CC := $(DEVKITARM)/bin/arm-none-eabi-gcc CXX := $(DEVKITARM)/bin/arm-none-eabi-g++ - BIN2S := $(DEVKITARM)/bin/bin2s PICASSO := $(DEVKITARM)/bin/picasso SMDHTOOL := $(DEVKITARM)/bin/smdhtool _3DSXTOOL := $(DEVKITARM)/bin/3dsxtool @@ -179,31 +178,28 @@ runhw: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE) @$(_3DSLINK) --address $(REMOTE_IP) $(OUTPUT_DIR)/3ds/$(STRIPPED_NAME)/$(STRIPPED_NAME).3dsx endif -$(BUILD_DIR)/%.bin.o: %.bin +$(BUILD_DIR)/%.shbin.o: $(BUILD_DIR)/%.shbin.c @echo $@ - @$(BIN2S) $< | $(AS) -o $(@) - @echo "extern const u8" `(echo $( `(echo $(BUILD_DIR)/$< | tr . _)`.h - @echo "extern const u8" `(echo $(> `(echo $(BUILD_DIR)/$< | tr . _)`.h - @echo "extern const u32" `(echo $(> `(echo $(BUILD_DIR)/$< | tr . _)`.h + @$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@ define shader-as - $(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$@)) + $(eval CURBIN := $(patsubst %.shbin.c,%.shbin,$@)) $(PICASSO) -o $(CURBIN) $1 - $(BIN2S) $(CURBIN) | $(AS) -o $@ - echo "extern const u8" `(echo $(notdir $(CURBIN)) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h + @cd $(dir $(CURBIN)); \ + xxd -i $(notdir $(CURBIN)) $(CURDIR)/$@ echo "extern const u8" `(echo $(notdir $(CURBIN)) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h - echo "extern const u32" `(echo $(notdir $(CURBIN)) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h + echo "extern const u32" `(echo $(notdir $(CURBIN)) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_len";" >> `(echo $(CURBIN) | tr . _)`.h endef -$(BUILD_DIR)/%.shbin.o: %.v.pica %.g.pica +$(BUILD_DIR)/%.shbin.c: %.v.pica %.g.pica @echo $@ @$(call shader-as,$^) -$(BUILD_DIR)/%.shbin.o: %.v.pica +$(BUILD_DIR)/%.shbin.c: %.v.pica @echo $@ @$(call shader-as,$<) -$(BUILD_DIR)/%.shbin.o: %.shlist +$(BUILD_DIR)/%.shbin.c: %.shlist @echo $@ @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file))) @@ -289,6 +285,17 @@ $(BUILD_DIR)/%.o: %.S @echo $@ @$(CC) -c $(CC_FLAGS) -MMD -MP -MF -x assembler-with-cpp $(BUILD_DIR)/$*.d $< -o $@ +$(BUILD_DIR)/%.bin.o: $(BUILD_DIR)/%.bin.c + @echo $@ + @$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@ + +$(BUILD_DIR)/%.bin.c: %.bin + @echo $@ + @cd $(> `(echo $(BUILD_DIR)/$< | tr . _)`.h + @echo "extern const u32" `(echo $(> `(echo $(BUILD_DIR)/$< | tr . _)`.h + $(foreach file,$(OBJECT_FILES),$(eval $(call createdirrule,$(file)))) $(foreach file,$(OUTPUT_FILES),$(eval $(call createdirrule,$(file))))