about summary refs log tree commit diff
path: root/Completion/Unix/Command/_make
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-10-16 16:34:26 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-10-18 01:39:45 +0000
commitecc0a5ece2b3bbccdfb005c59508cec7473b9b06 (patch)
tree27314419442ba3b7a59cb220531d703ec45fd5eb /Completion/Unix/Command/_make
parentae3b675ce6e4ac62451ea08169c2b4dc45cf533b (diff)
downloadzsh-ecc0a5ece2b3bbccdfb005c59508cec7473b9b06.tar.gz
zsh-ecc0a5ece2b3bbccdfb005c59508cec7473b9b06.tar.xz
zsh-ecc0a5ece2b3bbccdfb005c59508cec7473b9b06.zip
39654: (based on patch by Baptiste Daroussin) Better support bmake, FreeBSD's default make(1) implementation.
Don't pass gmake options to bmake.

Add bmake-speciic codepath for completing targets and parsing the makefile.
Diffstat (limited to 'Completion/Unix/Command/_make')
-rw-r--r--Completion/Unix/Command/_make19
1 files changed, 11 insertions, 8 deletions
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index d10c8eece..35a892cc4 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -263,17 +263,20 @@ _make() {
 
     if [[ -n "$file" ]]
     then
-      if [[ $is_gnu == gnu ]] && zstyle -t ":completion:${curcontext}:targets" call-command
+      if [[ $is_gnu == gnu ]] 
       then
-        _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+        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)
+        else
+          _make-parseMakefile $PWD < $file
+        fi
       else
-        case "$OSTYPE" in
-          freebsd*)
-          _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp -f "$file" .PHONY 2> /dev/null)
-    ;;
-    *)
+        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)
+        else
           _make-parseMakefile $PWD < $file
-        esac
+        fi
       fi
     fi