aboutsummaryrefslogtreecommitdiff
path: root/build2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-19 15:35:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-19 15:35:06 +0200
commit4776ab7859e71bb6cec004a1aea05324ad33fd1d (patch)
tree33d37fd63f6d8d0d6a10f8373458da07fe438dc0 /build2/cc
parentd19ae162c2cf8059b3145ded8cfbce2ab01c8fc6 (diff)
Implement uninstall operation
Diffstat (limited to 'build2/cc')
-rw-r--r--build2/cc/common7
-rw-r--r--build2/cc/link.cxx14
-rw-r--r--build2/cc/module.cxx33
3 files changed, 34 insertions, 20 deletions
diff --git a/build2/cc/common b/build2/cc/common
index 95f205a..2be290a 100644
--- a/build2/cc/common
+++ b/build2/cc/common
@@ -84,6 +84,7 @@ namespace build2
const char* x_compile; // Rule names.
const char* x_link;
const char* x_install;
+ const char* x_uninstall;
// Cached values for some commonly-used variables.
//
@@ -122,6 +123,7 @@ namespace build2
const char* compile,
const char* link,
const char* install,
+ const char* uninstall,
const string& id,
const string& tg,
const string& sys,
@@ -130,7 +132,10 @@ namespace build2
const target_type* const* hdr,
const target_type* const* inc)
: config_data (cd),
- x_compile (compile), x_link (link), x_install (install),
+ x_compile (compile),
+ x_link (link),
+ x_install (install),
+ x_uninstall (uninstall),
cid (id), ctg (tg), tsys (sys), tclass (class_),
x_src (src), x_hdr (hdr), x_inc (inc) {}
};
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index df1fa7e..61dd0ad 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -595,8 +595,12 @@ namespace build2
// "library meta-information protocol". Don't do this if we are
// called from the install rule just to check if we would match.
//
+ auto op (a.operation ());
+ auto oop (a.outer_operation ());
+
if (seen_lib && lt != otype::e &&
- a.operation () != install_id && a.outer_operation () != install_id)
+ op != install_id && oop != install_id &&
+ op != uninstall_id && oop != uninstall_id)
{
if (t.group != nullptr)
t.group->prerequisite_targets.clear (); // lib{}'s
@@ -1087,6 +1091,8 @@ namespace build2
{
tracer trace (x, "link::perform_update");
+ auto oop (a.outer_operation ());
+
file& t (static_cast<file&> (xt));
scope& rs (t.root_scope ());
@@ -1107,7 +1113,7 @@ namespace build2
// assembly itself is generated later, after updating the target. Omit
// it if we are updating for install.
//
- if (a.outer_operation () != install_id)
+ if (oop != install_id && oop != uninstall_id)
rpath_timestamp = windows_rpath_timestamp (t);
path mf (
@@ -1354,7 +1360,7 @@ namespace build2
{
if (libs* ls = pt->is_a<libs> ())
{
- if (a.outer_operation () != install_id)
+ if (oop != install_id && oop != uninstall_id)
{
sargs.push_back ("-Wl,-rpath," +
ls->path ().directory ().string ());
@@ -1781,7 +1787,7 @@ namespace build2
//
if (lt == otype::e && tclass == "windows")
{
- if (a.outer_operation () != install_id)
+ if (oop != install_id && oop != uninstall_id)
windows_rpath_assembly (t,
cast<string> (rs[x_target_cpu]),
rpath_timestamp,
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index ec7178b..d3849e1 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -307,30 +307,32 @@ namespace build2
link& lr (*this);
install& ir (*this);
- r.insert<obje> (perform_update_id, x_compile, cr);
- r.insert<obje> (perform_clean_id, x_compile, cr);
- r.insert<obje> (configure_update_id, x_compile, cr);
+ r.insert<obje> (perform_update_id, x_compile, cr);
+ r.insert<obje> (perform_clean_id, x_compile, cr);
+ r.insert<obje> (configure_update_id, x_compile, cr);
- r.insert<exe> (perform_update_id, x_link, lr);
- r.insert<exe> (perform_clean_id, x_link, lr);
- r.insert<exe> (configure_update_id, x_link, lr);
+ r.insert<exe> (perform_update_id, x_link, lr);
+ r.insert<exe> (perform_clean_id, x_link, lr);
+ r.insert<exe> (configure_update_id, x_link, lr);
- r.insert<exe> (perform_install_id, x_install, ir);
+ r.insert<exe> (perform_install_id, x_install, ir);
+ r.insert<exe> (perform_uninstall_id, x_uninstall, ir);
// Only register static object/library rules if the bin.ar module is
// loaded (by us or by the user).
//
if (cast_false<bool> (b["bin.ar.loaded"]))
{
- r.insert<obja> (perform_update_id, x_compile, cr);
- r.insert<obja> (perform_clean_id, x_compile, cr);
- r.insert<obja> (configure_update_id, x_compile, cr);
+ r.insert<obja> (perform_update_id, x_compile, cr);
+ r.insert<obja> (perform_clean_id, x_compile, cr);
+ r.insert<obja> (configure_update_id, x_compile, cr);
- r.insert<liba> (perform_update_id, x_link, lr);
- r.insert<liba> (perform_clean_id, x_link, lr);
- r.insert<liba> (configure_update_id, x_link, lr);
+ r.insert<liba> (perform_update_id, x_link, lr);
+ r.insert<liba> (perform_clean_id, x_link, lr);
+ r.insert<liba> (configure_update_id, x_link, lr);
- r.insert<liba> (perform_install_id, x_install, ir);
+ r.insert<liba> (perform_install_id, x_install, ir);
+ r.insert<liba> (perform_uninstall_id, x_uninstall, ir);
}
r.insert<objs> (perform_update_id, x_compile, cr);
@@ -341,7 +343,8 @@ namespace build2
r.insert<libs> (perform_clean_id, x_link, lr);
r.insert<libs> (configure_update_id, x_link, lr);
- r.insert<libs> (perform_install_id, x_install, ir);
+ r.insert<libs> (perform_install_id, x_install, ir);
+ r.insert<libs> (perform_uninstall_id, x_uninstall, ir);
}
}
}