Вопрос

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