Home > Archive > Fortran > February 2005 > Compile with modules
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Compile with modules
|
|
| Magnus Olsson 2005-02-24, 3:59 pm |
| I try to port a Unix (SUN7) program written in Fortran and C, and I
have never use Fortran before (they say that I only have to change in
the Makefile). Previous version are ported, but the new version are
using modules and I don't now how to make it working. The makefile use
–M to give the module path to the compiler, but I Linux it is not
correct. The compiler also say that it don't faint distv.o. I can of
cause write a target for that but is it any simpler way.
The makefile in Unix look like this:
INCDIR= $(P7DIR)/include/polka
MODDIR= $(P7DIR)/lib/$(CPU)
BUMSLIB=$(BUMSHOME)/bin/bums.a
P7LIBS= $(P7DIR)/lib/$(CPU)/libcm1.a \
$(P7DIR)/lib/$(CPU)/libth.a \
$(P7DIR)/lib/$(CPU)/libsimula.a \
$(P7DIR)/lib/$(CPU)/libphysics.a \
$(P7DIR)/lib/$(CPU)/libaux.a \
$(P7DIR)/lib/$(CPU)/libccc.a \
$(P7DIR)/lib/$(CPU)/libmatfun.a
EXEDIR = ../bin
F90FLAGS = -g -I$(INCDIR) –M$(MODLIB)
CFLAGS = -g
all: distv
distv: $(EXEDIR)/distv
$(EXEDIR)/distv: distv.o
$(F90C) $(F90FLAGS) -o $@ distv.o $(P7LIBS)
clean:
rm -f $(EXEDIR)/distv
rm -f distv.o
| |
| Paul Van Delst 2005-02-24, 4:00 pm |
| Magnus Olsson wrote:
> I try to port a Unix (SUN7) program written in Fortran and C, and I
> have never use Fortran before (they say that I only have to change in
> the Makefile). Previous version are ported, but the new version are
> using modules and I don't now how to make it working. The makefile use
> –M to give the module path to the compiler, but I Linux it is not
> correct.
The Sun compiler (at least the ones I dealt with) requires use of the "-M" switch to point
to the .mod files whereas ever other compiler I've used (SGI, IBM, Linux
pgf90/Intel/lf95/g95) happily accepts "-I" -- the same switch used for regular old include
files.) All the other compilers I list above also accept other switches for "including"
..mod files (e.g -module for pgf90 and ifort), but those switches also specify where to
*save* any created .mod files. It's an annoying "feature" of the Sun compiler not to
accept -I for .mod files.
So if you change
F90FLAGS = -g -I$(INCDIR) –M$(MODLIB)
to
F90FLAGS = -g -I$(INCDIR) –I$(MODLIB)
that problem should be averted
> The compiler also say that it don't faint distv.o.
I don't know what you mean by this. Did you mean "find"; as in the compiler couldn't find
distv.o? Is the default suffix rule, for whatever suffix the distv source file has, defined?
cheers,
paulv
> I can of
> cause write a target for that but is it any simpler way.
> The makefile in Unix look like this:
>
> INCDIR= $(P7DIR)/include/polka
> MODDIR= $(P7DIR)/lib/$(CPU)
> BUMSLIB=$(BUMSHOME)/bin/bums.a
>
> P7LIBS= $(P7DIR)/lib/$(CPU)/libcm1.a \
> $(P7DIR)/lib/$(CPU)/libth.a \
> $(P7DIR)/lib/$(CPU)/libsimula.a \
> $(P7DIR)/lib/$(CPU)/libphysics.a \
> $(P7DIR)/lib/$(CPU)/libaux.a \
> $(P7DIR)/lib/$(CPU)/libccc.a \
> $(P7DIR)/lib/$(CPU)/libmatfun.a
>
> EXEDIR = ../bin
>
> F90FLAGS = -g -I$(INCDIR) –M$(MODLIB)
> CFLAGS = -g
>
> all: distv
>
> distv: $(EXEDIR)/distv
> $(EXEDIR)/distv: distv.o
> $(F90C) $(F90FLAGS) -o $@ distv.o $(P7LIBS)
>
> clean:
> rm -f $(EXEDIR)/distv
> rm -f distv.o
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
|
|
|
|
|