×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# 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.

#### Resources

White Paper - Strategies to Secure Connected Cars with Firewalls
White-hat hackers have demonstrated gaining remote access to dashboard functions and transmissions of connected vehicles. That makes a firewall a vital component of a multilayered approach to vehicle security as well as overall vehicle safety and reliability. Learn strategies to secure with firewalls. Download Now
White Paper - Model Based Engineering for Wire Harness Manufacturing
As complexity rises, current harness manufacturing methods are struggling to keep pace due to manual data exchanges and the inability to capture tribal knowledge. A model-based wire harness manufacturing engineering flow automates data exchange and captures tribal knowledge through design rules to help harness manufacturers improve harness quality and boost efficiency. Download Now
White Paper - What is Generative Design and Why Do You Need It?
Engineers are being asked to produce more sophisticated designs under a perfect storm of complexity, cost, and change management pressures. Generative design empowers automotive design teams to navigate this storm by employing automation, data re-use and synchronization, and framing design in the context of a full vehicle platform. Download Now
eBook - Simulation-Driven Design with SOLIDWORKS
Simulation-driven design can reduce the time and cost of product development. In this engineering.com eBook, weâ€™ll explore how SOLIDWORKS users can access simulation-driven design through the SOLIDWORKS Simulation suite of analysis tools. 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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!