when building with --debug, the compiler commands will also be printed
(in the style of make(1)) so that build problems can be found more
easily.
---
build.sh | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/build.sh b/build.sh
index 5b51beb..8b8bee7 100755
--- a/build.sh
@@ -38,6 +38,11 @@ while [ $# -gt 0 ]; do
esac
done
+run () {
+ [ "$debug" -eq 1 ] && printf "%s\n" "$*"
+ "$@"
+}
+
echo "Cleaning.."
rm -f ./bin/uxnasm
rm -f ./bin/uxnemu
@@ -103,9 +108,9 @@ else
fi
echo "Building.."
-${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
-${CC} ${CFLAGS} ${CORE} src/devices/system.c src/devices/file.c src/devices/datetime.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} -o bin/uxnemu
-${CC} ${CFLAGS} ${CORE} src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
+run ${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
+run ${CC} ${CFLAGS} ${CORE} src/devices/system.c src/devices/file.c src/devices/datetime.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} -o bin/uxnemu
+run ${CC} ${CFLAGS} ${CORE} src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
if [ $install = 1 ]
then
@@ -114,9 +119,9 @@ then
fi
echo "Assembling(launcher).."
-./bin/uxnasm projects/software/launcher.tal bin/launcher.rom
+run ./bin/uxnasm projects/software/launcher.tal bin/launcher.rom
echo "Assembling(asma).."
-./bin/uxnasm projects/software/asma.tal bin/asma.rom
+run ./bin/uxnasm projects/software/asma.tal bin/asma.rom
if [ $norun = 1 ]; then exit; fi
--
2.34.1