How to synthesize line breaks in GNU Make warnings or errors?

When using the uilt-in functions $(error text) and $(warning text) GNU Make, how can I get line breaks in error / warning output without acrobatics

By acrobatics, I mean ridiculous methods such as these two:

 $(warning $(shell /bin/echo -e "something\nfoo\nbar\nbaz")) $(warning $(shell /bin/bash -c 'echo -e "something\nfoo\nbar\nbaz"')) 

which, by the way, did not work for me with GNU Make 3.81 on Ubuntu 10.04.

Justification: I want to make the error output in the conditional parts ( ifeq , ifneq ) of my GNUmakefile more readable.


The current workaround for me is to use for each line:

 $(warning ...) 

and finally for the last line:

 $(error ...) 
+6
source share
1 answer

Define a line break variable with define / endef and use it as $ n as follows:

 define n endef $(warning "something$nfoo$nbar$nbaz") 

Note the two blank lines between define and endef

+13
source

Source: https://habr.com/ru/post/947061/


All Articles