-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathmakefile
171 lines (138 loc) · 7.07 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
# 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
# prevent accidentally triggering a full build with invalid calls
ifneq (,$(PLATFORM))
ifeq (,$(MAKECMDGOALS))
$(error found PLATFORM arg but no target, did you mean "make PLATFORM=$(PLATFORM) shell"?)
endif
endif
ifeq (,$(PLATFORMS))
PLATFORMS = miyoomini trimuismart rg35xx rg35xxplus my355 tg5040 zero28 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
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
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/magicx 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/
mv ./build/BOOT/magicx ./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/BOOT/.tmp_update ./build/BASE/magicx/
cp -R ./build/BASE/miyoo ./build/BASE/miyoo354
cp -R ./build/BASE/miyoo ./build/BASE/miyoo355
ifneq (,$(findstring my355, $(PLATFORMS)))
cp -R ./workspace/my355/init ./build/BASE/miyoo355/app/my355
cp -r ./workspace/my355/other/squashfs/output/* ./build/BASE/miyoo355/app/my355/payload/
endif
tidy:
# ----------------------------------------------------
# copy update from merged platform to old pre-merge platform bin so old cards update properly
ifneq (,$(findstring rg35xxplus, $(PLATFORMS)))
mkdir -p ./build/SYSTEM/rg40xxcube/bin/
cp ./build/SYSTEM/rg35xxplus/bin/install.sh ./build/SYSTEM/rg40xxcube/bin/
endif
ifneq (,$(findstring tg5040, $(PLATFORMS)))
mkdir -p ./build/SYSTEM/tg3040/paks/MinUI.pak/
cp ./build/SYSTEM/tg5040/bin/install.sh ./build/SYSTEM/tg3040/paks/MinUI.pak/launch.sh
endif
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 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 miyoo355 magicx 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
###########################################################
.DEFAULT:
# ----------------------------------------------------
# $@
@echo "$(PLATFORMS)" | grep -q "\b$@\b" && (make common PLATFORM=$@) || (exit 1)