문제

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