屏幕输出中空行的linux Makefile语法

标签 linux makefile screen

我有这个生成文件:

SHELL=/bin/bash

COMPILER_VERSION = "Intel 64 Compiler 16.0.0.109 Build 20150815"

SOURCES = \
ron1.f    \
ron2.f   \
ron3.f \
ron4.f

OBJECTS = $(SOURCES:.f=.o)

TARGET = mylib.a

FC = gfortran
FFLAGS = -O3

linux: $(TARGET)
    @echo
    @echo "   " \
    ar r $(TARGET) $(OBJECTS)
    @echo
    @echo "   " \
    ranlib $(TARGET)
    @echo

$(TARGET): $(OBJECTS)

$(OBJECTS):$(SOURCES)

cleanall:
    @echo
    rm -f $(OBJECTS) $(TARGET)
    @echo
clean:
    @echo
    rm -f $(OBJECTS)
    @echo

.f.o:
    @echo "   " \
    $(FC) -c $(FFLAGS) $*.f

结果如下:

prompt> make cleanall

rm -f ron1.o ron2.o ron3.o ron4.o mylib.a

prompt> make 
    gfortran -c -O3 ron1.f
    gfortran -c -O3 ron2.f
    gfortran -c -O3 ron3.f
    gfortran -c -O3 ron4.f

    ar r mylib.a ron1.o ron2.o ron3.o ron4.o

    ranlib mylib.a

prompt>

我想要做的是在“prompt> make”和 gfortran 的第一次发生之间创建一个空间。

理想情况下,我希望屏幕上的输出在第一个 gfortran 发生之前首先打印出我的 COMPILER_VERSION 变量的内容,这样输出看起来像

prompt> make

    makefile written for: Intel 64 Compiler 16.0.0.109 Build 20150815

    gfortran -c -O3 ron1.f
    gfortran -c -O3 ron2.f
    gfortran -c -O3 ron3.f
    and so on...

非常感谢任何帮助。

最佳答案

您应该向“linux”目标添加一些先决条件,例如此处的“ECHO”:

linux: ECHO $(TARGET)
     ar r $(TARGET) $(OBJECTS)
     @echo
     @echo "   " \
     ranlib $(TARGET)
     @echo

ECHO:
     @echo "\n\n\n\n Makefile written for the compiler version ${COMPILER_VERSION}"

关于屏幕输出中空行的linux Makefile语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34349299/

相关文章:

android - 谁能解释一下如何制作适合大多数设备屏幕的 Android 应用程序?我不明白文档中的任何内容

android - 在android系统上测试屏幕

linux - 在 docker 守护进程中初始化网络 Controller 时出错

linux - 创建的窗口未出现

php - 使用 php 在本地保存 url 的内容,包括图像

makefile - GNU make : inverting sub-process success?

c++ - 如何使用makefile独立编译和更新一个文件夹下的所有文件

bash - 从 makefile 到 bash 的变量

linux - 将符号链接(symbolic link)到 Linux 上的固定地址

Android 屏幕停止读取输入