Add mechanism to probe for toolchain features

This commit is contained in:
Michael Forney
2017-08-21 00:53:08 -07:00
parent 7c4274cfb3
commit 224b5fdbf9
4 changed files with 14 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ include 'rules.ninja'
toolchain 'target'
subgen 'probe'
subgen 'pkg'
subgen 'src'

3
probe/gen.lua Normal file
View File

@@ -0,0 +1,3 @@
local function probe(var)
build('probe', '$outdir/'..var, '$dir/'..var, {var=var})
end

View File

@@ -39,6 +39,9 @@ rule mc
rule muse
command = muse $museflags -o $out $in
rule probe
command = rc ./scripts/probe.rc $var $cc $cflags $ldflags -o /dev/null -x c $in >$out.tmp && mv $out.tmp $out
# misc tools
rule touch
command = touch $out

7
scripts/probe.rc Normal file
View File

@@ -0,0 +1,7 @@
flag e +
var=$1
shift
if($* >[2]/dev/null)
echo '#define '$var' 1'
status=()