Usually, when I write a collection of Fortran functions, I put them into a MODULE like this:
!mystuff.f90
MODULE mymodule
IMPLICIT NONE
CONTAINS
SUBROUTINE mysubroutine1(a,b)
!code
END SUBROUTINE
SUBROUTINE mysubroutine2(a,b)
!code
END SUBROUTINE
!lots more functions and subroutines
END MODULE
and I successfully compile it like this gfortran -c mystuff.f90. This creates mystuff.o which I can use in my main program.
However, the number and individual sizes of functions/subroutines in my MODULE have become so huge, that I really need to split up this up into different files.
!mysubrtn1.f90
SUBROUTINE mysubroutine1(a,b)
!code
END SUBROUTINE
and
! mysubrtn2.f90
SUBROUTINE mysubroutine2(a,b)
!code
END SUBROUTINE
and so forth...
But I'd still like to keep all these functions inside a single MODULE. How can I tell the compiler to compile the functions in mysubrtn1.f90, mysubrtn2.f90, ... such that it produces a single module in a .o file?