... | ... |
@@ -1,27 +1,33 @@ |
1 | 1 |
#!/usr/bin/env bash |
2 | 2 |
|
3 |
-echo "Formatting.." |
|
4 |
-clang-format -i src/uxn.h |
|
5 |
-clang-format -i src/uxn.c |
|
6 |
-clang-format -i src/devices/ppu.h |
|
7 |
-clang-format -i src/devices/ppu.c |
|
8 |
-clang-format -i src/devices/apu.h |
|
9 |
-clang-format -i src/devices/apu.c |
|
10 |
-clang-format -i src/devices/mpu.h |
|
11 |
-clang-format -i src/devices/mpu.c |
|
12 |
-clang-format -i src/uxnasm.c |
|
13 |
-clang-format -i src/uxnemu.c |
|
14 |
-clang-format -i src/uxncli.c |
|
15 |
- |
|
16 | 3 |
echo "Cleaning.." |
17 | 4 |
rm -f ./bin/uxnasm |
18 | 5 |
rm -f ./bin/uxnemu |
19 | 6 |
rm -f ./bin/uxncli |
20 | 7 |
rm -f ./bin/boot.rom |
21 | 8 |
|
9 |
+# When clang-format is present |
|
10 |
+ |
|
11 |
+if command -v clang-format &> /dev/null |
|
12 |
+then |
|
13 |
+ echo "Formatting.." |
|
14 |
+ clang-format -i src/uxn.h |
|
15 |
+ clang-format -i src/uxn.c |
|
16 |
+ clang-format -i src/devices/ppu.h |
|
17 |
+ clang-format -i src/devices/ppu.c |
|
18 |
+ clang-format -i src/devices/apu.h |
|
19 |
+ clang-format -i src/devices/apu.c |
|
20 |
+ clang-format -i src/devices/mpu.h |
|
21 |
+ clang-format -i src/devices/mpu.c |
|
22 |
+ clang-format -i src/uxnasm.c |
|
23 |
+ clang-format -i src/uxnemu.c |
|
24 |
+ clang-format -i src/uxncli.c |
|
25 |
+fi |
|
26 |
+ |
|
22 | 27 |
mkdir -p bin |
23 | 28 |
CFLAGS="-std=c89 -Wall -Wno-unknown-pragmas" |
24 | 29 |
UXNEMU_LDFLAGS="-L/usr/local/lib $(sdl2-config --cflags --libs)" |
30 |
+ |
|
25 | 31 |
if cc ${CFLAGS} -c src/devices/mpu.c -o bin/mpu.o 2>/dev/null; then |
26 | 32 |
rm -f bin/mpu.o |
27 | 33 |
echo "Building with portmidi.." |
... | ... |
@@ -30,6 +36,7 @@ else |
30 | 36 |
echo "Building without portmidi.." |
31 | 37 |
CFLAGS="${CFLAGS} -DNO_PORTMIDI" |
32 | 38 |
fi |
39 |
+ |
|
33 | 40 |
if [ "${1}" = '--debug' ]; |
34 | 41 |
then |
35 | 42 |
echo "[debug]" |
... | ... |
@@ -39,17 +46,17 @@ else |
39 | 46 |
CFLAGS="${CFLAGS} -DNDEBUG -Os -g0 -s" |
40 | 47 |
CORE='src/uxn-fast.c' |
41 | 48 |
fi |
49 |
+ |
|
42 | 50 |
cc ${CFLAGS} src/uxnasm.c -o bin/uxnasm |
43 | 51 |
cc ${CFLAGS} ${CORE} src/devices/ppu.c src/devices/apu.c src/devices/mpu.c src/uxnemu.c ${UXNEMU_LDFLAGS} -o bin/uxnemu |
44 | 52 |
cc ${CFLAGS} ${CORE} src/uxncli.c -o bin/uxncli |
45 | 53 |
|
46 |
-echo "Installing.." |
|
47 | 54 |
if [ -d "$HOME/bin" ] && [ -e ./bin/uxnemu ] && [ -e ./bin/uxnasm ] |
48 | 55 |
then |
56 |
+ echo "Installing in $HOME/bin" |
|
49 | 57 |
cp ./bin/uxnemu $HOME/bin |
50 | 58 |
cp ./bin/uxnasm $HOME/bin |
51 | 59 |
cp ./bin/uxncli $HOME/bin |
52 |
- echo "Installed in $HOME/bin" |
|
53 | 60 |
fi |
54 | 61 |
|
55 | 62 |
echo "Assembling.." |