I have a target like this:
curly:
curl --header "Content-Type: application/json" --data \
'data line 1 \
data line 2' \
${URL}
It's important that the two data lines echo separately to make it easier for the user of the Makefile to see what's going on.
This works nicely. But then I wanted to add a second target. I don't want to duplicate the data so hoped to define a macro and use it in both targets:
DATA = data line 1 \
data line 2
curlier:
curl --header "Content-Type: application/json" --data \
'${DATA}' \
${URL2}
This doesn't work as well. The command executes correctly, but the data lines are run together when the recipe is echoed.
I tried the trick of defining a newline macro and embedding it in the DATA string, to no avail.
I can get clean output by invoking make recusively, but my reviewer doesn't like that.
Any other suggestions?