How to write makefile if use IMSL library
How to write makefile if use IMSL library
(OP)
Hi,
I am going to run my fortran code in a server and I need to write a makefile. Now in my fortran, I invoke the subroutine in IMSL.
So how do I write the makefile? or how to define the IMSL subroutine in makefile?
Thanks,
mapi
I am going to run my fortran code in a server and I need to write a makefile. Now in my fortran, I invoke the subroutine in IMSL.
So how do I write the makefile? or how to define the IMSL subroutine in makefile?
Thanks,
mapi
RE: How to write makefile if use IMSL library
1) What do you want the makefile to do? Do you want it to compile and link your fortran program or do you want it to run the program as well?
2) Is this a Unix or Windows system? The way in which you link libraries is different for Unix/Linux and Windows.
3) Which Fortran compiler are you using.
4) Is IMSL a library?
RE: How to write makefile if use IMSL library
1) I want the makefile to link the Fortran program and run them in a server (not my PC).
2) My computer is a Windows system. The server is a Linux system and I am using SSH.
3) I write my Fortran program in F77 format and I think in the makefile I use: g77.
4) IMSL is a libraly that provides many subroutines for user to call.
Thanks.
RE: How to write makefile if use IMSL library
RE: How to write makefile if use IMSL library
RE: How to write makefile if use IMSL library
I prefer to use 'cygwin', a free F77 compiler that you can put onto a PC. Tried some fancier programs, better GUI, hated them, so I went back to the basics.
For instance, my makefile is
.f:
g77 $< -static -lm -o $*
I use the command 'make xxx.f' to compile xxx.f into an object and creates an executable at the same time, xxx.exe
So back to the original question--I am going to assume that this IMSL library is someplace you can look at the folder. The file names are *.f or *.o or what?
RE: How to write makefile if use IMSL library
Is it true?
RE: How to write makefile if use IMSL library
1) The program source
2) The IMSL source
Assume the IMSL source is not available but the IMSL library and headers are.
Does the program source live on the Linux server or the Windows PC? If it lives on the Linux server, does the Linux server have access to the Windows PC's file system through Samba? If it doesn't, the files have to be ftp'd to the server.
Assuming the IMSL headers live in /opt/IMSL/include and the library lives in /opt/IMSL/lib and the library is called libIMSL.a or libIMSL.so the rule will look something like
.f.o:
g77 -c -I/opt/IMSL/include $<
This will create a .o from a .f. This rule appears first. Next comes the target. Say your program is aiamasal and the program source in main.f
aiamasal: main.o
g77 -o $@ $? -L/opt/IMSL/lib -lIMSL
-L tells it where to look for the library -l tells it the library name without the lib, .a or .so. This wil create the executable on Linux. You can run it on Linux but not on your Windows PC.
RE: How to write makefile if use IMSL library