So, this is probably best for the 'make' forum, except that there isn't one...I could try an e-mail to the group, but I figure I give it a try here, too.
For years, I have been working in Fortran 77 and using make files successfully to automate compilation and deployment...
...somewhere in my make files, I have a line to collect all Fortran sources that are meant to be compiled:
fsrc?=$(wildcard *.f *.F)
With Fortran 77, my common blocks were in *.inc files and "include"-ed into the *.f files, so, the common blocks were not picked up for compilation; and it was not needed, of course.
Now, I am trying to move on to Fortran 90 and use modules to collect global variables. Module files, though, need to be compiled to produce *.mod and *.o files and so, I have given them *.f90 extension. To collect them, I initially updated my line to:
fsrc?=$(wildcard *.f *.F *.f90 *.F90)
This line collects the *.f90 files (modules and other sources) in no particular order and I noticed that module sources need to be compiled first to make the corresponding *.mod and *.o available for compilation of the sources the use them...so, I thought I would add the suffix "_mod" to module files and collect them first:
fsrc?=$(wildcard *.f *.F *_mod.f90 *.f90 *.F90)
Except, that now they get collected twice, once under *_mod.f90 and again under *.f90...which then yields "multiple definition" errors.
If anybody knows gnu-make well, maybe a way to remove duplicates from my list variable fsrc would do...I just don't see how, just yet. Don't want to use sort, because that may not leave the *_mod.f90 files at the beginning of the list.
Anyway ideas on how to go about solving this logistics problem? It's been a long day and could use some new ideas.
Thanks in advance.
Germán
For years, I have been working in Fortran 77 and using make files successfully to automate compilation and deployment...
...somewhere in my make files, I have a line to collect all Fortran sources that are meant to be compiled:
fsrc?=$(wildcard *.f *.F)
With Fortran 77, my common blocks were in *.inc files and "include"-ed into the *.f files, so, the common blocks were not picked up for compilation; and it was not needed, of course.
Now, I am trying to move on to Fortran 90 and use modules to collect global variables. Module files, though, need to be compiled to produce *.mod and *.o files and so, I have given them *.f90 extension. To collect them, I initially updated my line to:
fsrc?=$(wildcard *.f *.F *.f90 *.F90)
This line collects the *.f90 files (modules and other sources) in no particular order and I noticed that module sources need to be compiled first to make the corresponding *.mod and *.o available for compilation of the sources the use them...so, I thought I would add the suffix "_mod" to module files and collect them first:
fsrc?=$(wildcard *.f *.F *_mod.f90 *.f90 *.F90)
Except, that now they get collected twice, once under *_mod.f90 and again under *.f90...which then yields "multiple definition" errors.
If anybody knows gnu-make well, maybe a way to remove duplicates from my list variable fsrc would do...I just don't see how, just yet. Don't want to use sort, because that may not leave the *_mod.f90 files at the beginning of the list.
Anyway ideas on how to go about solving this logistics problem? It's been a long day and could use some new ideas.
Thanks in advance.
Germán