aboutsummaryrefslogtreecommitdiff
path: root/build2/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-16 17:22:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-16 17:22:28 +0200
commit75152526696fc024628796f0633ed695d5ebc49c (patch)
treefaeef54a6b4d7e9a816b8d541500c48484e4ed39 /build2/target
parentcc12ed4245a2b61f4c4eb2a970398c920fbc1d37 (diff)
Move exe{} to build2 core, add fallback extensions (existing files)
Diffstat (limited to 'build2/target')
-rw-r--r--build2/target27
1 files changed, 20 insertions, 7 deletions
diff --git a/build2/target b/build2/target
index f824689..5c897f1 100644
--- a/build2/target
+++ b/build2/target
@@ -425,7 +425,7 @@ namespace build2
// By default we go an extra step and short-circuit to the target state
// even if the raw state is not group provided the recipe is group_recipe.
// This is normally what you want or need, as in inject_prerequisites()
- // in the cxx module. But sometimes not, as in execute().
+ // in the cc module. But sometimes not, as in execute().
//
target_state
state (bool shortcircuit = true) const
@@ -1140,10 +1140,11 @@ namespace build2
derive_path (path_type base, const char* default_ext = nullptr);
// As above but only derives (and returns) the extension (empty means no
- // extension used).
+ // extension used). If search is true then look for the extension as if
+ // it was a prerequisite, not a target.
//
const string&
- derive_extension (const char* default_ext = nullptr);
+ derive_extension (const char* default_ext = nullptr, bool search = false);
public:
static const target_type static_type;
@@ -1215,6 +1216,18 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
+ // Executable file.
+ //
+ class exe: public file
+ {
+ public:
+ using file::file;
+
+ public:
+ static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
+ };
+
class buildfile: public file
{
public:
@@ -1311,24 +1324,24 @@ namespace build2
//
template <const char* ext>
const string*
- target_extension_fix (const target_key&, scope&);
+ target_extension_fix (const target_key&, scope&, bool);
// Get the extension from the variable or use the default if none set. If
// the default is NULL, then return NULL.
//
template <const char* var, const char* def>
const string*
- target_extension_var (const target_key&, scope&);
+ target_extension_var (const target_key&, scope&, bool);
// Always return NULL extension.
//
const string*
- target_extension_null (const target_key&, scope&);
+ target_extension_null (const target_key&, scope&, bool);
// Assert if called.
//
const string*
- target_extension_assert (const target_key&, scope&);
+ target_extension_assert (const target_key&, scope&, bool);
// Target print functions.
//