-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.sh
executable file
·121 lines (108 loc) · 3.55 KB
/
compile.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
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
#!/bin/bash
export LANG=C.UTF-8
#------------------------------------------
# Constants
#------------------------------------------
# Put here your name
KEYMAP="hexa"
WORKING_DIR="$(pwd)"
QMK_USER="${WORKING_DIR}/hexa"
#------------------------------------------
# Variable depending on input
#------------------------------------------
KEYBOARD=""
KEYBOARD_FOLDERNAME=""
KEYMAP_LINK=""
FILENAME=""
ACTION=""
#------------------------------------------
# Argument Handling
#------------------------------------------
ACTION="$1"
KEYBOARD_FOLDERNAME="$2"
if [[ "${ACTION}" != @("build"|"flash"|"clean") ]]
then
echo -e "Wrong Action specified! \nExiting..."
exit 0
fi
if [[ -z "${KEYBOARD_FOLDERNAME}" ]]
then
echo -e "No Keyboard specified! \nExiting..."
exit 0
fi
echo "-------------------------"
echo "> Compiling QMK Firmware"
echo -e "-------------------------\n"
#------------------------------------------
# Create Keymap symbolic link
#------------------------------------------
case ${KEYBOARD_FOLDERNAME} in
"lily58" )
export QMK_FIRMWARE_HOME="${WORKING_DIR}/../qmk_firmware"
echo "> Keymap folder lily58 will be used!"
KEYBOARD="splitkb/aurora/lily58/rev1"
KEYMAP_LINK="${QMK_FIRMWARE_HOME}/keyboards/splitkb/aurora/lily58/keymaps/${KEYMAP}"
FILENAME="splitkb_aurora_lily58_rev1"
cp -r "${WORKING_DIR}/lily58" "${KEYMAP_LINK}"
cp -r "${QMK_USER}" "${QMK_FIRMWARE_HOME}/users/${KEYMAP}"
;;
"fw16_iso" )
export QMK_FIRMWARE_HOME="${WORKING_DIR}/../fw16_qmk_firmware"
echo "> Keymap folder fw16_iso will be used!"
KEYBOARD="framework/iso"
KEYMAP_LINK="${QMK_FIRMWARE_HOME}/keyboards/framework/iso/keymaps/${KEYMAP}"
FILENAME="fw16_iso_keyboard"
cp -r "${WORKING_DIR}/fw16_iso" "${KEYMAP_LINK}"
cp -r "${QMK_USER}" "${QMK_FIRMWARE_HOME}/users/${KEYMAP}"
;;
"fw16_macropad" )
export QMK_FIRMWARE_HOME="${WORKING_DIR}/../fw16_qmk_firmware"
echo "> Keymap folder fw16_macropad will be used!"
KEYBOARD="framework/macropad"
KEYMAP_LINK="${QMK_FIRMWARE_HOME}/keyboards/framework/macropad/keymaps/${KEYMAP}"
FILENAME="fw16_macropad"
cp -r "${WORKING_DIR}/fw16_macropad" "${KEYMAP_LINK}"
cp -r "${QMK_USER}" "${QMK_FIRMWARE_HOME}/users/${KEYMAP}"
;;
*)
echo -e "No Keyboard specified! \nExiting..."
exit 0
;;
esac
#------------------------------------------
# Do Actions
#------------------------------------------
pushd ${QMK_FIRMWARE_HOME}
case ${ACTION} in
"build" )
echo -e "> Compiling Firmware now...\n"
qmk compile -kb ${KEYBOARD} -km ${KEYMAP}
;;
"flash" )
make ${KEYBOARD}:${KEYMAP}:flash -o ${FILENAME}
;;
"clean" )
qmk clean
echo -e "> Removing Output files..."
echo -e "> .*hex files in qmk_firmware folder"
echo -e "> .build folder in qmk_firmware folder"
rm -r -- "${QMK_FIRMWARE_HOME}/.build"
rm -r "${QMK_FIRMWARE_HOME}/users/${KEYMAP}"
rm -- "${QMK_FIRMWARE_HOME}"/*.hex
;;
*)
echo -e "No Keyboard specified..."
exit
;;
esac
popd
#------------------------------------------
# Cleanup of Links and Files
#------------------------------------------
echo -e "> Cleanup of symbolic link dir...\n"
rm -r "${KEYMAP_LINK}"
rm -r "${QMK_FIRMWARE_HOME}/users/${KEYMAP}"
echo -e "> Copy Output to Working Direction..."
sleep 1
mv -fv -- ${QMK_FIRMWARE_HOME}/*.uf2 "."
mv -fv -- ${QMK_FIRMWARE_HOME}/*.hex "."