From 76f1988539c477ad3b906f254654929aec04283c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Nov 2021 10:15:33 +0200 Subject: Add support for dynamic dependencies as byproduct of script body Specifically, the `depdb dyndep` builtin now has the --byproduct option (which must come first). In this mode only the --file input is supported. For example: obje{hello.o}: cxx{hello} {{ o = $path($>) t = $(o).t depdb dyndep --byproduct --what=header --default-type=h --file $t diag c++ ($<[0]) $cxx.path $cxx.poptions $cc.poptions $cc.coptions $cxx.coptions $cxx.mode -o $o -MD -MF $t -c $path($<[0]) }} Naturally, this mode does not support dynamic auto-generated prerequisites. If present, such prerequisites must be specified statically in the buildfile. Note also that the --default-prereq-type option has been rename to --default-type. --- libbuild2/build/script/builtin-options.hxx | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'libbuild2/build/script/builtin-options.hxx') diff --git a/libbuild2/build/script/builtin-options.hxx b/libbuild2/build/script/builtin-options.hxx index 85d67b9..15119f4 100644 --- a/libbuild2/build/script/builtin-options.hxx +++ b/libbuild2/build/script/builtin-options.hxx @@ -297,10 +297,10 @@ namespace build2 { namespace script { - class depdb_dep_options + class depdb_dyndep_options { public: - depdb_dep_options (); + depdb_dyndep_options (); // Return true if anything has been parsed. // @@ -404,19 +404,34 @@ namespace build2 include_path_specified (bool); const string& - default_prereq_type () const; + default_type () const; string& - default_prereq_type (); + default_type (); void - default_prereq_type (const string&); + default_type (const string&); bool - default_prereq_type_specified () const; + default_type_specified () const; void - default_prereq_type_specified (bool); + default_type_specified (bool); + + const dir_path& + cwd () const; + + dir_path& + cwd (); + + void + cwd (const dir_path&); + + bool + cwd_specified () const; + + void + cwd_specified (bool); // Implementation details. // @@ -439,8 +454,10 @@ namespace build2 bool what_specified_; dir_paths include_path_; bool include_path_specified_; - string default_prereq_type_; - bool default_prereq_type_specified_; + string default_type_; + bool default_type_specified_; + dir_path cwd_; + bool cwd_specified_; }; } } -- cgit v1.1