Add the path of a new Fortran90 file

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
Minjie_Xu
Posts: 3
Joined: Fri Dec 15, 2017 6:07 pm
Location: Ocean University of China

Add the path of a new Fortran90 file

#1 Unread post by Minjie_Xu »

I want to add a new mod.F90 to the ROMS. Which file do I need to add the path of this mod.F90 to?
If I change the suffix .F90 to .F, the program can be compiled successfully

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Add the path of a new Fortran90 file

#2 Unread post by kate »

The makefile has rules for going from .F files to .f90 files to compile them into .o files. You would have to add rules for .F90 files if you refuse to rename your file.

Minjie_Xu
Posts: 3
Joined: Fri Dec 15, 2017 6:07 pm
Location: Ocean University of China

Re: Add the path of a new Fortran90 file

#3 Unread post by Minjie_Xu »

Thanks for your help!
What rules do I need to add to makefile? Is it added in lines 181-195?
Image

Minjie_Xu
Posts: 3
Joined: Fri Dec 15, 2017 6:07 pm
Location: Ocean University of China

Re: Add the path of a new Fortran90 file

#4 Unread post by Minjie_Xu »

Thanks for your help!
What rules do I need to add to makefile? Is it added in lines 181-195?
kate wrote: Wed Jul 01, 2020 5:01 am The makefile has rules for going from .F files to .f90 files to compile them into .o files. You would have to add rules for .F90 files if you refuse to rename your file.
Attachments
TIM截图20200701131527.jpg
TIM截图20200701131527.jpg (17.22 KiB) Viewed 2267 times

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Add the path of a new Fortran90 file

#5 Unread post by kate »

I don't think so. It instead uses:

Code: Select all

define compile-rules
  $(foreach f, $(local_src),       \
    $(call one-compile-rule,$(call source-to-object,$f), \
    $(call f90-source,$f),$f))
endef
and friends. The compile-rules function is called in the Module.mk files.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Add the path of a new Fortran90 file

#6 Unread post by kate »

If I were to overhaul this now, I would check to see if the compilers now in use can all invoke the C-preprocessor automatically for .F90 files. If so, take out the cpp step and the cpp_clean step and just have compile-time errors point to the line number of the .F90 file. I did once meet a compiler that would not invoke cpp correctly and that's why things are the way they are in the build system - but that was a long time ago.

Post Reply