Allow including binary files on targets other than 3DS.
This commit is contained in:
parent
116f6d7dc6
commit
cbda9a6b87
1 changed files with 20 additions and 13 deletions
33
make_base
33
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 $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(BUILD_DIR)/$< | tr . _)`.h
|
||||
@echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(BUILD_DIR)/$< | tr . _)`.h
|
||||
@echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(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 $(<D); \
|
||||
xxd -i $(<F) $(CURDIR)/$@
|
||||
@echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(BUILD_DIR)/$< | tr . _)`.h
|
||||
@echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_len";" >> `(echo $(BUILD_DIR)/$< | tr . _)`.h
|
||||
|
||||
$(foreach file,$(OBJECT_FILES),$(eval $(call createdirrule,$(file))))
|
||||
$(foreach file,$(OUTPUT_FILES),$(eval $(call createdirrule,$(file))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue