diff options
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bash_completion.d/make.bash | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bash/bash_completion.d/make.bash b/bash/bash_completion.d/make.bash index c157bdc1..67c577f3 100644 --- a/bash/bash_completion.d/make.bash +++ b/bash/bash_completion.d/make.bash @@ -1,8 +1,13 @@ # Completion setup for Make, completing targets _make() { - # Bail if no legible Makefile - [[ -r Makefile ]] || return 1 + # Find a legible Makefile according to the POSIX spec (look for "makefile" + # first, then "Makefile"). You may want to add "GNU-makefile" after this. + local mf + for mf in makefile Makefile '' ; do + [[ -f $mf ]] && break + done + [[ -n $mf ]] || return 1 # Iterate through the Makefile, line by line while IFS= read -r line ; do @@ -40,6 +45,6 @@ _make() { done ;; esac - done < Makefile + done < "$mf" } complete -F _make -o default make |