[mpas-developers] Makefile changes in trunk
Michael Duda
duda at ucar.edu
Thu Jun 3 15:41:06 MDT 2010
Hi, All.
I'd like to propose replacing the line
#EXPAND_LEVELS = -DEXPAND_LEVELS=26
in the top-level Makefile with the following
ifeq ($(CORE),hyd_atmos)
EXPAND_LEVELS = -DEXPAND_LEVELS=26
endif
This change should eliminate the need to either comment or
uncomment the EXPAND_LEVELS line, depending on whether one is
building the sw, ocean, or hyd_atmos cores. I've tested this
change under Linux, Mac OS, and AIX, and it appears that the
versions of make that I used on all systems accept the 'ifeq'
statement.
If anyone else would volunteer to give this change a try (with any
core on any system), that would be great. I've attached an updated
Makefile if that would help, too.
Cheers,
Michael
-------------- next part --------------
#MODEL_FORMULATION = -DNCAR_FORMULATION
MODEL_FORMULATION = -DLANL_FORMULATION
ifeq ($(CORE),hyd_atmos)
EXPAND_LEVELS = -DEXPAND_LEVELS=26
endif
FILE_OFFSET = -DOFFSET64BIT
#########################
# Section for Zoltan TPL
#########################
ifdef ZOLTAN_HOME
ZOLTAN_DEFINE = -DHAVE_ZOLTAN
endif
#########################
dummy:
@( echo "try one of:"; \
echo " make xlf"; \
echo " make pgi"; \
echo " make ifort"; \
echo " make gfortran"; \
)
xlf:
( make all \
"FC = mpxlf90" \
"CC = mpcc" \
"SFC = xlf90" \
"SCC = xlc" \
"FFLAGS = -qrealsize=8 -g -C " \
"CFLAGS = -g" \
"LDFLAGS = -g -C" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
ftn:
( make all \
"FC = ftn" \
"CC = cc" \
"SFC = ftn" \
"SCC = cc" \
"FFLAGS = -i4 -r8 -gopt -O2 -Mvect=nosse -Kieee" \
"CFLAGS = -fast" \
"LDFLAGS = " \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
pgi:
( make all \
"FC = mpif90" \
"CC = mpicc" \
"SFC = pgf90" \
"SCC = pgcc" \
"FFLAGS = -r8 -O3" \
"CFLAGS = -O3" \
"LDFLAGS = -O3" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
pgi-llnl:
( make all \
"FC = mpipgf90" \
"CC = pgcc" \
"SFC = pgf90" \
"SCC = pgcc" \
"FFLAGS = -i4 -r8 -g -O2" \
"CFLAGS = -fast" \
"LDFLAGS = " \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
pgi-serial:
( make all \
"FC = pgf90" \
"CC = pgcc" \
"SFC = pgf90" \
"SCC = pgcc" \
"FFLAGS = -r8 -O0 -g -Mbounds -Mchkptr" \
"CFLAGS = -O0 -g" \
"LDFLAGS = -O0 -g -Mbounds -Mchkptr" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
ifort:
( make all \
"FC = mpif90" \
"CC = gcc" \
"SFC = ifort" \
"SCC = gcc" \
"FFLAGS = -real-size 64 -O3" \
"CFLAGS = -O3 -m64" \
"LDFLAGS = -O3" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI -DUNDERSCORE -m64 $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
gfortran:
( make all \
"FC = mpif90" \
"CC = mpicc" \
"SFC = gfortran" \
"SCC = gcc" \
"FFLAGS = -O3 -m64 -ffree-line-length-none -fdefault-real-8" \
"CFLAGS = -O3 -m64" \
"LDFLAGS = -O3 -m64" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI -DUNDERSCORE -m64 $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
g95:
( make all \
"FC = mpif90" \
"CC = mpicc" \
"SFC = g95" \
"SCC = gcc" \
"FFLAGS = -O3 -ffree-line-length-huge -r8" \
"CFLAGS = -O3" \
"LDFLAGS = -O3" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -D_MPI -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
g95-serial:
( make all \
"FC = g95" \
"CC = gcc" \
"SFC = g95" \
"SCC = gcc" \
"FFLAGS = -O3 -ffree-line-length-huge -r8" \
"CFLAGS = -O3" \
"LDFLAGS = -O3" \
"CORE = $(CORE)" \
"CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) $(EXPAND_LEVELS) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
CPPINCLUDES = -I../inc -I$(NETCDF)/include
FCINCLUDES = -I../inc -I$(NETCDF)/include
LIBS = -L$(NETCDF)/lib -lnetcdf
RM = rm -f
CPP = cpp -C -P -traditional
RANLIB = ranlib
#########################
# Section for Zoltan TPL
#########################
ifdef ZOLTAN_HOME
ifdef ZOLTAN_INC_PATH
FCINCLUDES += -I$(ZOLTAN_INC_PATH)
else
FCINCLUDES += -I$(ZOLTAN_HOME)/include
endif
ifdef ZOLTAN_LIB_PATH
LIBS += -L$(ZOLTAN_LIB_PATH) -lzoltan
else
LIBS += -L$(ZOLTAN_HOME)/lib -lzoltan
endif
endif
#########################
ifdef CORE
all: mpas_main
mpas_main:
cd src; make FC="$(FC)" \
CC="$(CC)" \
CFLAGS="$(CFLAGS)" \
FFLAGS="$(FFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
RM="$(RM)" \
CPP="$(CPP)" \
CPPFLAGS="$(CPPFLAGS)" \
LIBS="$(LIBS)" \
CPPINCLUDES="$(CPPINCLUDES)" \
FCINCLUDES="$(FCINCLUDES)" \
CORE="$(CORE)"
if [ ! -e $(CORE)_model.exe ]; then ln -s src/$(CORE)_model.exe .; fi
clean:
cd src; make clean RM="$(RM)" CORE="$(CORE)"
$(RM) $(CORE)_model.exe
else
all: errmsg
clean: errmsg
errmsg:
@echo "************ ERROR ************"
@echo "No CORE specified. Quitting."
@echo "************ ERROR ************"
endif
More information about the mpas-developers
mailing list