I have a program I am trying to create a make file for. I must admit I am a novice with both fortran compiling and make files. I need to call the fortran compiler from one directory, ROOT, while the source files are in another directory, SOURCE. This is a necessity for other things with the program. I can get it to work if I move the make file into the SOURCE directory but that isnt what I need. The issue seems to be that the compilation code links to a non-standard .a library file which is in the same SOURCE directory. I cant seem to find a way to get it to find the correct library. While this is partially about make files, really its just an issue with the compile command itself. The rest of the make file is irrelevant and works fine.
Here is an example of the code I am using. Again, this is from ROOT
ifort -O3 -o main SOURCE/main.f90 SOURCE/foo.f90 SOURCE/bar.f90 -fopenmp -L. -lcfitsio
I am then greeted with the error:
ld: cannot find -lcfitsio
I dont really understand what the commands at the end are doing, which makes it hard to try and fix that error. I think -fopenmp is linking to the openmp library, which seems to be a general one. I am not sure what -L. is doing. -lcfitsio is the library I am trying to link to, which I think is in the file SOURCE/libcfitsio.a, and the compiler clearly cannot find it. Do you know how to point it to the right place?