From: Ralph Ronnquist Date: Mon, 13 Jan 2025 03:10:20 +0000 (+1100) Subject: build script for x86_64 X-Git-Url: https://git.rrq.selfhost.au/?a=commitdiff_plain;h=c512e77cafd1667cfc5edf72887b1208854c2a15;p=rrq%2Ffasmarm.git build script for x86_64 --- 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" +