aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-10-21 10:59:09 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-10-21 10:59:09 +1300
commit39ef159bc64ac2ba590fce49f52da53f4115c715 (patch)
treef3156afa086aa5baeffa54d9a0ab40590ac6a7c7 /bash/bash_completion.d
parentAdd missing linebreak (diff)
downloaddotfiles-39ef159bc64ac2ba590fce49f52da53f4115c715.tar.gz
dotfiles-39ef159bc64ac2ba590fce49f52da53f4115c715.zip
Observe POSIX spec for looking for Makefile name
Diffstat (limited to 'bash/bash_completion.d')
-rw-r--r--bash/bash_completion.d/make.bash11
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