×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to write makefile if use IMSL library

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

RE: How to write makefile if use IMSL library

Need to know a few things first

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

(OP)
Hi,

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

It's been a few years since I've used IMSL. Do you have access to the Fortran source or just the object files?

RE: How to write makefile if use IMSL library

(OP)
Do you mean the IMSL source/object file?

RE: How to write makefile if use IMSL library

Confusion...I call 'source' any file you can read, ASCII text. To me that's source. You compile the 'source' code to get object files (assembly language, that is). You then compile the object files with the result an application or 'executable' file.

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

(OP)
I don't have access to these source in the server. But I hear that the source is in default in some location/directory. And if we include these directory with the IMSL lib, we may run the IMSL with no problem. Otherwishe in my current case, the subroutine from IMSL lib is not recognized and said to be undefined.
Is it true?

RE: How to write makefile if use IMSL library

There are two sources that seem to be referred to in this thread

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

(OP)
Thanks a lot. I will try.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close