CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Makefile for f90 under unix (https://www.cfd-online.com/Forums/main/14136-makefile-f90-under-unix.html)

Jinwon September 22, 2007 04:02

Makefile for f90 under unix
 
I am running fortran codes on Linux/UNIX system. On Linux, the intel fortran, ifort is installed. My makefile worked well in that system. To run them on UNIX having f90, I modified the makefile as

---------------------------------------------------------- # 1. Fortran compiler FC = f90 OPTS = -O3

# 2. DEFINE DIRECTIONS SRCDIR = . OBJDIR = . PROG = main

# 5. DEFINE OBJECT FILES OBJS = \

analytic.o \

................

# 6. DEFINE OBJECT FILES DEPENDENCIES SOURCE = ${SRCDIR}/analytic.f90 ${OBJDIR}/analytic.o:$(SOURCE) ${OBJDIR}

${FC} ${OPTS} -c -module ${OBJDIR} $< -o $@ ............... ------------------------------------------------------- It does not work with this message --> don't know how to make /, (bu42).

I am pretty new to run fortran codes on UNIX. Please let me know how to run these codes on UNIX. I did it on Linux having ifort. But i could not run them on UNIX having f90.


Jinwon September 22, 2007 05:10

Re: Makefile for f90 under unix
 
I accomplished compiling of a single file even though I typed make all. Please see my makefile. --------------------------------------------------------- # 1. DEFINE COMPILER FC = f90 OPTS = -n32

# 2. DEFINE DIRECTIONS SRCDIR = . OBJDIR = . PROG = main

# 3. DEFINE OBJECT FILES OBJS = \

analytic.o \

boundary.o \

compute_flux.o \

main.o \

# 4. DEFINE OBJECT FILES DEPENDENCIES SOURCE = ${SRCDIR}/analytic.f90 ${OBJDIR}/analytic.o:$(SOURCE) ${OBJDIR}

${FC} ${OPTS} -c ${OBJDIR} $< -o $@

SOURCE = ${SRCDIR}/boundary.f90 ${OBJDIR}/boundary.o:$(SOURCE) ${OBJDIR}

${FC} ${OPTS} -c ${OBJDIR} $< -o $@

SOURCE = ${SRCDIR}/compute_flux.f90 ${OBJDIR}/compute_flux.o:$(SOURCE) ${OBJDIR}

${FC} ${OPTS} -c -module ${OBJDIR} $< -o $@

SOURCE = ${SRCDIR}/main.f90 ${OBJDIR}/main.o : $(SOURCE) ${OBJDIR}

${FC} ${OPTS} -c -module ${OBJDIR} $< -o $@

# 5. LINK OBJECT FILES (*.o) ${PROG}: ${addprefix ${OBJDIR}/, ${OBJS}}

${FC} ${OPTS} $^ -o $@

echo ${PROG} : make complete

# 6. CLEAN OBJECT FILES (*.o) and EXE

rm -r *.o

echo clean : make complete w/o error # 7. DEFINE ALL TARGET #all: ${PROG}

# END OF MAKEFILE -----------------------------------------------------------

Please help me. I have to finish a simulation in this weekend. Thanks in advance.


All times are GMT -4. The time now is 22:09.