f



makefile from linux lahey fortran to intel visual fortran on windows

Hello!

I am new with programming in fortran and I need some help with
compiling.

I have this program that uses a makefile for linux lahey fortran, and I
want to make the program run on intel visual fortran.  The program uses
modules (which replace common blocks in fortran 77), and I don't know
how to port the makefile. The makefile for linux lahey fortran looks
like

EXECUTABLE: main.o subroutine1.o subroutine2.o module.o

lf95 -o EXECUTABLE main.o subroutine1.o subroutine2.o module.o

main.o: main.f90 module.o makefile
	lf95 -c main.f90

subroutine1.o: subroutine1.f90 module.o makefile
	lf95 -c subroutine1.f90

subroutine2.o: subroutine2.f90 module.o makefile
	lf95 -c subroutine1.f90

module.o: module.f90 makefile
	lf95 -c module.f90

I changed the .o for .obj, the -o by /o, the -c by /c, the lf95 by
ifort, name the makefile makefile.mak, and use the nmake command to
call it,
but it is not working.  as I said, I'm really new in programming.

Can somebody help me with that?

The error says:
makefile.mak(18) : fatal error U1033: syntax error : 'ifort' unexpected
Stop.
and I suspect that there will be more errors... any suggestions? maybe
I'm in the wrong track?

Thank you!

Robert

0
12/5/2005 10:09:41 PM
comp.lang.fortran 11941 articles. 1 followers. Post Follow

4 Replies
1722 Views

Similar Articles

[PageSpeed] 7

Your best bet will be to use the Visual Fortran (IDE). Since you say
visual fortran - i am assuming that you know how to start a new
project. Add all the f90 files are dependencies in the project and hit
Build.

It's been a while since i used that platform - but i think i am on the
right track. 

-Ash

0
wiredashu (16)
12/5/2005 11:39:55 PM
Hei Ash,

Thanks a lot for your answer.

I have indeed visual fortran. However, I have this version only because
it is one of the versions that can work on Windows. I would really
prefer only to work from the command line prompt with a makefile. I
have been able to compile with my makefile on a Unix machine by logging
remote, but I would like to have a version of fortran that I coud use
locally on my computer. Installing linux on my computer and then a
version of fortran for linux could be an option, and another that I am
trying now is to use intel visual fortran on Windows using the command
line prompt.

I have tried the visual interface a little and have gotten not too big
a success...

Would you have some tips on how to use a makefile to be able to use
only the command line prompt with intel visual fortran on Windows?

Thank you very much,

Robert


AM skrev:
> Your best bet will be to use the Visual Fortran (IDE). Since you say
> visual fortran - i am assuming that you know how to start a new
> project. Add all the f90 files are dependencies in the project and hit
> Build.
>
> It's been a while since i used that platform - but i think i am on the
> right track. 
> 
> -Ash

0
12/6/2005 10:03:31 AM
This is a multi-part message in MIME format.

------=_NextPart_000_00BC_01C5FA60.80CB2AD0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

bonsoir2006@hotmail.com wrote:
| Hei Ash,
|
| Thanks a lot for your answer.
|
| I have indeed visual fortran. However, I have this version only because
| it is one of the versions that can work on Windows. I would really
| prefer only to work from the command line prompt with a makefile. I
| have been able to compile with my makefile on a Unix machine by logging
| remote, but I would like to have a version of fortran that I coud use
| locally on my computer. Installing linux on my computer and then a
| version of fortran for linux could be an option, and another that I am
| trying now is to use intel visual fortran on Windows using the command
| line prompt.
|
| I have tried the visual interface a little and have gotten not too big
| a success...
|
| Would you have some tips on how to use a makefile to be able to use
| only the command line prompt with intel visual fortran on Windows?

Is it Microsoft NMAKE (the one that ships with Visual Studio) or
some other flavor? MSDN-ing... yes; U1033 is NMAKE's error message.

I attached a modified makefile which works with NMAKE. First, you had
missing tabs before build command (maybe they were erased in posting?).
Second, ifort AFAIK cannot be made to produce object files with extension
..o (not that I looked at documentation too deeply).

We use lots of make macros to achieve portability; here's an excerpt
from a bigger makefile which builds (lib)dmsapp.so/dll on
Compaq F90 on Tru64 unix, CVF on Windows and ifort on Fedora
(the latter two commented out):

# TRU64 -------------------------------------------

SEP=/
BINDIR=$(DMS_PATH)/lib

DMSAPP=libdmsapp

LINK32=ld
LINK32_FLAGS= -o
$(BINDIR)$(SEP)$(DMSAPP).$(DLL) -shared -lfor -lm -lc -lUfor -lFutil -lots

RM=rm -rf

# FEDORA ----------------------------------------------
#F90=ifort
#F90_PROJ=-c -O0 -automatic -check bounds -check
format -DTA -DLF -DPI -DMINIMAL -DSPACE_32 -I$(INTDIR) -nologo -module
$(INTDIR) -o $*.$(OBJ)

#OBJ=o
#DLL=so
#SEP=/
#BINDIR=$(SEP)usr$(SEP)share$(SEP)DMS$(SEP)bin

#DMSAPP=libdmsapp

