-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch_rules
125 lines (101 loc) · 3.91 KB
/
switch_rules
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif
include $(DEVKITPRO)/devkitA64/base_tools
#---------------------------------------------------------------------------------
%.a:
#---------------------------------------------------------------------------------
@echo " AR " $@
@rm -f $@
$(AR) -rc $@ $^
#---------------------------------------------------------------------------------
%.o: %.cpp
@echo " CXX " $(notdir $<)
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.c
@echo " CC " $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.s
@echo " CC " $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.S
@echo " CC " $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
@echo " BIN " $(notdir $<)
@bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' -e 's/[^A-Za-z0-9_]/_/g')`"_end[];" > `(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' -e 's/[^A-Za-z0-9_]/_/g')`"[];" >> `(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' -e 's/[^A-Za-z0-9_]/_/g')`_size";" >> `(echo $(<F) | tr . _)`.h
endef
PORTLIBS := $(PORTLIBS_PATH)/switch
PATH := $(PORTLIBS)/bin:$(PATH)
LIBNX ?= $(DEVKITPRO)/libnx
ifeq ($(strip $(APP_TITLE)),)
APP_TITLE := $(notdir $(OUTPUT))
endif
ifeq ($(strip $(APP_AUTHOR)),)
APP_AUTHOR := Unspecified Author
endif
ifeq ($(strip $(APP_VERSION)),)
APP_VERSION := 1.0.0
endif
ifeq ($(strip $(APP_ICON)),)
APP_ICON := $(LIBNX)/default_icon.jpg
endif
#---------------------------------------------------------------------------------
%.nacp: $(MAKEFILE_LIST)
@echo " NACP " $(notdir $@)
@nacptool --create "$(APP_TITLE)" "$(APP_AUTHOR)" "$(APP_VERSION)" $@ $(NACPFLAGS)
#---------------------------------------------------------------------------------
%.npdm: $(APP_JSON)
@echo " NPDM " $(notdir $@)
@npdmtool $< $@
#---------------------------------------------------------------------------------
define make_pfs0
@echo " PFS0 " $(notdir $@)
@mkdir -p exefs
@[ $(BUILD_EXEFS_SRC) ] && [ -d $(BUILD_EXEFS_SRC) ] && cp -R $(BUILD_EXEFS_SRC)/* exefs || echo > /dev/null
@cp $*.nso exefs/main
@[ $(APP_JSON) ] && cp $*.npdm exefs/main.npdm || echo > /dev/null
@build_pfs0 exefs $@
endef
ifeq ($(strip $(APP_JSON)),)
%.pfs0: %.nso
else
%.pfs0: %.nso %.npdm
endif
$(make_pfs0)
ifeq ($(strip $(APP_JSON)),)
%.nsp: %.nso
else
%.nsp: %.nso %.npdm
endif
$(make_pfs0)
#---------------------------------------------------------------------------------
%.ovl: %.nro
@echo " OVL " $(notdir $@)
@cp $< $@
#---------------------------------------------------------------------------------
%.nso: %.elf
@echo " NSO " $(notdir $@)
@elf2nso $< $@
#---------------------------------------------------------------------------------
%.nro: %.elf
@echo " NRO " $(notdir $@)
@elf2nro $< $@ $(NROFLAGS) 1> /dev/null
#---------------------------------------------------------------------------------
%.kip: %.elf
@echo " KIP " $(notdir $@)
@elf2kip $< $(APP_JSON) $@
#---------------------------------------------------------------------------------
%.elf:
@echo " LD " $(notdir $@)
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
@$(NM) -CSn $@ > $(notdir $*.lst)