blob: 04667227e89bb1919584b41d016e56cb8c4153a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
TARGET := scummvm
APP_TITLE := ScummVM
APP_DESCRIPTION := Point-and-click adventure game engines
APP_AUTHOR := ScummVM Team
APP_ICON := $(srcdir)/backends/platform/3ds/app/icon.png
APP_RSF := $(srcdir)/backends/platform/3ds/app/scummvm.rsf
APP_BANNER_IMAGE:= $(srcdir)/backends/platform/3ds/app/banner.png
APP_BANNER_AUDIO:= $(srcdir)/backends/platform/3ds/app/banner.wav
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CXXFLAGS += -std=gnu++11
ASFLAGS += -mfloat-abi=hard
LDFLAGS += -specs=3dsx.specs $(ARCH) -L$(DEVKITPRO)/libctru/lib -L$(DEVKITPRO)/portlibs/3ds/lib
.PHONY: clean_3ds
clean: clean_3ds
clean_3ds:
$(RM) backends/platform/3ds/shader.shbin
$(RM) backends/platform/3ds/shader_shbin.h
$(RM) $(TARGET).smdh
$(RM) $(TARGET).3dsx
$(RM) $(TARGET).bnr
$(RM) $(TARGET).cia
$(RM) -rf romfs
romfs: $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD)
@rm -rf romfs
@mkdir -p romfs
@cp $(DIST_FILES_THEMES) romfs/
ifdef DIST_FILES_ENGINEDATA
@cp $(DIST_FILES_ENGINEDATA) romfs/
endif
ifdef DIST_FILES_NETWORKING
@cp $(DIST_FILES_NETWORKING) romfs/
endif
ifdef DIST_FILES_VKEYBD
@cp $(DIST_FILES_VKEYBD) romfs/
endif
$(TARGET).smdh: $(APP_ICON)
@smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
@echo built ... $(notdir $@)
$(TARGET).3dsx: $(EXECUTABLE) $(TARGET).smdh romfs
@3dsxtool $< $@ --smdh=$(TARGET).smdh --romfs=romfs
@echo built ... $(notdir $@)
$(TARGET).bnr: $(APP_BANNER_IMAGE) $(APP_BANNER_AUDIO)
@bannertool makebanner -o $@ -i $(APP_BANNER_IMAGE) -a $(APP_BANNER_AUDIO)
@echo built ... $(notdir $@)
$(TARGET).romfs: romfs
@3dstool -cvtf romfs $(TARGET).romfs --romfs-dir romfs
@echo built ... $(notdir $@)
$(TARGET).cia: $(EXECUTABLE) $(APP_RSF) $(TARGET).smdh $(TARGET).bnr $(TARGET).romfs
@makerom -f cia -target t -exefslogo -o $@ -elf $(EXECUTABLE) -rsf $(APP_RSF) -banner $(TARGET).bnr -icon $(TARGET).smdh -romfs $(TARGET).romfs
@echo built ... $(notdir $@)
#---------------------------------------------------------------------------------
# rules for assembling GPU shaders
#---------------------------------------------------------------------------------
define shader-as
$(eval FILEPATH := $(patsubst %.shbin.o,%.shbin,$@))
$(eval FILE := $(patsubst %.shbin.o,%.shbin,$(notdir $@)))
picasso -o $(FILEPATH) $1
bin2s $(FILEPATH) | $(AS) -o $@
echo "extern const u8" `(echo $(FILE) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(FILEPATH) | tr . _)`.h
echo "extern const u8" `(echo $(FILE) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(FILEPATH) | tr . _)`.h
echo "extern const u32" `(echo $(FILE) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(FILEPATH) | tr . _)`.h
endef
vpath %.v.pica $(srcdir)
vpath %.g.pica $(srcdir)
vpath %.shlist $(srcdir)
%.shbin.o : %.v.pica %.g.pica
@echo $(notdir $^)
@$(call shader-as,$^)
%.shbin.o : %.v.pica
@echo $(notdir $<)
@$(call shader-as,$<)
%.shbin.o : %.shlist
@echo $(notdir $<)
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file)))
|