aboutsummaryrefslogtreecommitdiff
path: root/build/prerequisite.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/prerequisite.cxx')
-rw-r--r--build/prerequisite.cxx58
1 files changed, 22 insertions, 36 deletions
diff --git a/build/prerequisite.cxx b/build/prerequisite.cxx
index aa6c53c..5d3235c 100644
--- a/build/prerequisite.cxx
+++ b/build/prerequisite.cxx
@@ -18,52 +18,38 @@ namespace build
ostream&
operator<< (ostream& os, const prerequisite& p)
{
- if (p.target != nullptr)
- os << *p.target;
- else
+ // Print scope unless the prerequisite's directory is absolute.
+ //
+ if (!p.dir.absolute ())
{
- os << p.type.name << '{';
-
- // Print scope unless the directory is absolute.
- //
- if (!p.dir.absolute ())
- {
- string s (diag_relative (p.scope.path ()));
+ string s (diag_relative (p.scope.path (), false));
- if (s != ".")
- {
- os << s;
-
- if (s.back () != path::traits::directory_separator)
- os << path::traits::directory_separator;
-
- os << ": ";
- }
- }
+ if (!s.empty ())
+ os << s << ':';
+ }
- // Print directory.
- //
- if (!p.dir.empty ())
- {
- string s (diag_relative (p.dir));
+ // If the name is empty, then we want to print the directory
+ // inside {}, e.g., dir{bar/}, not bar/dir{}.
+ //
+ bool n (!p.name.empty ());
+ string d (diag_relative (p.dir, false));
- if (s != ".")
- {
- os << s;
+ if (n)
+ os << d;
- if (!p.name.empty () &&
- s.back () != path::traits::directory_separator)
- os << path::traits::directory_separator;
- }
- }
+ os << p.type.name << '{';
+ if (n)
+ {
os << p.name;
if (p.ext != nullptr && !p.ext->empty ())
os << '.' << *p.ext;
-
- os << '}';
}
+ else
+ os << d;
+
+ os << '}';
return os;
}
@@ -89,7 +75,7 @@ namespace build
//
auto prerequisite_set::
insert (const target_type& tt,
- path dir,
+ dir_path dir,
std::string name,
const std::string* ext,
scope& s,