linux 屏幕输出中空行的 Makefile 语法
linux Makefile syntax for blank lines in screen output
我有这个生成文件:
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
之间创建一个 space。
理想情况下,我希望屏幕上的输出在第一个 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: ECHO $(TARGET)
效果很好,唯一与您输入的不同的是 ECHO 的语法:我将其放在 makefile 的底部。它允许我 space 完全按照我想要的方式输出屏幕输出。
ECHO:
@echo
@echo "Makefile written for compiler version ${COMPILER_VERSION}"
@echo
我有这个生成文件:
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
之间创建一个 space。
理想情况下,我希望屏幕上的输出在第一个 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: ECHO $(TARGET)
效果很好,唯一与您输入的不同的是 ECHO 的语法:我将其放在 makefile 的底部。它允许我 space 完全按照我想要的方式输出屏幕输出。
ECHO:
@echo
@echo "Makefile written for compiler version ${COMPILER_VERSION}"
@echo