-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
181 lines (162 loc) · 5.62 KB
/
justfile
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
# colors
reset := '\033[0m'
red := '\033[1;31m'
green := '\033[1;32m'
yellow := '\033[1;33m'
blue := '\033[1;34m'
alias f := flash
alias l := layout
alias w := watch-layout
# Symbolic link qmk directory into firmware
stow:
stow -R -d {{justfile_directory()}}/qmk -t {{justfile_directory()}}/firmware .
# Build all keyboards
all:
@just dm4
@just dm5
@just arc
@just crkbd
@just tofu
# Build dactyl manuform 4x6 keyboard firmware
arc:
@just _build handwired/arc:edeneast handwired_arc_edeneast.hex arc
# Build dactyl manuform 4x6 keyboard firmware
dm4:
@just _build handwired/dactyl_manuform/4x6:edeneast handwired_dactyl_manuform_4x6_edeneast.hex dm4
# Build dactyl manuform 5x6 keyboard firmware
dm5:
@just _build handwired/dactyl_manuform/5x6:edeneast handwired_dactyl_manuform_5x6_edeneast.hex dm5
# Build Corne keyboard (crkbd) firmware
crkbd:
@just _build crkbd:edeneast crkbd_rev1_edeneast.hex crkbd
tofu:
@just _build dztech/dz60v2:edeneast dz60_edeneast.hex tofu
_build make_cmd source target: init
#!/usr/bin/env bash
printf "{{yellow}}--------------------------------------------------------------------------------------{{reset}}\n"
printf "Buildling: {{blue}}{{source}}{{reset}}\n\n"
mkdir -p result
(
cd firmware
make {{make_cmd}}
)
mv ./firmware/{{source}} ./result/{{target}}.hex
printf "Result: {{green}}{{target}}.hex{{reset}}\n"
if [ ! -z "$POST_BUILD" ]; then
echo "executing postbuild: $POST_BUILD"
$POST_BUILD
fi
# Flash `keyboard`
flash keyboard:
#!/usr/bin/env bash
if [ "{{keyboard}}" = "crkbd" ]; then
cmd="crkbd:edeneast:dfu"
elif [ "{{keyboard}}" = "arc" ]; then
cmd="handwired/arc:edeneast:avrdude"
elif [ "{{keyboard}}" = "dm4" ]; then
cmd="handwired/dactyl_manuform/4x6:edeneast:avrdude"
elif [ "{{keyboard}}" = "dm5" ]; then
cmd="handwired/dactyl_manuform/5x6:edeneast:avrdude"
elif [ "{{keyboard}}" = "tofu" ]; then
cmd="handwired/dz60:edeneast:dfu"
else
printf "{{red}}Failed: Unknown keyboard: {{keyboard}}{{reset}}\n"
fi
(
cd firmware
make $cmd
)
# Flash left hand of `keyboard`
left keyboard:
#!/usr/bin/env bash
if [ "{{keyboard}}" = "crkbd" ]; then
cmd="crkbd:edeneast:dfu-split-left"
elif [ "{{keyboard}}" = "arc" ]; then
cmd="handwired/arc:edeneast:avrdude-split-left"
elif [ "{{keyboard}}" = "dm4" ]; then
cmd="handwired/dactyl_manuform/4x6:edeneast:avrdude-split-left"
elif [ "{{keyboard}}" = "dm5" ]; then
cmd="handwired/dactyl_manuform/5x6:edeneast:avrdude-split-left"
else
printf "{{red}}Failed: Unknown keyboard: {{keyboard}}{{reset}}\n"
exit
fi
(
cd firmware
make $cmd
)
# Flash right hand of `keyboard`
right keyboard:
#!/usr/bin/env bash
if [ "{{keyboard}}" = "crkbd" ]; then
cmd="crkbd:edeneast:dfu-split-right"
elif [ "{{keyboard}}" = "arc" ]; then
cmd="handwired/arc:edeneast:avrdude-split-right"
elif [ "{{keyboard}}" = "dm4" ]; then
cmd="handwired/dactyl_manuform/4x6:edeneast:avrdude-split-right"
elif [ "{{keyboard}}" = "dm5" ]; then
cmd="handwired/dactyl_manuform/5x6:edeneast:avrdude-split-right"
else
printf "{{red}}Failed: Unknown keyboard: {{keyboard}}{{reset}}\n"
exit
fi
(
cd firmware
make $cmd
)
# Setup submodule and link directories to submodules
init:
#!/usr/bin/env bash
git submodule update --init --recursive --recommend-shallow
stow -R -d {{justfile_directory()}}/qmk -t {{justfile_directory()}}/firmware .
if [ "$(git config submodule.firmware.ignore)" != "all" ]; then
git config submodule.firmware.ignore all
fi
if [ "$(qmk config user.qmk_home | cut -d '=' -f 2)" != "{{justfile_directory()}}/firmware" ]; then
qmk config user.qmk_home="{{justfile_directory()}}/firmware"
fi
# Format c files
fmt:
clang-format -i $(fd --exclude firmware --exclude qmk/users/edeneast/features --extension c --extension h .)
# Generate layout map
layout:
keymap draw ./resources/layout.yml > ./resources/layout.svg
# live reload layout map
[linux]
@watch-layout:
#!/usr/bin/env bash
[[ $(uname -r) =~ microsoft ]] && powershell.exe start $(wslpath ./resources/layout.svg) || xdg-open ./resources/layout.svg
watchexec -nrpw resources/layout.yml -- just layout
# live reload layout map
[macos]
@watch-layout:
#!/usr/bin/env bash
open ./resources/layout.svg
watchexec -nrpw resources/layout.yml -- just layout
# Update qmk submodule
qmk-update:
#!/usr/bin/env bash
# https://stackoverflow.com/a/41081908
pushd ./firmware
git reset --hard
git clean -fdx
git co master
git fetch origin --depth 1
git reset --hard origin/master
git submodule update --init --recursive --recommend-shallow
popd
git add -f ./firmware
just init
# Update features subtree
subtree-update:
#!/usr/bin/env bash
# https://stackoverflow.com/questions/22334382/git-subtree-only-one-file-or-directory
# https://gist.github.com/tswaters/542ba147a07904b1f3f5
# https://getreuer.info/posts/keyboards/achordion/index.html
[[ $(git diff --name-only --diff-filter=M | wc -l) > 0 ]] && echo 'There are uncommited changes, aborting' && exit 1
git fetch --depth=1 https://github.com/getreuer/qmk-keymap main:subtree-main
git checkout subtree-main
git subtree split --prefix=features -b subtree-split
git checkout -
git subtree merge --squash --prefix=./qmk/users/edeneast/features subtree-split
git branch -D subtree-main subtree-split