Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] include Makefile relative from the current working directory
- X-seq: zsh-workers 42521
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: SATOH Fumiyasu <fumiyas@xxxxxxxxxxxxx>
- Subject: Re: [PATCH] include Makefile relative from the current working directory
- Date: Sat, 24 Mar 2018 14:31:16 +0100
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1521899930; bh=1ItfjPwDTcdKnjyua6QK3x0mqyL/fC88r6WTM2DOJtA=; h=From:References:To:Subject:Date:From:Subject; b=H+rhZ3Wc65ExGaCFmr94SMdag3dwOAxB8zHkAoOypTlz6oZNmx1TD8LhoJwfxoOs+2hy6HKZtcA2QixysrZkHjdBTnYjTNrtXX+0qnkYmWCx9PpsdPHKoHetEAmgTlw3jjdBbgunYbylILwY1OsYWuqg+bXLU6FEOcqpLxE8WPE76BtbiGK9xeWRs5+uCoJ69LeaAFl1lF9XG6VqyO8eWwhkBPUlaIKJ+uNOBPdcyuJzUt//usCUuSL0Dc7GBUz2W08JG4bsUdOqUDsA2DneB1MzMpEdqDbLZTd7mrnmEKW5mgnvqslP3Yff/EhdnMwcITLAb3TQvoVNya5tCqtg7g==
- In-reply-to: <87wp2eobmf.wl-fumiyas@osstech.co.jp>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <87wp2eobmf.wl-fumiyas@osstech.co.jp>
On 25 Nov, SATOH Fumiyasu wrote:
> I've confirmed that GNU make, BSD make, Solaris 10 make and
> AIX 7.2 make include Makefile relative from the current
> working directory.
Sorry for taking so long to review this and reply. I can confirm the
make behaviour and the patch looks good.
There's also further superfluous code in _make, there to keep
track of the location of the current Makefile location. This can also be
removed so I'll apply the following expanded patch.
Oliver
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 890ad1c83..c4548f9a5 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -69,7 +69,7 @@ _make-expandVars() {
}
_make-parseMakefile () {
- local input var val target dep TAB=$'\t' dir=$1 tmp IFS=
+ local input var val target dep TAB=$'\t' tmp IFS=
while read input
do
@@ -108,14 +108,10 @@ _make-parseMakefile () {
f=${f%[\">]}
fi
f=$(_make-expandVars $f)
- case $f in
- (/*) ;;
- (*) f=$dir/$f ;;
- esac
if [[ -r $f ]]
then
- _make-parseMakefile ${f%%/[^/]##} < $f
+ _make-parseMakefile < $f
fi
;;
esac
@@ -150,7 +146,7 @@ _make-findBasedir () {
_make() {
- local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match
+ local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match
local context state state_descr line
local -a option_specs
local -A VARIABLES VAR_ARGS opt_args
@@ -266,16 +262,16 @@ _make() {
if [[ $is_gnu == gnu ]]
then
if zstyle -t ":completion:${curcontext}:targets" call-command; then
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+ _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
else
- _make-parseMakefile $PWD < $file
+ _make-parseMakefile < $file
fi
else
if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then
TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
+ _make-parseMakefile < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
else
- _make-parseMakefile $PWD < $file
+ _make-parseMakefile < $file
fi
fi
fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author