“multiple target patterns” Makefile error

后端 未结 6 1768
有刺的猬
有刺的猬 2020-11-27 15:07

My makefile fails with error:

Makefile:34: *** multiple target patterns.  Stop.

What does it really mean, how can I fix this?

(GNU

相关标签:
6条回答
  • 2020-11-27 15:40

    My IDE left a mix of spaces and tabs in my Makefile.

    Setting my Makefile to use only tabs fixed this error for me.

    0 讨论(0)
  • 2020-11-27 15:43

    I met with the same error. After struggling, I found that it was due to "Space" in the folder name.

    For example :

    Earlier My folder name was : "Qt Projects"

    Later I changed it to : "QtProjects"

    and my issue was resolved.

    Its very simple but sometimes a major issue.

    0 讨论(0)
  • 2020-11-27 15:48

    Besides having to escape colons as in the original answer, I have found if the indentation is off you could potentially get the same problem. In one makefile, I had to replace spaces with a tab and that allowed me to get past the error.

    0 讨论(0)
  • 2020-11-27 15:49

    I had this problem (colons in the target name) because I had -n in my GREP_OPTIONS environment variable. Apparently, this caused configure to generate the Makefile incorrectly.

    0 讨论(0)
  • 2020-11-27 15:55

    I had it on the Makefile

    MAPS+=reverse/db.901:550:2001.ip6.arpa 
    lastserial:  ${MAPS}
        ./updateser ${MAPS}
    

    It's because of the : in the file name. I solved this with

                          -------- notice
                         /    /
                        v    v
    MAPS+=reverse/db.901\:550\:2001.ip6.arpa
    lastserial:  ${MAPS}
        ./updateser ${MAPS}
    
    0 讨论(0)
  • 2020-11-27 15:56

    I just want to add, if you get this error because you are using Cygwin make and auto-generated files, you can fix it with the following sed,

    sed -e 's@\\\([^ ]\)@/\1@g' -e 's@[cC]:@/cygdrive/c@' -i filename.d
    

    You may need to add more characters than just space to the escape list in the first substitution but you get the idea. The concept here is that /cygdrive/c is an alias for c: that cygwin's make will recognize.

    And may as well throw in

    -e 's@^ \+@\t@'
    

    just in case you did start with spaces on accident (although I /think/ this will usually be a "missing separator" error).

    0 讨论(0)
提交回复
热议问题