diff options
Diffstat (limited to 'Builder.cpp')
-rw-r--r-- | Builder.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Builder.cpp b/Builder.cpp index 69ecf48..d64ba27 100644 --- a/Builder.cpp +++ b/Builder.cpp @@ -326,6 +326,13 @@ std::unordered_map<fs::path, std::vector<fs::path>> Builder::get_dependencies(co } } + // add dependencies to YMakefiles + for (auto& i: dependencies) { + if (is_buildable_by_name(i.first) && fs::exists(i.first.parent_path() / YMakefile)) { + i.second.push_back(i.first.parent_path() / YMakefile); + } + } + return dependencies; } @@ -339,7 +346,9 @@ void Builder::build_file(const fs::path& p) { command = _lang.getCompileCommand(p, source_file, target_from_object(p), include_paths_of_object(p)); } else { // link - std::vector<fs::path> objects{dependencies_of(p)}; + std::vector<fs::path> deps{dependencies_of(p)}; + std::vector<fs::path> objects; + std::copy_if(deps.begin(), deps.end(), std::back_inserter(objects), is_linkable); std::vector<fs::path> link_libs{link_libs_of(p)}; command = _lang.getLinkCommand(p, objects, link_libs); } @@ -438,7 +447,7 @@ std::unordered_set<fs::path> Builder::get_buildlist(std::function<bool(const fs: container.push(i); } - if (outdated_pred(current) && is_buildable_by_extension(current)) { + if (outdated_pred(current) && is_buildable_by_name(current)) { result.insert(current); } } @@ -467,7 +476,7 @@ void Builder::clean() { std::unordered_set<fs::path> add; for (const auto& i: cleanlist) { std::vector<fs::path> deps{dependencies_of(i)}; - std::copy(deps.begin(), deps.end(), std::inserter(add, add.begin())); + std::copy_if(deps.begin(), deps.end(), std::inserter(add, add.begin()), is_buildable_by_name); } std::copy(add.begin(), add.end(), std::inserter(cleanlist, cleanlist.begin())); |