-
Notifications
You must be signed in to change notification settings - Fork 46
/
makefile
215 lines (170 loc) · 8.03 KB
/
makefile
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# MinUI
# NOTE: this runs on the host system (eg. macOS) not in a docker image
# it has to, otherwise we'd be running a docker in a docker and oof
ifeq (,$(PLATFORMS))
PLATFORMS = miyoomini trimuismart rg35xx rg35xxplus tg5040 rgb30 m17 gkdpixel my282 magicmini
endif
###########################################################
BUILD_HASH:=$(shell git rev-parse --short HEAD)
RELEASE_TIME:=$(shell TZ=GMT date +%Y%m%d)
RELEASE_BETA=
RELEASE_BASE=MinUI-$(RELEASE_TIME)$(RELEASE_BETA)
RELEASE_DOT:=$(shell find -E ./releases/. -regex ".*/${RELEASE_BASE}-[0-9]+-base\.zip" | wc -l | sed 's/ //g')
RELEASE_NAME=$(RELEASE_BASE)-$(RELEASE_DOT)
###########################################################
.PHONY: build
export MAKEFLAGS=--no-print-directory
all: setup $(PLATFORMS) special package done
shell:
make -f makefile.toolchain PLATFORM=$(PLATFORM)
name:
echo $(RELEASE_NAME)
build:
# ----------------------------------------------------
make build -f makefile.toolchain PLATFORM=$(PLATFORM)
# ----------------------------------------------------
system:
make -f ./workspace/$(PLATFORM)/platform/makefile.copy PLATFORM=$(PLATFORM)
# populate system
cp ./workspace/$(PLATFORM)/keymon/keymon.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/$(PLATFORM)/libmsettings/libmsettings.so ./build/SYSTEM/$(PLATFORM)/lib
cp ./workspace/all/minui/build/$(PLATFORM)/minui.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/minarch/build/$(PLATFORM)/minarch.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/syncsettings/build/$(PLATFORM)/syncsettings.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/clock/build/$(PLATFORM)/clock.elf ./build/EXTRAS/Tools/$(PLATFORM)/Clock.pak/
cp ./workspace/all/minput/build/$(PLATFORM)/minput.elf ./build/EXTRAS/Tools/$(PLATFORM)/Input.pak/
cores: # TODO: can't assume every platform will have the same stock cores (platform should be responsible for copy too)
# stock cores
cp ./workspace/$(PLATFORM)/cores/output/fceumm_libretro.so ./build/SYSTEM/$(PLATFORM)/cores
cp ./workspace/$(PLATFORM)/cores/output/gambatte_libretro.so ./build/SYSTEM/$(PLATFORM)/cores
cp ./workspace/$(PLATFORM)/cores/output/gpsp_libretro.so ./build/SYSTEM/$(PLATFORM)/cores
cp ./workspace/$(PLATFORM)/cores/output/picodrive_libretro.so ./build/SYSTEM/$(PLATFORM)/cores
ifneq ($(PLATFORM),trimui)
cp ./workspace/$(PLATFORM)/cores/output/snes9x2005_plus_libretro.so ./build/SYSTEM/$(PLATFORM)/cores
cp ./workspace/$(PLATFORM)/cores/output/pcsx_rearmed_libretro.so ./build/SYSTEM/$(PLATFORM)/cores
# extras
ifeq ($(PLATFORM), trimuismart)
cp ./workspace/miyoomini/cores/output/fake08_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/P8.pak
else ifeq ($(PLATFORM), m17)
cp ./workspace/miyoomini/cores/output/fake08_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/P8.pak
else ifneq ($(PLATFORM),gkdpixel)
cp ./workspace/$(PLATFORM)/cores/output/fake08_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/P8.pak
endif
cp ./workspace/$(PLATFORM)/cores/output/mgba_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/MGBA.pak
cp ./workspace/$(PLATFORM)/cores/output/mgba_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/SGB.pak
cp ./workspace/$(PLATFORM)/cores/output/mednafen_pce_fast_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/PCE.pak
cp ./workspace/$(PLATFORM)/cores/output/pokemini_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/PKM.pak
cp ./workspace/$(PLATFORM)/cores/output/race_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/NGP.pak
cp ./workspace/$(PLATFORM)/cores/output/race_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/NGPC.pak
ifneq ($(PLATFORM),gkdpixel)
cp ./workspace/$(PLATFORM)/cores/output/mednafen_supafaust_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/SUPA.pak
cp ./workspace/$(PLATFORM)/cores/output/mednafen_vb_libretro.so ./build/EXTRAS/Emus/$(PLATFORM)/VB.pak
endif
endif
common: build system cores
clean:
rm -rf ./build
setup: name
# ----------------------------------------------------
# make sure we're running in an input device
tty -s
# ready fresh build
rm -rf ./build
mkdir -p ./releases
cp -R ./skeleton ./build
# remove authoring detritus
cd ./build && find . -type f -name '.keep' -delete
cd ./build && find . -type f -name '*.meta' -delete
echo $(BUILD_HASH) > ./workspace/hash.txt
# copy readmes to workspace so we can use Linux fmt instead of host's
mkdir -p ./workspace/readmes
cp ./skeleton/BASE/README.txt ./workspace/readmes/BASE-in.txt
cp ./skeleton/EXTRAS/README.txt ./workspace/readmes/EXTRAS-in.txt
done:
say "done" 2>/dev/null || true
special:
# ----------------------------------------------------
# setup miyoomini/trimui family .tmp_update in BOOT
mv ./build/BOOT/common ./build/BOOT/.tmp_update
mv ./build/BOOT/miyoo ./build/BASE/
mv ./build/BOOT/trimui ./build/BASE/
cp -R ./build/BOOT/.tmp_update ./build/BASE/miyoo/app/
cp -R ./build/BOOT/.tmp_update ./build/BASE/trimui/app/
cp -R ./build/BASE/miyoo ./build/BASE/miyoo354
tidy:
# ----------------------------------------------------
# remove systems we're not ready to support yet
# TODO: tmp, figure out a cleaner way to do this
rm -rf ./build/SYSTEM/trimui
rm -rf ./build/EXTRAS/Tools/trimui
rm -rf ./build/EXTRAS/Tools/tg5040/Splore.pak
package: tidy
# ----------------------------------------------------
# zip up build
# move formatted readmes from workspace to build
cp ./workspace/readmes/BASE-out.txt ./build/BASE/README.txt
cp ./workspace/readmes/EXTRAS-out.txt ./build/EXTRAS/README.txt
rm -rf ./workspace/readmes
cd ./build/SYSTEM && echo "$(RELEASE_NAME)\n$(BUILD_HASH)" > version.txt
./commits.sh > ./build/SYSTEM/commits.txt
cd ./build && find . -type f -name '.DS_Store' -delete
mkdir -p ./build/PAYLOAD
mv ./build/SYSTEM ./build/PAYLOAD/.system
cp -R ./build/BOOT/.tmp_update ./build/PAYLOAD/
cd ./build/PAYLOAD && zip -r ../BASE/trimui.zip .tmp_update
cd ./build/PAYLOAD && zip -r MinUI.zip .system .tmp_update
mv ./build/PAYLOAD/MinUI.zip ./build/BASE
# TODO: can I just add everything in BASE to zip?
cd ./build/BASE && zip -r ../../releases/$(RELEASE_NAME)-base.zip Bios Roms Saves miyoo miyoo354 trimui rg35xx rg35xxplus gkdpixel em_ui.sh MinUI.zip README.txt
cd ./build/EXTRAS && zip -r ../../releases/$(RELEASE_NAME)-extras.zip Bios Emus Roms Saves Tools README.txt
echo "$(RELEASE_NAME)" > ./build/latest.txt
###########################################################
# TODO: make this a template like the cores makefile?
rg35xx:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
rg35xxplus:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
miyoomini:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
trimuismart:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
trimui:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
rgb30:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
tg5040:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
m17:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
gkdpixel:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
my282:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
magicmini:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------
tg3040:
# ----------------------------------------------------
make common PLATFORM=$@
# ----------------------------------------------------