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