aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/link2
-rw-r--r--build2/cc/link.cxx14
-rw-r--r--build2/cc/windows-manifest.cxx11
3 files changed, 15 insertions, 12 deletions
diff --git a/build2/cc/link b/build2/cc/link
index cd83516..9e9e7cf 100644
--- a/build2/cc/link
+++ b/build2/cc/link
@@ -112,7 +112,7 @@ namespace build2
// Windows-specific (windows-manifest.cxx).
//
- path
+ pair<path, bool>
windows_manifest (const file&, bool rpath_assembly) const;
private:
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index bd2face..6d0c605 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -997,10 +997,12 @@ namespace build2
if (!for_install)
rpath_timestamp = windows_rpath_timestamp (t, bs, act, lo);
- path mf (
- windows_manifest (
- t,
- rpath_timestamp != timestamp_nonexistent));
+ pair<path, bool> p (
+ windows_manifest (t,
+ rpath_timestamp != timestamp_nonexistent));
+
+ path& mf (p.first);
+ bool mf_cf (p.second); // Changed flag (timestamp resolution).
timestamp mf_mt (file_mtime (mf));
@@ -1012,7 +1014,7 @@ namespace build2
//
manifest = mf + ".o";
- if (mf_mt > file_mtime (manifest))
+ if (mf_mt > file_mtime (manifest) || mf_cf)
{
path of (relative (manifest));
@@ -1087,7 +1089,7 @@ namespace build2
{
manifest = move (mf); // Save for link.exe's /MANIFESTINPUT.
- if (mf_mt > mt)
+ if (mf_mt > mt || mf_cf)
update = true; // Manifest changed, force update.
}
}
diff --git a/build2/cc/windows-manifest.cxx b/build2/cc/windows-manifest.cxx
index 3b9c649..3a62fcc 100644
--- a/build2/cc/windows-manifest.cxx
+++ b/build2/cc/windows-manifest.cxx
@@ -36,9 +36,10 @@ namespace build2
}
// Generate a Windows manifest and if necessary create/update the manifest
- // file corresponding to the exe{} target. Return the manifest file path.
+ // file corresponding to the exe{} target. Return the manifest file path
+ // as well as whether it was changed.
//
- path link::
+ pair<path, bool> link::
windows_manifest (const file& t, bool rpath_assembly) const
{
tracer trace (x, "link::windows_manifest");
@@ -108,11 +109,11 @@ namespace build2
getline (ifs, s, '\0');
if (s == m)
- return mf;
+ return make_pair (move (mf), false);
}
catch (const io_error&)
{
- // Whatever the reason we failed for , let's rewrite the file.
+ // Whatever the reason we failed for, let's rewrite the file.
}
}
@@ -130,7 +131,7 @@ namespace build2
fail << "unable to write to " << m << ": " << e;
}
- return mf;
+ return make_pair (move (mf), true);
}
}
}