質問

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