diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-11-11 13:20:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-11-23 13:07:58 +0200 |
commit | 939beb11a5ccf58d7fe79a809a1b592c5c9143c0 (patch) | |
tree | 2aff4e52f277ecac62ce1cb8bf302ffd0884666a /libbuild2/buildfile | |
parent | 189a1c2a8fad0716e0bc4132e21f664c80d7574b (diff) |
Add support for dynamic dependencies in ad hoc Buildscript recipes
Specifically, add the new `depdb dyndep` builtin that can be used to extract
dynamic dependencies from a program run or a file. For example:
obje{hello.o}: cxx{hello}
{{
s = $path($<[0])
depdb dyndep $cxx.poptions $cc.poptions --what=header --default-prereq-type=h -- $cxx.path $cxx.poptions $cc.poptions $cxx.mode -M -MG $s
diag c++ ($<[0])
o = $path($>)
$cxx.path $cxx.poptions $cc.poptions $cc.coptions $cxx.coptions $cxx.mode -o $o -c $s
}}
Currently only the `make` dependency format is supported.
Diffstat (limited to 'libbuild2/buildfile')
-rw-r--r-- | libbuild2/buildfile | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/libbuild2/buildfile b/libbuild2/buildfile index 17003b5..f21be7b 100644 --- a/libbuild2/buildfile +++ b/libbuild2/buildfile @@ -32,7 +32,8 @@ lib{build2}: libul{build2}: \ libul{build2}: script/{hxx ixx txx cxx}{** -*-options -**.test...} \ script/{hxx ixx cxx}{builtin-options} -libul{build2}: build/{hxx ixx txx cxx}{** -**.test...} +libul{build2}: build/script/{hxx ixx txx cxx}{** -*-options -**.test...} \ + build/script/{hxx ixx cxx}{builtin-options} # Note that this won't work in libul{} since it's not installed. # @@ -216,38 +217,56 @@ else # Generated options parser. # -script/ +# @@ Consider generating common cli runtime namespace if adding more option +# files. Plus sommon types-parser.?xx (which could also potentially be +# reused by the driver). +# +if $cli.configured { - if $cli.configured + cli.options += --std c++11 -I $src_root --include-with-brackets \ +--generate-vector-scanner --generate-modifier --generate-specifier \ +--suppress-usage + + cli.cxx{*}: { - cli.cxx{builtin-options}: cli{builtin} - - cli.options += --std c++11 -I $src_root --include-with-brackets \ ---include-prefix libbuild2/script --guard-prefix LIBBUILD2_SCRIPT \ ---cli-namespace build2::script::cli --generate-vector-scanner \ ---generate-modifier --generate-specifier --suppress-usage - - cli.cxx{*}: - { - # Include the generated cli files into the distribution and don't remove - # them when cleaning in src (so that clean results in a state identical - # to distributed). But don't install their headers since they are only - # used internally in the testscript implementation. - # - dist = true - clean = ($src_root != $out_root) - install = false - - # We keep the generated code in the repository so copy it back to src in - # case of a forwarded configuration. - # - backlink = overwrite - } - } - else - # No install for the pre-generated case. + # Include the generated cli files into the distribution and don't remove + # them when cleaning in src (so that clean results in a state identical + # to distributed). But don't install their headers since they are only + # used internally in the testscript implementation. + # + dist = true + clean = ($src_root != $out_root) + install = false + + # We keep the generated code in the repository so copy it back to src in + # case of a forwarded configuration. # - hxx{builtin-options}@./ ixx{builtin-options}@./: install = false + backlink = overwrite + } + + script/cli.cxx{builtin-options}: script/cli{builtin} + { + cli.options += --cli-namespace build2::script::cli \ +--include-prefix libbuild2/script --guard-prefix LIBBUILD2_SCRIPT + } + + build/script/cli.cxx{builtin-options}: build/script/cli{builtin} + { + cli.options += --cli-namespace build2::build::script::cli \ +--include-prefix libbuild2/build/script --guard-prefix LIBBUILD2_BUILD_SCRIPT \ +--cxx-prologue "#include <libbuild2/build/script/types-parsers.hxx>" \ +--generate-parse + } +} +else +{ + # No install for the pre-generated case. + # + script/hxx{builtin-options}@./ \ + script/ixx{builtin-options}@./: install = false + + build/script/hxx{builtin-options}@./ \ + build/script/ixx{builtin-options}@./: install = false } # Install into the libbuild2/ subdirectory of, say, /usr/include/ |