在makefile文件中打印换行符有问题

问题描述 投票:2回答:2

如何在makefile中打印换行符?

例如,如果我有目标:

printIt:
        @echo "Compiling..."

我如何打印出

Compiling...

我读过某个地方,您可以定义一个。但是我已经尝试了所提到的here

define \n

endef



printit:
        @echo "${\n}Compiling..."

但是这不会打印换行符。我也尝试了c ++样式“ \ n”。我正在使用GNU Make 3.81

makefile gnu-make
2个回答
3
投票

用途:

@echo ""; echo "Compiling..."

第一个echo回显换行符;第二个回显该消息。


0
投票

echo的某些实现中,例如Bash,您可以使用echo -e解释转义字符。使用

printIt:
        @echo -e "\nCompiling..."
© www.soinside.com 2019 - 2024. All rights reserved.