Getting started on bluevistaExample
last update:
11/11/2006
This example of a makefile shows how to set macros for the compiler, compiler options, and libraries to be used for compilation. It shows how to denote files that depend on other files (for example, the executable depends on the successful compilation of an object file before the libraries are linked in). Then a choice of compilation "targets" is set up, such as whether to build the executable or to clean out all the previous executables and object files. Finally, the rules for compiling files with different extensions and languages are given.
Once a makefile has been set up, it not only makes it easier to compile by just typing "make," or "make clean," but it keeps track of whether or not source files have been changed, and only recompiles those.
#Makefile
#
#Wei Huang
#April 11, 2006
####################################################
LN = ln -sf
MAKE = make -i -r
RM = /bin/rm -f
MV = /bin/mv -f
CP = /bin/cp -f
AR = ar ru
M4 = m4 -B12000
RANLIB = echo
.SUFFIXES: .F90 .o .f .c
####################################################
CC = mpcc_r
CFLAGS = -I/usr/local/hpmtoolkit/dist_3.1.0/pwr5_aix5/include -I. -pg -DDM_PARALLEL -DIBM
#CFLAGS = -I/usr/local/ihpct/include -I. -pg -DDM_PARALLEL -DIBM
#CC = cc
#CFLAGS = -DIBM -I/usr/local/ihpct/include -I. -pg
FC = mpxlf90_r
FFLAGS = -I. -w -qsmp=omp -O4 -qfree=f90 -qipa -pg
#FFLAGS = -I. -w -O4 -qfree=f90 -qipa -pg
#FC = xlf90
#FFLAGS = -I. -w -O0 -qfree=f90 -pg
CPP = cpp -C -P
#CPPFLAGS = -I/usr/local/ihpct/include -I. -DDM_PARALLEL
CPPFLAGS = -I/usr/local/hpmtoolkit/dist_3.1.0/pwr5_aix5/include -I. -DDM_PARALLEL
#CPPFLAGS = -I.
LOC_LIBS = -L/usr/local/hpmtoolkit/dist_3.1.0/pwr5_aix5/lib -lhpm -lpmapi -lm
RANLIB = ranlib
####################################################
OBJS = redirect.o \
perform.o \
get_grid_info.o
F_OBJS = index.o \
fox.o
###########################################################################
deflt: fox.exe
fox.exe: $(OBJS) $(F_OBJS)
$(FC) -o $@ $(FFLAGS) $(OBJS) $(F_OBJS) $(LOC_LIBS)
###########################################################################
# Dependencies
$(OBJS):
fox.o: index.o
###########################################################################
.PHONY: clean
clean:
/bin/rm -rf core *.o *.a *.f *.exe *.mod std.* *.err *.out gmon.*
####################################################
#There is probably no reason to modify these rules
.F90.o:
$(RM) $*.o $*.f
$(CPP) $(CPPFLAGS) $*.F90 > $*.f
$(FC) -c $(FFLAGS) $*.f
.F90.f:
$(RM) $*.f
$(CPP) $(CPPFLAGS) $*.F90 > $*.f
.f.o:
$(RM) $*.o
$(FC) -c $(FFLAGS) $*.f
.c.o:
$(RM) $@
$(CC) -c $(CFLAGS) $*.c
If you have questions about this document, please contact SCD Customer Support. You can also reach us by telephone 24 hours a day, seven days a week at 303-497-1278. Additional contact methods: consult1@ucar.edu and during business hours in NCAR Mesa Lab Suite 39.
© Copyright 2006. University Corporation for Atmospheric Research (UCAR). All Rights Reserved.
Address of this page: http://www.scd.ucar.edu/docs/bluevista/examples/Makefile.html