Skip to content

Commit b5a86fa

Browse files
committed
Improved burn and build script a bit
1 parent 9f5d525 commit b5a86fa

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

scripts/build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/bin/bash
22
set -e
3-
source common.sh
3+
source "$(dirname $0)/common.sh"
44

55
SOURCE=${1?"path to source.asm is missing: \$1"}
6+
SOURCE_DIR="$(dirname $SOURCE)"
67
BINARY=${2?"path for output binary is missing: \$2"}
78
MAX_SIZE=446
89

910
echo "[Build] Starting..."
10-
nasm -f bin "${SOURCE:?}" -o "${BINARY:?}"
11+
nasm -f bin "${SOURCE:?}" -o "${BINARY:?}" -i "${SOURCE_DIR}"
1112
binary_size="$(stat -c '%s' ${BINARY:?})"
1213
(( ${binary_size:?} <= ${MAX_SIZE:?})) || raise "Binary size exceeds ${MAX_SIZE:?} bytes, got ${binary_size:?}"
13-
echo "[Build] Done."
14+
echo "[Build] done. BinarySize: ${binary_size} bytes. MaxSize: ${MAX_SIZE} bytes."

scripts/burn.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -e
3-
source common.sh
3+
source "$(dirname $0)/common.sh"
44

55
BINARY=${1?"path to binary is missing: \$1"}
66
DISK=${2?"path for disk to burn is missing: \$2"}

scripts/run.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ SOURCE="$(realpath main.asm)"
99
BINARY="${BUILD_DIR:?}/main"
1010
DISK="$(realpath ../disk.vmdk)"
1111

12-
mkdir -p BUILD_DIR
12+
mkdir -p ${BUILD_DIR:?}
1313

14-
cd "${SCRIPTS_DIR}"
15-
bash build.sh "${SOURCE}" "${BINARY}"
16-
bash burn.sh "${BINARY}" "${DISK}"
14+
bash "${SCRIPTS_DIR}/build.sh" "${SOURCE}" "${BINARY}"
15+
bash "${SCRIPTS_DIR}/burn.sh" "${BINARY}" "${DISK}"
1716
echo "Run Completed!"

0 commit comments

Comments
 (0)