Improved build script

This commit is contained in:
neauoire 2022-04-06 12:38:34 -07:00
parent 60b20eaaf7
commit 2a179c94de
2 changed files with 20 additions and 12 deletions

View File

@ -25,7 +25,7 @@ The stack mapping is 254 bytes of data, a byte for the pointer and a byte for an
All you need is X11. All you need is X11.
```sh ```sh
gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11 gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11
``` ```
### Terminal ### Terminal
@ -33,13 +33,15 @@ gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c
If you wish to build the emulator without graphics mode: If you wish to build the emulator without graphics mode:
```sh ```sh
cc src/devices/datetime.c src/devices/system.c src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
``` ```
## Run ## Usage
The first parameter is the rom file, the subsequent arguments will be accessible to the rom, via the [Console vector](https://wiki.xxiivv.com/site/varvara.html#console).
```sh ```sh
bin/uxnemu bin/polycat.rom bin/uxnemu bin/polycat.rom arg1 arg2
``` ```
## Devices ## Devices

View File

@ -1,32 +1,38 @@
#!/bin/sh -e #!/bin/sh -e
RELEASE_FLAGS="-DNDEBUG -Og -g0 -s"
DEBUG_FLAGS="-std=c89 -D_POSIX_C_SOURCE=199309L -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"
EMU_INC="src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11"
CLI_INC="src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli"
if [ "${1}" = '--format' ]; if [ "${1}" = '--format' ];
then then
echo "Formatting.." echo "Formatting.."
clang-format -i src/uxn.c
clang-format -i src/uxn.h
clang-format -i src/uxn11.c clang-format -i src/uxn11.c
clang-format -i src/uxncli.c clang-format -i src/uxncli.c
clang-format -i src/devices/* clang-format -i src/devices/*
fi fi
echo "Cleaning.." echo "Cleaning.."
rm -f ./bin/* rm -f bin/*
echo "Building.."
mkdir -p bin mkdir -p bin
echo "Building.."
if [ "${1}" = '--install' ]; if [ "${1}" = '--install' ];
then then
echo "Installing.." echo "Installing.."
gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11 gcc ${RELEASE_FLAGS} ${EMU_INC}
gcc src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxncli gcc ${RELEASE_FLAGS} ${CLI_INC}
cp bin/uxn11 ~/bin cp bin/uxn11 ~/bin
cp bin/uxncli ~/bin cp bin/uxncli ~/bin
else else
gcc -std=c89 -D_POSIX_C_SOURCE=199309L -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/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11 gcc ${DEBUG_FLAGS} ${EMU_INC}
gcc -std=c89 -D_POSIX_C_SOURCE=199309L -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/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli gcc ${DEBUG_FLAGS} ${CLI_INC}
fi fi
echo "Assembling polycat.." echo "Assembling.."
bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/ bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/
echo "Running.." echo "Running.."