logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 96bcd25021135928929e629fb9d3a86571e11e26
parent 171fc7752185f5a24293d995966999f06d23448b
Author: Michael Forney <mforney@mforney.org>
Date:   Tue, 16 Oct 2018 20:01:52 -0700

Add mechanism to probe for size of type

Diffstat:

Mrules.ninja3+++
Ascripts/probe-size.sh13+++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/rules.ninja b/rules.ninja @@ -42,6 +42,9 @@ rule muse rule probe command = sh ./scripts/probe.sh $var $cc $cflags $ldflags -o /dev/null -x c $in >$out.tmp && mv $out.tmp $out +rule probesize + command = sh ./scripts/probe-size.sh $var $cc $cflags -c -o /dev/null -x c $in >$out.tmp && mv $out.tmp $out + # misc tools rule touch command = touch $out diff --git a/scripts/probe-size.sh b/scripts/probe-size.sh @@ -0,0 +1,13 @@ +set -e + +var=$1 +shift +for size in 8 4 2 1 ; do + if "$@" -D "$var=$size" 2>/dev/null ; then + echo "#define $var $size" + exit 0 + fi +done + +printf "%s: could not determine %s\n" "$0" "$var" >&2 +exit 1