#LINK32=ld
#LINK32_FLAGS= -o $(BINDIR)$(SEP)$(DMSAPP).$(DLL) -shared

#RM=rm -rf

# WINDOWS -------------------------------------------
#F90=f90
#F90_PROJ=/c /debug /automatic /check:bounds /check:format /DTA /DLF /DPI
/DMINIMAL /DSPACE_32 /I$(INTDIR) /nologo /module:$(INTDIR) /object:$*.$(OBJ)

#OBJ=obj
#DLL=dll
#SEP=\\
#BINDIR=..$(SEP)..$(SEP)..$(SEP)..$(SEP)bin

#DMSAPP=dmsapp

#LINK32=link
#LINK32_FLAGS= /out:$(BINDIR)$(SEP)$(DMSAPP).$(DLL) /dll

#RM=del

....
SRCDIR=..$(SEP)..$(SEP)

OBJDIR=.$(SEP)objs

INTDIR=$(OBJDIR)$(SEP)

MOD=mod

MSG_F90    = echo "Compiling Fortran ($@)"
MSG_LD     = echo "Linking ($@)..."
....
#LINK OBJS=================================
LINK32_OBJS= \
 $(INTDIR)e_enum.$(OBJ) \
 $(INTDIR)e_output.$(OBJ) \

#LINK COMMAND===============================
$(BINDIR)$(SEP)$(DMSAPP).$(DLL): $(LINK32_OBJS) $(BINDIR) $(OBJDIR)
 @ $(MSG_LD)
 @ $(LINK32) $(LINK32_FLAGS) $(LINK32_OBJS)

#BUILD RULES===============================
$(INTDIR)e_enum.$(MOD) : $(INTDIR)e_enum.$(OBJ)

$(INTDIR)e_output.$(OBJ) : $(SRCDIR)e_output.f90 $(INTDIR)m_dmsapp.$(MOD)
 @ $(MSG_F90)
 @ $(F90) $(F90_PROJ) $(SRCDIR)e_output.f90


-- 
 Jugoslav
___________
www.xeffort.com

Please reply to the newsgroup.
You can find my real e-mail on my home page above.

------=_NextPart_000_00BC_01C5FA60.80CB2AD0
Content-Type: text/plain;
	name="Makefile.mak"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="Makefile.mak"

EXECUTABLE = foo.exe

EXECUTABLE: main.obj subroutine1.obj subroutine2.obj module.obj
	link main.obj subroutine1.obj subroutine2.obj module.obj /out:$(EXECUTABLE) 

main.obj: main.f90 module.obj makefile.mak
	ifort -c main.f90

subroutine1.obj: subroutine1.f90 module.obj makefile.mak
	ifort -c subroutine1.f90 

subroutine2.obj: subroutine2.f90 module.obj makefile.mak
	ifort -c subroutine2.f90 

module.obj: module.f90 makefile.mak
	ifort -c module.f90 
------=_NextPart_000_00BC_01C5FA60.80CB2AD0
Content-Type: text/plain;
	name="module.F90"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="module.F90"

module moddie

integer:: ans = 42

end module moddie
------=_NextPart_000_00BC_01C5FA60.80CB2AD0
Content-Type: text/plain;
	name="subroutine1.F90"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="subroutine1.F90"

subroutine sub1(i)

use moddie

call sub2(i)

end subroutine
------=_NextPart_000_00BC_01C5FA60.80CB2AD0
Content-Type: text/plain;
	name="subroutine2.F90"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="subroutine2.F90"

subroutine sub2(i)

use moddie

i = ans

end subroutine sub2
------=_NextPart_000_00BC_01C5FA60.80CB2AD0
Content-Type: text/plain;
	name="main.F90"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="main.F90"

program foo

use moddie

call sub1(i)
print *, i

end program foo
------=_NextPart_000_00BC_01C5FA60.80CB2AD0--

0
jdujic (694)
12/6/2005 11:28:03 AM
bonsoir2006@hotmail.com wrote:
> Hei Ash,
> 
> Thanks a lot for your answer.
> 
> I have indeed visual fortran. However, I have this version only because
> it is one of the versions that can work on Windows. I would really
> prefer only to work from the command line prompt with a makefile. I
> have been able to compile with my makefile on a Unix machine by logging
> remote, but I would like to have a version of fortran that I coud use
> locally on my computer. Installing linux on my computer and then a
> version of fortran for linux could be an option, and another that I am
> trying now is to use intel visual fortran on Windows using the command
> line prompt.
> 
> I have tried the visual interface a little and have gotten not too big
> a success...
> 
> Would you have some tips on how to use a makefile to be able to use
> only the command line prompt with intel visual fortran on Windows?
> 
As gnu make is available in so many flavors, including mingw and cygwin, 
I don't find the choice so difficult.  Perhaps the most difficult choice 
is between .o and .obj files.  For the latter, you would need a 
..SUFFIXES rule, including .obj as well as .exe.  It gets somewhat ugly 
then, when you set up to handle both .o and .obj files.
You don't mention whether you are using a 64-bit compiler, which may 
bring in complications with the addition of /amd64 tags when building 
libraries and linking.
0
tprince (584)
12/6/2005 2:13:23 PM
Reply: