From c512e77cafd1667cfc5edf72887b1208854c2a15 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 13 Jan 2025 14:10:20 +1100 Subject: [PATCH] build script for x86_64 --- build.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e122be4 --- /dev/null +++ b/build.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +HERE="$(pwd)" + +includes() { + cd "${1%/*}" + for F in $(awk "-F'" '$1 ~ /include / {print $2}' "${1##*/}") ; do + F="${F//\\//}" + realpath --relative-to="$HERE" "$F" + done +} + +prepare() { + echo $1 + for F in $(includes $1) ; do + F="${F#fasm/}" + BF="build/${F#source/}" + [ -e "$BF" ] && continue + [ -e "$F" ] || F="fasm/${F/linux/Linux}" + [ -e "$F" ] || exit 1 + mkdir -p "${BF%/*}" + cp "$F" "$BF" + prepare "$F" + done +} + +SRC="source/linux/x64/fasmarm.asm" +BLD="build/${SRC#source/}" +BIN="$(basename "$SRC" .asm)" + +set -e +if [ -d build ] ; then + read -p "Type y for removing the old build tree" X + if [ "$X" = y ] ; then + rm -r build + fi +fi +prepare "$SRC" +cp "$SRC" "$BLD" +fasm -m 50000 "$BLD" "$BIN" +chmod a+x "$BIN" + -- 2.47.2