Use:
@echo ""; echo "Compiling..."
The first echo
echoes a newline; the second echoes the message.
Pergunta
How can I print a newline in a makefile?
For instance, if I have a target:
printIt:
@echo "Compiling..."
How could I print out
Compiling...
I had read somewhere that you can define one. But I have tried what is mentioned here:
define \n
endef
printit:
@echo "${\n}Compiling..."
But this doesn't print the newline. I have also tried a c++ style "\n".
I'm using GNU Make 3.81
.
Solução
Use:
@echo ""; echo "Compiling..."
The first echo
echoes a newline; the second echoes the message.
Outras dicas
In some implementations of echo
eg. Bash, you can use echo -e
to interpret escape characters. Use
printIt:
@echo -e "\nCompiling..."