summaryrefslogtreecommitdiffhomepage
path: root/file.cpp
diff options
context:
space:
mode:
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)