I am trying to combine two Fortran projects using gFortran. But one project is written using f90 with free form and another one using .for with fixed 132 line length form. Can I set up the different line length according to Fortran file type in one project as below?
-ffixed-line-length-132 for .for -ffree-line-length-none for .f90
Thank you
Yes, you can. I was not sure so I just went ahead and tried it.
gfortran -ffixed-line-length-1000 -ffree-line-length-1000 longline.for longline.f90
compiled two files with very long lines without any problem.
The same happened for 132
for the former and none
for the latter, but it correctly complained when I exceeded 132 for the fixed form file.
Anyway, be aware that you can always compile your files in separate steps and use different flags in each of these steps:
gfortran -ffixed-line-length-132 longline.for -o longline-fixed.o
gfortran -ffree-line-length-1000 longline-fixed.o longline.f90
For large projects it is typical to use some build system that organizes the compilation into these steps automatically (make, CMake, SConstruct, FoBiS.py,...).