# Copyright (c) 1998 Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement # retains certain rights in this software. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # # * Neither the name of Sandia Corporation nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #======================================================================== # A platform must define: # # BITS either 32 or 64 depending on a 32-bit or 64-bit build # CC == the C compiler # FC == the Fortran compiler # CCOPTIONS == non-optimization related flags for C compiling on this platform # F77OPTIONS == non-optimization related flags for Fortran compiling on this platform # OS_TYPE == See listing in forbind/src/Imakefile # RANLIB == ranlib or 'true' if no ranlib # AR == command to build an archive library. # #======================================================================== SYSTEM := $(shell uname) #======================================================================== # Linux #======================================================================== ifeq ($(SYSTEM),Linux) BITS = 32 RANLIB = ranlib OS_TYPE = linux AR = ar -rcv ifeq ($(COMPILER),Portland) CC = pgcc FC = pgf77 CCOPTIONS = -Mframe F77OPTIONS = -fast endif ifeq ($(COMPILER),Intel) CC = icc CCOPTIONS = -Xc endif ifeq ($(COMPILER),GNU) CC = gcc FC = g77 CCOPTIONS = -O2 -Wall -Wno-deprecated F77OPTIONS = -O2 endif endif #======================================================================== # SUN #======================================================================== ifeq ($(SYSTEM),SunOS) RANLIB = ranlib OS_TYPE = sunos AR = CC -xar -o ifeq ($(COMPILER),GNU) BITS = 32 CC = gcc FC = g77 CCOPTIONS = -Wall else BITS = 32 CC = cc FC = f77 CCOPTIONS = -xtarget=ultra2 -xarch=v9 -g -ftrap=common -Xc F77OPTIONS = -xtarget=ultra2 -xarch=v9 -g -ftrap=common -errtags=INVOKE -C endif endif #======================================================================== # SGI #======================================================================== ifeq ($(SYSTEM),IRIX64) DO32=FALSE RANLIB = true OS_TYPE = irix AR = ar -rcv CC = cc FC = f77 ifeq ($(DO32),TRUE) BITS = 32 CCOPTIONS = -n32 -LANG:std F77OPTIONS = -n32 F77PREC = else BITS = 64 CCOPTIONS = -64 -LANG:std F77OPTIONS = -64 F77PREC = -DBuild64 -r8 -i8 endif endif #======================================================================== # IBM #======================================================================== ifeq ($(SYSTEM),AIX) BITS = 64 RANLIB = ranlib OS_TYPE = aix AR = ar -rcv -X64 CC = xlc FC = xlf CCOPTIONS = -q64 -w F77OPTIONS = -q64 -w F77PREC = -WF,-DBuild64 -qintsize=8 -qrealsize=8 SYSLIB = -lm endif #======================================================================== #======================================================================== # TFLOP #======================================================================== ifeq ($(SYSTEM),TFLOP) BITS = 32 RANLIB = ranlib OS_TYPE = osf AR = xar -rcv CC = icc FC = if77 CCOPTIONS = -DPUMAGON -cougar F77OPTIONS = -cougar endif #======================================================================== #======================================================================== # OSF (DEC Alpha) #======================================================================== ifeq ($(SYSTEM),OSF1) BITS = 32 RANLIB = ranlib OS_TYPE = osf AR = ar -crsv CC = cc FC = f77 CCOPTIONS = -std strict_ansi -ptr $(shell pwd)/OSF1/cxx_repository -noimplicit_include -ttimestamp endif #======================================================================== OPTIMIZE_FLAG = -O STD_DEFINES = -DVERBOSE CFLAGS = $(OPTIMIZE_FLAG) $(CCOPTIONS) $(STD_DEFINES) $(EXODUS_INC) $(NETCDF_INC) FFLAGS = $(OPTIMIZE_FLAG) $(F77OPTIONS) $(F77PREC) $(EXODUS_INC) NETCDF_INC = -I$(ACCESS)/inc EXODUS_INC = -I$(ACCESS)/inc NETCDF_LIB_DIR = ${ACCESS}/lib NETCDF_LIB = -L$(NETCDF_LIB_DIR) -lnetcdf EXODUS_LIB_DIR = ${ACCESS}/lib EXODUS_LIB = -L$(EXODUS_LIB_DIR) -lexodus EXODUS_FLIB = -L$(EXODUS_LIB_DIR) -lexoIIv2for EXT_LIBS = $(EXODUS_LIB) $(NETCDF_LIB) EXT_FLIBS = $(EXODUS_FLIB) SUBDIRS = forbind SRCS = nemesis_wrapper.c OBJS = ${SRCS:.c=.o} all:: libnemesis.a libnemIf.a libnemesis.a: $(OBJS) $(AR) $@ $? $(RANLIB) $@ libnemIf.a: (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) cp forbind/libnemIf.a . check: test test:: ne_test.c libnemesis.a $(CC) -c $(CFLAGS) ne_test.c $(CC) $(CFLAGS) -o ne_ctest ne_test.o libnemesis.a $(EXT_LIBS) -lm ./ne_ctest test:: forbind/ne_test.f libnemIf.a $(FC) -c $(FFLAGS) -I./forbind forbind/ne_test.f $(FC) $(FFLAGS) -o ne_ftest ne_test.o libnemIf.a libnemesis.a $(EXT_FLIBS) $(EXT_LIBS) -lm ./ne_ftest clean:: rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* clean:: rm -f ne_ctest ne_ftest ne_test.exoII ne_test.nemI clean:: @for flag in $(MAKEFLAGS) ''; do \ case "$$flag" in *=*) ;; *[ik]*) set +e;; esac; done; \ for i in $(SUBDIRS) ;\ do \ if test -d $$i; then \ echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ (cd $$i && $(MAKE) -f Makefile.standalone $(MFLAGS) clean); \ fi; \ done .SUFFIXES: .c .c.o: $(CC) -c -I. $(CFLAGS) $*.c