From 939295f95a2553d6da443f9aa79024a130f15e96 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Mon, 8 Jul 2019 04:29:05 +0200 Subject: [PATCH] Experimental fix to remove unrequired dependencies. --- build.zsh.in | 14 ++++++++++++-- build/ofile.zsh | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/build.zsh.in b/build.zsh.in index 207ba50..6d144d0 100644 --- a/build.zsh.in +++ b/build.zsh.in @@ -174,10 +174,20 @@ function duplicated { function dirdep { dirname="$(dirname "$1")" + local sources=(${(@s/ /)2}) + local depends=(${(@s/ /)3}) - if [[ "$dirname" != "." ]]; then - echo "$dirname" + for dep in ${sources[@]} ${depends[@]}; do + if [[ "$(dirname $dep)" == "$dirname" ]]; then + return 0 + fi + done + + if [[ "$dirname" == "." ]]; then + return 0 fi + + echo "$dirname" } for dir in "@SHAREDIR@/build.zsh" ./build; do diff --git a/build/ofile.zsh b/build/ofile.zsh index 9f02334..1136e69 100644 --- a/build/ofile.zsh +++ b/build/ofile.zsh @@ -1,7 +1,7 @@ function ofile.build { local dirname="$(dirname "$target")" - write -n "${target}: ${target%.o}.c $(dirdep $target)" + write -n "${target}: ${target%.o}.c $(dirdep $target "${target%.o}.c ${sources[$target]}" "${depends[@target]}")" sed '/^#include "/!d;s/^#include "//;s/"$//' "${target%.o}.c" | \ while read h; do