aboutsummaryrefslogtreecommitdiff
path: root/build2/buildfile
diff options
context:
space:
mode:
Diffstat (limited to 'build2/buildfile')
-rw-r--r--build2/buildfile33
1 files changed, 30 insertions, 3 deletions
diff --git a/build2/buildfile b/build2/buildfile
index 6fd0cac..412b348 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -7,6 +7,7 @@ import libs = libbutl%lib{butl}
exe{b}: \
{hxx ixx txx cxx}{ algorithm } \
{ cxx}{ b } \
+ {hxx ixx cxx}{ b-options } \
{hxx txx cxx}{ context } \
{hxx cxx}{ diagnostics } \
{hxx cxx}{ dump } \
@@ -15,7 +16,6 @@ exe{b}: \
{hxx cxx}{ module } \
{hxx cxx}{ name } \
{hxx cxx}{ operation } \
- {hxx ixx cxx}{ options } \
{hxx cxx}{ parser } \
{hxx cxx}{ path-io } \
{hxx cxx}{ prerequisite } \
@@ -59,6 +59,33 @@ install/{hxx }{ utility } \
test/{hxx cxx}{ rule } \
$libs
-#@@ TODO, also remove gen files from the repository/add to .gitignore
+# Load the cli module but only if it's available. This way a distribution
+# that includes pre-generated files can be built without installing cli.
+# This is also the reason why above we explicitly spelled out individual
+# source files instead of using the cli.cxx{} group (it won't be there
+# unless the module is loaded).
#
-# cli --generate-specifier --cli-namespace cl --include-with-brackets --include-prefix build2 --guard-prefix BUILD2 --hxx-suffix "" options.cli
+using? cli
+
+if! $cli.loaded
+{
+ define cli: file
+ cli{*}: extension = cli
+}
+
+{hxx ixx cxx}{b-options}: cli{b}
+
+cli.options += -I $src_root --include-with-brackets --include-prefix build2 \
+--guard-prefix BUILD2 --cli-namespace build2::cl --generate-file-scanner \
+--generate-specifier
+
+# Usage options.
+#
+cli.options += --suppress-undocumented --long-usage --ansi-color \
+--page-usage 'build2::print_$name$_' --option-length 23
+
+# Include generated cli files into the distribution.
+#
+hxx{*-options}: dist = true
+ixx{*-options}: dist = true
+cxx{*-options}: dist = true