Description of problem: Bash completion is not well configured for Makefiles. How reproducible: go to some directory with "Makefile" file. Try to write make and the completion list is based on files, not on Makefile entries.
Works fine for me, for example in the prepared bash-completion development dir. Need (much) more details and exact reproducer to be able to say more.
I am using PostgreSQL source directory [pavel@nemesis postgresql]$ pwd /home/pavel/src/postgresql [pavel@nemesis postgresql]$ ls aclocal.m4 config.log configure contrib doc GNUmakefile HISTORY README src config config.status configure.in COPYRIGHT finitdb_log GNUmakefile.in Makefile README.git tmp_install [pavel@nemesis postgresql]$ make config.status GNUmakefile src/ [pavel@nemesis postgresql]$ make expected: all check install installdirs installcheck installcheck-parallel ... I tested another source - bash - and it doesn't work too. My installation is fresh Fedora 24.
Works for me on F24 and prepared bash source dir. For some reason producing the completions takes a long time the first time, but the expected ones eventually appear, and it's quick afterwards. Still need more info, see Troubleshooting in bash-completion's README.md, and post the generated output somewhere for examination.
Created attachment 1176081 [details] trace log trace log for auto complete in PostgreSQL src directory
I found some example of using _make_target_extract_script It doesn't work on my comp sed -nrf <(_make_target_extract_script --) Makefile sed -nrf <(_make_target_extract_script --) Makefile + sed -nrf /dev/fd/63 Makefile _make_target_extract_script -- ++ _make_target_extract_script -- ++ local mode=-- ++ shift ++ local prefix= +++ command sed 's/[][\,.*^$(){}?+|/]/\\&/g' +++ sed 's/[][\,.*^$(){}?+|/]/\\&/g' ++ local prefix_pat= ++ local basename= ++ local dirname_len=0 ++ [[ -- == -d ]] ++ local 'output=\1\2' ++ cat ++ [[ -z '' ]] ++ cat sed: file /dev/fd/63 line 22: invalid reference \2 on `s' command's RHS
(In reply to Pavel Stehule from comment #5) > It doesn't work on my comp > > sed -nrf <(_make_target_extract_script --) Makefile That's most likely because of the "r" in -nrf. I don't know where you got it, we don't call "sed -nrf" but "sed -nf". (I haven't looked at your trace yet.)
(In reply to Ville Skyttä from comment #6) > (In reply to Pavel Stehule from comment #5) > > It doesn't work on my comp > > > > sed -nrf <(_make_target_extract_script --) Makefile > > That's most likely because of the "r" in -nrf. I don't know where you got > it, we don't call "sed -nrf" but "sed -nf". > > (I haven't looked at your trace yet.) It returns nothing
Reproduced with the PostgreSQL build dir also on F-23, moving discussion to upstream at https://github.com/scop/bash-completion/issues/53
Closing as WONTFIX per upstream resolution wrt PostgreSQL dir. If you find other Makefiles for which completion doesn't work, feel free to file new bugs (preferably upstream), one per case.