How does one activate tab completion in Zsh when using a makefile that includes additional makefiles?

Viewed 23

GNU Make 4.3+

OS: Mac

With the following added to the .zshrc file, I am able to generate auto completions for make at the target level for aMakefile (or 'makefile') containing rules in that literal file.

zstyle ':completion:*:*:make:*' tag-order 'targets'
autoload -U compinit && compinit

However, when I group the commands into subfiles and include them via the include *.mk mechanic, zsh no longer generates the correct auto-completion statement. Only the targets defined in the top level makefile are output.


The exact file structure:

├── install-brew
├── install-oh-my-zsh
├── install-pathogen
├── makefile
├── mk
│   ├── get.mk
│   ├── notes.mk
│   ├── setup.mk
    ...

And makefile:

include mk/*.mk

foo:
  echo foo

bar:
  echo bar

> make [tab] produces:

> make foo
foo bar

And make get-brew:

if [ -z `command -v brew` ]; then ./install-brew; else echo "brew detected: `command -v brew`" >&2; fi

(so the makefile is working)


How does one configure zsh to generate the full user-defined target list from a makefile even when that make file includes supporting make files?

0 Answers
Related