aboutsummaryrefslogtreecommitdiff
path: root/build/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-05-22 15:23:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-05-22 15:23:54 +0200
commit2b0b06cbf4288746075a74c12ef233efc929a095 (patch)
tree6fec848d888a56f718c2eaa13fba0b8a93a00d40 /build/target.cxx
parente7688fc3efaa79b3236b9a3775ef1a0ffaeed1b1 (diff)
Avoid relying on static initialization order
Diffstat (limited to 'build/target.cxx')
-rw-r--r--build/target.cxx30
1 files changed, 14 insertions, 16 deletions
diff --git a/build/target.cxx b/build/target.cxx
index 164a13f..3810092 100644
--- a/build/target.cxx
+++ b/build/target.cxx
@@ -72,15 +72,6 @@ namespace build
return os << target_key {&t.type (), &t.dir, &t.name, &t.ext};
}
- static target*
- search_target (const prerequisite_key& pk)
- {
- // The default behavior is to look for an existing target in the
- // prerequisite's directory scope.
- //
- return search_existing_target (pk);
- }
-
// target_set
//
target_set targets;
@@ -284,10 +275,19 @@ namespace build
return path_mtime (path_);
}
- // file target
+ // Search functions.
//
- static target*
+ target*
+ search_target (const prerequisite_key& pk)
+ {
+ // The default behavior is to look for an existing target in the
+ // prerequisite's directory scope.
+ //
+ return search_existing_target (pk);
+ }
+
+ target*
search_file (const prerequisite_key& pk)
{
// First see if there is an existing target.
@@ -308,8 +308,6 @@ namespace build
return nullptr;
}
- // dir target
- //
static target*
search_alias (const prerequisite_key& pk)
{
@@ -343,7 +341,7 @@ namespace build
"mtime_target",
&target::static_type,
nullptr,
- target::static_type.search
+ &search_target
};
const target_type path_target::static_type
@@ -352,7 +350,7 @@ namespace build
"path_target",
&mtime_target::static_type,
nullptr,
- mtime_target::static_type.search
+ &search_target
};
const target_type file::static_type
@@ -379,6 +377,6 @@ namespace build
"fsdir",
&target::static_type,
&target_factory<fsdir>,
- target::static_type.search
+ &search_target
};
}