How do I get make to print out newlines with returned shell data? I'm learning make by modifying a makefile. Having newline come out as newlines would be nice.

# simple trial makefile
$(warning Making where CURDIR is $(CURDIR))
$(warning  $(shell ls -l $(CURDIR)))

I've seen a hint here. How to synthesize line breaks in GNU Make warnings or errors?

GNU Make 3.82

Robert

有帮助吗?

解决方案

You cannot do this. The shell documentation clearly says that all newlines will be converted into spaces. You cannot avoid this.

You could run a command and redirect the output to stderr, instead of stdout, so that it doesn't get captured by the $(shell ...) function:

$(warning Making where CURDIR is $(CURDIR))
$(shell ls -l $(CURDIR) 1>&2)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top