-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
build.sh
47 lines (32 loc) · 912 Bytes
/
build.sh
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
#!/bin/bash
ARG=${1:-'--confirm'}
cd "$(dirname "${BASH_SOURCE[0]}")"
# Clean-up from last build
rm -rf ./code_templates/tmp
mkdir ./code_templates/tmp
mv ./source/main.cpp ./main.cpp
make clean_all
# Build PoC
poc_name="nxdt_rw_poc"
poc_path="./code_templates/$poc_name.c"
rm -f ./source/main.c
cp $poc_path ./source/main.c
cp ./romfs/icon/nxdumptool.jpg ./romfs/icon/$poc_name.jpg
set -e
if [ ${ARG,,} != "--noconfirm" ]; then
make BUILD_TYPE="$poc_name" -j$(nproc)
else
make BUILD_TYPE="$poc_name" -j8
fi
set +e
rm -f ./romfs/icon/$poc_name.jpg
mv -f ./$poc_name.nro ./code_templates/tmp/$poc_name.nro
mv -f ./$poc_name.elf ./code_templates/tmp/$poc_name.elf
# Post build clean-up
make BUILD_TYPE="$poc_name" clean
make clean_all
rm -f ./source/main.c
mv -f ./main.cpp ./source/main.cpp
if [ ${ARG,,} != "--noconfirm" ]; then
read -rsp $'Press any key to continue...\n' -n 1 key
fi