From f98262e37f608330fcfce799dcacc6fbacac8f8a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Apr 2018 14:25:58 +0200 Subject: Implement forwarded configurations and backlinking --- build2/context.cxx | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'build2/context.cxx') diff --git a/build2/context.cxx b/build2/context.cxx index b669ae6..2ebe163 100644 --- a/build2/context.cxx +++ b/build2/context.cxx @@ -326,6 +326,7 @@ namespace build2 const variable* var_out_root; const variable* var_src_base; const variable* var_out_base; + const variable* var_forwarded; const variable* var_project; const variable* var_amalgamation; @@ -338,6 +339,7 @@ namespace build2 const variable* var_import_target; const variable* var_clean; + const variable* var_backlink; const char var_extension[10] = "extension"; @@ -417,10 +419,6 @@ namespace build2 // may reference these things. // - // Target extension. - // - vp.insert (var_extension, variable_visibility::target); - gs.assign ("build.work") = work; gs.assign ("build.home") = home; @@ -673,28 +671,38 @@ namespace build2 vp.insert_pattern ( "**.configured", false, variable_visibility::project); - var_src_root = &vp.insert ("src_root"); - var_out_root = &vp.insert ("out_root"); - var_src_base = &vp.insert ("src_base"); - var_out_base = &vp.insert ("out_base"); - - // Note that subprojects is not typed since the value requires - // pre-processing (see file.cxx). - // { - auto pv (variable_visibility::project); + auto v_p (variable_visibility::project); + auto v_t (variable_visibility::target); - var_project = &vp.insert ("project", pv); - var_amalgamation = &vp.insert ("amalgamation", pv); - var_subprojects = &vp.insert ("subprojects", pv); - var_version = &vp.insert ("version", pv); + var_src_root = &vp.insert ("src_root"); + var_out_root = &vp.insert ("out_root"); + var_src_base = &vp.insert ("src_base"); + var_out_base = &vp.insert ("out_base"); - var_project_url = &vp.insert ("project.url", pv); - var_project_summary = &vp.insert ("project.summary", pv); + var_forwarded = &vp.insert ("forwarded", v_p); + + // Note that subprojects is not typed since the value requires + // pre-processing (see file.cxx). + // + var_project = &vp.insert ("project", v_p); + var_amalgamation = &vp.insert ("amalgamation", v_p); + var_subprojects = &vp.insert ("subprojects", v_p); + var_version = &vp.insert ("version", v_p); + + var_project_url = &vp.insert ("project.url", v_p); + var_project_summary = &vp.insert ("project.summary", v_p); var_import_target = &vp.insert ("import.target"); - var_clean = &vp.insert ("clean", variable_visibility::target); + var_clean = &vp.insert ("clean", v_t); + var_backlink = &vp.insert ("backlink", v_t); + vp.insert (var_extension, v_t); + + // Backlink executables and (generated) documentation by default. + // + gs.target_vars[exe::static_type]["*"].assign (var_backlink) = true; + gs.target_vars[doc::static_type]["*"].assign (var_backlink) = true; } // Register builtin rules. -- cgit v1.1