"multiple target patterns" Makefile error

Viewed 145653

My makefile fails with error:

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

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

(GNU make manual, written by Captain Obvious, isn't helping).


Found it. I had rule in form:

$(FOO): bar

where FOO was set from shell command that polluted it with error message that contained a colon.

8 Answers

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

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

I also got this error (within the Eclipse-based STM32CubeIDE on Windows).

After double-clicking on the "multiple target patterns" error it showed a path to a .ld file. It turns out to be another "illegal character" problem. The offending character was the (wait for it): =

Heuristic of the week: use only [a..z] in your paths, as there are bound to be other illegal characters </vomit>.

The GNU make manual doesn't explicitly document this.

I got the same error and my issue was an extra whitespace and a backslash at the end of listing source files:

SRCS := ft_striteri.c \
        ft_putchar_fd.c \
        ft_putstr_fd.c \
        ft_putendl_fd.c \
        ft_putnbr_fd.c \
BONUS_SRCS :=   ft_lstadd_back.c \
                ft_lstadd_front.c \
                ft_lstlast.c \
                ft_lstnew.c \
                ft_lstsize.c

The correct version that works looks like this:

SRCS := ft_striteri.c \
        ft_putchar_fd.c \
        ft_putstr_fd.c \
        ft_putendl_fd.c \
        ft_putnbr_fd.c
BONUS_SRCS :=   ft_lstadd_back.c \
                ft_lstadd_front.c \
                ft_lstlast.c \
                ft_lstnew.c \
                ft_lstsize.c
Related