summaryrefslogtreecommitdiffhomepage
path: root/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'file.cpp')
-rw-r--r--file.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/file.cpp b/file.cpp
index 6de8b07..31695e5 100644
--- a/file.cpp
+++ b/file.cpp
@@ -16,7 +16,7 @@ const fs::path YMakefile{"YMakefile"};
// type of file can be built from dependencies
bool is_buildable_by_extension(const fs::path& p) {
fs::path ext{p.extension()};
- return ext.empty() || ext == ".o" || is_dynamic_lib(p) || is_static_lib(p) ;
+ return ext.empty() || ext == ".o" || is_dynamic_lib(p) || is_dynamic_lib_link(p) || is_static_lib(p) ;
}
namespace {
@@ -29,6 +29,11 @@ bool is_compile_unit_source_by_extension(const fs::path& p) {
return compile_unit_source_types.find(ext) != compile_unit_source_types.end();
}
+bool is_executable_target(const std::filesystem::path& p)
+{
+ return p.extension().empty();
+}
+
// e.g. libxyz.so.1.2.3 (the shorter versions are links to this one)
bool is_dynamic_lib(const std::filesystem::path& p)
{
@@ -36,6 +41,13 @@ bool is_dynamic_lib(const std::filesystem::path& p)
return name.find(".so.") != name.npos && std::count(name.begin(), name.end(), '.') == 4;
}
+// e.g. libxyz.so.1 libxyz.so
+bool is_dynamic_lib_link(const std::filesystem::path& p)
+{
+ std::string name{p.filename()};
+ return name.find(".so") != name.npos && std::count(name.begin(), name.end(), '.') < 4;
+}
+
// in: libxyz.so.1.2.3
// out: libxyz.so.1
std::filesystem::path soname_shorter(const std::filesystem::path& p)
@@ -95,7 +107,7 @@ std::filesystem::path simplified_path(const std::filesystem::path& p)
return p;
}
-bool is_executable(const std::string& file) {
+bool is_executable_command(const std::string& file) {
std::vector<std::string> paths {Reichwein::Stringhelper::split(env_value("PATH"), ":")};
for (const auto& i: paths) {