Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
... | ... |
@@ -1,5 +1,37 @@ |
1 | 1 |
#!/bin/sh -e |
2 | 2 |
|
3 |
+format=0 |
|
4 |
+console=0 |
|
5 |
+debug=0 |
|
6 |
+norun=0 |
|
7 |
+ |
|
8 |
+while [ $# -gt 0 ]; do |
|
9 |
+ case $1 in |
|
10 |
+ --format) |
|
11 |
+ format=1 |
|
12 |
+ shift |
|
13 |
+ ;; |
|
14 |
+ |
|
15 |
+ --console) |
|
16 |
+ console=1 |
|
17 |
+ shift |
|
18 |
+ ;; |
|
19 |
+ |
|
20 |
+ --debug) |
|
21 |
+ debug=1 |
|
22 |
+ shift |
|
23 |
+ ;; |
|
24 |
+ |
|
25 |
+ --no-run) |
|
26 |
+ norun=1 |
|
27 |
+ shift |
|
28 |
+ ;; |
|
29 |
+ |
|
30 |
+ *) |
|
31 |
+ shift |
|
32 |
+ esac |
|
33 |
+done |
|
34 |
+ |
|
3 | 35 |
echo "Cleaning.." |
4 | 36 |
rm -f ./bin/uxnasm |
5 | 37 |
rm -f ./bin/uxnemu |
... | ... |
@@ -10,7 +42,7 @@ rm -f ./bin/asma.rom |
10 | 42 |
|
11 | 43 |
# When clang-format is present |
12 | 44 |
|
13 |
-if [ "${1}" = '--format' ]; |
|
45 |
+if [ $format = 1 ]; |
|
14 | 46 |
then |
15 | 47 |
echo "Formatting.." |
16 | 48 |
clang-format -i src/uxn.h |
... | ... |
@@ -37,7 +69,7 @@ CC="${CC:-cc}" |
37 | 69 |
CFLAGS="${CFLAGS:--std=c89 -Wall -Wno-unknown-pragmas}" |
38 | 70 |
case "$(uname -s 2>/dev/null)" in |
39 | 71 |
MSYS_NT*|MINGW*) # MSYS2 on Windows |
40 |
- if [ "${1}" = '--console' ]; |
|
72 |
+ if [ $console = 1 ]; |
|
41 | 73 |
then |
42 | 74 |
UXNEMU_LDFLAGS="-static $(sdl2-config --cflags --static-libs | sed -e 's/ -mwindows//g')" |
43 | 75 |
else |
... | ... |
@@ -53,7 +85,7 @@ Linux|*) |
53 | 85 |
;; |
54 | 86 |
esac |
55 | 87 |
|
56 |
-if [ "${1}" = '--debug' ]; |
|
88 |
+if [ $debug = 1 ]; |
|
57 | 89 |
then |
58 | 90 |
echo "[debug]" |
59 | 91 |
CFLAGS="${CFLAGS} -DDEBUG -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined" |
... | ... |
@@ -80,7 +112,7 @@ echo "Assembling(boot+hypervisor).." |
80 | 112 |
echo "Assembling(asma).." |
81 | 113 |
./bin/uxnasm projects/software/asma.tal bin/asma.rom |
82 | 114 |
|
83 |
-if [ "${1}" = '--no-run' ]; then exit; fi |
|
115 |
+if [ $norun = 1 ]; then exit; fi |
|
84 | 116 |
|
85 | 117 |
echo "Assembling(piano).." |
86 | 118 |
bin/uxncli bin/asma.rom projects/examples/demos/piano.tal bin/piano.rom 2> bin/piano.log |