使用makefile编译Fortran源文件
我有几个需要编译的fortran源文件并将其链接在一起以形成EXE计算代码。软件包中还有一个makefile.dos
,但我不知道如何使用它来编译fortran文件。
我尝试使用
ifort /O3 /QxHost /Qparallel /Qdiag-disable:warn *.for
app.exe
成功创建的app.exe
将源文件与Intel Parallel Studio一起编译,但似乎尚未正确编译计时器例程。因为当我执行代码时,进程的时机未记录在输出文件中。我猜与Makefile一起编译可能会解决问题。
然后,我尝试在makefile的帮助下编译Fortran文件:
nmake /f makefile.dos FPP=ifort LINK32=386link
这次我收到以下错误:
nmake:致命错误U1073:不知道如何制作'app.obj'
我在做什么错?我的操作系统是Windows 10 LTSC。
这是makefile的内容(在代码包中,有这些项目在下面的“ srcs”变量的前面列出):
FC = f77l3
LINKER = 386link
PROGRAM = APP.exe
DEST = APP
EXTHDRS =
FFLAGS =
HDRS =
LDFLAGS =
LDMAP = nul
LIBS =
MAKEFILE = Makefile
OBJS = APP.OBJ TIMING.OBJ READDA.OBJ APPDL.OBJ PRELUD.OBJ \
FIL1.OBJ FIL2.OBJ FILE3.OBJ FIL4.OBJ FIL5.OBJ \
FIL6.OBJ FIL7.OBJ FIL8.OBJ FIL9.OBJ \
FIL11.OBJ FIL12.OBJ FIL13.OBJ \
FIL14.OBJ FIL15.OBJ FIL16.OBJ
SRCS = APP.FOR TIMING.FOR READDA.FOR APPDL.FOR PRELUD.FOR \
FIL1.FOR FIL2.FOR FIL3.FOR FIL4.FOR FIL5.FOR \
FIL6.FOR FIL7.FOR FIL8.FOR FIL9.FOR \
FIL11.FOR FIL12.FOR FIL13.FOR \
FIL14.FOR FIL15.FOR FIL16.FOR
STUB = -stub runb
$(PROGRAM): $(OBJS) $(LIBS)
$(LINKER) $(OBJS) $(STUB) -EXE $@ -LIB $(LIBS) $(LDFLAGS)
APP: $(objects)
$(FC) -o $@ $(objects)
I have several Fortran source files that need to be compiled and link together to form an exe computational code. There is also a makefile.dos
in the package but I don't know how to use it to compile the Fortran files.
I tried to compile source files with Intel parallel studio without using the makefile, with
ifort /O3 /QxHost /Qparallel /Qdiag-disable:warn *.for
The APP.exe
created successfully but it seems that the timer routine has not been compiled properly. Because when I execute the code, the timing of processes are not recorded in the output file. I guess compiling with the makefile may resolve the issue.
Then I tried to compile the Fortran Files with the help of the makefile by:
nmake /f makefile.dos FPP=ifort LINK32=386link
This time I got the following error:
NMAKE : fatal error U1073: don't know how to make 'app.OBJ'
What am I doing wrong? My OS is WINDOWS 10 LTSC.
Here is the content of the makefile (In the code package there are those items that are listed in front of "SRCS" variable below):
FC = f77l3
LINKER = 386link
PROGRAM = APP.exe
DEST = APP
EXTHDRS =
FFLAGS =
HDRS =
LDFLAGS =
LDMAP = nul
LIBS =
MAKEFILE = Makefile
OBJS = APP.OBJ TIMING.OBJ READDA.OBJ APPDL.OBJ PRELUD.OBJ \
FIL1.OBJ FIL2.OBJ FILE3.OBJ FIL4.OBJ FIL5.OBJ \
FIL6.OBJ FIL7.OBJ FIL8.OBJ FIL9.OBJ \
FIL11.OBJ FIL12.OBJ FIL13.OBJ \
FIL14.OBJ FIL15.OBJ FIL16.OBJ
SRCS = APP.FOR TIMING.FOR READDA.FOR APPDL.FOR PRELUD.FOR \
FIL1.FOR FIL2.FOR FIL3.FOR FIL4.FOR FIL5.FOR \
FIL6.FOR FIL7.FOR FIL8.FOR FIL9.FOR \
FIL11.FOR FIL12.FOR FIL13.FOR \
FIL14.FOR FIL15.FOR FIL16.FOR
STUB = -stub runb
$(PROGRAM): $(OBJS) $(LIBS)
$(LINKER) $(OBJS) $(STUB) -EXE $@ -LIB $(LIBS) $(LDFLAGS)
APP: $(objects)
$(FC) -o $@ $(objects)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论