1 (edited by davidb 2014-06-14 10:49:28)

Topic: Clean and modules

Would it be possible for "Clean" in the build menu to remove *.mod files from the project directory when they have the same name as a *.mod file in the "modules" sub-directory.

Although SF puts its *.mod files in the "modules" sub-directory, I have found that if there are .mod files in the project directory gfortran will try to use these first before looking in the "modules" sub-directory. This is probably a quirk of the search path that gfortran uses. Even though you have used -Jmodules it still looks in the project directory first. You can test this by putting an empty .mod file in the project directory.

I sometimes have *.mod files in my project directory because I sometimes compile my source code using other compilers (yes naughty). But then the *.mod files I generate prevents SF from building my project (since they are not GNU ones). Since "Clean" doesn't help, I have to remove these by hand currently.

An alternative would be to fix -Jmodules in the makefile (replace with -Imodules ?) so that the project directory isn't searched. I seem to recall -J was deprecated as some point, but I am not sure. I have been using -Imodules here in other work, unrelated to SF.

--
David

Re: Clean and modules

David,

It would be possible to do this, but I'd prefer to shy away from having Simply Fortran "manage" files (your .mod files in this case) that it isn't normally involved with.  A better alternative might be to allow custom Makefile commands that could be added to a build step so that you can add "del *.mod" to your Clean step but still keep the automatic Makefile building.

The -J flag is not deprecated.  It is needed by the Fortran compiler to tell it where to place modules that it compiles.  The -I flag only specifies a location to search for modules as opposed to the location where compiled modules should be placed. 

In your case, one thing you could do is allow Simply Fortran to place its modules in the project directory as well.  If you open Project Options and go to the File Locations tab, you can leave "Module Directory" blank, and all modules should be left in the project directory.

Jeff Armstrong
Approximatrix, LLC