0
votes

Co-targets (i.e. a list of whitespace-separated words for the target), is a well-known feature of Make, which basically allows for a makefile to assemble "similar" targets (i.e. they share the same recipe and prerequisites) into a single rule.

So, I have a makefile, like:

define targets
foo
bar
baz
endef

$(targets) ::
    @echo '$@'



Executing, I get:

/bin/sh: 1: Syntax error: Unterminated quoted string
makefile:8: recipe for target 'foo
bar
baz' failed
make: *** [foo
bar
baz] Error 2



Really?

1

1 Answers

1
votes
targets := foo bar baz

$(targets) ::
    @echo '$@'

define is used to create a variable that contains newlines. This is not what you want, you just want whitespaces.