summaryrefslogtreecommitdiffhomepage
path: root/file.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2024-06-15 14:24:14 +0200
committerRoland Reichwein <mail@reichwein.it>2024-06-15 14:24:14 +0200
commitec955eb6726b31e26d17c34474619b60f3563194 (patch)
tree3ce74889185f0b2a3a9a13d67ccf9b3812479e83 /file.cpp
parentd9e360bb95d4fced4974bb716f993c81626417cb (diff)
Automatically depend on YMakefile (rebuild if necessary), testsHEADmaster
Diffstat (limited to 'file.cpp')
-rw-r--r--file.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/file.cpp b/file.cpp
index 6211471..2284cb3 100644
--- a/file.cpp
+++ b/file.cpp
@@ -14,9 +14,9 @@ using namespace std::string_literals;
const fs::path YMakefile{"YMakefile"};
// type of file can be built from dependencies
-bool is_buildable_by_extension(const fs::path& p) {
+bool is_buildable_by_name(const fs::path& p) {
fs::path ext{p.extension()};
- return ext.empty() || ext == ".o" || is_dynamic_lib(p) || is_dynamic_lib_link(p) || is_static_lib(p) ;
+ return (ext.empty() || ext == ".o" || is_dynamic_lib(p) || is_dynamic_lib_link(p) || is_static_lib(p)) && p.filename() != YMakefile;
}
namespace {
@@ -48,6 +48,16 @@ bool is_dynamic_lib_link(const std::filesystem::path& p)
return name.find(".so") != name.npos && std::count(name.begin(), name.end(), '.') < 4;
}
+bool is_lib(const std::filesystem::path& p)
+{
+ return is_dynamic_lib(p) || is_static_lib(p) || is_dynamic_lib_link(p) || is_external_lib(p);
+}
+
+bool is_linkable(const std::filesystem::path& p)
+{
+ return is_lib(p) || p.extension() == ".o";
+}
+
// in: libxyz.so.1.2.3
// out: libxyz.so.1
std::filesystem::path soname_shorter(const std::filesystem::path& p)
@@ -119,7 +129,7 @@ bool is_static_lib(const std::filesystem::path& p)
bool is_external_lib(const std::filesystem::path& p)
{
- return !(is_static_lib(p) || is_dynamic_lib(p) || is_dynamic_lib_link(p));
+ return !(is_static_lib(p) || is_dynamic_lib(p) || is_dynamic_lib_link(p)) && p.filename() != YMakefile;
}
std::filesystem::path simplified_path(const std::filesystem::path& p)