~rabbits/uxn

ref: 16f51cb8766fa0610588716be376d0fad9fda712 uxn/build.sh -rwxr-xr-x 1.9 KiB
16f51cb8Andrew Alderwick Rewritten asma 6 months ago
                                                                                
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
#!/bin/bash

echo "Formatting.."
clang-format -i src/uxn.h
clang-format -i src/uxn.c
clang-format -i src/ppu.h
clang-format -i src/ppu.c
clang-format -i src/apu.h
clang-format -i src/apu.c
clang-format -i src/mpu.h
clang-format -i src/mpu.c
clang-format -i src/assembler.c
clang-format -i src/emulator.c
clang-format -i src/debugger.c

echo "Cleaning.."
rm -f ./bin/assembler
rm -f ./bin/emulator
rm -f ./bin/debugger
rm -f ./bin/boot.rom

echo "Building.."
mkdir -p bin
if [ "${1}" = '--debug' ]; 
then
	echo "[debug]"
    cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/assembler.c -o bin/assembler
	cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/ppu.c src/apu.c src/mpu.c src/emulator.c -L/usr/local/lib -lSDL2 -lportmidi -o bin/emulator
    cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/debugger.c -o bin/debugger
else
	cc src/assembler.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/assembler
	cc src/uxn.c src/debugger.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/debugger
	cc src/uxn.c src/ppu.c src/apu.c src/mpu.c src/emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -lportmidi -o bin/emulator
fi

echo "Assembling.."
./bin/assembler projects/demos/drum-rack.usm bin/boot.rom

echo "Running.."
if [ "${2}" = '--cli' ]; 
then
	echo "[cli]"
	./bin/debugger bin/boot.rom
else
	./bin/emulator bin/boot.rom
fi

echo "Done."