zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] include Makefile relative from the current working directory
@ 2017-11-25 10:59 SATOH Fumiyasu
  2018-03-24 13:31 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: SATOH Fumiyasu @ 2017-11-25 10:59 UTC (permalink / raw)
  To: zsh-workers

Don't include Makefile relative from the current Makefile.

I've confirmed that GNU make, BSD make, Solaris 10 make and
AIX 7.2 make include Makefile relative from the current
working directory.
---
 Completion/Unix/Command/_make | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 890ad1c83..66b7e13b1 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -108,10 +108,6 @@ _make-parseMakefile () {
         f=${f%[\">]}
       fi
       f=$(_make-expandVars $f)
-      case $f in
-        (/*) ;;
-        (*) f=$dir/$f ;;
-      esac
 
       if [[ -r $f ]]
       then
-- 
2.15.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] include Makefile relative from the current working directory
  2017-11-25 10:59 [PATCH] include Makefile relative from the current working directory SATOH Fumiyasu
@ 2018-03-24 13:31 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2018-03-24 13:31 UTC (permalink / raw)
  To: SATOH Fumiyasu; +Cc: zsh-workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-24 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-25 10:59 [PATCH] include Makefile relative from the current working directory SATOH Fumiyasu
2018-03-24 13:31 ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).