-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.mk
105 lines (73 loc) · 2.78 KB
/
build.mk
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.PHONY: build
build: $(TARGET)$(EXT)
ifeq ($(BUILD_3DSX), 1)
build: $(TARGET).3dsx $(TARGET).smdh
$(BUILD_DIR)/$(TARGET).3dsx: $(BUILD_DIR)/$(TARGET).elf
endif
ifeq ($(BUILD_3DS), 1)
build: $(TARGET).3ds
$(BUILD_DIR)/$(TARGET).3ds: $(BUILD_DIR)/$(TARGET).elf
endif
ifeq ($(BUILD_CIA), 1)
build: $(TARGET).cia
$(BUILD_DIR)/$(TARGET).cia: $(BUILD_DIR)/$(TARGET).elf
endif
%: $(BUILD_DIR)/%
cp $< $@
$(BUILD_DIR)/$(TARGET)$(EXT): $(OBJS) $(MODULE) .lastbuild
touch .lastbuild
$(CXX) $(OBJS) -L$(dir $(MODULE)) -l:$(notdir $(MODULE)) $(LDFLAGS) $(LIBDIRS) $(LIBS) -Wall -o $@
$(BUILD_DIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $< $(CFLAGS) -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend -c -o $@
$(BUILD_DIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CC) $< $(CXXFLAGS) -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend -c -o $@
$(BUILD_DIR)/%.o: %.s
@mkdir -p $(dir $@)
$(CC) $< $(ASFLAGS) -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend -c -o $@
$(BUILD_DIR)/%.o: %.S
@mkdir -p $(dir $@)
$(CC) $< $(ASFLAGS) -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend -c -o $@
$(BUILD_DIR)/%.a:
$(AR) -rc $@ $^
%.vert.inc: %.vert
glslc -c -mfmt=c $< -o $@
%.frag.inc: %.frag
glslc -c -mfmt=c $< -o $@
%.geom.inc: %.geom
glslc -c -mfmt=c $< -o $@
%.vert.inc: %.slang
glslc -c -mfmt=c -fshader-stage=vertex -DVERTEX_SHADER $< -o $@
%.frag.inc: %.slang
glslc -c -mfmt=c -fshader-stage=fragment -DFRAGMENT_SHADER $< -o $@
%.geom.inc: %.slang
glslc -c -mfmt=c -fshader-stage=geometry -DGEOMETRY_SHADER $< -o $@
ifeq ($(platform),3ds)
$(BUILD_DIR)/%.o: %.vsh %.gsh
$(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin
$(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(AS) -o $@
rm $*.shbin
$(BUILD_DIR)/%.o: %.vsh
$(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin
$(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@
rm $*.shbin
$(BUILD_DIR)/$(TARGET).smdh: $(APP_ICON)
smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
$(BUILD_DIR)/$(TARGET).3dsx: $(BUILD_DIR)/$(TARGET).elf
3dsxtool $< $@
$(BUILD_DIR)/$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
$(BANNERTOOL) makebanner -i "$(APP_BANNER)" -a "$(APP_AUDIO)" -o $@
$(BUILD_DIR)/$(TARGET).icn: $(APP_ICON)
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
$(BUILD_DIR)/$(TARGET).3ds: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).bnr $(BUILD_DIR)/$(TARGET).icn $(APP_RSF)
$(MAKEROM) -f cci -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=true
$(BUILD_DIR)/$(TARGET).cia: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).bnr $(BUILD_DIR)/$(TARGET).icn $(APP_RSF)
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
endif
.lastbuild: ;
clean:
# rm -rf objs
rm -f $(OBJS) $(OBJS:.o=.depend)
rm -f $(BUILD_DIR)/$(TARGET) $(TARGET) $(SPIRV_OBJS) .lastbuild
-include $(OBJS:.o=.depend)