Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] Converting existing gfortran code to Eclipse project

The auto makefile seems to work for Hello World but quickly need a real makefile under your control.

Create a new fortran makefile project.

There is lots of info on makefiles on the internet, link below, here is a simple one I’m using to get you started.

Advanced makefiles have variables and get more powerful/cryptic.

You can raise the bar and use cmake to generate a makefile too.

***There must be a real <tab> to indent not spaces for make to work

I’m using gfortran in Cygwin with Windows 7 and Eclipse PTP Photran.

 

makefile:

# test.exe is compiled and linked from one.f90 and two.f90

all: test

 

test: one.o two.o

     gfortran one.o two.o -o test

 

one.o: one.f90

     gfortran -fcheck=all -Wall -g -c one.f90

 

two.o: two.f90

     gfortran -fcheck=all -Wall -g -c two.f90

 

clean:

     rm *.o *.mod

 

RTFM:

               https://www.gnu.org/software/make/manual/make.html

 

 

From: photran-bounces@xxxxxxxxxxx [mailto:photran-bounces@xxxxxxxxxxx] On Behalf Of Simon Woodward
Sent: Monday, December 11, 2017 7:11 PM
To: photran@xxxxxxxxxxx
Subject: EXTERNAL: [photran] Converting existing gfortran code to Eclipse project

 

Hi photran users

 

I have a small f90 project that is compiled using the following bat file:

:compile

gfortran -x f95-cpp-input -Dweathergen -O3 -c -fdefault-real-8 model\parameters_site.f90 model\parameters_plant.f90 model\environment.f90 model\resources.f90 model\soil.f90 model\plant.f90 model\set_params.f90 model\BASGRA.f90

:link

gfortran -shared -o BASGRA_WG.DLL parameters_site.o parameters_plant.o environment.o resources.o soil.o plant.o set_params.o BASGRA.o

:clean

del *.o

del *.mod

pause

 

I would like to use Eclipse to work on this DLL (or if there is a better option, please suggest it). I have created a Fortran project, and can see the source code files in the IDE. But how do I set up the build/compilation/makefile within Eclipse? There is some kind of autogenerated makefile but it doesn’t work.

 

Thanks

 

Simon Woodward

Senior Scientist (Mathematical Modelling)

DairyNZ

Cnr Ruakura & Morrinsville Roads | Newstead | Private Bag 3221| Hamilton 3240 | NEW ZEALAND

Ph +64 7 858 3750 | DDI +64 7 858 3787 | Fax +64 7 858 3751

Web www.dairynz.co.nz | www.GoDairy.co.nz | www.getfresh.co.nz

 

 


Back to the top