Search code examples
bashmakefilegnu-makebash-completion

.RECIPEPREFIX confuses autocompletion for Makefille targets


without .RECIPEPREFIX:

the Makefile:

t1:
    ls

t2:
    ls

gmake completion works well:

gmake [tab][tab]
Makefile  t1        t2        

with .RECIPEPREFIX

the Makefile:

.RECIPEPREFIX = >

t1:
> ls

t2:
> ls

it doesn't seem to work any, the second target t2 doesn't show up:

gmake [tab][tab]
Makefile  t1        

Question

I wonder if it's due to my setup or bash-completion, or Make

My bash-completion version:

bash-completion: stable 1.3 (bottled)

My make version:

gmake --version
GNU Make 4.3
Built for x86_64-apple-darwin19.2.0

Solution

  • with help from scop, I updated to bash-completion@2

    brew install bash-completion@2
    

    and changed my login bash to 5 as bash-completition@2 needs bash version to be ≥ 4 (following instruction on https://unix.stackexchange.com/a/196059/145789),

    sudo chsh -s /usr/local/bin/bash [username]
    

    and it works now.