| 1 |
# Copyright (c) 1998 Sandia Corporation. Under the terms of Contract |
| 2 |
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement |
| 3 |
# retains certain rights in this software. |
| 4 |
# |
| 5 |
# Redistribution and use in source and binary forms, with or without |
| 6 |
# modification, are permitted provided that the following conditions are |
| 7 |
# met: |
| 8 |
# |
| 9 |
# * Redistributions of source code must retain the above copyright |
| 10 |
# notice, this list of conditions and the following disclaimer. |
| 11 |
# |
| 12 |
# * Redistributions in binary form must reproduce the above |
| 13 |
# copyright notice, this list of conditions and the following |
| 14 |
# disclaimer in the documentation and/or other materials provided |
| 15 |
# with the distribution. |
| 16 |
# |
| 17 |
# * Neither the name of Sandia Corporation nor the names of its |
| 18 |
# contributors may be used to endorse or promote products derived |
| 19 |
# from this software without specific prior written permission. |
| 20 |
# |
| 21 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 27 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 28 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 29 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 |
# |
| 33 |
|
| 34 |
#======================================================================== |
| 35 |
# A platform must define: |
| 36 |
# |
| 37 |
# BITS either 32 or 64 depending on a 32-bit or 64-bit build |
| 38 |
# CC == the C compiler |
| 39 |
# FC == the Fortran compiler |
| 40 |
# CCOPTIONS == non-optimization related flags for C compiling on this platform |
| 41 |
# F77OPTIONS == non-optimization related flags for Fortran compiling on this platform |
| 42 |
# OS_TYPE == See listing in forbind/src/Imakefile |
| 43 |
# RANLIB == ranlib or 'true' if no ranlib |
| 44 |
# AR == command to build an archive library. |
| 45 |
# |
| 46 |
#======================================================================== |
| 47 |
|
| 48 |
SYSTEM := $(shell uname) |
| 49 |
|
| 50 |
#======================================================================== |
| 51 |
# Linux |
| 52 |
#======================================================================== |
| 53 |
ifeq ($(SYSTEM),Linux) |
| 54 |
BITS = 32 |
| 55 |
RANLIB = ranlib |
| 56 |
OS_TYPE = linux |
| 57 |
|
| 58 |
AR = ar -rcv |
| 59 |
|
| 60 |
ifeq ($(COMPILER),Portland) |
| 61 |
CC = pgcc |
| 62 |
FC = pgf77 |
| 63 |
CCOPTIONS = -Mframe |
| 64 |
F77OPTIONS = -fast |
| 65 |
endif |
| 66 |
|
| 67 |
ifeq ($(COMPILER),Intel) |
| 68 |
CC = icc |
| 69 |
CCOPTIONS = -Xc |
| 70 |
endif |
| 71 |
|
| 72 |
ifeq ($(COMPILER),GNU) |
| 73 |
CC = gcc |
| 74 |
FC = g77 |
| 75 |
CCOPTIONS = -O2 -Wall -Wno-deprecated |
| 76 |
F77OPTIONS = -O2 |
| 77 |
endif |
| 78 |
|
| 79 |
endif |
| 80 |
|
| 81 |
#======================================================================== |
| 82 |
# SUN |
| 83 |
#======================================================================== |
| 84 |
ifeq ($(SYSTEM),SunOS) |
| 85 |
RANLIB = ranlib |
| 86 |
OS_TYPE = sunos |
| 87 |
|
| 88 |
AR = CC -xar -o |
| 89 |
|
| 90 |
ifeq ($(COMPILER),GNU) |
| 91 |
BITS = 32 |
| 92 |
CC = gcc |
| 93 |
FC = g77 |
| 94 |
CCOPTIONS = -Wall |
| 95 |
else |
| 96 |
BITS = 32 |
| 97 |
CC = cc |
| 98 |
FC = f77 |
| 99 |
CCOPTIONS = -xtarget=ultra2 -xarch=v9 -g -ftrap=common -Xc |
| 100 |
F77OPTIONS = -xtarget=ultra2 -xarch=v9 -g -ftrap=common -errtags=INVOKE -C |
| 101 |
endif |
| 102 |
endif |
| 103 |
|
| 104 |
#======================================================================== |
| 105 |
# SGI |
| 106 |
#======================================================================== |
| 107 |
ifeq ($(SYSTEM),IRIX64) |
| 108 |
|
| 109 |
DO32=FALSE |
| 110 |
|
| 111 |
RANLIB = true |
| 112 |
OS_TYPE = irix |
| 113 |
AR = ar -rcv |
| 114 |
CC = cc |
| 115 |
FC = f77 |
| 116 |
|
| 117 |
ifeq ($(DO32),TRUE) |
| 118 |
BITS = 32 |
| 119 |
CCOPTIONS = -n32 -LANG:std |
| 120 |
F77OPTIONS = -n32 |
| 121 |
F77PREC = |
| 122 |
|
| 123 |
else |
| 124 |
BITS = 64 |
| 125 |
CCOPTIONS = -64 -LANG:std |
| 126 |
F77OPTIONS = -64 |
| 127 |
F77PREC = -DBuild64 -r8 -i8 |
| 128 |
endif |
| 129 |
endif |
| 130 |
|
| 131 |
#======================================================================== |
| 132 |
# IBM |
| 133 |
#======================================================================== |
| 134 |
ifeq ($(SYSTEM),AIX) |
| 135 |
BITS = 64 |
| 136 |
RANLIB = ranlib |
| 137 |
OS_TYPE = aix |
| 138 |
|
| 139 |
AR = ar -rcv -X64 |
| 140 |
CC = xlc |
| 141 |
FC = xlf |
| 142 |
CCOPTIONS = -q64 -w |
| 143 |
F77OPTIONS = -q64 -w |
| 144 |
F77PREC = -WF,-DBuild64 -qintsize=8 -qrealsize=8 |
| 145 |
SYSLIB = -lm |
| 146 |
endif |
| 147 |
|
| 148 |
#======================================================================== |
| 149 |
|
| 150 |
#======================================================================== |
| 151 |
# TFLOP |
| 152 |
#======================================================================== |
| 153 |
ifeq ($(SYSTEM),TFLOP) |
| 154 |
BITS = 32 |
| 155 |
RANLIB = ranlib |
| 156 |
OS_TYPE = osf |
| 157 |
|
| 158 |
AR = xar -rcv |
| 159 |
CC = icc |
| 160 |
FC = if77 |
| 161 |
CCOPTIONS = -DPUMAGON -cougar |
| 162 |
F77OPTIONS = -cougar |
| 163 |
endif |
| 164 |
|
| 165 |
#======================================================================== |
| 166 |
|
| 167 |
#======================================================================== |
| 168 |
# OSF (DEC Alpha) |
| 169 |
#======================================================================== |
| 170 |
ifeq ($(SYSTEM),OSF1) |
| 171 |
BITS = 32 |
| 172 |
RANLIB = ranlib |
| 173 |
OS_TYPE = osf |
| 174 |
|
| 175 |
AR = ar -crsv |
| 176 |
CC = cc |
| 177 |
FC = f77 |
| 178 |
CCOPTIONS = -std strict_ansi -ptr $(shell pwd)/OSF1/cxx_repository -noimplicit_include -ttimestamp |
| 179 |
endif |
| 180 |
#======================================================================== |
| 181 |
|
| 182 |
OPTIMIZE_FLAG = -O |
| 183 |
STD_DEFINES = -DVERBOSE |
| 184 |
|
| 185 |
CFLAGS = $(OPTIMIZE_FLAG) $(CCOPTIONS) $(STD_DEFINES) $(EXODUS_INC) $(NETCDF_INC) |
| 186 |
FFLAGS = $(OPTIMIZE_FLAG) $(F77OPTIONS) $(F77PREC) $(EXODUS_INC) |
| 187 |
|
| 188 |
NETCDF_INC = -I$(ACCESS)/inc |
| 189 |
EXODUS_INC = -I$(ACCESS)/inc |
| 190 |
|
| 191 |
NETCDF_LIB_DIR = ${ACCESS}/lib |
| 192 |
NETCDF_LIB = -L$(NETCDF_LIB_DIR) -lnetcdf |
| 193 |
|
| 194 |
EXODUS_LIB_DIR = ${ACCESS}/lib |
| 195 |
EXODUS_LIB = -L$(EXODUS_LIB_DIR) -lexodus |
| 196 |
EXODUS_FLIB = -L$(EXODUS_LIB_DIR) -lexoIIv2for |
| 197 |
|
| 198 |
EXT_LIBS = $(EXODUS_LIB) $(NETCDF_LIB) |
| 199 |
EXT_FLIBS = $(EXODUS_FLIB) |
| 200 |
|
| 201 |
SUBDIRS = forbind |
| 202 |
|
| 203 |
SRCS = nemesis_wrapper.c |
| 204 |
|
| 205 |
OBJS = ${SRCS:.c=.o} |
| 206 |
|
| 207 |
all:: libnemesis.a libnemIf.a |
| 208 |
|
| 209 |
libnemesis.a: $(OBJS) |
| 210 |
$(AR) $@ $? |
| 211 |
$(RANLIB) $@ |
| 212 |
|
| 213 |
libnemIf.a: |
| 214 |
(cd forbind && $(MAKE) $(MFLAGS) -f Makefile.standalone "BITS=$(BITS)" "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "FC=$(FC)" "FFLAGS=$(FFLAGS)" "RANLIB=$(RANLIB)" "SYSTEM=$(SYSTEM)" "OS_TYPE=$(OS_TYPE)" libnemIf.a) |
| 215 |
cp forbind/libnemIf.a . |
| 216 |
|
| 217 |
check: test |
| 218 |
test:: ne_test.c libnemesis.a |
| 219 |
$(CC) -c $(CFLAGS) ne_test.c |
| 220 |
$(CC) $(CFLAGS) -o ne_ctest ne_test.o libnemesis.a $(EXT_LIBS) -lm |
| 221 |
./ne_ctest |
| 222 |
|
| 223 |
test:: forbind/ne_test.f libnemIf.a |
| 224 |
$(FC) -c $(FFLAGS) -I./forbind forbind/ne_test.f |
| 225 |
$(FC) $(FFLAGS) -o ne_ftest ne_test.o libnemIf.a libnemesis.a $(EXT_FLIBS) $(EXT_LIBS) -lm |
| 226 |
./ne_ftest |
| 227 |
|
| 228 |
clean:: |
| 229 |
rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* |
| 230 |
|
| 231 |
clean:: |
| 232 |
rm -f ne_ctest ne_ftest ne_test.exoII ne_test.nemI |
| 233 |
|
| 234 |
clean:: |
| 235 |
@for flag in $(MAKEFLAGS) ''; do \ |
| 236 |
case "$$flag" in *=*) ;; *[ik]*) set +e;; esac; done; \ |
| 237 |
for i in $(SUBDIRS) ;\ |
| 238 |
do \ |
| 239 |
if test -d $$i; then \ |
| 240 |
echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ |
| 241 |
(cd $$i && $(MAKE) -f Makefile.standalone $(MFLAGS) clean); \ |
| 242 |
fi; \ |
| 243 |
done |
| 244 |
|
| 245 |
.SUFFIXES: .c |
| 246 |
.c.o: |
| 247 |
$(CC) -c -I. $(CFLAGS) $*.c |