In order to solve some integrals i downloaded QUADPACK for fortran and compiled all the source files in to object files. Now when I want to call subroutines from QUADPACK I need to link them manually or use a makefile/script and this works just fine. However since I am using multiple routines from QUADPACK and for a range of different programs it would make my life alot easier if I could get gfortran to automatically look for the .o files. Say I have a directory where all the .o files are contained I would like to add that as a standard path for gfortran to look for object files. So that I can call a subroutine in my program and just compile it without having to find out witch .o files I need and link them manually.
I understand that the -l flag will solve the problem, but I want to know if there is an easier/lazy way to do it. I was thinking maybe I can make some changes to the compiler and remake it, but that is not really something I want to start to mess with.
I am using Ubuntu by the way. Hope you guys understand my problem and that there is an easy solution.
PS: This is the way I do it now, in order to call one routine.
#!/bin/sh
gfortran -c int.f95
gfortran -o int int.o qagie.o qelg.o qk15i.o qpsrt.o r1mach.o xermsg.o j4save.o
xerprn.o xersve.o xerhlt.o xercnt.o fdump.o xgetua.o i1mach.o
./int
As you can see it it is just a simple shell script to compile and run int.f95
You could create a library and add your object files to it. Then pass that library (i.e., -l) to gfortran when you use gfortran as the linker. It will pull out just the object files that it needs. Later, if you change one source code file that contributed an object file to the library, you can replace just that one in the library. There is plenty of info on the web about how to do this.