summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-09-16 18:39:30 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-09-20 12:38:32 +0300
commitd90cabcb1f6ecb0de2c4d2f32b9d8ccb45f0156f (patch)
treea0e78d5c2feeb0d9601aab5d40a7b0b58929bc9a /cli
parent1486a4f2333d28b1335211acb1e072caecb62761 (diff)
Add --generate-dep option
Diffstat (limited to 'cli')
-rw-r--r--cli/cli/cli.cxx8
-rw-r--r--cli/cli/context.cxx1
-rw-r--r--cli/cli/generator.cxx144
-rw-r--r--cli/cli/generator.hxx7
-rw-r--r--cli/cli/options.cli26
-rw-r--r--cli/cli/parser.cxx29
-rw-r--r--cli/cli/parser.hxx21
-rw-r--r--cli/cli/parser.test.cxx2
-rw-r--r--cli/cli/pregenerated/cli/options.cxx47
-rw-r--r--cli/cli/pregenerated/cli/options.hxx44
-rw-r--r--cli/cli/pregenerated/cli/options.ixx78
-rw-r--r--cli/doc/pregenerated/cli.115
-rw-r--r--cli/doc/pregenerated/cli.xhtml21
13 files changed, 414 insertions, 29 deletions
diff --git a/cli/cli/cli.cxx b/cli/cli/cli.cxx
index f1196de..d56f9e2 100644
--- a/cli/cli/cli.cxx
+++ b/cli/cli/cli.cxx
@@ -6,6 +6,7 @@
#include <string>
#include <memory> // unique_ptr
#include <fstream>
+#include <utility> // move()
#include <iostream>
#include <libcutl/compiler/code-stream.hxx>
@@ -121,8 +122,9 @@ main (int argc, char* argv[])
// Parse and generate.
//
- parser p (include_paths);
- unique_ptr<semantics::cli_unit> unit (p.parse (ifs, path));
+ parser p (include_paths, ops.generate_dep ());
+ parser::parse_result r (p.parse (ifs, path));
+ unique_ptr<semantics::cli_unit>& unit (r.unit);
// Merge documentation variables from the command line.
//
@@ -143,7 +145,7 @@ main (int argc, char* argv[])
}
generator g;
- g.generate (ops, *unit, path);
+ g.generate (ops, move (*unit), move (r.dependencies), path);
}
catch (cli::exception const& ex)
{
diff --git a/cli/cli/context.cxx b/cli/cli/context.cxx
index 0c3254d..46896f2 100644
--- a/cli/cli/context.cxx
+++ b/cli/cli/context.cxx
@@ -7,6 +7,7 @@
#include <cstring> // strncmp()
#include <fstream>
#include <sstream>
+#include <utility> // move()
#include <iostream>
#include <cli/context.hxx>
diff --git a/cli/cli/generator.cxx b/cli/cli/generator.cxx
index b4e6640..623ac67 100644
--- a/cli/cli/generator.cxx
+++ b/cli/cli/generator.cxx
@@ -2,9 +2,10 @@
// author : Boris Kolpackov <boris@codesynthesis.com>
// license : MIT; see accompanying LICENSE file
-#include <cctype> // std::toupper, std::is{alpha,upper,lower}
+#include <cctype> // toupper, is{alpha,upper,lower}
#include <string>
#include <fstream>
+#include <utility> // move()
#include <iostream>
#include <libcutl/fs/auto-remove.hxx>
@@ -98,7 +99,10 @@ namespace
}
void
- append (context& ctx, vector<string> const& text, string const& file)
+ append (context& ctx,
+ vector<string> const& text,
+ string const& file,
+ vector<path>* pdeps)
{
for (vector<string>::const_iterator i (text.begin ());
i != text.end (); ++i)
@@ -111,7 +115,8 @@ namespace
ifstream ifs;
open (ifs, file);
- path d (path (file).directory ());
+ path p (file);
+ path d (p.directory ());
// getline() will set the failbit if it failed to extract anything,
// not even the delimiter and eofbit if it reached eof before seeing
@@ -119,6 +124,9 @@ namespace
//
for (string s; getline (ifs, s); )
append (ctx, s, &d);
+
+ if (pdeps != nullptr)
+ pdeps->push_back (move (p.normalize ()));
}
}
}
@@ -129,7 +137,10 @@ generator ()
}
void generator::
-generate (options& ops, semantics::cli_unit& unit, path const& p)
+generate (options& ops,
+ semantics::cli_unit&& unit,
+ vector<path>&& deps,
+ path const& p)
{
if (ops.generate_group_scanner ())
ops.generate_vector_scanner (true);
@@ -168,8 +179,48 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
}
}
+ bool gen_dep (ops.generate_dep ());
+ vector<path>* pdeps (gen_dep ? &deps : nullptr);
+ vector<path> depts; // Dependents.
+
fs::auto_removes auto_rm;
+ // gen_dep
+ //
+ // Make sure that we remove the potentially outdated dependency file if we
+ // fail to generate any source/documentation file.
+ //
+ // Note that we will write the dependency file content later, when all the
+ // dependents and dependencies are determined.
+ //
+ ofstream dep;
+
+ if (gen_dep)
+ {
+ path dep_path;
+
+ if (ops.dep_file ().empty ())
+ {
+ dep_path = path (pfx + base + sfx + ops.dep_suffix ());
+
+ if (!ops.output_dir ().empty ())
+ dep_path = path (ops.output_dir ()) / dep_path;
+ }
+ else
+ dep_path = path (ops.dep_file ());
+
+ dep.open (dep_path.string ().c_str (), ios_base::out);
+
+ if (!dep.is_open ())
+ {
+ cerr << "error: unable to open '" << dep_path << "' in write mode"
+ << endl;
+ throw failed ();
+ }
+
+ auto_rm.add (dep_path);
+ }
+
// C++ output.
//
if (gen_cxx)
@@ -235,6 +286,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
auto_rm.add (hxx_path);
+ if (gen_dep)
+ depts.push_back (move (hxx_path.normalize ()));
+
//
//
ofstream ixx;
@@ -251,6 +305,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
}
auto_rm.add (ixx_path);
+
+ if (gen_dep)
+ depts.push_back (move (ixx_path.normalize ()));
}
//
@@ -266,6 +323,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
auto_rm.add (cxx_path);
+ if (gen_dep)
+ depts.push_back (move (cxx_path.normalize ()));
+
// Print headers.
//
hxx << cxx_header;
@@ -304,7 +364,7 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
//
hxx << "// Begin prologue." << endl
<< "//" << endl;
- append (ctx, ops.hxx_prologue (), ops.hxx_prologue_file ());
+ append (ctx, ops.hxx_prologue (), ops.hxx_prologue_file (), pdeps);
hxx << "//" << endl
<< "// End prologue." << endl
<< endl;
@@ -331,7 +391,7 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
//
hxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (ctx, ops.hxx_epilogue (), ops.hxx_epilogue_file ());
+ append (ctx, ops.hxx_epilogue (), ops.hxx_epilogue_file (), pdeps);
hxx << "//" << endl
<< "// End epilogue." << endl
<< endl;
@@ -349,7 +409,7 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
//
ixx << "// Begin prologue." << endl
<< "//" << endl;
- append (ctx, ops.ixx_prologue (), ops.ixx_prologue_file ());
+ append (ctx, ops.ixx_prologue (), ops.ixx_prologue_file (), pdeps);
ixx << "//" << endl
<< "// End prologue." << endl
<< endl;
@@ -369,7 +429,7 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
//
ixx << "// Begin epilogue." << endl
<< "//" << endl;
- append (ctx, ops.ixx_epilogue (), ops.ixx_epilogue_file ());
+ append (ctx, ops.ixx_epilogue (), ops.ixx_epilogue_file (), pdeps);
ixx << "//" << endl
<< "// End epilogue." << endl;
}
@@ -383,7 +443,7 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
//
cxx << "// Begin prologue." << endl
<< "//" << endl;
- append (ctx, ops.cxx_prologue (), ops.cxx_prologue_file ());
+ append (ctx, ops.cxx_prologue (), ops.cxx_prologue_file (), pdeps);
cxx << "//" << endl
<< "// End prologue." << endl
<< endl;
@@ -413,7 +473,7 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
//
cxx << "// Begin epilogue." << endl
<< "//" << endl;
- append (ctx, ops.cxx_epilogue (), ops.cxx_epilogue_file ());
+ append (ctx, ops.cxx_epilogue (), ops.cxx_epilogue_file (), pdeps);
cxx << "//" << endl
<< "// End epilogue." << endl
<< endl;
@@ -443,6 +503,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
}
auto_rm.add (man_path);
+
+ if (gen_dep)
+ depts.push_back (move (man_path.normalize ()));
}
// The explicit cast helps VC++ 8.0 overcome its issues.
@@ -452,9 +515,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
for (bool first (true); first || ctx.toc; first = false)
{
- append (ctx, ops.man_prologue (), ops.man_prologue_file ());
+ append (ctx, ops.man_prologue (), ops.man_prologue_file (), pdeps);
generate_man (ctx);
- append (ctx, ops.man_epilogue (), ops.man_epilogue_file ());
+ append (ctx, ops.man_epilogue (), ops.man_epilogue_file (), pdeps);
if (ctx.toc)
{
@@ -492,6 +555,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
}
auto_rm.add (html_path);
+
+ if (gen_dep)
+ depts.push_back (move (html_path.normalize ()));
}
// The explicit cast helps VC++ 8.0 overcome its issues.
@@ -501,9 +567,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
for (bool first (true); first || ctx.toc; first = false)
{
- append (ctx, ops.html_prologue (), ops.html_prologue_file ());
+ append (ctx, ops.html_prologue (), ops.html_prologue_file (), pdeps);
generate_html (ctx);
- append (ctx, ops.html_epilogue (), ops.html_epilogue_file ());
+ append (ctx, ops.html_epilogue (), ops.html_epilogue_file (), pdeps);
if (ctx.toc)
{
@@ -538,6 +604,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
}
auto_rm.add (txt_path);
+
+ if (gen_dep)
+ depts.push_back (move (txt_path.normalize ()));
}
// The explicit cast helps VC++ 8.0 overcome its issues.
@@ -547,9 +616,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
for (bool first (true); first || ctx.toc; first = false)
{
- append (ctx, ops.txt_prologue (), ops.txt_prologue_file ());
+ append (ctx, ops.txt_prologue (), ops.txt_prologue_file (), pdeps);
generate_txt (ctx);
- append (ctx, ops.txt_epilogue (), ops.txt_epilogue_file ());
+ append (ctx, ops.txt_epilogue (), ops.txt_epilogue_file (), pdeps);
if (ctx.toc)
{
@@ -561,6 +630,49 @@ generate (options& ops, semantics::cli_unit& unit, path const& p)
ctx.verify_id_ref ();
}
+ // gen_dep
+ //
+ if (gen_dep)
+ {
+ // Write the specified path to the dependencies file stream, escaping
+ // colons and backslashes.
+ //
+ auto write = [&dep] (path const& p)
+ {
+ for (char c: p.string ())
+ {
+ if (c == ':' || c == '\\')
+ dep << '\\';
+
+ dep << c;
+ }
+ };
+
+ // Note that we don't add the dependency file as a dependent, but in the
+ // future may invent some option which triggers that.
+ //
+ bool first (true);
+ for (const auto& p: depts)
+ {
+ if (!first)
+ dep << " \\" << endl;
+ else
+ first = false;
+
+ write (p);
+ }
+
+ dep << ':';
+
+ for (const auto& p: deps)
+ {
+ dep << " \\" << endl
+ << " "; write (p);
+ }
+
+ dep << endl;
+ }
+
auto_rm.cancel ();
}
catch (const generation_failed&)
diff --git a/cli/cli/generator.hxx b/cli/cli/generator.hxx
index f567528..3deb3f3 100644
--- a/cli/cli/generator.hxx
+++ b/cli/cli/generator.hxx
@@ -5,6 +5,8 @@
#ifndef CLI_GENERATOR_HXX
#define CLI_GENERATOR_HXX
+#include <vector>
+
#include <cli/options.hxx>
#include <cli/semantics/unit.hxx>
@@ -16,7 +18,10 @@ public:
class failed {};
void
- generate (options&, semantics::cli_unit&, semantics::path const&);
+ generate (options&,
+ semantics::cli_unit&&,
+ std::vector<semantics::path>&& dependencies,
+ semantics::path const&);
private:
generator (generator const&);
diff --git a/cli/cli/options.cli b/cli/cli/options.cli
index 03a0053..211e01f 100644
--- a/cli/cli/options.cli
+++ b/cli/cli/options.cli
@@ -199,6 +199,18 @@ class options
"Generate documentation in the plain text format, similar to usage."
};
+ bool --generate-dep
+ {
+ "Generate \cb{make} dependency information. This option triggers the
+ creation of the \cb{.d} file containing the dependencies of the generated
+ files on the main \cb{.cli} file as well as all the \cb{.cli} files that
+ it includes or sources, transitively. Paths specified with the
+ \cb{--*-prologue-file} and \cb{--*-epilogue-file} options are also
+ added as dependencies. Note, however, that paths specified with the
+ \cb{--options-file} option are not added (since they may or may not
+ contain options that affect the output)."
+ };
+
bool --stdout
{
"Write output to STDOUT instead of a file. This option is not valid
@@ -586,6 +598,20 @@ class options
the generated text file."
};
+ std::string --dep-suffix = ".d"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{.d} to construct the name of the
+ generated dependency file. See also \cb{--dep-file}."
+ };
+
+ std::string --dep-file
+ {
+ "<path>",
+ "Use <path> as the generated dependency file path instead of deriving it
+ from the input file name."
+ };
+
std::string --option-prefix = "-"
{
"<prefix>",
diff --git a/cli/cli/parser.cxx b/cli/cli/parser.cxx
index c330e53..e2efca5 100644
--- a/cli/cli/parser.cxx
+++ b/cli/cli/parser.cxx
@@ -17,6 +17,7 @@
#include <fstream>
#include <sstream>
+#include <utility> // move()
#include <iostream>
#include <cli/token.hxx>
@@ -66,7 +67,7 @@ const char* punctuation[] = {
// Output the token type and value in a format suitable for diagnostics.
//
-std::ostream&
+static std::ostream&
operator<< (std::ostream& os, token const& t)
{
switch (t.type ())
@@ -184,7 +185,7 @@ recover (token& t)
}
}
-unique_ptr<cli_unit> parser::
+parser::parse_result parser::
parse (std::istream& is, path const& p)
{
unique_ptr<cli_unit> unit (new cli_unit (p, 1, 1));
@@ -193,7 +194,10 @@ parse (std::istream& is, path const& p)
path ap (p);
ap.complete ();
ap.normalize ();
- include_map_[ap] = unit.get ();
+ include_map_[move (ap)] = unit.get ();
+
+ if (collect_dependencies_)
+ dependencies_.push_back (path (p).normalize ());
}
root_ = cur_ = unit.get ();
@@ -211,7 +215,7 @@ parse (std::istream& is, path const& p)
if (!valid_ || !l.valid ())
throw invalid_input ();
- return unit;
+ return parse_result {move (unit), move (dependencies_)};
}
void parser::
@@ -350,6 +354,16 @@ source_decl ()
if (valid_)
{
+ if (collect_dependencies_)
+ {
+ path ap (p);
+ ap.complete ();
+ ap.normalize ();
+
+ if (include_map_.emplace (move (ap), nullptr).second)
+ dependencies_.push_back (p);
+ }
+
auto_restore<path const> new_path (path_, &p);
ifstream ifs (p.string ().c_str ());
@@ -472,11 +486,14 @@ include_decl ()
ap.normalize ();
include_map::iterator it (include_map_.find (ap));
- if (it == include_map_.end ())
+ if (it == include_map_.end () || it->second == nullptr)
{
+ if (collect_dependencies_ && it == include_map_.end ())
+ dependencies_.push_back (p);
+
cli_unit& n (root_->new_node<cli_unit> (p, 1, 1));
root_->new_edge<cli_includes> (*cur_, n, ik, f);
- include_map_[ap] = &n;
+ include_map_[move (ap)] = &n;
auto_restore<cli_unit> new_cur (cur_, &n);
auto_restore<path const> new_path (path_, &p);
diff --git a/cli/cli/parser.hxx b/cli/cli/parser.hxx
index 326768e..960e74b 100644
--- a/cli/cli/parser.hxx
+++ b/cli/cli/parser.hxx
@@ -23,11 +23,23 @@ class parser
public:
typedef std::vector<semantics::path> paths;
- parser (paths const& include_paths): include_paths_ (include_paths) {}
+ parser (paths const& include_paths, bool collect_dependencies)
+ : include_paths_ (include_paths),
+ collect_dependencies_ (collect_dependencies) {}
struct invalid_input {};
- std::unique_ptr<semantics::cli_unit>
+ struct parse_result
+ {
+ std::unique_ptr<semantics::cli_unit> unit;
+
+ // Normalized paths of the main CLI file and files it includes and sources
+ // recursively, with the duplicates suppressed.
+ //
+ paths dependencies;
+ };
+
+ parse_result
parse (std::istream& is, semantics::path const& path);
private:
@@ -72,6 +84,7 @@ private:
private:
paths const include_paths_;
+ bool collect_dependencies_;
bool valid_;
semantics::path const* path_;
@@ -84,8 +97,12 @@ private:
std::size_t doc_count_; // Scope doc counter, see scope_doc() for details.
+ // If the entry's value is NULL, then the key refers to a sourced file.
+ //
typedef std::map<semantics::path, semantics::cli_unit*> include_map;
include_map include_map_;
+
+ paths dependencies_;
};
#endif // CLI_PARSER_HXX
diff --git a/cli/cli/parser.test.cxx b/cli/cli/parser.test.cxx
index 5a87bb7..44109b3 100644
--- a/cli/cli/parser.test.cxx
+++ b/cli/cli/parser.test.cxx
@@ -32,7 +32,7 @@ main (int argc, char* argv[])
ifs.open (path.string ().c_str ());
parser::paths include_paths;
- parser p (include_paths);
+ parser p (include_paths, true /* collect_dependencies */);
p.parse (ifs, path);
}
catch (semantics::invalid_path const& e)
diff --git a/cli/cli/pregenerated/cli/options.cxx b/cli/cli/pregenerated/cli/options.cxx
index 2cb2f75..99aa50d 100644
--- a/cli/cli/pregenerated/cli/options.cxx
+++ b/cli/cli/pregenerated/cli/options.cxx
@@ -736,6 +736,7 @@ options ()
generate_man_ (),
generate_html_ (),
generate_txt_ (),
+ generate_dep_ (),
stdout__ (),
suppress_undocumented_ (),
suppress_usage_ (),
@@ -825,6 +826,10 @@ options ()
html_suffix_specified_ (false),
txt_suffix_ (".txt"),
txt_suffix_specified_ (false),
+ dep_suffix_ (".d"),
+ dep_suffix_specified_ (false),
+ dep_file_ (),
+ dep_file_specified_ (false),
option_prefix_ ("-"),
option_prefix_specified_ (false),
option_separator_ ("--"),
@@ -880,6 +885,7 @@ options (int& argc,
generate_man_ (),
generate_html_ (),
generate_txt_ (),
+ generate_dep_ (),
stdout__ (),
suppress_undocumented_ (),
suppress_usage_ (),
@@ -969,6 +975,10 @@ options (int& argc,
html_suffix_specified_ (false),
txt_suffix_ (".txt"),
txt_suffix_specified_ (false),
+ dep_suffix_ (".d"),
+ dep_suffix_specified_ (false),
+ dep_file_ (),
+ dep_file_specified_ (false),
option_prefix_ ("-"),
option_prefix_specified_ (false),
option_separator_ ("--"),
@@ -1027,6 +1037,7 @@ options (int start,
generate_man_ (),
generate_html_ (),
generate_txt_ (),
+ generate_dep_ (),
stdout__ (),
suppress_undocumented_ (),
suppress_usage_ (),
@@ -1116,6 +1127,10 @@ options (int start,
html_suffix_specified_ (false),
txt_suffix_ (".txt"),
txt_suffix_specified_ (false),
+ dep_suffix_ (".d"),
+ dep_suffix_specified_ (false),
+ dep_file_ (),
+ dep_file_specified_ (false),
option_prefix_ ("-"),
option_prefix_specified_ (false),
option_separator_ ("--"),
@@ -1174,6 +1189,7 @@ options (int& argc,
generate_man_ (),
generate_html_ (),
generate_txt_ (),
+ generate_dep_ (),
stdout__ (),
suppress_undocumented_ (),
suppress_usage_ (),
@@ -1263,6 +1279,10 @@ options (int& argc,
html_suffix_specified_ (false),
txt_suffix_ (".txt"),
txt_suffix_specified_ (false),
+ dep_suffix_ (".d"),
+ dep_suffix_specified_ (false),
+ dep_file_ (),
+ dep_file_specified_ (false),
option_prefix_ ("-"),
option_prefix_specified_ (false),
option_separator_ ("--"),
@@ -1323,6 +1343,7 @@ options (int start,
generate_man_ (),
generate_html_ (),
generate_txt_ (),
+ generate_dep_ (),
stdout__ (),
suppress_undocumented_ (),
suppress_usage_ (),
@@ -1412,6 +1433,10 @@ options (int start,
html_suffix_specified_ (false),
txt_suffix_ (".txt"),
txt_suffix_specified_ (false),
+ dep_suffix_ (".d"),
+ dep_suffix_specified_ (false),
+ dep_file_ (),
+ dep_file_specified_ (false),
option_prefix_ ("-"),
option_prefix_specified_ (false),
option_separator_ ("--"),
@@ -1468,6 +1493,7 @@ options (::cli::scanner& s,
generate_man_ (),
generate_html_ (),
generate_txt_ (),
+ generate_dep_ (),
stdout__ (),
suppress_undocumented_ (),
suppress_usage_ (),
@@ -1557,6 +1583,10 @@ options (::cli::scanner& s,
html_suffix_specified_ (false),
txt_suffix_ (".txt"),
txt_suffix_specified_ (false),
+ dep_suffix_ (".d"),
+ dep_suffix_specified_ (false),
+ dep_file_ (),
+ dep_file_specified_ (false),
option_prefix_ ("-"),
option_prefix_specified_ (false),
option_separator_ ("--"),
@@ -1643,6 +1673,8 @@ print_usage (::std::ostream& os, ::cli::usage_para p)
os << "--generate-txt Generate documentation in the plain text format," << ::std::endl
<< " similar to usage." << ::std::endl;
+ os << "--generate-dep Generate make dependency information." << ::std::endl;
+
os << "--stdout Write output to STDOUT instead of a file." << ::std::endl;
os << "--suppress-undocumented Suppress the generation of documentation entries" << ::std::endl
@@ -1793,6 +1825,13 @@ print_usage (::std::ostream& os, ::cli::usage_para p)
os << "--txt-suffix <suffix> Use <suffix> instead of the default .txt to" << ::std::endl
<< " construct the name of the generated text file." << ::std::endl;
+ os << "--dep-suffix <suffix> Use <suffix> instead of the default .d to" << ::std::endl
+ << " construct the name of the generated dependency" << ::std::endl
+ << " file." << ::std::endl;
+
+ os << "--dep-file <path> Use <path> as the generated dependency file path" << ::std::endl
+ << " instead of deriving it from the input file name." << ::std::endl;
+
os << "--option-prefix <prefix> Use <prefix> instead of the default '-' as an" << ::std::endl
<< " option prefix." << ::std::endl;
@@ -1898,6 +1937,8 @@ struct _cli_options_map_init
&::cli::thunk< options, &options::generate_html_ >;
_cli_options_map_["--generate-txt"] =
&::cli::thunk< options, &options::generate_txt_ >;
+ _cli_options_map_["--generate-dep"] =
+ &::cli::thunk< options, &options::generate_dep_ >;
_cli_options_map_["--stdout"] =
&::cli::thunk< options, &options::stdout__ >;
_cli_options_map_["--suppress-undocumented"] =
@@ -2040,6 +2081,12 @@ struct _cli_options_map_init
_cli_options_map_["--txt-suffix"] =
&::cli::thunk< options, std::string, &options::txt_suffix_,
&options::txt_suffix_specified_ >;
+ _cli_options_map_["--dep-suffix"] =
+ &::cli::thunk< options, std::string, &options::dep_suffix_,
+ &options::dep_suffix_specified_ >;
+ _cli_options_map_["--dep-file"] =
+ &::cli::thunk< options, std::string, &options::dep_file_,
+ &options::dep_file_specified_ >;
_cli_options_map_["--option-prefix"] =
&::cli::thunk< options, std::string, &options::option_prefix_,
&options::option_prefix_specified_ >;
diff --git a/cli/cli/pregenerated/cli/options.hxx b/cli/cli/pregenerated/cli/options.hxx
index 08180f3..f44258f 100644
--- a/cli/cli/pregenerated/cli/options.hxx
+++ b/cli/cli/pregenerated/cli/options.hxx
@@ -725,6 +725,15 @@ class options
generate_txt (const bool&);
const bool&
+ generate_dep () const;
+
+ bool&
+ generate_dep ();
+
+ void
+ generate_dep (const bool&);
+
+ const bool&
stdout_ () const;
bool&
@@ -1409,6 +1418,36 @@ class options
txt_suffix_specified (bool);
const std::string&
+ dep_suffix () const;
+
+ std::string&
+ dep_suffix ();
+
+ void
+ dep_suffix (const std::string&);
+
+ bool
+ dep_suffix_specified () const;
+
+ void
+ dep_suffix_specified (bool);
+
+ const std::string&
+ dep_file () const;
+
+ std::string&
+ dep_file ();
+
+ void
+ dep_file (const std::string&);
+
+ bool
+ dep_file_specified () const;
+
+ void
+ dep_file_specified (bool);
+
+ const std::string&
option_prefix () const;
std::string&
@@ -1583,6 +1622,7 @@ class options
bool generate_man_;
bool generate_html_;
bool generate_txt_;
+ bool generate_dep_;
bool stdout__;
bool suppress_undocumented_;
bool suppress_usage_;
@@ -1672,6 +1712,10 @@ class options
bool html_suffix_specified_;
std::string txt_suffix_;
bool txt_suffix_specified_;
+ std::string dep_suffix_;
+ bool dep_suffix_specified_;
+ std::string dep_file_;
+ bool dep_file_specified_;
std::string option_prefix_;
bool option_prefix_specified_;
std::string option_separator_;
diff --git a/cli/cli/pregenerated/cli/options.ixx b/cli/cli/pregenerated/cli/options.ixx
index e3fd397..54fa54a 100644
--- a/cli/cli/pregenerated/cli/options.ixx
+++ b/cli/cli/pregenerated/cli/options.ixx
@@ -775,6 +775,24 @@ generate_txt (const bool& x)
}
inline const bool& options::
+generate_dep () const
+{
+ return this->generate_dep_;
+}
+
+inline bool& options::
+generate_dep ()
+{
+ return this->generate_dep_;
+}
+
+inline void options::
+generate_dep (const bool& x)
+{
+ this->generate_dep_ = x;
+}
+
+inline const bool& options::
stdout_ () const
{
return this->stdout__;
@@ -2143,6 +2161,66 @@ txt_suffix_specified (bool x)
}
inline const std::string& options::
+dep_suffix () const
+{
+ return this->dep_suffix_;
+}
+
+inline std::string& options::
+dep_suffix ()
+{
+ return this->dep_suffix_;
+}
+
+inline void options::
+dep_suffix (const std::string& x)
+{
+ this->dep_suffix_ = x;
+}
+
+inline bool options::
+dep_suffix_specified () const
+{
+ return this->dep_suffix_specified_;
+}
+
+inline void options::
+dep_suffix_specified (bool x)
+{
+ this->dep_suffix_specified_ = x;
+}
+
+inline const std::string& options::
+dep_file () const
+{
+ return this->dep_file_;
+}
+
+inline std::string& options::
+dep_file ()
+{
+ return this->dep_file_;
+}
+
+inline void options::
+dep_file (const std::string& x)
+{
+ this->dep_file_ = x;
+}
+
+inline bool options::
+dep_file_specified () const
+{
+ return this->dep_file_specified_;
+}
+
+inline void options::
+dep_file_specified (bool x)
+{
+ this->dep_file_specified_ = x;
+}
+
+inline const std::string& options::
option_prefix () const
{
return this->option_prefix_;
diff --git a/cli/doc/pregenerated/cli.1 b/cli/doc/pregenerated/cli.1
index 8cf5cd1..91e18f5 100644
--- a/cli/doc/pregenerated/cli.1
+++ b/cli/doc/pregenerated/cli.1
@@ -169,6 +169,15 @@ Generate documentation in the man page format\.
Generate documentation in the HTML format\.
.IP "\fB--generate-txt\fR"
Generate documentation in the plain text format, similar to usage\.
+.IP "\fB--generate-dep\fR"
+Generate \fBmake\fR dependency information\. This option triggers the creation
+of the \fB\.d\fR file containing the dependencies of the generated files on
+the main \fB\.cli\fR file as well as all the \fB\.cli\fR files that it
+includes or sources, transitively\. Paths specified with the
+\fB--*-prologue-file\fR and \fB--*-epilogue-file\fR options are also added as
+dependencies\. Note, however, that paths specified with the
+\fB--options-file\fR option are not added (since they may or may not contain
+options that affect the output)\.
.IP "\fB--stdout\fR"
Write output to STDOUT instead of a file\. This option is not valid when
generating C++ code and is normally used to combine generated documentation
@@ -348,6 +357,12 @@ the generated HTML file\.
.IP "\fB--txt-suffix\fR \fIsuffix\fR"
Use \fIsuffix\fR instead of the default \fB\.txt\fR to construct the name of
the generated text file\.
+.IP "\fB--dep-suffix\fR \fIsuffix\fR"
+Use \fIsuffix\fR instead of the default \fB\.d\fR to construct the name of the
+generated dependency file\. See also \fB--dep-file\fR\.
+.IP "\fB--dep-file\fR \fIpath\fR"
+Use \fIpath\fR as the generated dependency file path instead of deriving it
+from the input file name\.
.IP "\fB--option-prefix\fR \fIprefix\fR"
Use \fIprefix\fR instead of the default '\fB-\fR' as an option prefix\.
Unknown command line arguments that start with this prefix are treated as
diff --git a/cli/doc/pregenerated/cli.xhtml b/cli/doc/pregenerated/cli.xhtml
index 909fa34..84d013a 100644
--- a/cli/doc/pregenerated/cli.xhtml
+++ b/cli/doc/pregenerated/cli.xhtml
@@ -213,6 +213,18 @@ arg+{ --foo } # 'arg+{' ...</pre>
<dd>Generate documentation in the plain text format, similar to
usage.</dd>
+ <dt><code><b>--generate-dep</b></code></dt>
+ <dd>Generate <code><b>make</b></code> dependency information. This option
+ triggers the creation of the <code><b>.d</b></code> file containing the
+ dependencies of the generated files on the main <code><b>.cli</b></code>
+ file as well as all the <code><b>.cli</b></code> files that it includes or
+ sources, transitively. Paths specified with the
+ <code><b>--*-prologue-file</b></code> and
+ <code><b>--*-epilogue-file</b></code> options are also added as
+ dependencies. Note, however, that paths specified with the
+ <code><b>--options-file</b></code> option are not added (since they may or
+ may not contain options that affect the output).</dd>
+
<dt><code><b>--stdout</b></code></dt>
<dd>Write output to STDOUT instead of a file. This option is not valid
when generating C++ code and is normally used to combine generated
@@ -485,6 +497,15 @@ arg+{ --foo } # 'arg+{' ...</pre>
<code><b>.txt</b></code> to construct the name of the generated text
file.</dd>
+ <dt><code><b>--dep-suffix</b></code> <code><i>suffix</i></code></dt>
+ <dd>Use <code><i>suffix</i></code> instead of the default
+ <code><b>.d</b></code> to construct the name of the generated dependency
+ file. See also <code><b>--dep-file</b></code>.</dd>
+
+ <dt><code><b>--dep-file</b></code> <code><i>path</i></code></dt>
+ <dd>Use <code><i>path</i></code> as the generated dependency file path
+ instead of deriving it from the input file name.</dd>
+
<dt><code><b>--option-prefix</b></code> <code><i>prefix</i></code></dt>
<dd>Use <code><i>prefix</i></code> instead of the default
'<code><b>-</b></code>' as an option prefix. Unknown command line