Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the `shell` command in Make remove newlines?

Tags:

makefile

According to the Make documentation here: http://www.ecoop.net/coop/translated/GNUMake3.77/make_8.html#SEC80

The only processing make does on the result, before substituting it into the surrounding text, is to convert each newline or carriage-return / newline pair to a single space. It also removes the trailing (carriage-return and) newline, if it's the last thing in the result.

Why does Make do this processing at all?

Without a recursive wildcard command, having the ability to return a delimited list from find would sure be nice.

like image 581
hatch Avatar asked Apr 22 '15 04:04

hatch


1 Answers

When you use the variable, the value of the variable is substituted. Make docs ( like "define" in C ).

The new lines would cause havoc on make's ability to parse.

It is possible to have new lines in a variable though: Another question

I imagine it's just because "no new lines" is the used most case. You might be able to use other shell commands to replace those new lines with something else before make tried to replace them.

like image 199
Carl Avatar answered Nov 15 '22 12:11

Carl