Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm running Ubuntu Linux 10.04.

And I have the following in my .bashrc file:

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

I'm having a problem with autocomplete only when I type:

make Tab

For some reason it freezes and the only way to get out of that is to send a keyboard interrupt. The weird thing is I don't have any problems with autocomplete when executing any other programs...

My question is there a specific reason for this? And is there a way to specifically change the autocomplete instructions for make?

I looked at this question Autocompletion for Makefile rules in tcsh, but wasn't able to find the tcsh files anywhere on my system.

This is the result from set-x and make Tab

make + local file makef makef_dir=. makef_inc cur prev i split=false
+ COMPREPLY=()
++ _get_cword
++ '[' -n '4.1.5(1)-release' ']'
++ __get_cword4
++ local i
++ local LC_CTYPE=C
++ local 'WORDBREAKS=   
"'\''><=;|&(:'
++ WORDBREAKS='     
'\''><=;|&(:'
++ WORDBREAKS='     
><=;|&(:'
++ '[' -n '' ']'
++ local 'cur=make '
++ local 'tmp=make '
+++ expr 'make ' : '.*[     
><=;|&(:]'
++ local word_start=5
++ '[' 5 -ge 2 ']'
++ local char=e
++ '[' e '!=' '\' ']'
++ break
++ cur=
++ printf %s ''
+ cur=
+ prev=make
+ _split_longopt
+ [[ '' == --?*=* ]]
+ return 1
+ case $prev in
+ false
+ [[ '' == -* ]]
+ (( i=0 ))
+ (( i < 2 ))
+ [[ make == -C ]]
+ (( i++  ))
+ (( i < 2 ))
+ [[ '' == -C ]]
+ (( i++  ))
+ (( i < 2 ))
+ (( i=0 ))
+ (( i < 2 ))
+ [[ make == -f ]]
+ (( i++  ))
+ (( i < 2 ))
+ [[ '' == -f ]]
+ (( i++  ))
+ (( i < 2 ))
+ '[' -n '' ']'
+ '[' -n . ']'
+ makef_dir='-C .'
+ COMPREPLY=($( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null      |              awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/     \
            {split($1,A,/ /);for(i in A)print A[i]}' )"             --     "$cur" ))
+++ make -qp -C .
+++ awk -F: '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
        {split($1,A,/ /);for(i in A)print A[i]}'
share|improve this question
1  
what shell are you using? if you don't know run echo $SHELL –  strugee Jul 12 '13 at 2:23
    
Bash allows for command-specific completion (that's what /etc/bash_completion sets up). It looks like there's something wrong with your rules for make (which might be stored in /etc/bash_completion.d/make; I'm not sure about Ubuntu). –  cjm Jul 12 '13 at 5:56
    
Does this happen even in a directory where there is no Makefile? Run set -x in a bash window, then try a completion for make, and copy-paste what appears in the shell window. –  Gilles Jul 12 '13 at 23:09
    
echo $SHELL says /bin/bash @Gilles It's pretty long, should I paste it in my question instead? Or just dump it here in the comments? –  ishikun Jul 16 '13 at 2:58
    
@ishikun Edit your question, or if it's really too long, put it up on pastebin. –  Gilles Jul 16 '13 at 10:18
show 1 more comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.