aboutsummaryrefslogtreecommitdiff
path: root/build/bin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-01 13:39:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-01 13:42:10 +0200
commit7996c2bfc2d7e998e2f9f1236d457ec7bea8ad8a (patch)
treedca79d3657bec47d4cd5db85899a70d3d49c079e /build/bin
parentf355a4379f035df61a7702f5ff805eefb004fb20 (diff)
Implement support for definition target type aliases
For example: define cli=file Currently, the semantics is that of a real alias with only name differences that are used for display. See tests/define/buildfile for more use cases.
Diffstat (limited to 'build/bin')
-rw-r--r--build/bin/target14
-rw-r--r--build/bin/target.cxx41
2 files changed, 31 insertions, 24 deletions
diff --git a/build/bin/target b/build/bin/target
index 729f119..cbabcaf 100644
--- a/build/bin/target
+++ b/build/bin/target
@@ -19,8 +19,8 @@ namespace build
using file::file;
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
class objso: public file
@@ -29,8 +29,8 @@ namespace build
using file::file;
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
class obj: public target
@@ -42,8 +42,8 @@ namespace build
objso* so {nullptr};
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
class exe: public file
@@ -52,8 +52,8 @@ namespace build
using file::file;
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
// The lib{} target group.
@@ -64,8 +64,8 @@ namespace build
using file::file;
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
class libso: public file
@@ -74,8 +74,8 @@ namespace build
using file::file;
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
class lib: public target
@@ -90,8 +90,8 @@ namespace build
reset (action_type);
public:
- virtual const target_type& type () const {return static_type;}
static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
};
}
}
diff --git a/build/bin/target.cxx b/build/bin/target.cxx
index 5a1bb92..c2c5e05 100644
--- a/build/bin/target.cxx
+++ b/build/bin/target.cxx
@@ -11,10 +11,10 @@ namespace build
namespace bin
{
static target*
- obja_factory (dir_path d, std::string n, const std::string* e)
+ obja_factory (const target_type&, dir_path d, string n, const string* e)
{
obj* o (targets.find<obj> (d, n));
- obja* a (new obja (std::move (d), std::move (n), e));
+ obja* a (new obja (move (d), move (n), e));
if ((a->group = o))
o->a = a;
@@ -30,14 +30,15 @@ namespace build
&obja_factory,
nullptr,
&search_target, // Note: not _file(); don't look for an existing file.
- false
+ false,
+ nullptr
};
static target*
- objso_factory (dir_path d, std::string n, const std::string* e)
+ objso_factory (const target_type&, dir_path d, string n, const string* e)
{
obj* o (targets.find<obj> (d, n));
- objso* so (new objso (std::move (d), std::move (n), e));
+ objso* so (new objso (move (d), move (n), e));
if ((so->group = o))
o->so = so;
@@ -53,11 +54,12 @@ namespace build
&objso_factory,
nullptr,
&search_target, // Note: not _file(); don't look for an existing file.
- false
+ false,
+ nullptr
};
static target*
- obj_factory (dir_path d, string n, const string* e)
+ obj_factory (const target_type&, dir_path d, string n, const string* e)
{
obja* a (targets.find<obja> (d, n));
objso* so (targets.find<objso> (d, n));
@@ -80,7 +82,8 @@ namespace build
&obj_factory,
nullptr,
&search_target,
- false
+ false,
+ nullptr
};
const target_type exe::static_type
@@ -91,14 +94,15 @@ namespace build
&target_factory<exe>,
nullptr,
&search_file,
- false
+ false,
+ nullptr
};
static target*
- liba_factory (dir_path d, std::string n, const std::string* e)
+ liba_factory (const target_type&, dir_path d, string n, const string* e)
{
lib* l (targets.find<lib> (d, n));
- liba* a (new liba (std::move (d), std::move (n), e));
+ liba* a (new liba (move (d), move (n), e));
if ((a->group = l))
l->a = a;
@@ -127,14 +131,15 @@ namespace build
&liba_factory,
&target_extension_fix<a_ext>,
&search_file,
- false
+ false,
+ nullptr
};
static target*
- libso_factory (dir_path d, std::string n, const std::string* e)
+ libso_factory (const target_type&, dir_path d, string n, const string* e)
{
lib* l (targets.find<lib> (d, n));
- libso* so (new libso (std::move (d), std::move (n), e));
+ libso* so (new libso (move (d), move (n), e));
if ((so->group = l))
l->so = so;
@@ -151,7 +156,8 @@ namespace build
&libso_factory,
&target_extension_fix<so_ext>,
&search_file,
- false
+ false,
+ nullptr
};
// lib
@@ -164,7 +170,7 @@ namespace build
}
static target*
- lib_factory (dir_path d, string n, const string* e)
+ lib_factory (const target_type&, dir_path d, string n, const string* e)
{
liba* a (targets.find<liba> (d, n));
libso* so (targets.find<libso> (d, n));
@@ -187,7 +193,8 @@ namespace build
&lib_factory,
nullptr,
&search_target,
- false
+ false,
+ nullptr
};
}
}