| 1 |
# $Header$ -*-makefile-*- |
| 2 |
|
| 3 |
# Purpose: GNU Makefile for NCO module nco |
| 4 |
# Requires GNU Make---AT&T Make chokes on GNU syntax |
| 5 |
|
| 6 |
# Copyright (C) 1994--present Charlie Zender |
| 7 |
# License: 3-Clause BSD License |
| 8 |
# See https://opensource.org/licenses/BSD-3-Clause for full license text |
| 9 |
|
| 10 |
# Quickie test copies: |
| 11 |
# scp ~/nco/bld/Makefile dust.ess.uci.edu:nco/bld |
| 12 |
# scp ~/nco/bld/Makefile grele.ess.uci.edu:nco/bld |
| 13 |
# scp ~/nco/bld/Makefile gplogin2.ps.uci.edu:nco/bld |
| 14 |
# scp ~/nco/bld/Makefile skyglow.ess.uci.edu:nco/bld |
| 15 |
|
| 16 |
# Machine build parameters |
| 17 |
# Source Method Packages Compiler |
| 18 |
# AppVeyor CI : NCO CMake All else MSVC |
| 19 |
# andes.olcf.ornl.gov: NCO Makefile All else GCC |
| 20 |
# cheyenne.ucar.edu : NCO Makefile All else Intel |
| 21 |
# firn.ess.uci.edu : NCO Configure All else Intel |
| 22 |
# frazil.ess.uci.edu : NCO Configure All else clang |
| 23 |
# glace.ess.uci.edu : NCO CMake All else GCC |
| 24 |
# grele.ess.uci.edu : NCO + netCDF Makefile All else GCC |
| 25 |
# katabatic.ess.uci.e: NCO CMake All else clang |
| 26 |
# sastrugi.ess.uci.ed: NCO + netCDF Configure All else clang |
| 27 |
# spectral.ess.uci.ed: NCO Configure All else clang |
| 28 |
|
| 29 |
# Usage (testing): |
| 30 |
# make tst # Vanilla regression test |
| 31 |
# make FL_FMT=netcdf4 tst # netCDF4 regression test |
| 32 |
# make MPI_PRC=3 tst # MPI regression test |
| 33 |
# make MPI_PRC=3 bm # MPI benchmarks |
| 34 |
# make THR_NBR=2 tst # OpenMP regression test |
| 35 |
# make THR_NBR=2 bm # OpenMP benchmarks |
| 36 |
# make MPI=Y # MPI features (HDF5 and PnetCDF I/O) |
| 37 |
# make NETCDF4=Y # netCDF4 features |
| 38 |
# make PNETCDF=Y # PnetCDF features |
| 39 |
|
| 40 |
# Usage (Compilation): |
| 41 |
# cd ~/nco/qt;qmake;make;cd - # Qt |
| 42 |
# cd ~/nco/bld;make;cd - # Default build |
| 43 |
# cd ~/nco/bld;make USR_TKN='-DHAVE_NC_RENAME_GRP';cd - # New API |
| 44 |
# cd ~/nco/bld;make UDUNITS_INC='/usr/include/udunits2';cd - # Fedora build |
| 45 |
# cd ~/nco/bld;make cln bin_cln;cd - # Clean all dependencies for fresh build |
| 46 |
# cd ~/nco/bld;make dir all; cd - # Create target directories then build |
| 47 |
# cd ~/nco/bld;make dbg;cd - # Print make diagnostics |
| 48 |
# cd ~/nco/bld;make DPKG=Y;cd - # Debian hardening |
| 49 |
# cd ~/nco/bld;make ESMF=Y;cd - # ESMF regridding |
| 50 |
# cd ~/nco/bld;make GSL=Y;cd - # GSL support |
| 51 |
# cd ~/nco/bld;make I18N=Y;cd - # Internationalization |
| 52 |
# cd ~/nco/bld;make lib_cln;cd - # Clean libraries |
| 53 |
# cd ~/nco/bld;make MPI=Y;cd - # MPI support |
| 54 |
# cd ~/nco/bld;make MPI_FAKE=Y;cd - # Spoof MPI support |
| 55 |
# cd ~/nco/bld;make OMP=Y;cd - # OpenMP support |
| 56 |
# cd ~/nco/bld;make OPTS=D;cd - # "Debugging": Enough symbols for debugging (default) |
| 57 |
# cd ~/nco/bld;make OPTS=O;cd - # "Optimize": For production (includes symbols) |
| 58 |
# cd ~/nco/bld;make OPTS=R;cd - # "Regular": No optimization or debugging |
| 59 |
# cd ~/nco/bld;make OPTS=X;cd - # "eXtreme": All debugging switches available |
| 60 |
# cd ~/nco/bld;make sys;cd - # Install in /usr/local (must sudo) |
| 61 |
# cd ~/nco/bld;make SZ=Y;cd - # Szip support |
| 62 |
# cd ~/nco/bld;make UDUNITS=Y;cd - # UDUnits support |
| 63 |
# cd ~/nco/bld;make --jobs=4;cd - # Parallel make |
| 64 |
# Normal (Linux) developer systems: |
| 65 |
# cd ~/nco/bld;make cln all ncap2;cd - # New default for most machines |
| 66 |
# cd ~/nco/bld;make OMP=Y CUDA=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd - # givre |
| 67 |
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd - # givre, neige |
| 68 |
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # glace, virga |
| 69 |
# mpi-selector --set openmpi_gcc-1.3.3 # Then use /sopt/netcdf/netcdf3-gcc-serial serial libraries |
| 70 |
# mpi-selector --set mpich_pgi_1.2.7p1 # After compiling |
| 71 |
# cd ~/nco/bld;ANTLR_ROOT=/sopt/gfortran_g++ NETCDF_ROOT=/sopt/gfortran_g++ SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=Y SZ=Y UDUNITS=N allinone;cd - # greenplanet gcc |
| 72 |
# cd ~/nco/bld;ANTLR=/home/pvicente/install/antlr-2.7.7/bin/antlr ANTLR_ROOT=/home/pvicente/install/antlr-2.7.7 NETCDF_ROOT=/home/pvicente/install/netcdf-4.3.0 UDUNITS_INC=/home/pvicente/install/udunits-2.1.24/include UDUNITS_LIB=/home/pvicente/install/udunits-2.1.24/lib make OPTS=D allinone;cd - # greenplanet gcc pedro |
| 73 |
# cd ~/nco/bld;ANTLR=/sopt/ifort_icpc/bin/antlr ANTLR_ROOT=/sopt/ifort_icpc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=Y SZ=Y UDUNITS=N allinone;cd - # greenplanet intel |
| 74 |
# cd ~/nco/bld;ANTLR=/sopt/pgf90_pgcc/bin/antlr ANTLR_ROOT=/sopt/pgf90_pgcc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=N SZ=Y UDUNITS=N allinone;cd - # greenplanet pgi |
| 75 |
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # pbs |
| 76 |
# cd ~/nco/bld;make OMP=Y OPTS=D UDUNITS=Y UBUNTU_440=Y allinone # grele |
| 77 |
# cd ~/nco/bld;make NETCDF4=N all ncap2;cd - # tephra |
| 78 |
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # silt, clay |
| 79 |
# cd ~/nco/bld;NETCDF_INC='/usr/include/netcdf-3' NETCDF_LIB='/usr/lib64' make GSL=N OMP=N OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # snow |
| 80 |
# cd ~/nco/bld;make OMP=N OPTS=D NETCDF4=N UDUNITS=N USR_TKN='-DNEED_NC_INQ_FORMAT' allinone;cd - # snow w/OPeNDAP |
| 81 |
# cd ~/nco/bld;make OPTS=D USR_TKN='-DNEED_NC_INQ_FORMAT' allinone;cd - |
| 82 |
# 64-bit ABI on UCI MPC: |
| 83 |
# cd ~/nco/bld;env ANTLR='/software/antlr/bin/antlr' ANTLR_ROOT='/software/antlr' UDUNITS_INC='/software/udunits/include' UDUNITS_LIB='/software/udunits/lib' make --jobs=1 ABI=64 allinone;cd - |
| 84 |
# 64-bit ABI on UCI IPCC: |
| 85 |
# cd ~/nco/bld;env ANTLR='/usr/local/pgi/bin/antlr' ANTLR_ROOT='/usr/local/pgi' make --jobs=1 ABI=64 allinone;cd - |
| 86 |
# 64-bit ABI netCDF3 on NCAR AIX systems (bluefire): |
| 87 |
# cd ~/nco/bld;ANTLR='/contrib/antlr-2.7.7/bin/antlr' ANTLR_ROOT='/contrib/antlr-2.7.7' GSL_INC='/contrib/gsl-1.12/include' GSL_LIB='/contrib/gsl-1.12/lib' NETCDF_LIB='/usr/local/lib64/r4i4' UDUNITS_INC='/contrib/udunits-1.12.9/include' UDUNITS_LIB='/contrib/udunits-1.12.9/lib' make --jobs=1 OPTS=D NETCDF4=N UDUNITS=N allinone ABI=64;cd - |
| 88 |
# 64-bit ABI netCDF4 on NCAR AIX systems (bluefire): |
| 89 |
# cd ~/nco/bld;ANTLR='/contrib/antlr-2.7.7/bin/antlr' ANTLR_ROOT='/contrib/antlr-2.7.7' CURL_LIB='/contrib/curl/7.21.2/lib' GSL_INC='/contrib/gsl-1.12/include' GSL_LIB='/contrib/gsl-1.12/lib' HDF5_ROOT='/contrib/hdf5-1.8.7_seq' LDFLAGS='-lnetcdf -lhdf5_hl -lhdf5 -lz' NETCDF_ROOT='/contrib/netcdf/4.1.3_seq' SZ_LIB='/contrib/szip/lib' UDUNITS_LIB='/contrib/zlib/lib' make --jobs=1 OPTS=D SZ=Y allinone ABI=64;cd - |
| 90 |
# 64-bit ABI netCDF4 on NCAR AIX systems (bluefire): |
| 91 |
# cd ~/bin/AIX;/usr/local/bin/tar cvzf ~/nco-4.4.6.aix53.tar.gz nc*;scp ~/nco-4.4.6.aix53.tar.gz zender,[email protected]:/home/project-web/nco/htdocs/src |
| 92 |
# netCDF4 on NCAR Linux cluster systems (mirage): |
| 93 |
# cd ~/nco/bld;make OPTS=D allinone;cd - |
| 94 |
# netCDF4 on ORNL Linux cluster systems (titan, rhea.ccs.ornl.gov): |
| 95 |
# module avail |
| 96 |
# . ~/.bashrc |
| 97 |
# module add intel gsl |
| 98 |
# export LD_LIBRARY_PATH='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3/lib:/sw/redhat6/szip/2.1/rhel6.6_gnu4.8.2/lib':${LD_LIBRARY_PATH} |
| 99 |
# export NETCDF_ROOT='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3' |
| 100 |
# export PATH='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3/bin':${PATH} |
| 101 |
# cd ~/nco/bld;make ANTLR_ROOT=${HOME} NETCDF_ROOT='/sw/redhat6/netcdf/4.1.3/rhel6.4_intel13.1.3' SZ=Y SZ_LIB='/sw/redhat6/szip/2.1/rhel6.6_gnu4.8.2/lib' UDUNITS_INC='/sw/redhat6/udunits/2.1.24/rhel6.4_intel13.1.3/include' UDUNITS_LIB='/sw/redhat6/udunits/2.1.24/rhel6.4_intel13.1.3/lib' OPTS=D allinone;cd - |
| 102 |
# ncap2: |
| 103 |
# netCDF4 on NCAR Linux cluster systems (yellowstone): |
| 104 |
# /ncar/opt/hpss/hsi # Starts HPSS session |
| 105 |
# export PATH=${PATH}\:/ncar/opt/hpss |
| 106 |
# GNU (works): |
| 107 |
# module swap intel gnu;module add gsl;module add netcdf/4.3.0; |
| 108 |
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}\:/glade/apps/opt/udunits/2.1.24/gnu/default/lib |
| 109 |
# cd ~/nco/bld;make NETCDF_ROOT='/glade/apps/opt/netcdf/4.3.0/gnu/default' UDUNITS_INC='/glade/apps/opt/udunits/2.1.24/gnu/default/include' UDUNITS_LIB='/glade/apps/opt/udunits/2.1.24/gnu/default/lib' OPTS=D allinone;cd - |
| 110 |
# Intel (works as of 20140129): |
| 111 |
# module add intel;module add gsl;module add netcdf/4.3.0; |
| 112 |
# https://www2.cisl.ucar.edu/sites/default/files/Yellowstone_Started_Nov30-2.pdf |
| 113 |
# module add pnetcdf/1.4.1 |
| 114 |
# export PATH=${PATH}:/glade/apps/opt/netcdf/4.3.0/intel/12.1.5/bin # needed for ncgen |
| 115 |
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/glade/apps/opt/netcdf/4.3.0/intel/12.1.5/lib # needed to run NCO |
| 116 |
# cd ~/nco/bld;make NETCDF_ROOT='/glade/apps/opt/netcdf/4.3.0/intel/default' UDUNITS_INC='/glade/apps/opt/udunits/2.1.24/intel/12.1.4/include' UDUNITS_LIB='/glade/apps/opt/udunits/2.1.24/intel/12.1.4/lib' OPTS=D allinone;cd - |
| 117 |
# Cygwin on Windows Vista systems: |
| 118 |
# cd ~/nco/bld;ANTLR='antlr' make --jobs=1 GSL=Y OPTS=D NETCDF4=Y UDUNITS=Y allinone;cd - |
| 119 |
# cd ~/bin/WIN32;tar cvzf ~/nco-4.5.2.win32.cygwin.tar.gz nc* ; scp ~/nco-4.5.2.win32.cygwin.tar.gz zender,[email protected]:/home/project-web/nco/htdocs/src |
| 120 |
# Data files to dust |
| 121 |
# cd ~/nco/data;scp cmip5.nc obs.nc mdl_1.nc mdl_2.nc in_grp*.nc in.nc in_4c.nc dust.ess.uci.edu:/var/www/html/nco |
| 122 |
|
| 123 |
# Top-level tokens defining directory structure |
| 124 |
# These tokens may be over-ridden by environment variables or when invoking make, e.g., make OMP=Y |
| 125 |
MY_BLD_DIR := ../bld |
| 126 |
ifndef PVM_ARCH |
| 127 |
PVM_ARCH := $(shell ${MY_BLD_DIR}/pvmgetarch) |
| 128 |
endif |
| 129 |
ifndef MY_BIN_DIR |
| 130 |
MY_BIN_DIR := ../bin |
| 131 |
endif |
| 132 |
ifndef MY_LIB_DIR |
| 133 |
MY_LIB_DIR := ../lib |
| 134 |
endif |
| 135 |
ifndef MY_MAN_DIR |
| 136 |
MY_MAN_DIR := ../man |
| 137 |
endif |
| 138 |
ifndef MY_OBJ_DIR |
| 139 |
MY_OBJ_DIR := ../obj |
| 140 |
endif |
| 141 |
MY_BM_DIR := ../bm |
| 142 |
MY_DAT_DIR := ../data |
| 143 |
MY_DBN_DIR := ../debian |
| 144 |
MY_DOC_DIR := ../doc |
| 145 |
MY_DPN_DIR := ${MY_OBJ_DIR} |
| 146 |
MY_SRC_DIR := ../src/nco |
| 147 |
MY_INC_DIR := ${MY_SRC_DIR} |
| 148 |
NCO_CXX_SRC_DIR := ${MY_SRC_DIR}/../nco_c++ |
| 149 |
NCOXX_SRC_DIR := ${MY_SRC_DIR}/../nco++ |
| 150 |
|
| 151 |
# Primary tokens which determine build options |
| 152 |
# Specify non-default when invoking make, e.g. make OMP=Y |
| 153 |
ifndef ABI |
| 154 |
# 32- vs. 64-bit ABI: 32=32-bit mode, 64=64-bit mode (default) if available |
| 155 |
ABI := 64 |
| 156 |
endif # !ABI |
| 157 |
ifndef CCACHE |
| 158 |
CCACHE := N |
| 159 |
endif # CCACHE |
| 160 |
ifndef CNK |
| 161 |
# Use newer netCDF4.1 chunking API |
| 162 |
CNK := Y |
| 163 |
endif # !CNK |
| 164 |
ifndef CUDA |
| 165 |
CUDA := N |
| 166 |
endif # CUDA |
| 167 |
ifndef DAP |
| 168 |
DAP := Y |
| 169 |
endif # DAP |
| 170 |
ifndef DBG |
| 171 |
# Debugging token N=No (default) Y=Yes |
| 172 |
DBG := N |
| 173 |
endif # !DBG |
| 174 |
ifndef DPKG |
| 175 |
# Debian hardening tokens |
| 176 |
DPKG := N |
| 177 |
endif # !DPKG |
| 178 |
ifdef FL_FMT |
| 179 |
# Pass this netCDF4 argument to nco_bm.pl |
| 180 |
FL_FMT_SNG := "--fl_fmt=${FL_FMT}" |
| 181 |
else # !FL_FMT |
| 182 |
FL_FMT_SNG := |
| 183 |
endif # !FL_FMT |
| 184 |
ifndef GCC_RCH_ARG |
| 185 |
GCC_RCH_ARG := |
| 186 |
endif # !GCC_RCH_ARG |
| 187 |
ifndef GSL |
| 188 |
# Use GSL functionality |
| 189 |
GSL := Y |
| 190 |
endif # !GSL |
| 191 |
ifndef ICC_RCH_ARG |
| 192 |
ICC_RCH_ARG := |
| 193 |
endif # !ICC_RCH_ARG |
| 194 |
ifndef I18N |
| 195 |
I18N := N |
| 196 |
endif |
| 197 |
ifndef NCO_YY_PFX |
| 198 |
NCO_YY_PFX := nco_yy |
| 199 |
endif |
| 200 |
ifndef MK_DPN |
| 201 |
MK_DPN = ${CPP} -M # NB: Recursive expansion required |
| 202 |
MK_DPN_CXX = ${CXX} -M # NB: Recursive expansion required |
| 203 |
endif # !MK_DPN |
| 204 |
ifndef MPI # MPI |
| 205 |
MPI := N |
| 206 |
endif # !MPI |
| 207 |
ifndef MPI_FAKE # MPI |
| 208 |
MPI_FAKE := N |
| 209 |
endif # !MPI_FAKE |
| 210 |
ifndef NCO_BUILDENGINE |
| 211 |
NCO_BUILDENGINE := Traditional \(nco/bld/Makefile\) |
| 212 |
endif # NCO_BUILDENGINE |
| 213 |
ifndef NCO_VRS |
| 214 |
# Used for RPM building |
| 215 |
NCO_VRS := $(shell cat ${MY_DOC_DIR}/VERSION) |
| 216 |
endif |
| 217 |
ifndef NETCDF4 # netCDF4 support |
| 218 |
NETCDF4 := Y |
| 219 |
endif # !NETCDF4 |
| 220 |
ifndef NETCDF_ROOT |
| 221 |
NETCDF_ROOT := /usr/local |
| 222 |
endif |
| 223 |
ifndef NETCDF4_ROOT |
| 224 |
NETCDF4_ROOT := ${NETCDF_ROOT} |
| 225 |
endif |
| 226 |
ifndef NETCDF_INC |
| 227 |
ifdef INC_NCAR |
| 228 |
NETCDF_INC := ${INC_NCAR} # NCAR module path |
| 229 |
else # endelse INC_NCAR |
| 230 |
NETCDF_INC := ${NETCDF_ROOT}/include # Directory containing netcdf.h |
| 231 |
endif # !INC_NCAR |
| 232 |
endif # !NETCDF_INC |
| 233 |
ifndef NETCDF_LIB |
| 234 |
ifdef LIB_NCAR |
| 235 |
NETCDF_LIB := ${LIB_NCAR} # NCAR module path |
| 236 |
else # endelse LIB_NCAR |
| 237 |
NETCDF_LIB := ${NETCDF_ROOT}/lib # Directory containing libnetcdf.a |
| 238 |
endif # !LIB_NCAR |
| 239 |
endif # !NETCDF_LIB |
| 240 |
ifndef ${OMP} # OpenMP |
| 241 |
OMP := N |
| 242 |
endif # !OMP |
| 243 |
ifndef OPTS |
| 244 |
OPTS := D |
| 245 |
endif |
| 246 |
ifndef PGI_RCH_ARG |
| 247 |
PGI_RCH_ARG := |
| 248 |
endif # !PGI_RCH_ARG |
| 249 |
ifndef PNETCDF # pnetCDF support |
| 250 |
PNETCDF := N |
| 251 |
endif # !PNETCDF |
| 252 |
ifndef PSC_RCH_ARG |
| 253 |
PSC_RCH_ARG := |
| 254 |
endif # !PSC_RCH_ARG |
| 255 |
ifndef RPM |
| 256 |
RPM := N |
| 257 |
endif # !RPM |
| 258 |
ifndef STC |
| 259 |
# Created statically linked executable |
| 260 |
STC := N |
| 261 |
endif |
| 262 |
ifndef SZ |
| 263 |
# Link to Szip library |
| 264 |
SZ := N |
| 265 |
endif |
| 266 |
ifndef UDUNITS |
| 267 |
# Use UDUnits functionality |
| 268 |
UDUNITS := Y |
| 269 |
endif |
| 270 |
ifndef UNAMES |
| 271 |
UNAMES := $(shell uname -s) |
| 272 |
endif |
| 273 |
ifndef USR_TKN |
| 274 |
USR_TKN := |
| 275 |
endif # !USR_TKN |
| 276 |
ifndef VRS_SNG |
| 277 |
# VRS_SNG := $(shell date +%Y%m%d) |
| 278 |
# 20150622 |
| 279 |
# VRS_SNG := $(shell git describe --abbrev=7 --dirty --always --tags) |
| 280 |
VRS_SNG := $(shell cat ${MY_DOC_DIR}/VERSION) |
| 281 |
endif # !VRS_SNG |
| 282 |
ifndef ZNETCDF # znetcdf support |
| 283 |
ZNETCDF := N |
| 284 |
endif # !ZNETCDF |
| 285 |
# Derived-tokens based on primary tokens |
| 286 |
# These tokens should not be altered by hand |
| 287 |
|
| 288 |
# NB: CPP_TKN is recursively expanded variable, define only when components are ready |
| 289 |
CPP_TKN = ${USR_TKN} -DNCO_BUILDENGINE='${NCO_BUILDENGINE}' -D${PVM_ARCH} -DNO_NETCDF_2 -DNCO_VERSION='${VRS_SNG}' -DHOSTNAME='${HOST}' -DUSER='${USER}' -UNCO_ABORT_ON_ERROR |
| 290 |
ifndef LFLAGS # Flags for Flex (Lex) |
| 291 |
LFLAGS := -P${NCO_YY_PFX} |
| 292 |
endif |
| 293 |
ifndef YFLAGS # Flags for Bison (Yacc) |
| 294 |
YFLAGS := -d --name-prefix=${NCO_YY_PFX} |
| 295 |
endif |
| 296 |
|
| 297 |
# Internationalize NCO with i18n features |
| 298 |
ifeq (${I18N},Y) |
| 299 |
MY_SHR_DIR := ${HOME}/share |
| 300 |
MY_ES_DIR := ${MY_SHR_DIR}/locale/es/LC_MESSAGES |
| 301 |
MY_FR_DIR := ${MY_SHR_DIR}/locale/fr/LC_MESSAGES |
| 302 |
endif |
| 303 |
|
| 304 |
# Message Passing Interface (MPI) |
| 305 |
ifeq (${MPI_FAKE},Y) |
| 306 |
# MPI_FAKE instructs make to compile mpnc*.c operators without defining ENABLE_MPI |
| 307 |
# Resulting executables use UP or SMP code not MPI code |
| 308 |
# This tests compile, link, execution of MPI mpnc*.c code without using any MPI calls |
| 309 |
MPI := Y |
| 310 |
endif # !MPI_FAKE |
| 311 |
ifdef MPI_PRC |
| 312 |
# MPI_PRC tells test scripts how many MPI processes to spawn |
| 313 |
# Pass this MPI argument to nco_bm.pl |
| 314 |
MPI_PRC_SNG := "--mpi_prc=${MPI_PRC}" |
| 315 |
# MPI_PRC implies MPI |
| 316 |
MPI := Y |
| 317 |
else # !MPI_PRC |
| 318 |
MPI_PRC_SNG := |
| 319 |
endif # !MPI_PRC |
| 320 |
|
| 321 |
# PnetCDF implies MPI |
| 322 |
ifeq (${PNETCDF},Y) |
| 323 |
MPI := Y |
| 324 |
endif # !PNETCDF |
| 325 |
|
| 326 |
LINUX_OR_MACOS := N |
| 327 |
ifneq (${null},$(findstring LINUX,${PVM_ARCH})) |
| 328 |
LINUX_OR_MACOS := Y |
| 329 |
endif |
| 330 |
ifneq (${null},$(findstring MACOS,${PVM_ARCH})) |
| 331 |
LINUX_OR_MACOS := Y |
| 332 |
endif |
| 333 |
# Decide among the plethora of compilers. Use names like LINUX_CC for historical reasons. |
| 334 |
ifeq (${LINUX_OR_MACOS},Y) |
| 335 |
ifndef LINUX_CXX |
| 336 |
# C++ compiler for Linux |
| 337 |
LINUX_CXX := g++ |
| 338 |
#LINUX_CXX := clang |
| 339 |
#LINUX_CXX := como |
| 340 |
#LINUX_CXX := icpc |
| 341 |
#LINUX_CXX := insure |
| 342 |
#LINUX_CXX := pathCC |
| 343 |
#LINUX_CXX := pgCC |
| 344 |
endif # !LINUX_CXX |
| 345 |
ifndef LINUX_CC |
| 346 |
# C compiler for Linux |
| 347 |
LINUX_CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 348 |
#LINUX_CC := clang |
| 349 |
#LINUX_CC := como --c99 |
| 350 |
#LINUX_CC := icc -std=c99 -D_DEFAULT_SOURCE |
| 351 |
#LINUX_CC := insure |
| 352 |
#LINUX_CC := nvcc |
| 353 |
#LINUX_CC := pathcc -std=c99 |
| 354 |
#LINUX_CC := pgcc -c9x |
| 355 |
endif # !LINUX_CC |
| 356 |
ifndef LINUX_FC |
| 357 |
# Fortran compiler for Linux |
| 358 |
#LINUX_FC := g95 |
| 359 |
LINUX_FC := gfortran |
| 360 |
#LINUX_FC := ifort |
| 361 |
#LINUX_FC := lf95 |
| 362 |
#LINUX_FC := pathf95 |
| 363 |
#LINUX_FC := pgf90 |
| 364 |
endif # !LINUX_CC |
| 365 |
endif # !LINUX_OR_MACOS |
| 366 |
|
| 367 |
# OpenMP |
| 368 |
ifeq (${OMP},Y) |
| 369 |
ifdef THR_NBR |
| 370 |
# Pass this OpenMP argument to nco_bm.pl |
| 371 |
THR_NBR_SNG := "--thr_nbr=${THR_NBR}" |
| 372 |
else # !THR_NBR |
| 373 |
THR_NBR_SNG := |
| 374 |
endif # !THR_NBR |
| 375 |
endif # !OMP |
| 376 |
|
| 377 |
ifeq (${RPM},Y) |
| 378 |
# rpm command, and thus RPM variables only guaranteed in RedHat Linux |
| 379 |
# Use recursive expansion so rpm command is not executed on non-RPM systems |
| 380 |
MDL_RPM_NST_NM = $(shell rpm -qa | grep nco-) # Name of installed package |
| 381 |
# MDL_RPM_PRV_NM = $(shell rpm -qp foo) # Name of package provided by specified RPM |
| 382 |
endif # !RPM |
| 383 |
|
| 384 |
ifeq (${PVM_ARCH},WINOS) |
| 385 |
BNR_SFX := .exe |
| 386 |
else |
| 387 |
BNR_SFX := ${null} |
| 388 |
endif |
| 389 |
|
| 390 |
ifeq (${ESMF},Y) |
| 391 |
# Build ESMF-enabled NCO |
| 392 |
# Place ESMF block after DAP blocks for both to work together |
| 393 |
ifdef ESMF_INC |
| 394 |
ESMF_INC_FLG := -I${ESMF_INC} |
| 395 |
else |
| 396 |
ifdef ESMF_ROOT |
| 397 |
ifeq (${PVM_ARCH},MACOS) |
| 398 |
ESMF_INC_FLG := -I${ESMF_ROOT}/include/esmf |
| 399 |
else |
| 400 |
ESMF_INC_FLG := -I${ESMF_ROOT}/include |
| 401 |
endif # !MACOS |
| 402 |
else |
| 403 |
ESMF_INC_FLG := -I/usr/local/include |
| 404 |
endif # !ESMF_ROOT |
| 405 |
endif # !ESMF_INC |
| 406 |
# 20150319: For some reason, ESMC.h #includes ESMC_VM.h which #includes mpi.h |
| 407 |
ifeq (${PVM_ARCH},MACOS) |
| 408 |
# Use stub header for uniprocessor MPI emulation provided by ESMF |
| 409 |
ESMF_INC_FLG += -I/Users/zender/data/esmf/src/Infrastructure/stubs/mpiuni |
| 410 |
ESMF_LIB_RT := ${null} |
| 411 |
ESMF_LIB_LAPACK := -llapack |
| 412 |
ESMF_LIB_XERCES := -lxerces-c |
| 413 |
else # !MACOS |
| 414 |
# Use real MPI |
| 415 |
ESMF_INC_FLG += -I/usr/include/openmpi-x86_64 |
| 416 |
ESMF_LIB_RT := -lrt |
| 417 |
ESMF_LIB_LAPACK := ${null} |
| 418 |
ESMF_LIB_XERCES := ${null} |
| 419 |
endif # !MACOS |
| 420 |
ifdef ESMF_LIB |
| 421 |
ESMF_LIB_FLG := -L${ESMF_LIB} -lesmf ${ESMF_LIB_LAPACK} ${ESMF_LIB_RT} ${ESMF_LIB_XERCES} -lgfortran -ldl -lnetcdff -lnetcdf_c++ |
| 422 |
else |
| 423 |
ifdef ESMF_ROOT |
| 424 |
ESMF_LIB_FLG := -L${ESMF_ROOT}/lib -lesmf ${ESMF_LIB_LAPACK} ${ESMF_LIB_RT} ${ESMF_LIB_XERCES} -lgfortran -ldl -lnetcdff -lnetcdf_c++ |
| 425 |
else |
| 426 |
ESMF_LIB_FLG := -L/usr/local/lib -lesmf ${ESMF_LIB_LAPACK} ${ESMF_LIB_RT} ${ESMF_LIB_XERCES} -lgfortran -ldl -lnetcdff -lnetcdf_c++ |
| 427 |
endif # !ESMF_ROOT |
| 428 |
endif # !ESMF_LIB |
| 429 |
endif # end if ESMF |
| 430 |
|
| 431 |
ifeq (${GSL},Y) |
| 432 |
# Build GSL-enabled NCO |
| 433 |
# Place GSL block after DAP blocks for both to work together |
| 434 |
ifdef GSL_ROOT |
| 435 |
GSL_CONFIG := ${GSL_ROOT}/bin/gsl-config |
| 436 |
else |
| 437 |
GSL_CONFIG := gsl-config |
| 438 |
endif |
| 439 |
ifdef GSL_INC |
| 440 |
GSL_INC_FLG := -I${GSL_INC} |
| 441 |
else |
| 442 |
GSL_INC_FLG := $(shell ${GSL_CONFIG} --cflags) |
| 443 |
endif # !GSL_INC |
| 444 |
ifdef GSL_LIB |
| 445 |
GSL_LIB_FLG := -L${GSL_LIB} -lgsl -lgslcblas |
| 446 |
else |
| 447 |
GSL_LIB_FLG := $(shell ${GSL_CONFIG} --libs) |
| 448 |
endif # !GSL_LIB |
| 449 |
ifndef GSL_MAJOR_VERSION |
| 450 |
# 20161118: Following line is always accurate |
| 451 |
GSL_MAJOR_VERSION := $(shell ${GSL_CONFIG} --version | cut -c 1 ) |
| 452 |
endif # !GSL_MAJOR_VERSION |
| 453 |
ifndef GSL_MINOR_VERSION |
| 454 |
# gsl-config --version: 1.16 (old GSL versioning) |
| 455 |
# gsl-config --version: 2.2.1 (new GSL versioning) |
| 456 |
# GSL_MINOR_VERSION := $(shell ${GSL_CONFIG} --version ) |
| 457 |
ifeq (${GSL_MAJOR_VERSION},2) |
| 458 |
GSL_MINOR_VERSION := $(shell ${GSL_CONFIG} --version | cut -c 3 ) |
| 459 |
GSL_PATCH_VERSION := $(shell ${GSL_CONFIG} --version | cut -c 5 ) |
| 460 |
else # !GSL_MAJOR_VERSION |
| 461 |
GSL_MINOR_VERSION := $(shell ${GSL_CONFIG} --version | sed s/^[1-9]\.// ) |
| 462 |
GSL_PATCH_VERSION := 0 |
| 463 |
endif # !GSL_MAJOR_VERSION |
| 464 |
ifeq (${GSL_MINOR_VERSION},${null}) |
| 465 |
GSL_MINOR_VERSION := 4 |
| 466 |
GSL_PATCH_VERSION := 0 |
| 467 |
endif # end if GSL_MINOR_VERSION |
| 468 |
endif # !GSL_PATCH_VERSION |
| 469 |
ifndef GSL_PATCH_VERSION |
| 470 |
GSL_PATCH_VERSION := 0 |
| 471 |
endif # !GSL_PATCH_VERSION |
| 472 |
endif # end if GSL |
| 473 |
|
| 474 |
ifeq (${SZ},Y) |
| 475 |
# 20150515: -lsz needed (at least by icc) on rhea |
| 476 |
ifdef SZ_LIB |
| 477 |
SZ_LIB_FLG := -L${SZ_LIB} -lsz |
| 478 |
else |
| 479 |
SZ_LIB_FLG := -lsz |
| 480 |
endif # end if SZ_LIB |
| 481 |
endif # end if SZ |
| 482 |
|
| 483 |
ifeq (${UDUNITS},Y) |
| 484 |
# 20130607: -lexpat needed on .deb systems, not on RPM systems |
| 485 |
ifdef UDUNITS_INC |
| 486 |
UDUNITS_INC_FLG := -I${UDUNITS_INC} |
| 487 |
else |
| 488 |
UDUNITS_INC_FLG := -I/usr/include/udunits2 |
| 489 |
endif # !UDUNITS_INC |
| 490 |
ifdef UDUNITS_LIB |
| 491 |
UDUNITS_LIB_FLG := -L${UDUNITS_LIB} -ludunits2 |
| 492 |
else |
| 493 |
UDUNITS_LIB_FLG := -ludunits2 |
| 494 |
endif # end if UDUNITS_LIB |
| 495 |
endif # end if UDUNITS |
| 496 |
|
| 497 |
# At this point we change NETCDF_INC from a directory to a flag |
| 498 |
NC_CFLAGS := $(shell ${NETCDF_ROOT}/bin/nc-config --cflags) |
| 499 |
NC_LDFLAGS := $(shell ${NETCDF_ROOT}/bin/nc-config --libs) |
| 500 |
NCO_LDFLAGS := -L${MY_LIB_DIR} -lnco |
| 501 |
|
| 502 |
ifeq (${MPI},Y) |
| 503 |
# Enable MPI functionality |
| 504 |
NC_CFLAGS := $(shell /usr/local/parallel/bin/nc-config --cflags) |
| 505 |
NC_LDFLAGS := $(shell /usr/local/parallel/bin/nc-config --libs) |
| 506 |
MPI_CFLAGS := -I/usr/include/openmpi-x86_64 |
| 507 |
MPI_LDFLAGS := -L/usr/lib64/openmpi/lib -lmpi |
| 508 |
endif # !MPI |
| 509 |
|
| 510 |
ifdef LIB_NCAR |
| 511 |
NC_LDFLAGS := ${LIB_NCAR} ${NC_LDFLAGS} |
| 512 |
endif |
| 513 |
|
| 514 |
OTHER_CFLAGS := ${ESMF_INC_FLG} ${NC_CFLAGS} ${MPI_CFLAGS} ${GSL_INC_FLG} ${UDUNITS_INC_FLG} |
| 515 |
OTHER_LDFLAGS := ${NCO_LDFLAGS} ${ESMF_LIB_FLG} ${NC_LDFLAGS} ${MPI_LDFLAGS} ${GSL_LIB_FLG} ${SZ_LIB_FLG} ${UDUNITS_LIB_FLG} |
| 516 |
|
| 517 |
# NB: Do NOT add comment lines, e.g., # This is a comma, to character definitions |
| 518 |
null := |
| 519 |
space := ${null} ${null} |
| 520 |
comma := , |
| 521 |
newline := \n |
| 522 |
# '/' and '+' appear in filenames ('/' is directory separator) |
| 523 |
# Operating on these with Perl is problematic since they are special Rx characters |
| 524 |
# We replace `/' and '+' by non-special Rx's, call perl, then demangle |
| 525 |
# Unique character(s) to substitute for '/' and '+' before passing to perl Rx |
| 526 |
slash_rx := cszzsc |
| 527 |
plus_rx := xdikmj |
| 528 |
# Unique character(s) to replace by ${slash_rx} before passing to perl regex |
| 529 |
slash := / |
| 530 |
plus := + |
| 531 |
MY_OBJ_DIR_RX := $(subst ${slash},${slash_rx},${MY_OBJ_DIR}) |
| 532 |
MY_DPN_DIR_RX := $(subst ${slash},${slash_rx},${MY_DPN_DIR}) |
| 533 |
|
| 534 |
# Directories to search for source files |
| 535 |
MDL_PTH := ./ ${MY_SRC_DIR} |
| 536 |
# Find all C, C++, CUDA files in given directory |
| 537 |
FIND_FNC = $(wildcard ${dir}/*.cc ${dir}/*.c ${dir}/*.cu) |
| 538 |
# Assemble source files from all directories |
| 539 |
SRC_LST = $(foreach dir, ${MDL_PTH},$(FIND_FNC)) |
| 540 |
# Source file names with directories removed |
| 541 |
MDL_SRC := $(notdir $(SRC_LST)) |
| 542 |
# Dependency list for executable |
| 543 |
MDL_OBJ := $(addprefix ${MY_OBJ_DIR}/,$(addsuffix .o, $(basename ${MDL_SRC}))) |
| 544 |
# Dependency (make) file for each object file |
| 545 |
MDL_DPN := $(addprefix ${MY_DPN_DIR}/,$(addsuffix .d, $(basename ${MDL_SRC}))) |
| 546 |
# VPATH helps make find dependencies (which are not pathname qualified) in *.d file |
| 547 |
VPATH := $(subst ${space},:,${MDL_PTH}) |
| 548 |
# Prepend -I to use for compiler argument |
| 549 |
CPP_PTH := $(foreach dir,${MDL_PTH},-I${dir}) |
| 550 |
|
| 551 |
# Variables having to do with binary executables created by module |
| 552 |
MDL_BIN_TRG := ncap ncatted ncbo ncecat ncflint ncks ncpdq ncra ncrename ncwa # NCO binary targets |
| 553 |
MDL_BIN_SYM_LNK := ncdiff ncea nces ncrcat # Symbolic links |
| 554 |
MDL_BIN_SPT := ncclimo ncremap ncz2psx ncchecker # Scripts |
| 555 |
ifeq (${MPI},Y) |
| 556 |
# MDL_MPI_TRG := mpncbo mpncecat mpncflint mpncpdq mpncra mpncwa # MPI binary targets |
| 557 |
MDL_MPI_TRG := # MPI binary targets |
| 558 |
MDL_MPI_TRG_SMP := ncbo ncecat ncflint ncpdq ncra ncwa # MPI binary targets |
| 559 |
# MDL_MPI_SYM_LNK := mpncdiff mpncea mpnces mpncrcat # MPI Symbolic links |
| 560 |
MDL_MPI_SYM_LNK := # MPI Symbolic links |
| 561 |
MDL_MPI_STB := ${MDL_MPI_TRG} ${MDL_MPI_SYM_LNK} # All MPI files in MY_BIN_DIR |
| 562 |
MDL_MPI_BIN := $(addprefix ${MY_BIN_DIR}/,${MDL_MPI_TRG}) # mpi_cln removes these files |
| 563 |
MDL_MPI_OBJ := $(addsuffix .o,$(addprefix ${MY_OBJ_DIR}/,${MDL_MPI_TRG})) # mpi_cln removes these files |
| 564 |
MDL_BIN_TRG += ${MDL_MPI_TRG} # NCO binary targets |
| 565 |
MDL_BIN_SYM_LNK += ${MDL_MPI_SYM_LNK} # Symbolic links |
| 566 |
endif # !MPI |
| 567 |
MDL_BIN_STB := ${MDL_BIN_TRG} ${MDL_BIN_SPT} ${MDL_BIN_SYM_LNK} # All NCO files in MY_BIN_DIR |
| 568 |
MDL_BIN := $(addprefix ${MY_BIN_DIR}/,${MDL_BIN_STB}) # distclean removes these files |
| 569 |
MDL_SPT_SRC := $(addprefix ${MY_DAT_DIR}/,${MDL_BIN_SPT}) |
| 570 |
|
| 571 |
# Variables having to do with header files created by module |
| 572 |
# List header targets alphabetically by "category": |
| 573 |
MDL_INC_TRG := # Raw (no functions) |
| 574 |
MDL_INC_TRG += libnco.h # libnco |
| 575 |
MDL_INC_SYM_LNK := # Symbolic links |
| 576 |
MDL_INC_STB = ${MDL_INC_TRG} ${MDL_INC_SYM_LNK} # All header files in ${MY_INC_DIR} |
| 577 |
MDL_INC = $(addprefix ${MY_INC_DIR}/,${MDL_INC_STB}) # dst_cln removes these files |
| 578 |
|
| 579 |
# Variables having to do with NCO data |
| 580 |
MDL_DAT_STB := 85 86 87 88 89 h0001 h0002 h0003 # Symbolic links to in.nc |
| 581 |
MDL_DAT_STB := $(addsuffix .nc,${MDL_DAT_STB}) # `make data' creates these files |
| 582 |
MDL_DAT := $(addprefix ${MY_DAT_DIR}/,${MDL_DAT_STB}) # `make distclean' removes these files |
| 583 |
|
| 584 |
# Variables having to do with NCO documentation |
| 585 |
MDL_DOC_SRC := $(addprefix ../,acinclude.m4 CMakeLists.txt configure.ac configure.eg Makefile.am) $(addprefix ${MY_DOC_DIR}/,nco.texi ANNOUNCE MANIFEST TODO VERSION beta.txt debian.txt dods.sh index.shtml xmp_cesm.html man_end.txt man_srt.txt ncap.txt nco_news.shtml nco_src_frg.txt opendap.sh) $(addprefix ${MY_DBN_DIR}/,changelog compat control copyright files info rules doc-base) # `make tags' includes these files |
| 586 |
MDL_DOC_TRG := nco.dvi nco.html nco.info nco.pdf nco.ps nco.txt nco.xml # `make doc' creates these files |
| 587 |
MDL_DOC := $(addprefix ${MY_DOC_DIR}/,${MDL_DOC_TRG}) # `make distclean' removes these files |
| 588 |
|
| 589 |
MDL_MAN := $(wildcard ${MY_MAN_DIR}/*.1) |
| 590 |
MDL_MAN := $(notdir ${MDL_MAN}) |
| 591 |
MDL_MAN := $(addprefix ${MY_MAN_DIR}/,${MDL_MAN}) # distclean removes these files |
| 592 |
|
| 593 |
# Variables having to do with NCO build |
| 594 |
MDL_BLD_SRC := $(addprefix ${MY_BLD_DIR}/,libnco_tst.c libnco_c++_tst.cc Makefile nco.spec nco_dst.pl) # `make tags' includes these files |
| 595 |
MDL_BLD_SRC += $(addprefix ${MY_BM_DIR}/,NCO_bm.pm NCO_benchmarks.pm NCO_rgr.pm nco_bm.pl nco_bm.sh mk_bm_plots.pl) # `make tags' includes these files |
| 596 |
MDL_BLD_SRC += $(addprefix ${MY_DAT_DIR}/,Makefile.am) $(addprefix ${MY_SRC_DIR}/,Makefile.am) $(addprefix ${MY_DOC_DIR}/,Makefile.am) $(addprefix ${NCO_CXX_SRC_DIR}/,Makefile.am) $(addprefix ${NCOXX_SRC_DIR}/,Makefile.am) # `make tags' includes these files |
| 597 |
# Files, if any, to exclude from tags |
| 598 |
#TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc ../src/nco/lex.${NCO_YY_PFX}.c |
| 599 |
TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc ../bld/lex.${NCO_YY_PFX}.c |
| 600 |
# TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc |
| 601 |
|
| 602 |
# Variables having to do with ncap |
| 603 |
MDL_NCAP_SRC := $(addprefix ${MY_SRC_DIR}/,ncap_lex.l ncap_utl.h) # `make tags' includes these files |
| 604 |
MDL_NCAP_TRG := ncap_lex.c # `make ncap' creates these files |
| 605 |
MDL_NCAP := $(addprefix ${MY_SRC_DIR}/,${MDL_NCAP_TRG}) # `make distclean' removes these files |
| 606 |
|
| 607 |
# Variables having to do with C++ source and documentation |
| 608 |
# fxm: auto-generate source code components of C++ lists |
| 609 |
MDL_CXX_SRC := $(addprefix ${NCOXX_SRC_DIR}/,libnco++.hh Makefile.am Makefile.old ncap2.cc ncap2.hh ncap2_utl.cc NcapVar.cc NcapVar.hh NcapVarVector.cc NcapVarVector.hh NcapVector.hh ncoGrammar.g nco_antlr_pst_prc.pl fmc_cls.cc fmc_cls.hh fmc_all_cls.cc fmc_all_cls.hh fmc_gsl_cls.cc fmc_gsl_cls.hh Invoke.cc Invoke.hh map_srt_tmp.hh nco_gsl.cc nco_gsl.hh prs_cls.cc prs_cls.hh sdo_utl.cc sdo_utl.hh sym_cls.cc sym_cls.hh VarOp.hh vtl_cls.hh) $(addprefix ${NCO_CXX_SRC_DIR}/,INSTALL libnco_c++.hh Makefile.am Makefile.old nco_att.cc nco_att.hh nco_dmn.cc nco_dmn.hh nco_fl.cc nco_fl.hh nco_hgh.cc nco_hgh.hh nco_utl.cc nco_utl.hh nco_var.cc nco_var.hh README TODO tst.cc) # `make tags' includes these files |
| 610 |
|
| 611 |
TAGS_FILES := ${MY_SRC_DIR}/*.h $(filter-out ${TAGS_FILTER_FILES},${SRC_LST}) ${MDL_DOC_SRC} ${MDL_MAN} ${MDL_BLD_SRC} ${MDL_CXX_SRC} ${MDL_NCAP_SRC} ${MDL_SPT_SRC} |
| 612 |
|
| 613 |
# Redefine default C and C++ pattern rules |
| 614 |
${MY_OBJ_DIR}/%.o : %.c |
| 615 |
${CC} ${CPPFLAGS} ${CFLAGS} -c $< -o ${MY_OBJ_DIR}/$(notdir $@) |
| 616 |
${MY_OBJ_DIR}/%.o : %.cu |
| 617 |
nvcc -deviceemu ${CPPFLAGS} ${CFLAGS} -c $< -o ${MY_OBJ_DIR}/$(notdir $@) |
| 618 |
${MY_OBJ_DIR}/%.o : %.ccxb |
| 619 |
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c $< -o ${MY_OBJ_DIR}/$(notdir $@) |
| 620 |
|
| 621 |
# Default Fortran pattern rules: CRAY and RS6K must override these rules |
| 622 |
${MY_OBJ_DIR}/%.o : %.F |
| 623 |
${FC} ${CPPFLAGS} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 624 |
${MY_OBJ_DIR}/%.o : %.f |
| 625 |
${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 626 |
|
| 627 |
# Rules for installing header files |
| 628 |
#${MY_INC_DIR}/%.h : %.h |
| 629 |
# cp -f -p $(notdir $@) $@ |
| 630 |
${MY_INC_DIR}/%.hh : %.hh |
| 631 |
cp -f -p $(notdir $@) $@ |
| 632 |
|
| 633 |
# Rules for installing i18n files |
| 634 |
# -k_ : Treat underscore as keyword (so "_" is equivalent to "gettext") |
| 635 |
# --default-domain : Name of program or library |
| 636 |
# --join-existing : Join messages with existing file |
| 637 |
%.po : %.c |
| 638 |
xgettext --default-domain=$* -k_ --join-existing $< |
| 639 |
${MY_ES_DIR}/%.mo : %.po |
| 640 |
# Linux version accepts more arguments than Solaris version |
| 641 |
# msgfmt --output-file=$@ --statistics $< |
| 642 |
msgfmt -o $@ $< |
| 643 |
|
| 644 |
# Automatically generate a dependency file for each source file |
| 645 |
# $* is the stem, e.g., f |
| 646 |
# $@ is the filename of the target, e.g., f.d |
| 647 |
# Linux gcc may return an extra `.F' on Fortran names, e.g., `hello.F.o: hello.F' |
| 648 |
# (.F)? gets rid of this extra `.F' |
| 649 |
${MY_DPN_DIR}/%.d : %.F |
| 650 |
# Following command makes, e.g., f.d begin "f.o f.d : f.F ..." |
| 651 |
# Since f.o is not preceded by ${MY_OBJ_DIR}, objects are not recompiled when sources are touched. |
| 652 |
# ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.F\.o/$*.o $@/g;' > $@ |
| 653 |
# Following command makes, e.g., f.d begin "/home/zender/obj/LINUX/f.o f.d : f.F ..." |
| 654 |
# This works fairly well, but is a hack |
| 655 |
# First pattern substitutes MY_OBJ_DIR_RX, which has placeholders for slashes |
| 656 |
# Second pattern substitutes slashes for the placeholders |
| 657 |
${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*(\.F)?\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ |
| 658 |
# Following command makes, e.g., f.d begin "${MY_OBJ_DIR}/f.o f.d : f.F ..." |
| 659 |
# This would be the ideal command but I can't get the dollar sign to show up |
| 660 |
# ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.F\.o/\${dollar}MY_OBJ_DIR\/$*.o $@/g;' > $@ |
| 661 |
|
| 662 |
${MY_DPN_DIR}/%.d : %.c |
| 663 |
# ${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.o/$*.o $@/g;' > $@ |
| 664 |
${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ |
| 665 |
|
| 666 |
${MY_DPN_DIR}/%.d : %.cu |
| 667 |
nvcc -M ${CPPFLAGS} $< | perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ |
| 668 |
|
| 669 |
${MY_DPN_DIR}/%.d : %.cc |
| 670 |
# NB: Use ${CXX} rather than ${CPP} on C++ files for now because, e.g., SUNMP cpp does not pre-process .cc files quite correctly |
| 671 |
# Extra hack to allow C++ filenames to contain '+' character |
| 672 |
# $(subst ${plus},${plus_rx},${*}) is filename stub with an Rx in place of '+' |
| 673 |
${MK_DPN_CXX} ${CXXCPPFLAGS} $< | perl -p -e 's/\${plus}/${plus_rx}/g;s/$(subst ${plus},${plus_rx},${*})\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g;s/${plus_rx}/\${plus}/g' > $@ |
| 674 |
|
| 675 |
# First LDFLAGS is for typical C programs with netCDF, math, and networking |
| 676 |
# Second LDFLAGS, when present, enables C/Fortran linking |
| 677 |
|
| 678 |
# Manually define autotools tokens normally defined with HAVE_CONFIG_H in config.h |
| 679 |
# Initialize OS-specific tokens to empty |
| 680 |
CPP_TKN_OS := -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DNEED_STRCASESTR |
| 681 |
# Assume netCDF >= 3.6.1 |
| 682 |
CPP_TKN_OS += -DHAVE_NC_INQ_FORMAT |
| 683 |
# Assume netCDF >= 4.3.1 |
| 684 |
# NC_HAVE_RENAME_GRP replaced HAVE_NC_RENAME_GRP in netCDF 4.9.0 |
| 685 |
CPP_TKN_OS += -DHAVE_NC_RENAME_GRP -DNC_HAVE_RENAME_GRP |
| 686 |
# Assume netCDF >= 4.3.2 |
| 687 |
CPP_TKN_OS += -DHAVE_NC_INQ_PATH |
| 688 |
# Assume netCDF >= 4.6.1 |
| 689 |
CPP_TKN_OS += -DHAVE_NC_SET_LOG_LEVEL |
| 690 |
# Assume netCDF >= 4.4.0, but Ubuntu 4.4.0 (e.g., on grele) fumbled netcdf_mem.h header |
| 691 |
ifndef UBUNTU_440 |
| 692 |
CPP_TKN_OS += -DHAVE_NETCDF_MEM_H |
| 693 |
endif # !grele |
| 694 |
# gcc 4.7.3 finally includes strcasestr() in string.h iff _GNU_SOURCE token is defined |
| 695 |
# NB: C++ (or at least g++ 4.7.3) always includes strcasestr()---work around this with tokens in nco_sng_utl.[ch] |
| 696 |
ifneq (${PVM_ARCH},CRAY) |
| 697 |
CPP_TKN_OS += -DHAVE_MKSTEMP |
| 698 |
endif # CRAY |
| 699 |
ifneq (${null},$(findstring ${PVM_ARCH},FREEBSDLINUXALPHALINUXAMD64LINUXARMMACOSWINOS)) |
| 700 |
CPP_TKN_OS += -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG |
| 701 |
endif # !LINUX |
| 702 |
ifneq (${null},$(findstring ${PVM_ARCH},AIXSGIMP64)) |
| 703 |
CPP_TKN_OS += -DNEED_GETOPT_LONG |
| 704 |
endif # !(AIX || SGI) |
| 705 |
ifeq (${CNK},Y) |
| 706 |
CPP_TKN_OS += -DHAVE_NEW_CHUNKING_API -DNC_HAVE_NEW_CHUNKING_API |
| 707 |
endif # !CNK |
| 708 |
ifeq (${DAP},Y) |
| 709 |
CPP_TKN_OS += -DENABLE_DAP |
| 710 |
endif # !DAP |
| 711 |
ifeq (${ESMF},Y) |
| 712 |
CPP_TKN_OS += -DENABLE_ESMF |
| 713 |
endif # !ESMF |
| 714 |
ifeq (${GSL},Y) |
| 715 |
CPP_TKN_OS += -DENABLE_GSL -DHAVE_GSL_H |
| 716 |
endif # !GSL |
| 717 |
ifeq (${MPI},Y) |
| 718 |
ifneq (${MPI_FAKE},Y) |
| 719 |
CPP_TKN_OS += -DENABLE_MPI |
| 720 |
endif # MPI_FAKE |
| 721 |
endif # !MPI |
| 722 |
ifeq (${UDUNITS},Y) |
| 723 |
CPP_TKN_OS += -DENABLE_UDUNITS -DHAVE_UDUNITS_H -DHAVE_UDUNITS2_H |
| 724 |
endif # !UDUNITS |
| 725 |
ifeq (${NETCDF4},Y) |
| 726 |
CPP_TKN_OS += -DENABLE_NETCDF4 -DHAVE_NETCDF4_H |
| 727 |
endif # !NETCDF4 |
| 728 |
ifeq (${PNETCDF},Y) |
| 729 |
CPP_TKN_OS += -DENABLE_PNETCDF |
| 730 |
endif # !PNETCDF |
| 731 |
# !PNETCDF |
| 732 |
# Assume strcasecmp() and strdup() routines are present (Comeau, Pathscale are exceptions) |
| 733 |
CPP_TKN_OS += |
| 734 |
# fxm: Define HAVE_LIBINTL, HAVE_LOCALE_H, HAVE_GETTEXT, HAVE_OMP_H |
| 735 |
|
| 736 |
# Works on AIX and AIX46K |
| 737 |
ifneq (${null},$(findstring AIX,${PVM_ARCH})) |
| 738 |
# 20030804: Always use re-entrant (_r) compilers---Jim Edwards NCAR/IBM |
| 739 |
CC := xlc_r -qlanglvl=extc99 |
| 740 |
#CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 741 |
CXX := xlC_r |
| 742 |
# CXX := g++ |
| 743 |
CPP := xlc -c -qlanglvl=extc99 -qsuppress=1501-245 -I/usr/lpp/ppe.poe/include |
| 744 |
FC := xlf95_r |
| 745 |
ifneq (${null},$(findstring xl,${CC})) |
| 746 |
# /usr/include headers must occur before Visual Age headers to prevent xlC pragma warnings |
| 747 |
# Visual Age compiler headers must occur before g++ headers |
| 748 |
CPP_TKN_OS += -I/usr/include -I/usr/vacpp/include |
| 749 |
endif # xlC compilers |
| 750 |
# Add /usr/local/include for libintl.h explicitly until netCDF is moved there |
| 751 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} -DNEED_LOGF |
| 752 |
LD := ld |
| 753 |
# 20020422: -lC links to AIX C++ library which contains float intrinsics cosf()... |
| 754 |
# -bh:5 suppresses annoying messages from xlC linker WARNING: Duplicate symbol: ... |
| 755 |
LDFLAGS += -bh:5 ${OTHER_LDFLAGS} -lm -lC |
| 756 |
LEX := flex |
| 757 |
LINT := lint |
| 758 |
YACC := bison |
| 759 |
# AIX VA Compiler Collection |
| 760 |
ifneq (${null},$(findstring xl,${CC})) |
| 761 |
# Visual Age compiler defaults specified in /etc/vac.cfg |
| 762 |
# Additional switch to fix compiler warnings on csz.c |
| 763 |
# -qarch=auto : Automatically detect architecture of compiling machine and assume execution on same machine |
| 764 |
# -qlonglong allow long long integers (and strtoll(), strtoull()) (default on in C not C++). Redundant with -qlanglvl=extc99 |
| 765 |
# -qmaxmem=num Limit memory used by space intensive optimizations to <num> kilobytes |
| 766 |
# -qspill=size Size in B of register allocation spill area, mie needs > 1040 B |
| 767 |
# -qsrcmsg prints transgressing source line with finger |
| 768 |
# -qsuppress=1501-245 : Suppress RLIM_INFINITY memory message due to ulimits |
| 769 |
# -qtune=auto : Optimize executable for architecture detected during compilation |
| 770 |
CFLAGS := -qmaxmem=8192 -qspill=2048 -qsrcmsg -qsuppress=1501-245 |
| 771 |
FFLAGS := -NS2000 -qfixed=132 -qsrcmsg |
| 772 |
# -bh:5 suppresses annoying messages from xlC linker WARNING: Duplicate symbol: ... |
| 773 |
LDFLAGS += -bh:5 -qsuppress=1501-245 |
| 774 |
#LDFLAGS += -lxlf90 # Required for linking Fortran objects |
| 775 |
ifeq (${OMP},Y) |
| 776 |
FC := xlf95_r |
| 777 |
# -qsmp=noauto : Turn on SMP/OMP code generation but do no automatic parallelization |
| 778 |
# -qsmp=omp : Use industry standard OMP without IBM extensions |
| 779 |
OMP_FLG := -qsmp=omp |
| 780 |
else |
| 781 |
CPP_DFN += -U_OPENMP |
| 782 |
FC := xlf95 |
| 783 |
endif # !OMP |
| 784 |
ifeq (${OPTS},O) |
| 785 |
# -O : -O3 is safe, -O5 is dangerous |
| 786 |
# -qstrict: Ensure that -O3 optimizations do not alter program semantics |
| 787 |
# -Q : Inline all appropriate subprograms |
| 788 |
CFLAGS += -O3 -g -qstrict -Q |
| 789 |
FFLAGS += -O3 -g -qstrict -Q |
| 790 |
endif |
| 791 |
ifeq (${OPTS},D) |
| 792 |
CFLAGS += -g |
| 793 |
FFLAGS += -g |
| 794 |
endif |
| 795 |
ifeq (${OPTS},X) |
| 796 |
# -qflttrap generates instructions for floating point exceptions |
| 797 |
# -qidirfirst uses headers found in -I directories first |
| 798 |
# -qmakedep creates .d file |
| 799 |
# -qwarn64 check for possible long-to-integer or pointer-to-integer truncation |
| 800 |
# -qhalt=e stop compiler if error severity equals or exceeds i, w, e, s, u |
| 801 |
CFLAGS += -g -qflttrap -qidirfirst -qwarn64 -qcheck=all -qhalt=s |
| 802 |
FFLAGS += -g |
| 803 |
endif |
| 804 |
ifeq (${ABI},64) |
| 805 |
AR := ar -X 64 |
| 806 |
CFLAGS += -q64 |
| 807 |
FFLAGS += -q64 |
| 808 |
LDFLAGS += -q64 |
| 809 |
else |
| 810 |
CPPFLAGS += -D_LARGE_FILES |
| 811 |
endif # !ABI |
| 812 |
# Additional flags for AIX: |
| 813 |
# -M Generate information to be included in a "make" description file; output goes to .u file |
| 814 |
# -c Do not send object files to the linkage editor |
| 815 |
# -P Preprocess but do not compile; output goes to .i file |
| 816 |
# Using -P causes additional warning messages about lm |
| 817 |
# Not using -P causes *.o files to be created twice |
| 818 |
${MY_DPN_DIR}/%.d : %.c |
| 819 |
${MK_DPN} ${CPPFLAGS} $< ;perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' $*.u > $@ ; \ |
| 820 |
rm -f $*.i $*.o $*.u; |
| 821 |
${MY_DPN_DIR}/%.d : %.cc |
| 822 |
${MK_DPN_CXX} ${CPPFLAGS} $< ;perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' $*.u > $@ ; \ |
| 823 |
rm -f $*.i $*.o $*.u; |
| 824 |
endif # !AIX VA Compiler Collection |
| 825 |
# GNU Compiler Collection |
| 826 |
ifneq (${null},$(findstring gcc,${CC})) |
| 827 |
CFLAGS := -Wall -Werror=format-security -Wunused |
| 828 |
ifeq (${OPTS},O) |
| 829 |
CFLAGS += -O -g ${GCC_RCH_ARG} |
| 830 |
endif |
| 831 |
ifeq (${OPTS},D) |
| 832 |
CFLAGS += -g |
| 833 |
endif |
| 834 |
ifeq (${OPTS},R) |
| 835 |
CFLAGS += |
| 836 |
endif |
| 837 |
ifeq (${OPTS},X) |
| 838 |
CFLAGS += -g -O |
| 839 |
LDFLAGS += /usr/local/lib/ccmalloc-g++.o -L/usr/local/lib -lccmalloc -ldl |
| 840 |
endif |
| 841 |
ifeq (${ABI},64) |
| 842 |
CC += -maix64 |
| 843 |
CXX += -maix64 |
| 844 |
endif # !ABI |
| 845 |
CXXFLAGS := ${CFLAGS} |
| 846 |
endif # !GNU Compiler Collection |
| 847 |
# -q64: Select 64-bit compiler mode (required for accessing large files) |
| 848 |
# -qwarn64: Warn on possible long-to-integer or pointer-to-integer truncation |
| 849 |
CXXFLAGS := ${CFLAGS} |
| 850 |
ifeq (${OMP},Y) |
| 851 |
CFLAGS += ${OMP_FLG} |
| 852 |
CXXFLAGS += ${OMP_FLG} |
| 853 |
FFLAGS += ${OMP_FLG} |
| 854 |
LDFLAGS := ${OMP_FLG} ${LDFLAGS} |
| 855 |
endif # !OMP |
| 856 |
endif |
| 857 |
# !AIX |
| 858 |
|
| 859 |
ifeq (${PVM_ARCH},ALPHA) |
| 860 |
ifeq (${OMP},Y) |
| 861 |
OMP_FLG := -omp |
| 862 |
endif # !OMP |
| 863 |
CXX := cxx |
| 864 |
CC := cc |
| 865 |
CFLAGS := ${OMP_FLG} |
| 866 |
CPP := cpp |
| 867 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 868 |
FC := f90 |
| 869 |
FFLAGS := -r8 -i4 -c ${OMP_FLG} -automatic |
| 870 |
FIXEDFLAGS := -extend_source ${OMP_FLG} -automatic |
| 871 |
FREEFLAGS := -DHIDE_SHR_MSG -free |
| 872 |
LD := ld |
| 873 |
LDFLAGS += ${OMP_FLG} ${OTHER_LDFLAGS} -lm |
| 874 |
LEX := flex |
| 875 |
LINT := lint |
| 876 |
YACC := bison |
| 877 |
ifeq (${OPTS},O) |
| 878 |
CFLAGS += -O2 -g -ansi_alias |
| 879 |
FFLAGS += -O3 -g -inline speed |
| 880 |
endif |
| 881 |
ifeq (${OPTS},D) |
| 882 |
CFLAGS += -g -check_bounds -check -check_omp |
| 883 |
FFLAGS += -g3 -C |
| 884 |
endif |
| 885 |
ifeq (${OPTS},X) |
| 886 |
CFLAGS := -g -N 132 |
| 887 |
FFLAGS := -g -check bounds -check omp_bindings -check overflow -check underflow |
| 888 |
endif |
| 889 |
CXXFLAGS := ${CFLAGS} |
| 890 |
${MY_OBJ_DIR}/%.o : %.F90 |
| 891 |
${FC} -c ${FREEFLAGS} ${FFLAGS} ${CPPFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 892 |
${MY_OBJ_DIR}/%.o : %.F |
| 893 |
${FC} -c ${FIXEDFLAGS} ${FFLAGS} ${CPPFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 894 |
endif |
| 895 |
# !ALPHA |
| 896 |
|
| 897 |
ifeq (${PVM_ARCH},CRAY) |
| 898 |
CXX := CC |
| 899 |
CC := cc |
| 900 |
CPP := cpp |
| 901 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 902 |
FC := f90 |
| 903 |
# -F enables macro substitution |
| 904 |
# -dp enables DOUBLEPRECISION/double |
| 905 |
FFLAGS := -N 132 -F -dp |
| 906 |
LD := ld |
| 907 |
LDFLAGS += ${OTHER_LDFLAGS} -lm |
| 908 |
LEX := flex |
| 909 |
LINT := lint |
| 910 |
YACC := bison |
| 911 |
ifeq (${OPTS},O) |
| 912 |
CFLAGS += -h rounddiv -h nofastmd -h nofastmodulus |
| 913 |
FFLAGS += -O2 -g |
| 914 |
endif |
| 915 |
ifeq (${OPTS},D) |
| 916 |
CFLAGS += -g -h indef -h rounddiv -h nofastmd -h nofastmodulus |
| 917 |
FFLAGS += -g -ei |
| 918 |
endif |
| 919 |
ifeq (${OPTS},X) |
| 920 |
CFLAGS += -g -h rounddiv -h indef -h bounds -h nofastmd -h nofastmodulus |
| 921 |
FFLAGS += -g -ei -Rabc |
| 922 |
endif |
| 923 |
# 19971021 Added -P to suppress #line # directives on Fortran files |
| 924 |
${MY_OBJ_DIR}/%.o : %.F |
| 925 |
${CPP} -P ${CPPFLAGS} $< > $(patsubst %.F,%.f,$(notdir $<)) |
| 926 |
${FC} -c ${FFLAGS} $(patsubst %.F,%.f,$(notdir $<)) |
| 927 |
-mv -f $(notdir $@) ${MY_OBJ_DIR} |
| 928 |
rm -f $(patsubst %.F,%.f,$(notdir $<)) |
| 929 |
${MY_OBJ_DIR}/%.o : %.f |
| 930 |
${FC} -c ${FFLAGS} $< |
| 931 |
mv -f $(notdir $@) ${MY_OBJ_DIR} |
| 932 |
endif |
| 933 |
# !CRAY |
| 934 |
|
| 935 |
ifeq (${PVM_ARCH},HPPA) |
| 936 |
CXX := g++ |
| 937 |
CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 938 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 939 |
FC := f77 |
| 940 |
LD := ld |
| 941 |
LDFLAGS += ${OTHER_LDFLAGS} -lnsl -lm |
| 942 |
LEX := flex |
| 943 |
LINT := lint |
| 944 |
YACC := bison |
| 945 |
ifeq (${OPTS},O) |
| 946 |
CFLAGS += -O2 -g |
| 947 |
FFLAGS := -fast -eendif |
| 948 |
endif |
| 949 |
ifeq (${OPTS},D) |
| 950 |
CFLAGS += -g |
| 951 |
FFLAGS := -g -e |
| 952 |
endif |
| 953 |
ifeq (${OPTS},X) |
| 954 |
CFLAGS += -g |
| 955 |
FFLAGS := -g -e |
| 956 |
endif |
| 957 |
endif |
| 958 |
# !HPPA |
| 959 |
|
| 960 |
# Works on LINUX, LINUXALPHA, LINUXAMD64, LINUXARM, and FREEBSD and MACOS |
| 961 |
ifneq (${null},$(findstring ${PVM_ARCH},LINUXALPHALINUXAMD64LINUXARMFREEBSDMACOS)) |
| 962 |
# 20161001 Linux ar with Ubuntu Xenial began using deterministic mode. -U undoes that. |
| 963 |
# 20161001 GNU ar -s is equivalent to ranlib |
| 964 |
# ar -D: Operate in deterministic mode (breaks NCO build on Ubuntu) |
| 965 |
# ar -r: replace existing or insert new file(s) into the archive |
| 966 |
# ar -s: equivalent to ranlib |
| 967 |
# ar -U: Do not operate in deterministic mode. This is the inverse of the D modifier, above: added files and the archive index will get their actual UID, GID, timestamp, and file mode values. |
| 968 |
# ar -U: Unavailable option in RHEL 6 (2010) used on Rhea and Titan |
| 969 |
# ar -v: be verbose |
| 970 |
ARFLAGS := rsUv |
| 971 |
ifneq (${null},$(findstring rhea,${HOSTNAME})) |
| 972 |
ARFLAGS := rsv |
| 973 |
else ifneq (${null},$(findstring titan,${HOSTNAME})) |
| 974 |
ARFLAGS := rsv |
| 975 |
else ifneq (${null},$(findstring ys,${HOSTNAME})) |
| 976 |
ARFLAGS := rsv |
| 977 |
endif # !rhea,titan,yellowstone |
| 978 |
ifeq (${PVM_ARCH},MACOS) |
| 979 |
ARFLAGS := rsv |
| 980 |
endif # !aerosol,firn |
| 981 |
CXX := ${LINUX_CXX} |
| 982 |
CC := ${LINUX_CC} |
| 983 |
CPP := ${CC} |
| 984 |
# NB: nameser.h needs -Di386, but gcc sends -Di586 (on pentiums) |
| 985 |
CPP_TKN_OS += -Di386 |
| 986 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 987 |
FC := ${LINUX_FC} |
| 988 |
LD := ld |
| 989 |
LDFLAGS += ${OTHER_LDFLAGS} -lm |
| 990 |
ifeq (${PVM_ARCH},MACOS) |
| 991 |
LDFLAGS += -lresolv |
| 992 |
endif # !MACOS |
| 993 |
LEX := flex |
| 994 |
LINT := lint |
| 995 |
YACC := bison |
| 996 |
# Comeau C Compiler |
| 997 |
ifeq (${CXX},como) |
| 998 |
CFLAGS := |
| 999 |
CPPFLAGS += -DNEED_STRCASECMP |
| 1000 |
CPPFLAGS += -DNEED_STRDUP |
| 1001 |
LDFLAGS := ${COMOROOT}/libcomo/libcomo.a ${LDFLAGS} |
| 1002 |
ifeq (${OPTS},O) |
| 1003 |
CFLAGS += -O -g |
| 1004 |
endif |
| 1005 |
ifeq (${OPTS},D) |
| 1006 |
CFLAGS += -g |
| 1007 |
endif |
| 1008 |
ifeq (${OPTS},R) |
| 1009 |
CFLAGS += |
| 1010 |
endif |
| 1011 |
ifeq (${OPTS},X) |
| 1012 |
CFLAGS += -g |
| 1013 |
endif |
| 1014 |
CXXFLAGS := ${CFLAGS} |
| 1015 |
endif # !Comeau C Compiler |
| 1016 |
# GNU Compiler Collection or LLVM |
| 1017 |
# 20140204: gcc and clang should receive identical options |
| 1018 |
ifeq (gcc,$(firstword ${CC})) |
| 1019 |
GCC_OR_CLANG := Y |
| 1020 |
endif |
| 1021 |
ifeq (clang,$(firstword ${CC})) |
| 1022 |
GCC_OR_CLANG := Y |
| 1023 |
endif |
| 1024 |
ifeq (${GCC_OR_CLANG},Y) |
| 1025 |
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
| 1026 |
CFLAGS := -Wall -Wuninitialized |
| 1027 |
# Compilation flags for numerical routines recommended by GSL 1.3 manual, p. 397 |
| 1028 |
# Greenplanet has old compiler that lacks -Werror=format-security |
| 1029 |
# CFLAGS += -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g |
| 1030 |
CFLAGS += -Werror=format-security -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g |
| 1031 |
# Compilation flags recommended by GSL and others that I like and use: |
| 1032 |
# -D_BSD_SOURCE: Support 4.3 BSD Unix extensions to ANSI C (prevents nameser.h warnings) |
| 1033 |
# -D_POSIX_SOURCE: Support POSIX.1 standard additions to ANSI C (prevents fileno warnings) |
| 1034 |
# -pedantic: Disallow non-ISO constructs (including type long long) (sometimes useful) |
| 1035 |
# -W: Extra warnings, including missing return values, comparison of signed with unsigned |
| 1036 |
# -Wall: Warn about common programming problems |
| 1037 |
# -Wcast-align: Warn if casting pointer to type of different size |
| 1038 |
# -Wcast-qual: Warn if const qualifier removed from pointer |
| 1039 |
# -Werror: Consider warnings as errors |
| 1040 |
# -Werror=format-security: Consider this specific warning as errors (requires gcc > 4.1.2) |
| 1041 |
# -Wmaybe-uninitialized: Warn on uninitialized variables. GCC has many false negatives, clang is better? Available on GCC 4.8.2+. Not available on GCC 4.6.3-. |
| 1042 |
# -Wmissing-prototypes: Warn if missing prototypes |
| 1043 |
# -Wpointer-arith: Warn if pointer arithmetic on types without size, e.g., void |
| 1044 |
# -Wshadow: Warn if local variable has same name as other local variable |
| 1045 |
# -Wsometimes-uninitialized: LLVM/clang uses this but GCC does not |
| 1046 |
# -Wswitch: Warn if switch statement has enumerated index and case label outside enumeration range |
| 1047 |
# -Wuninitialized: Warn on uninitialized variables. GCC has many false negatives, clang is better? |
| 1048 |
# -Wunused: Warn on unused functions, labels, parameters, values, and variables |
| 1049 |
# -Wwrite-strings: Apply const-qualifier to string constants, die if overwritten |
| 1050 |
# -fno-common: Prevent global variables from being simultaneously defined in different files |
| 1051 |
# -g: Put debugging symbols in executable |
| 1052 |
# -pg: Enable profiling, generate gmon.out output files (also needed by linker) |
| 1053 |
# -O3: clang -O4 DNE, highest clang optimization is -O3 |
| 1054 |
# -O4: Turn on optimization so uninitialized variables are flagged. Downside: optimizes-out many debugging symbols |
| 1055 |
# Compilation flags recommended by GSL that I do not like and do not use: |
| 1056 |
# -ansi: Support only strict ANSI C. Equivalent to -std=c89, conflicts with -std=c99 |
| 1057 |
# --no-alias? -fstrict-aliasing |
| 1058 |
# -Waggregate-return: Warn if functions return aggregates like structures or unions |
| 1059 |
# -Wconversion: Warn if converting signed to unsigned. Intended for obsolete, non-prototyped code. Triggers fabsf(), sqrtf(), warnings. |
| 1060 |
# -Wnested-externs: Warn if extern is encountered within function. C only? |
| 1061 |
# -Wstrict-prototypes: Warn if inconsistent prototypes. C only? |
| 1062 |
# -Wtraditional: Warn if constructs differ between traditional and ANSI C. C only? |
| 1063 |
# -Dinline=: inline is not an ANSI keyword, must undefine inline to work with -ansi |
| 1064 |
# -fshort-enums: Make enums as short as possible, ususally non-int. Do not ever invoke this! This breaks ABI and causes subtle problems |
| 1065 |
ifeq (${OMP},Y) |
| 1066 |
ifneq (clang,$(firstword ${CC})) |
| 1067 |
# 20140526 clang does not recognize/utilize -fopenmp |
| 1068 |
OMP_FLG_C := -fopenmp |
| 1069 |
OMP_FLG_F := -fopenmp |
| 1070 |
LDFLAGS += -lgomp -lpthread |
| 1071 |
endif # !clang |
| 1072 |
endif # !OMP |
| 1073 |
ifeq (${OPTS},O) |
| 1074 |
ifeq (clang,$(firstword ${CC})) |
| 1075 |
CFLAGS += -O3 -g ${GCC_RCH_ARG} |
| 1076 |
else # !clang |
| 1077 |
CFLAGS += -O4 -g ${GCC_RCH_ARG} |
| 1078 |
endif # !clang |
| 1079 |
endif |
| 1080 |
ifeq (${OPTS},D) |
| 1081 |
CFLAGS += -g -Wno-switch |
| 1082 |
endif |
| 1083 |
ifeq (${OPTS},R) |
| 1084 |
CFLAGS += |
| 1085 |
endif |
| 1086 |
ifeq (${OPTS},X) |
| 1087 |
# 20090715: https://wiki.ubuntu.com/CompilerFlags |
| 1088 |
# -D_FORTIFY_SOURCE=2 : Compile-time libc checks, run-time buffer/memory checks |
| 1089 |
# : NB: _FORTIFY_SOURCE macro requires -O switch |
| 1090 |
# -fstack-protector : Enable run-time stack overflow verification |
| 1091 |
# -Wformat-security : Warn about misuse of format strings |
| 1092 |
# -Wl,-z,relro : Read-only relocation table area in final ELF |
| 1093 |
CPPFLAGS += -D_FORTIFY_SOURCE=2 |
| 1094 |
CFLAGS += -g -O -fstack-protector -Wformat-security |
| 1095 |
ifneq (clang,$(firstword ${CC})) |
| 1096 |
# 20150106 clang does not recognize/utilize -z |
| 1097 |
CFLAGS += -Wl,-z,relro |
| 1098 |
endif # !clang |
| 1099 |
# 20090715: -Werror triggers known nc_put_var?_string() and nco_def_var_chunking() errors |
| 1100 |
# CFLAGS += -g -pg -fno-inline -Werror |
| 1101 |
# CFLAGS += -g -O -pg -fno-inline |
| 1102 |
CFLAGS += -g -pg -fno-inline |
| 1103 |
LDFLAGS += -pg |
| 1104 |
# LDFLAGS += /usr/local/lib/ccmalloc-gcc.o -L/usr/local/lib -lccmalloc -ldl |
| 1105 |
endif |
| 1106 |
ifneq (${null},$(findstring AMD64,${PVM_ARCH})) |
| 1107 |
ifeq (${ABI},64) |
| 1108 |
CFLAGS += -m64 |
| 1109 |
FFLAGS += -m64 |
| 1110 |
LDFLAGS += -m64 |
| 1111 |
endif # !ABI |
| 1112 |
endif # !LINUXAMD64 |
| 1113 |
CXXFLAGS := ${CFLAGS} |
| 1114 |
endif # !GNU Compiler Collection or LLVM |
| 1115 |
# Intel (Kai) C Compiler |
| 1116 |
ifeq (icc,$(firstword ${CC})) |
| 1117 |
# -fast: enable -xP -O3 -ipo -static |
| 1118 |
# -ipo[n]: enable multi-file IP optimizations (between files) |
| 1119 |
# -no-gcc: do not define __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__ macros |
| 1120 |
# -static: prevents linking with shared libraries |
| 1121 |
# -std=c99: Enable C99 support for C programs |
| 1122 |
# -xB: specialize code to run exclusively on Intel Pentium M and compatible Intel processors |
| 1123 |
# -xK: specialize code to run exclusively on Intel Pentium III and compatible Intel processors |
| 1124 |
# -xN: specialize code to run exclusively on Intel Pentium 4 and compatible Intel processors |
| 1125 |
# -xP: specialize code to run exclusively on Intel Pentium 4 processors with SSE3 extensions |
| 1126 |
# -Wall: enable all warnings |
| 1127 |
# -Werror:force warnings to be reported as errors |
| 1128 |
# -w0: display errors (same as -w) |
| 1129 |
# -w1: display warnings and errors (DEFAULT) |
| 1130 |
# -w2: display remarks, warnings, and errors |
| 1131 |
# -wd<L1>[,<L2>,...] disable diagnostics L1 through LN |
| 1132 |
# warning #274: declaration is not visible outside of function |
| 1133 |
# remark #981: operands are evaluated in unspecified order |
| 1134 |
# remark #810: conversion from "double" to "float" may lose significant bits |
| 1135 |
# remark #1572: floating-point equality and inequality comparisons are unreliable |
| 1136 |
CFLAGS := -w1 -wd274 |
| 1137 |
# Rhea icc 13.1.3 (gcc version 4.4.7 compatibility) requires -D_BSD_SOURCE on files that #include nameser.h, recent transition of gcc 4.9 to -D_DEFAULT_SOURCE does not cut the mustard |
| 1138 |
CPPFLAGS += -no-gcc -D_BSD_SOURCE |
| 1139 |
LDFLAGS += -lsvml |
| 1140 |
OMP_FLG_C := -openmp -openmp_report0 |
| 1141 |
ifeq (${OPTS},O) |
| 1142 |
CFLAGS += -O3 -g ${ICC_RCH_ARG} |
| 1143 |
endif |
| 1144 |
ifeq (${OPTS},D) |
| 1145 |
CFLAGS += -g |
| 1146 |
endif |
| 1147 |
ifeq (${OPTS},R) |
| 1148 |
CFLAGS += |
| 1149 |
endif |
| 1150 |
ifeq (${OPTS},X) |
| 1151 |
CFLAGS += -g -Wall -wd810,981,1572 -inline_debug_info |
| 1152 |
endif |
| 1153 |
CXXFLAGS := ${CFLAGS} |
| 1154 |
endif # !Intel (Kai) C Compiler |
| 1155 |
# Intel (Kai) Fortran Compiler |
| 1156 |
ifeq (${FC},ifc) |
| 1157 |
# -e95 issues warnings for non-standard fortran |
| 1158 |
# -fpp2 necessary, but not sufficient, for OpenMP |
| 1159 |
FFLAGS := -extend_source -implicitnone -vms -e95 -fpp2 |
| 1160 |
# -lVaxlib needed for iargc_, getarg_ |
| 1161 |
LDFLAGS += -lVaxlib |
| 1162 |
OMP_FLG_C := -openmp |
| 1163 |
ifeq (${PRC},D) |
| 1164 |
FFLAGS += -i4 -r8 -doubletemps |
| 1165 |
else |
| 1166 |
FFLAGS += -i4 |
| 1167 |
endif |
| 1168 |
ifeq (${OPTS},O) |
| 1169 |
FFLAGS += -O2 -g |
| 1170 |
endif |
| 1171 |
ifeq (${OPTS},D) |
| 1172 |
FFLAGS += -g |
| 1173 |
endif |
| 1174 |
ifeq (${OPTS},R) |
| 1175 |
FFLAGS += |
| 1176 |
endif |
| 1177 |
ifeq (${OPTS},X) |
| 1178 |
FFLAGS += -g -C -e95 |
| 1179 |
endif |
| 1180 |
endif # !Intel (Kai) Fortran Compiler |
| 1181 |
# cd ~;nvcc -o libcuda_add.a -deviceemu -lib simpleTemplates.cu |
| 1182 |
# cd ~;g++ -I/usr/local/cuda/include -c -o test.o test.c |
| 1183 |
# cd ~;g++ -o ~/test test.o libcuda_add.a |
| 1184 |
# NVidia C Compiler |
| 1185 |
ifeq (nvcc,$(firstword ${CC})) |
| 1186 |
CPPFLAGS += |
| 1187 |
# -deviceemu: Emulate CUDA CPU |
| 1188 |
# -lib: build static libraries |
| 1189 |
CFLAGS := -deviceemu -lib |
| 1190 |
ifeq (${OMP},Y) |
| 1191 |
OMP_FLG_C := |
| 1192 |
OMP_FLG_F := |
| 1193 |
LDFLAGS += |
| 1194 |
endif # !OMP |
| 1195 |
ifeq (${OPTS},O) |
| 1196 |
CFLAGS += -O -g |
| 1197 |
endif |
| 1198 |
ifeq (${OPTS},D) |
| 1199 |
CFLAGS += -g |
| 1200 |
endif |
| 1201 |
ifeq (${OPTS},R) |
| 1202 |
CFLAGS += |
| 1203 |
endif |
| 1204 |
ifeq (${OPTS},X) |
| 1205 |
CFLAGS += -g |
| 1206 |
LDFLAGS += |
| 1207 |
endif |
| 1208 |
ifneq (${null},$(findstring AMD64,${PVM_ARCH})) |
| 1209 |
ifeq (${ABI},64) |
| 1210 |
CFLAGS += |
| 1211 |
FFLAGS += |
| 1212 |
LDFLAGS += |
| 1213 |
endif # !ABI |
| 1214 |
endif # !LINUXAMD64 |
| 1215 |
CXXFLAGS := ${CFLAGS} |
| 1216 |
endif # !NVidia C Compiler |
| 1217 |
# Pathscale (QLogic) C Compiler |
| 1218 |
ifeq (pathcc,$(firstword ${CC})) |
| 1219 |
# pathcc -show-defaults |
| 1220 |
# shows that pathcc automatically sets many hardware-specific options |
| 1221 |
# man -k pathscale for full listing |
| 1222 |
# -O2 = -O: Default optimization |
| 1223 |
# -Ofast = -O3: |
| 1224 |
CFLAGS := |
| 1225 |
CPPFLAGS += -DNEED_STRCASECMP |
| 1226 |
LDFLAGS += |
| 1227 |
OMP_FLG_C := -apo -mp |
| 1228 |
ifeq (${OPTS},O) |
| 1229 |
CFLAGS += -O3 -g ${PSC_RCH_ARG} |
| 1230 |
endif |
| 1231 |
ifeq (${OPTS},D) |
| 1232 |
CFLAGS += -g |
| 1233 |
endif |
| 1234 |
ifeq (${OPTS},R) |
| 1235 |
CFLAGS += -O2 |
| 1236 |
endif |
| 1237 |
ifeq (${OPTS},X) |
| 1238 |
CFLAGS += -g |
| 1239 |
endif |
| 1240 |
CXXFLAGS := ${CFLAGS} |
| 1241 |
endif # end Pathscale (QLogic) C++ Compiler |
| 1242 |
# Portland Group C++ Compiler |
| 1243 |
ifeq (pgcc,$(firstword ${CC})) |
| 1244 |
# Enable Large File Support (LFS) by default |
| 1245 |
CFLAGS := -Mlfs |
| 1246 |
# Pass kludgy PGI identifier to flag for broken C99 designated initializers etc. |
| 1247 |
CPPFLAGS := $(filter-out -DHAVE_C99,${CPPFLAGS}) |
| 1248 |
CPPFLAGS := -DPGI_CC ${CPPFLAGS} |
| 1249 |
LDFLAGS += -Mlfs |
| 1250 |
OMP_FLG_C := -mp |
| 1251 |
ifeq (${OPTS},O) |
| 1252 |
CFLAGS += -fast ${PGI_RCH_ARG} |
| 1253 |
endif |
| 1254 |
ifeq (${OPTS},D) |
| 1255 |
CFLAGS += -g |
| 1256 |
endif |
| 1257 |
ifeq (${OPTS},R) |
| 1258 |
CFLAGS += |
| 1259 |
endif |
| 1260 |
ifeq (${OPTS},X) |
| 1261 |
CFLAGS += -g -Mbounds |
| 1262 |
endif |
| 1263 |
CXXFLAGS := ${CFLAGS} |
| 1264 |
endif # !Portland Group C++ Compiler |
| 1265 |
# Portland Group Fortran Compiler |
| 1266 |
ifeq (${FC},pgf90) |
| 1267 |
FFLAGS := -Mextend -Mnosecond_underscore -byteswapio -Mrecursive -Mdalign -Ktrap=fp -Mlfs |
| 1268 |
OMP_FLG_F := -mp |
| 1269 |
ifeq (${PRC},D) |
| 1270 |
FFLAGS += -Mr8 -Mi4 |
| 1271 |
endif |
| 1272 |
ifeq (${OPTS},O) |
| 1273 |
FFLAGS += -fast |
| 1274 |
endif |
| 1275 |
ifeq (${OPTS},D) |
| 1276 |
FFLAGS += -g |
| 1277 |
endif |
| 1278 |
ifeq (${OPTS},R) |
| 1279 |
FFLAGS += |
| 1280 |
endif |
| 1281 |
ifeq (${OPTS},X) |
| 1282 |
FFLAGS += -g -Mbounds |
| 1283 |
endif |
| 1284 |
endif # !Portland Group Fortran Compiler |
| 1285 |
# G77 Fortran compiler |
| 1286 |
ifeq (${FC},g77) |
| 1287 |
FFLAGS := -ffixed-line-length-132 -fno-second-underscore |
| 1288 |
ifeq (${OPTS},O) |
| 1289 |
FFLAGS += -O -g |
| 1290 |
endif |
| 1291 |
ifeq (${OPTS},D) |
| 1292 |
FFLAGS += -g -fdebug-kludge |
| 1293 |
endif |
| 1294 |
ifeq (${OPTS},R) |
| 1295 |
FFLAGS += -fdebug-kludge |
| 1296 |
endif |
| 1297 |
ifeq (${OPTS},X) |
| 1298 |
FFLAGS := -g -O -fdebug-kludge -fbounds-check |
| 1299 |
endif |
| 1300 |
endif # !G77 Fortran compiler |
| 1301 |
ifeq (${DPKG},Y) |
| 1302 |
CPPFLAGS+=$(shell dpkg-buildflags --get CPPFLAGS) |
| 1303 |
CFLAGS+=$(shell dpkg-buildflags --get CFLAGS) |
| 1304 |
CXXFLAGS+=$(shell dpkg-buildflags --get CXXFLAGS) |
| 1305 |
LDFLAGS+=$(shell dpkg-buildflags --get LDFLAGS) |
| 1306 |
endif # !OMP |
| 1307 |
ifeq (${OMP},Y) |
| 1308 |
CFLAGS += ${OMP_FLG_C} |
| 1309 |
CXXFLAGS += ${OMP_FLG_C} |
| 1310 |
FFLAGS += ${OMP_FLG_C} |
| 1311 |
# LD behavior assumes C source code |
| 1312 |
LDFLAGS := ${OMP_FLG_C} ${LDFLAGS} |
| 1313 |
endif # !OMP |
| 1314 |
endif |
| 1315 |
# !LINUX, LINUXALPHA, LINUXAMD64, LINUXARM, FREEBSD, MACOS |
| 1316 |
|
| 1317 |
# NB: Deprecated as of 201403. Now LINUX* subsumes MACOS |
| 1318 |
ifeq (${PVM_ARCH},MACOSOLD) |
| 1319 |
CXX := ${LINUX_CXX} |
| 1320 |
# NB: -D_POSIX_SOURCE breaks MACOS build in nco_fl_utl.c, nco_mmr.c |
| 1321 |
#CC := cc -std=c99 -pedantic -D_BSD_SOURCE |
| 1322 |
CC := ${LINUX_CC} -std=c99 -pedantic -D_BSD_SOURCE |
| 1323 |
CPP := ${CC} |
| 1324 |
# -fno-common: Allows shared libraries to build |
| 1325 |
CFLAGS := -Wall -Werror=format-security -fno-common |
| 1326 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 1327 |
FC := f90 |
| 1328 |
LD := ld |
| 1329 |
LDFLAGS += ${OTHER_LDFLAGS} -lresolv -lm |
| 1330 |
LEX := flex |
| 1331 |
LINT := lint |
| 1332 |
YACC := bison |
| 1333 |
ifeq (${OPTS},O) |
| 1334 |
CFLAGS += -O |
| 1335 |
endif |
| 1336 |
ifeq (${OPTS},D) |
| 1337 |
CFLAGS += -g |
| 1338 |
endif |
| 1339 |
ifeq (${OPTS},R) |
| 1340 |
CFLAGS += |
| 1341 |
endif |
| 1342 |
ifeq (${OPTS},X) |
| 1343 |
CFLAGS += -g -O |
| 1344 |
LDFLAGS += /usr/local/lib/ccmalloc-gcc.o -L/usr/local/lib -lccmalloc -ldl |
| 1345 |
endif |
| 1346 |
CXXFLAGS := ${CFLAGS} |
| 1347 |
ifeq (${OMP},Y) |
| 1348 |
CFLAGS += ${OMP_FLG} |
| 1349 |
FFLAGS += ${OMP_FLG} |
| 1350 |
LDFLAGS := ${OMP_FLG} ${LDFLAGS} |
| 1351 |
endif # !OMP |
| 1352 |
endif |
| 1353 |
# !MACOSOLD |
| 1354 |
|
| 1355 |
ifeq (${PVM_ARCH},NECSX) |
| 1356 |
ifeq (${OMP},Y) |
| 1357 |
OMP_FLG := -Popenmp |
| 1358 |
endif # !OMP |
| 1359 |
CXX := c++ |
| 1360 |
#CC := c++ -Xa |
| 1361 |
CC := cc |
| 1362 |
CPP := c++ -E |
| 1363 |
#CPP := /usr/lib/cpp |
| 1364 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 1365 |
FC := f90 |
| 1366 |
LD := ld |
| 1367 |
LDFLAGS += ${OTHER_LDFLAGS} -lm |
| 1368 |
LEX := flex |
| 1369 |
LINT := lint |
| 1370 |
YACC := bison |
| 1371 |
ifeq (${OPTS},O) |
| 1372 |
CFLAGS += -h2 -hmath vector -hxint |
| 1373 |
# CFLAGS += -Cvopt -math vector -xint |
| 1374 |
FFLAGS = -Cvopt -f3 |
| 1375 |
endif |
| 1376 |
ifeq (${OPTS},D) |
| 1377 |
CFLAGS += -g |
| 1378 |
FFLAGS = -g -f3 |
| 1379 |
endif |
| 1380 |
ifeq (${OPTS},X) |
| 1381 |
CFLAGS += -g -h0 -hstack=nan |
| 1382 |
# CFLAGS += -Cdebug -init stack=nan |
| 1383 |
FFLAGS = -Cdebug -eR -f3 -Wf"-init stack=nan heap=nan" |
| 1384 |
endif |
| 1385 |
MK_DPN = /usr/local/bin/mkdep.perl /usr/lib/cpp # NECSX try this |
| 1386 |
${MY_DPN_DIR}/%.d : %.c |
| 1387 |
${MK_DPN} ${CPPFLAGS} $< | perl -p -e 's/$*\.o/${MY_OBJ_DIR_RX}\/$*.o ${MY_DPN_DIR_RX}\/$(notdir $@)/g;s/${slash_rx}/\${slash}/g' > $@ |
| 1388 |
endif |
| 1389 |
# !NECSX |
| 1390 |
|
| 1391 |
ifeq (${PVM_ARCH},RS6K) |
| 1392 |
CXX := g++ |
| 1393 |
CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 1394 |
CPP := /lib/cpp -P |
| 1395 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 1396 |
FC := xlf |
| 1397 |
LD := ld |
| 1398 |
LDFLAGS += ${OTHER_LDFLAGS} -lm |
| 1399 |
LEX := flex |
| 1400 |
LINT := lint |
| 1401 |
YACC := bison |
| 1402 |
ifeq (${OPTS},O) |
| 1403 |
CFLAGS += -O2 |
| 1404 |
CPP := ${CPP} ${CPPFLAGS} |
| 1405 |
PREPROCESS.F := ${CPP} ${CPPFLAGS} |
| 1406 |
FFLAGS := -O -g -NS2000 -qfixed=132 |
| 1407 |
endif |
| 1408 |
ifeq (${OPTS},D) |
| 1409 |
CFLAGS += -g |
| 1410 |
CPP := ${CPP} ${CPPFLAGS} |
| 1411 |
PREPROCESS.F := ${CPP} ${CPPFLAGS} |
| 1412 |
FFLAGS := -g -NS2000 -qfixed=132 |
| 1413 |
endif |
| 1414 |
${MY_OBJ_DIR}/%.o : %.F |
| 1415 |
${CPP} ${CPPFLAGS} $< ${MY_OBJ_DIR}/$(basename $<).f |
| 1416 |
${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) ${MY_OBJ_DIR}/$(basename $<).f |
| 1417 |
${MY_OBJ_DIR}/%.o : %.f |
| 1418 |
${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 1419 |
endif |
| 1420 |
# !RS6K |
| 1421 |
|
| 1422 |
# SGI6, SGI64, SGIMP64 |
| 1423 |
ifneq (${null},$(findstring SGI,${PVM_ARCH})) |
| 1424 |
ifeq (${OMP},Y) |
| 1425 |
OMP_FLG := -mp -mpio |
| 1426 |
endif # !OMP |
| 1427 |
CXX := CC -LANG:std |
| 1428 |
CC := cc -c99 |
| 1429 |
# 20000302: -w suppresses warnings which will swamp linker |
| 1430 |
#CXX := g++ -w |
| 1431 |
#CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 1432 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 1433 |
ifdef $(MIPSPRO_SGI) |
| 1434 |
# SGIs like dataproc keep omp.h in special location determined by module MIPSpro |
| 1435 |
CPPFLAGS := -I$(MIPSPRO_SGI)/usr/include ${CPPFLAGS} |
| 1436 |
endif |
| 1437 |
FC := f90 -cpp |
| 1438 |
LD := ld |
| 1439 |
LEX := flex |
| 1440 |
LINT := lint |
| 1441 |
YACC := bison |
| 1442 |
ifeq (${PVM_ARCH},SGI6) |
| 1443 |
GCC_ABI_FLG := -mabi=32 |
| 1444 |
GCC_LDFLAGS_SZ_SPC := ${GCC_ABI_FLG} -mips3 |
| 1445 |
SGI_ABI_FLG := -n32 -mips3 ${OMP_FLG} |
| 1446 |
else # SGI64, SGIMP64 |
| 1447 |
ifeq (${ABI},64) |
| 1448 |
GCC_ABI_FLG := -mabi=64 |
| 1449 |
GCC_LDFLAGS_SZ_SPC := ${GCC_ABI_FLG} -mips4 -L/usr/local/lib/mabi=64 |
| 1450 |
SGI_ABI_FLG := -64 -mips4 ${OMP_FLG} |
| 1451 |
else # ABI=32 |
| 1452 |
GCC_ABI_FLG := -mabi=32 |
| 1453 |
GCC_LDFLAGS_SZ_SPC := ${GCC_ABI_FLG} -mips4 |
| 1454 |
SGI_ABI_FLG := -n32 -mips4 ${OMP_FLG} |
| 1455 |
endif # !ABI |
| 1456 |
endif # !SGI64, SGIMP64 |
| 1457 |
ifeq (gcc,$(firstword ${CC})) |
| 1458 |
LDFLAGS += ${GCC_LDFLAGS_SZ_SPC} ${OTHER_LDFLAGS} -lm |
| 1459 |
CFLAGS := ${GCC_ABI_FLG} -Wall -Werror=format-security |
| 1460 |
ifeq (${OPTS},O) |
| 1461 |
CFLAGS += -O2 |
| 1462 |
endif |
| 1463 |
ifeq (${OPTS},R) |
| 1464 |
CFLAGS += |
| 1465 |
endif |
| 1466 |
ifeq (${OPTS},D) |
| 1467 |
CFLAGS += -g |
| 1468 |
endif |
| 1469 |
ifeq (${OPTS},X) |
| 1470 |
CFLAGS += -g -O |
| 1471 |
endif |
| 1472 |
CXXFLAGS := ${CFLAGS} |
| 1473 |
endif |
| 1474 |
# !CC=gcc |
| 1475 |
ifeq (cc,$(firstword ${CC})) |
| 1476 |
LDFLAGS += ${SGI_ABI_FLG} ${OTHER_LDFLAGS} -lm |
| 1477 |
CFLAGS := ${SGI_ABI_FLG} |
| 1478 |
ifeq (${OPTS},O) |
| 1479 |
CFLAGS += -O2 |
| 1480 |
endif |
| 1481 |
ifeq (${OPTS},R) |
| 1482 |
CFLAGS += |
| 1483 |
endif |
| 1484 |
ifeq (${OPTS},D) |
| 1485 |
CFLAGS += -g |
| 1486 |
endif |
| 1487 |
ifeq (${OPTS},X) |
| 1488 |
CFLAGS += -g -trapuv |
| 1489 |
endif |
| 1490 |
endif |
| 1491 |
# !CC=cc |
| 1492 |
# Fortran flags |
| 1493 |
FFLAGS := ${SGI_ABI_FLG} -extend_source |
| 1494 |
ifeq (${OPTS},O) |
| 1495 |
FFLAGS := -O2 -g |
| 1496 |
endif |
| 1497 |
ifeq (${OPTS},R) |
| 1498 |
FFLAGS := |
| 1499 |
endif |
| 1500 |
ifeq (${OPTS},D) |
| 1501 |
FFLAGS := -g |
| 1502 |
endif |
| 1503 |
ifeq (${OPTS},X) |
| 1504 |
FFLAGS := -g -check_bounds -trapuv |
| 1505 |
endif |
| 1506 |
# end fortran flags |
| 1507 |
endif |
| 1508 |
# !SGI6, SGI64, SGIMP64 |
| 1509 |
|
| 1510 |
ifeq (${UNAMES},SunOS) |
| 1511 |
CXX := CC |
| 1512 |
CC:= c99 -D_BSD_SOURCE |
| 1513 |
CFLAGS := |
| 1514 |
CPP := cc -E |
| 1515 |
#CXX := g++ |
| 1516 |
#CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 1517 |
#CFLAGS := -Wall |
| 1518 |
#CPP := cpp |
| 1519 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 1520 |
FC := f90 -DHIDE_SHR_MSG |
| 1521 |
#FFLAGS := -xs -stackvar -e -Qoption f90comp -r8const |
| 1522 |
FFLAGS := -xs -stackvar -e |
| 1523 |
LD := ld |
| 1524 |
LDFLAGS += ${OTHER_LDFLAGS} -lsunmath -lresolv -lsocket -lnsl -lm |
| 1525 |
LEX := flex |
| 1526 |
LINT := lint |
| 1527 |
YACC := bison |
| 1528 |
ifeq (${OPTS},O) |
| 1529 |
CFLAGS += -O2 -g |
| 1530 |
FFLAGS += -fast |
| 1531 |
endif |
| 1532 |
ifeq (${OPTS},D) |
| 1533 |
CFLAGS += -g |
| 1534 |
FFLAGS += -g |
| 1535 |
endif |
| 1536 |
ifeq (${OPTS},X) |
| 1537 |
CFLAGS += -g |
| 1538 |
FFLAGS += -g |
| 1539 |
# NB: 19980601 -C (range-checking) is not supported by Sun f90 |
| 1540 |
ifeq (${FC},f77) |
| 1541 |
FFLAGS += -C |
| 1542 |
endif |
| 1543 |
endif |
| 1544 |
CXXFLAGS := ${CFLAGS} |
| 1545 |
endif |
| 1546 |
# !SunOS=SUN4SOL2,SUNMP |
| 1547 |
|
| 1548 |
ifeq (${PVM_ARCH},WINOS) |
| 1549 |
CXX := g++ |
| 1550 |
CC := gcc -std=c99 -pedantic -D_DEFAULT_SOURCE |
| 1551 |
# NB: nameser.h needs -Di386, but gcc sends -Di586 (on pentiums) |
| 1552 |
#CPP_TKN_OS += -Di386 -DNEED_STRCASECMP -DNEED_STRDUP -I/usr/include |
| 1553 |
CPP_TKN_OS += -Di386 -DNEED_STRDUP -I/usr/include |
| 1554 |
CPPFLAGS := ${CPP_TKN} ${CPP_TKN_OS} ${CPP_PTH} ${OTHER_CFLAGS} |
| 1555 |
FC := g77 |
| 1556 |
LD := ld |
| 1557 |
LDFLAGS += ${OTHER_LDFLAGS} -lm |
| 1558 |
LEX := flex |
| 1559 |
LINT := lint |
| 1560 |
YACC := bison |
| 1561 |
ifeq (${OPTS},O) |
| 1562 |
CFLAGS += -O -g |
| 1563 |
endif |
| 1564 |
ifeq (${OPTS},D) |
| 1565 |
CFLAGS += -g |
| 1566 |
endif |
| 1567 |
${MY_OBJ_DIR}/%.o : %.F |
| 1568 |
${FC} -c ${FFLAGS} ${CPPFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 1569 |
${MY_OBJ_DIR}/%.o : %.f |
| 1570 |
${FC} -c ${FFLAGS} -o ${MY_OBJ_DIR}/$(notdir $@) $< |
| 1571 |
endif |
| 1572 |
# !WINOS |
| 1573 |
|
| 1574 |
# Resolve nvcc CUDA run-time library functions |
| 1575 |
ifeq (${CUDA},Y) |
| 1576 |
CUDA_FLG_C := |
| 1577 |
CUDA_FLG_F := |
| 1578 |
LDFLAGS += -L/usr/local/cuda/lib -lcudart |
| 1579 |
endif # !CUDA |
| 1580 |
|
| 1581 |
# Internationalize NCO with i18n features |
| 1582 |
ifeq (${I18N},Y) |
| 1583 |
CPPFLAGS += -DI18N |
| 1584 |
ifneq (${null},$(findstring MACOS,${PVM_ARCH})) |
| 1585 |
LDFLAGS += -lintl |
| 1586 |
endif |
| 1587 |
endif |
| 1588 |
# !I18N |
| 1589 |
|
| 1590 |
# Default to MPICC, MPICXX to CC, CXX and cross your fingers |
| 1591 |
MPICC := ${CC} |
| 1592 |
MPICXX := ${CXX} |
| 1593 |
# Manipulate CC, CPP, CXX as appropriate for MPI-enabled operators |
| 1594 |
ifeq (${MPI},Y) |
| 1595 |
ifneq (${null},$(findstring xl,${CC})) |
| 1596 |
# NB: AIX is not debugged yet |
| 1597 |
MPICC := $(subst xlc,mpcc,${CC}) |
| 1598 |
MPICXX := $(subst xlC,mpCC,${CXX}) |
| 1599 |
endif # !AIX VA Compiler Collection |
| 1600 |
ifneq (${null},$(findstring gcc,${CC})) |
| 1601 |
MPICC := $(subst gcc,mpicc,${CC}) |
| 1602 |
MPICXX := $(subst g++,mpicxx,${CXX}) |
| 1603 |
endif # !GNU Compiler Collection |
| 1604 |
ifeq (icpc,$(firstword ${CXX})) |
| 1605 |
MPICC := $(subst icc,mpicc,${CC}) |
| 1606 |
MPICXX := $(subst icpc,mpicxx,${CXX}) |
| 1607 |
endif # !Intel (Kai) C++ Compiler |
| 1608 |
ifneq (${null},$(findstring pathcc,${CC})) |
| 1609 |
MPICC := $(subst pathcc,mpicc,${CC}) |
| 1610 |
MPICXX := $(subst pathCC,mpicxx,${CXX}) |
| 1611 |
endif # !Pathscale (QLogic) Compilers |
| 1612 |
CPP := ${MPICC} |
| 1613 |
endif # !MPI |
| 1614 |
# Use MPI modifications, if any, to build all objects |
| 1615 |
CC := ${MPICC} |
| 1616 |
CXX := ${MPICXX} |
| 1617 |
|
| 1618 |
# Disable OpenMP on platforms which automatically support it |
| 1619 |
ifneq (${OMP},Y) |
| 1620 |
ifneq (${null},$(findstring SGI,${PVM_ARCH})) |
| 1621 |
CFLAGS := $(filter-out -mp -mpio,${CFLAGS}) |
| 1622 |
LDFLAGS := $(filter-out -mp -mpio,${LDFLAGS}) |
| 1623 |
endif # !SGI |
| 1624 |
CPPFLAGS += -U_OPENMP |
| 1625 |
endif # !OMP |
| 1626 |
|
| 1627 |
ifneq (${null},$(findstring LINUX,${PVM_ARCH})) |
| 1628 |
ifeq (${CCACHE},Y) |
| 1629 |
# Prefix CC and CXX with ccache |
| 1630 |
CC := ccache ${CC} |
| 1631 |
CXX := ccache ${CXX} |
| 1632 |
endif # !CCACHE |
| 1633 |
endif # !LINUX |
| 1634 |
|
| 1635 |
ifeq (${STC},Y) |
| 1636 |
# Created statically linked executable |
| 1637 |
LDFLAGS := -static ${LDFLAGS} |
| 1638 |
endif # !STC |
| 1639 |
|
| 1640 |
# Define CPPCXXFLAGS after making all possible modifications to CPPFLAGS |
| 1641 |
# Add nco_c++ to directory search path |
| 1642 |
CXXCPPFLAGS := ${CPPFLAGS} -I${NCO_CXX_SRC_DIR} |
| 1643 |
|
| 1644 |
# Define any remaining variables |
| 1645 |
libnco := ${MY_LIB_DIR}/libnco |
| 1646 |
|
| 1647 |
# Default targets |
| 1648 |
all: dir lib ${MDL_BIN_TRG} ${MDL_BIN_SPT} data |
| 1649 |
non_ncap: dir lib $(filter-out ncap,${MDL_BIN_TRG}) ${MDL_BIN_SPT} data |
| 1650 |
# .PHONY tells make to remake the following non-file targets |
| 1651 |
.PHONY: all cln dst_cln dbg ${MDL_BIN_TRG} ${MDL_BIN_SPT} |
| 1652 |
# Delete default suffixes---this should increase speed |
| 1653 |
.SUFFIXES: |
| 1654 |
# Define suffixes that matter |
| 1655 |
.SUFFIXES: .cc .c .cu .o .F .d |
| 1656 |
# Delete targets that were not successfully made |
| 1657 |
.DELETE_ON_ERROR: |
| 1658 |
# Target directories which may not exist |
| 1659 |
dir: bin_dir obj_dir lib_dir |
| 1660 |
bin_dir: |
| 1661 |
# Compaq ALPHA complains about -install |
| 1662 |
# -install -d ${MY_BIN_DIR} |
| 1663 |
-mkdir -p ${MY_BIN_DIR} |
| 1664 |
lib_dir: |
| 1665 |
# -install -d ${MY_BIN_DIR} |
| 1666 |
-mkdir -p ${MY_LIB_DIR} |
| 1667 |
obj_dir: |
| 1668 |
# -install -d ${MY_BIN_DIR} |
| 1669 |
-mkdir -p ${MY_OBJ_DIR} |
| 1670 |
# The whole shebang |
| 1671 |
allinone: all nco_c++ nco++ |
| 1672 |
nco_c++: |
| 1673 |
-cd ../src/nco_c++; ${MAKE} -f Makefile.old DBG=${DBG} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} SZ=${SZ} lib dat all |
| 1674 |
nco++: |
| 1675 |
-cd ../src/nco++; ${MAKE} -f Makefile.old CNK=${CNK} DAP=${DAP} DBG=${DBG} GSL=${GSL} MPI=${MPI} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} PNETCDF=${PNETCDF} SZ=${SZ} UDUNITS=${UDUNITS} lib all |
| 1676 |
# Targets in bin |
| 1677 |
mpi: mpi_nco |
| 1678 |
mpinco: mpi_nco |
| 1679 |
mpnco: mpi_nco |
| 1680 |
mpi_nco: ${MDL_MPI_TRG} |
| 1681 |
-rm -f ${MY_BIN_DIR}/mpirun && ln -f -s `which mpirun` ${MY_BIN_DIR}/mpirun |
| 1682 |
mpncbo: ${MY_BIN_DIR}/mpncbo |
| 1683 |
${MY_BIN_DIR}/mpncbo: ${MY_OBJ_DIR}/mpncbo.o lib |
| 1684 |
${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1685 |
chmod 755 $@${BNR_SFX} |
| 1686 |
cd ${MY_BIN_DIR}; rm -f mpncdiff; ln -s -f mpncbo mpncdiff |
| 1687 |
# 20050710: icc 8.1 with -axW flag dies compiling ncecat |
| 1688 |
# 20050915: Same problem occurs with MPI_FAKE version of mpncecat |
| 1689 |
ifeq (icc,$(firstword ${LINUX_CC})) |
| 1690 |
ncecat : CFLAGS := $(filter-out -axW,${CFLAGS}) |
| 1691 |
ifeq (${MPI_FAKE},Y) |
| 1692 |
mpncecat : CFLAGS := $(filter-out -axW,${CFLAGS}) |
| 1693 |
endif # !MPI_FAKE |
| 1694 |
endif # !Intel (Kai) C Compiler |
| 1695 |
mpncecat: ${MY_BIN_DIR}/mpncecat |
| 1696 |
${MY_BIN_DIR}/mpncecat: ${MY_OBJ_DIR}/mpncecat.o lib |
| 1697 |
${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1698 |
chmod 755 $@${BNR_SFX} |
| 1699 |
mpncflint: ${MY_BIN_DIR}/mpncflint |
| 1700 |
${MY_BIN_DIR}/mpncflint: ${MY_OBJ_DIR}/mpncflint.o lib |
| 1701 |
${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1702 |
chmod 755 $@${BNR_SFX} |
| 1703 |
mpncpdq: ${MY_BIN_DIR}/mpncpdq |
| 1704 |
${MY_BIN_DIR}/mpncpdq: ${MY_OBJ_DIR}/mpncpdq.o lib |
| 1705 |
${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1706 |
chmod 755 $@${BNR_SFX} |
| 1707 |
# cd ${MY_BIN_DIR}; rm -f mpncunpack; ln -s -f mpncpdq mpncunpack |
| 1708 |
# cd ${MY_BIN_DIR}; rm -f mpncpack; ln -s -f mpncpdq mpncpack |
| 1709 |
mpncra: ${MY_BIN_DIR}/mpncra |
| 1710 |
${MY_BIN_DIR}/mpncra: ${MY_OBJ_DIR}/mpncra.o lib |
| 1711 |
${MPICC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1712 |
chmod 755 $@${BNR_SFX} |
| 1713 |
cd ${MY_BIN_DIR}; rm -f mpncea; ln -s -f mpncra mpncea |
| 1714 |
cd ${MY_BIN_DIR}; rm -f mpnces; ln -s -f mpncra mpnces |
| 1715 |
cd ${MY_BIN_DIR}; rm -f mpncrcat; ln -s -f mpncra mpncrcat |
| 1716 |
mpncwa: ${MY_BIN_DIR}/mpncwa |
| 1717 |
${MY_BIN_DIR}/mpncwa: ${MY_OBJ_DIR}/mpncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib |
| 1718 |
${MPICC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS} |
| 1719 |
chmod 755 $@${BNR_SFX} |
| 1720 |
ncatted: ${MY_BIN_DIR}/ncatted |
| 1721 |
${MY_BIN_DIR}/ncatted: ${MY_OBJ_DIR}/ncatted.o lib |
| 1722 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1723 |
chmod 755 $@${BNR_SFX} |
| 1724 |
ncbo: ${MY_BIN_DIR}/ncbo |
| 1725 |
${MY_BIN_DIR}/ncbo: ${MY_OBJ_DIR}/ncbo.o lib |
| 1726 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1727 |
chmod 755 $@${BNR_SFX} |
| 1728 |
cd ${MY_BIN_DIR}; rm -f ncdiff; ln -s -f ncbo ncdiff |
| 1729 |
ncclimo: ${MY_BIN_DIR}/ncclimo |
| 1730 |
${MY_BIN_DIR}/ncclimo: ${MY_DAT_DIR}/ncclimo |
| 1731 |
/bin/cp -f ${MY_DAT_DIR}/ncclimo ${MY_BIN_DIR} |
| 1732 |
ncecat: ${MY_BIN_DIR}/ncecat |
| 1733 |
${MY_BIN_DIR}/ncecat: ${MY_OBJ_DIR}/ncecat.o lib |
| 1734 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1735 |
chmod 755 $@${BNR_SFX} |
| 1736 |
ncflint: ${MY_BIN_DIR}/ncflint |
| 1737 |
${MY_BIN_DIR}/ncflint: ${MY_OBJ_DIR}/ncflint.o lib |
| 1738 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1739 |
chmod 755 $@${BNR_SFX} |
| 1740 |
ncks: ${MY_BIN_DIR}/ncks |
| 1741 |
${MY_BIN_DIR}/ncks: ${MY_OBJ_DIR}/ncks.o lib |
| 1742 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1743 |
chmod 755 $@${BNR_SFX} |
| 1744 |
ncpdq: ${MY_BIN_DIR}/ncpdq |
| 1745 |
${MY_BIN_DIR}/ncpdq: ${MY_OBJ_DIR}/ncpdq.o lib |
| 1746 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1747 |
chmod 755 $@${BNR_SFX} |
| 1748 |
cd ${MY_BIN_DIR}; rm -f ncunpack; ln -s -f ncpdq ncunpack |
| 1749 |
cd ${MY_BIN_DIR}; rm -f ncpack; ln -s -f ncpdq ncpack |
| 1750 |
ncra: ${MY_BIN_DIR}/ncra |
| 1751 |
${MY_BIN_DIR}/ncra: ${MY_OBJ_DIR}/ncra.o lib |
| 1752 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1753 |
chmod 755 $@${BNR_SFX} |
| 1754 |
cd ${MY_BIN_DIR}; rm -f ncea; ln -s -f ncra ncea |
| 1755 |
cd ${MY_BIN_DIR}; rm -f nces; ln -s -f ncra nces |
| 1756 |
cd ${MY_BIN_DIR}; rm -f ncrcat; ln -s -f ncra ncrcat |
| 1757 |
ncremap: ${MY_BIN_DIR}/ncremap |
| 1758 |
${MY_BIN_DIR}/ncremap: ${MY_DAT_DIR}/ncremap |
| 1759 |
/bin/cp -f ${MY_DAT_DIR}/ncremap ${MY_BIN_DIR} |
| 1760 |
ncrename: ${MY_BIN_DIR}/ncrename |
| 1761 |
${MY_BIN_DIR}/ncrename: ${MY_OBJ_DIR}/ncrename.o lib |
| 1762 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1763 |
chmod 755 $@${BNR_SFX} |
| 1764 |
ncwa: ${MY_BIN_DIR}/ncwa |
| 1765 |
${MY_BIN_DIR}/ncwa: ${MY_OBJ_DIR}/ncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib |
| 1766 |
ifeq (${MSVC},TRUE) |
| 1767 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1768 |
else |
| 1769 |
${CC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS} |
| 1770 |
endif |
| 1771 |
chmod 755 $@${BNR_SFX} |
| 1772 |
ncz2psx: ${MY_BIN_DIR}/ncz2psx |
| 1773 |
${MY_BIN_DIR}/ncz2psx: ${MY_DAT_DIR}/ncz2psx |
| 1774 |
/bin/cp -f ${MY_DAT_DIR}/ncz2psx ${MY_BIN_DIR} |
| 1775 |
ncchecker: ${MY_BIN_DIR}/ncchecker |
| 1776 |
${MY_BIN_DIR}/ncchecker: ${MY_DAT_DIR}/ncchecker |
| 1777 |
/bin/cp -f ${MY_DAT_DIR}/ncchecker ${MY_BIN_DIR} |
| 1778 |
bin: ${MDL_BIN_TRG} ${MDL_BIN_SPT} |
| 1779 |
binclean: bin_cln |
| 1780 |
bin_cln: |
| 1781 |
rm -f ${MDL_BIN} |
| 1782 |
mpiclean: mpi_cln |
| 1783 |
mpi_cln: |
| 1784 |
rm -f ${MDL_MPI_BIN} ${MDL_MPI_OBJ} |
| 1785 |
mpi_fake_cp: ${MDL_MPI_TRG} |
| 1786 |
- for fl in ${MDL_MPI_TRG_SMP}; do /bin/cp -f ${MY_BIN_DIR}/$$fl ${MY_BIN_DIR}/mp$$fl; done |
| 1787 |
# 20050916 fxm: not sure why simpler substitution method does not work |
| 1788 |
# - for fl in ${MDL_MPI_TRG}; do /bin/cp -f ${MY_BIN_DIR}/$$fl ${MY_BIN_DIR}/$(subst mp,,$$fl); done |
| 1789 |
strip: |
| 1790 |
- printf "Before stripping...\n";ls -l ${MDL_BIN};strip ${MDL_BIN};printf "After stripping...\n";ls -l ${MDL_BIN} |
| 1791 |
# Targets in bld |
| 1792 |
buildclean: bld_cln |
| 1793 |
bld_cln: |
| 1794 |
cd ${MY_BLD_DIR}; rm -f TAGS |
| 1795 |
libtest: libtst |
| 1796 |
libtst: libnco_tst libnco_c++_tst |
| 1797 |
libnco_tst: ${MY_BLD_DIR}/libnco_tst |
| 1798 |
${MY_BLD_DIR}/libnco_tst: ${MY_BLD_DIR}/libnco_tst.o lib |
| 1799 |
${CC} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1800 |
chmod 755 $@${BNR_SFX} |
| 1801 |
libnco_c++_tst: ${MY_BLD_DIR}/libnco_c++_tst |
| 1802 |
${MY_BLD_DIR}/libnco_c++_tst: ${MY_BLD_DIR}/libnco_c++_tst.o lib |
| 1803 |
${CXX} -o $@${BNR_SFX} $< ${LDFLAGS} |
| 1804 |
chmod 755 $@${BNR_SFX} |
| 1805 |
rpm: ${MY_BLD_DIR}/nco.spec # Building rpm requires root priveleges, e.g., sudo make NCO_VRS=4.5.2 rpm |
| 1806 |
# Building NCO RPM requires following packages |
| 1807 |
# rpm -q bison flex netcdf-devel libtool automake autoconf udunits udunits-devel curl-devel libxml2 libxml2-devel librx-devel |
| 1808 |
# sudo yum install bison flex netcdf-devel libtool automake autoconf udunits udunits-devel curl-devel libxml2 libxml2-devel librx-devel |
| 1809 |
cd ${DATA}/tmp; \ |
| 1810 |
/bin/rm -fr ${DATA}/tmp/nco*; \ |
| 1811 |
cp -r ${HOME}/nco nco-${NCO_VRS}; \ |
| 1812 |
tar cvzf nco-${NCO_VRS}.tar.gz ./nco-${NCO_VRS}; \ |
| 1813 |
mv ${DATA}/tmp/nco-${NCO_VRS}.tar.gz /usr/src/redhat/SOURCES; \ |
| 1814 |
/bin/rm -f /usr/src/redhat/SPECS/nco-${NCO_VRS}.spec; \ |
| 1815 |
ln -s ${HOME}/nco/bld/nco.spec /usr/src/redhat/SPECS/nco-${NCO_VRS}.spec; \ |
| 1816 |
cd /usr/src/redhat/SPECS; \ |
| 1817 |
rpmbuild -ba --sign nco-${NCO_VRS}.spec; |
| 1818 |
# Crypographically sign RPM packages with GPG: http://fedoranews.org/tchung/gpg |
| 1819 |
# gpg --export -a 'Charlie Zender' > ~/GPG-zender # Export public key from key ring to text file |
| 1820 |
# sudo rpm --import ~/GPG-zender # Import public key to RPM database |
| 1821 |
# rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n' # Verify list of GPG public keys in RPM database |
| 1822 |
# Verify ~/.rpmmacros file specifies _signature and gpg_name |
| 1823 |
# sudo rpm --addsign /usr/src/redhat/SRPMS/nco-${NCO_VRS}-?.src.rpm /usr/src/redhat/RPMS/i386/nco-${NCO_VRS}-?.i386.rpm # Sign RPM packages |
| 1824 |
# rpm --checksig /usr/src/redhat/SRPMS/nco-${NCO_VRS}-?.src.rpm /usr/src/redhat/RPMS/i386/nco-${NCO_VRS}-?.i386.rpm # Check signatures |
| 1825 |
rpmnet: ${MY_BLD_DIR}/nco.spec # Building rpm requires root priveleges, e.g., sudo make NCO_VRS=3.1.8 rpmnet |
| 1826 |
- if test -f /usr/src/redhat/SOURCES/nco-${NCO_VRS}.tar.gz; then printf "Using existing nco-${NCO_VRS}.tar.gz\n" ; else ${MY_BIN_DIR}/ncks -R -p ftp://dust.ess.uci.edu/pub/zender/nco -l /usr/src/redhat/SOURCES nco-${NCO_VRS}.tar.gz; fi |
| 1827 |
/bin/rm -f /usr/src/redhat/SPECS/nco-${NCO_VRS}.spec; \ |
| 1828 |
cd /usr/src/redhat/SOURCES; \ |
| 1829 |
tar xvzf nco-${NCO_VRS}.tar.gz ./nco-${NCO_VRS}/bld/nco.spec; \ |
| 1830 |
mv ./nco-${NCO_VRS}/bld/nco.spec /usr/src/redhat/SPECS/nco.spec; \ |
| 1831 |
cd /usr/src/redhat/SPECS; \ |
| 1832 |
rpmbuild -ba --sign nco.spec; \ |
| 1833 |
scp /usr/src/redhat/SRPMS/nco-${NCO_VRS}-?.src.rpm /usr/src/redhat/RPMS/i386/nco-${NCO_VRS}-?.i386.rpm [email protected]:/var/www/html/nco/src |
| 1834 |
rpm_cln: |
| 1835 |
rpm --erase ${MDL_RPM_NST_NM} |
| 1836 |
# Targets in bm |
| 1837 |
bench: bm |
| 1838 |
bnch: bm |
| 1839 |
bm: |
| 1840 |
cd ${MY_BM_DIR}; \ |
| 1841 |
env MY_BIN_DIR=${MY_BIN_DIR} ../bm/nco_bm.pl --dbg=0 --bench --udpreport ${FL_FMT_SNG} ${MPI_PRC_SNG} ${THR_NBR_SNG} |
| 1842 |
file: fl |
| 1843 |
fl: |
| 1844 |
cd ${MY_BM_DIR}; \ |
| 1845 |
env MY_BIN_DIR=${MY_BIN_DIR} ../bm/nco_bm.pl --dbg=0 --test_files=A --udpreport ${FL_FMT_SNG} ${MPI_PRC_SNG} ${THR_NBR_SNG} |
| 1846 |
regression: tst |
| 1847 |
rgr: tst |
| 1848 |
test: tst |
| 1849 |
tst: dat |
| 1850 |
cd ${MY_BM_DIR}; \ |
| 1851 |
env MY_BIN_DIR=${MY_BIN_DIR} ../bm/nco_bm.pl --dbg=0 --regress --udpreport ${FL_FMT_SNG} ${MPI_PRC_SNG} ${THR_NBR_SNG} |
| 1852 |
# Targets in dat |
| 1853 |
# ncgen rules to build netCDF4 files must be error-tolerant to build on netCDF3-only installations |
| 1854 |
bug: ${MY_DAT_DIR}/buggy.nc |
| 1855 |
${MY_DAT_DIR}/buggy.nc: ${MY_DAT_DIR}/buggy.cdl |
| 1856 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1857 |
dap: data |
| 1858 |
-cd ~/nco/data; scp in.nc in.cdl dust.ess.uci.edu:/var/www/html/dodsdata; scp in.nc in.cdl esmf.ess.uci.edu:/var/www/html/dodsdata; scp in.nc in.cdl esmf.ess.uci.edu:/data/dodsdata |
| 1859 |
data: dat |
| 1860 |
dat: ${MY_DAT_DIR}/cmip5.nc ${MY_DAT_DIR}/obs.nc ${MY_DAT_DIR}/dsm.nc ${MY_DAT_DIR}/hdn.nc ${MY_DAT_DIR}/hdf.hdf ${MY_DAT_DIR}/mdl_1.nc ${MY_DAT_DIR}/mdl_2.nc ${MY_DAT_DIR}/mdl_3.nc ${MY_DAT_DIR}/mrd.nc ${MY_DAT_DIR}/in.nc ${MY_DAT_DIR}/in_4c.nc ${MY_DAT_DIR}/in_grp.nc ${MY_DAT_DIR}/in_4.nc ${MY_DAT_DIR}/in_grp_1.nc ${MY_DAT_DIR}/in_grp_2.nc ${MY_DAT_DIR}/in_grp_3.nc ${MY_DAT_DIR}/in_grp_4.nc ${MY_DAT_DIR}/in_grp_5.nc ${MY_DAT_DIR}/in_grp_6.nc ${MY_DAT_DIR}/in_grp_7.nc ${MY_DAT_DIR}/in_grp_8.nc ${MY_DAT_DIR}/in_mlt_rec1.nc ${MY_DAT_DIR}/in_mlt_rec2.nc ${MY_DAT_DIR}/in_rec_zero.nc |
| 1861 |
-for fl in ${MDL_DAT_STB}; do cd ${MY_DAT_DIR}; ln -s -f in.nc $$fl; done |
| 1862 |
${MY_DAT_DIR}/in.nc: ${MY_DAT_DIR}/in.cdl |
| 1863 |
ncgen -b -o $@ $< |
| 1864 |
${MY_DAT_DIR}/in_4c.nc: ${MY_DAT_DIR}/in.nc |
| 1865 |
-ncks -O -7 --cnk_dmn time,10 $< $@ |
| 1866 |
# ncgen default chunksize for time = 4 MB produces ~200 MB in_4c.nc file. Avoid that! |
| 1867 |
# -ncgen -k hdf5-nc3 -b -o $@ $< |
| 1868 |
${MY_DAT_DIR}/in_rec_zero.nc: ${MY_DAT_DIR}/in_rec_zero.cdl |
| 1869 |
ncgen -b -o $@ $< |
| 1870 |
${MY_DAT_DIR}/in_grp.nc: ${MY_DAT_DIR}/in_grp.cdl |
| 1871 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1872 |
${MY_DAT_DIR}/in_4.nc: ${MY_DAT_DIR}/in_4.cdl |
| 1873 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1874 |
${MY_DAT_DIR}/in_1.nc: ${MY_DAT_DIR}/in_1.cdl |
| 1875 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1876 |
${MY_DAT_DIR}/in_2.nc: ${MY_DAT_DIR}/in_2.cdl |
| 1877 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1878 |
${MY_DAT_DIR}/in_grp_1.nc: ${MY_DAT_DIR}/in_grp_1.cdl |
| 1879 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1880 |
${MY_DAT_DIR}/in_grp_2.nc: ${MY_DAT_DIR}/in_grp_2.cdl |
| 1881 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1882 |
${MY_DAT_DIR}/in_grp_3.nc: ${MY_DAT_DIR}/in_grp_3.cdl |
| 1883 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1884 |
${MY_DAT_DIR}/in_grp_4.nc: ${MY_DAT_DIR}/in_grp_4.cdl |
| 1885 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1886 |
${MY_DAT_DIR}/in_grp_5.nc: ${MY_DAT_DIR}/in_grp_5.cdl |
| 1887 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1888 |
${MY_DAT_DIR}/in_grp_6.nc: ${MY_DAT_DIR}/in_grp_6.cdl |
| 1889 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1890 |
${MY_DAT_DIR}/in_grp_7.nc: ${MY_DAT_DIR}/in_grp_7.cdl |
| 1891 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1892 |
${MY_DAT_DIR}/in_grp_8.nc: ${MY_DAT_DIR}/in_grp_8.cdl |
| 1893 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1894 |
${MY_DAT_DIR}/in_mlt_rec1.nc: ${MY_DAT_DIR}/in_mlt_rec1.cdl |
| 1895 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1896 |
${MY_DAT_DIR}/in_mlt_rec2.nc: ${MY_DAT_DIR}/in_mlt_rec2.cdl |
| 1897 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1898 |
${MY_DAT_DIR}/cmip5.nc: ${MY_DAT_DIR}/cmip5.cdl |
| 1899 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1900 |
${MY_DAT_DIR}/hdn.nc: ${MY_DAT_DIR}/hdn.cdl |
| 1901 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1902 |
${MY_DAT_DIR}/mrd.nc: ${MY_DAT_DIR}/mrd.cdl |
| 1903 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1904 |
${MY_DAT_DIR}/dsm.nc: ${MY_DAT_DIR}/dsm.cdl |
| 1905 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1906 |
${MY_DAT_DIR}/obs.nc: ${MY_DAT_DIR}/obs.cdl |
| 1907 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1908 |
${MY_DAT_DIR}/hdf.hdf: ${MY_DAT_DIR}/hdf.cdl |
| 1909 |
-hncgen -b -o $@ $< |
| 1910 |
${MY_DAT_DIR}/mdl_1.nc: ${MY_DAT_DIR}/mdl_1.cdl |
| 1911 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1912 |
${MY_DAT_DIR}/mdl_2.nc: ${MY_DAT_DIR}/mdl_2.cdl |
| 1913 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1914 |
${MY_DAT_DIR}/mdl_3.nc: ${MY_DAT_DIR}/mdl_3.cdl |
| 1915 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1916 |
${MY_DAT_DIR}/snd_ncwa.nc: ${MY_DAT_DIR}/snd_ncwa.cdl |
| 1917 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1918 |
${MY_DAT_DIR}/snc_ncwa.nc: ${MY_DAT_DIR}/snc_ncwa.cdl |
| 1919 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1920 |
${MY_DAT_DIR}/snd_grp.nc: ${MY_DAT_DIR}/snd_grp.cdl |
| 1921 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1922 |
${MY_DAT_DIR}/snc_grp.nc: ${MY_DAT_DIR}/snc_grp.cdl |
| 1923 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1924 |
${MY_DAT_DIR}/snc.nc: ${MY_DAT_DIR}/snc.cdl |
| 1925 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1926 |
${MY_DAT_DIR}/snd.nc: ${MY_DAT_DIR}/snd.cdl |
| 1927 |
-ncgen -k netCDF-4 -b -o $@ $< |
| 1928 |
${MY_DAT_DIR}/split.nc: ${MY_DAT_DIR}/split.cdl |
| 1929 |
-ncgen -b -o $@ $< |
| 1930 |
dataclean: dat_cln |
| 1931 |
dat_cln: |
| 1932 |
rm -f ${MDL_DAT} |
| 1933 |
cd ${MY_DAT_DIR}; rm -f foo* |
| 1934 |
tst_ftp: dat |
| 1935 |
- if test -f ${MY_DAT_DIR}/nco_tst.nc; then printf "" ; else ${MY_BIN_DIR}/ncks -q -R -p ftp://dust.ess.uci.edu/pub/zender/nco -l ${MY_DAT_DIR} nco_tst.nc; if [ $? != 0 ]; then printf "WARNING: Unable to retrieve ftp://dust.ess.uci.edu/pub/zender/nco/nco_tst.nc required for self-test, possible problem with getting through your firewall? Manually download and install in directory ../data to continue self test...\n"; fi; fi |
| 1936 |
cd ${MY_BLD_DIR}; \ |
| 1937 |
env MY_BIN_DIR=${MY_BIN_DIR} MY_DAT_DIR=${MY_DAT_DIR} ./nco_tst.pl |
| 1938 |
testclean: tst_cln |
| 1939 |
tst_cln: |
| 1940 |
cd ${MY_DAT_DIR}; rm -f foo* nco_tst.nc |
| 1941 |
# Targets in doc |
| 1942 |
# Each make directive line spawns a separate shell so must use `cd dir;cmd' format |
| 1943 |
doc: ${MY_DOC_DIR}/nco.dvi ${MY_DOC_DIR}/nco.html ${MY_DOC_DIR}/nco.info ${MY_DOC_DIR}/nco.ps ${MY_DOC_DIR}/nco.pdf ${MY_DOC_DIR}/nco.txt ${MY_DOC_DIR}/nco.xml |
| 1944 |
${MY_DOC_DIR}/nco.dvi: ${MY_DOC_DIR}/nco.texi |
| 1945 |
cd ${MY_DOC_DIR}; texi2dvi --output=$@ $< |
| 1946 |
${MY_DOC_DIR}/nco.info: ${MY_DOC_DIR}/nco.texi |
| 1947 |
cd ${MY_DOC_DIR}; makeinfo --no-split --output=$@ $< |
| 1948 |
${MY_DOC_DIR}/nco.html: ${MY_DOC_DIR}/nco.texi |
| 1949 |
cd ${MY_DOC_DIR}; texi2html -monolithic -verbose $< |
| 1950 |
# cd ${MY_DOC_DIR}; makeinfo --html --no-split --output=$@ $< |
| 1951 |
${MY_DOC_DIR}/nco.ps: ${MY_DOC_DIR}/nco.dvi |
| 1952 |
cd ${MY_DOC_DIR}; dvips -o $@ nco.dvi |
| 1953 |
${MY_DOC_DIR}/nco.pdf: ${MY_DOC_DIR}/nco.texi |
| 1954 |
cd ${MY_DOC_DIR}; texi2dvi --pdf --output=$@ $< |
| 1955 |
# cd ${MY_DOC_DIR}; ps2pdf -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true nco.ps $@ |
| 1956 |
${MY_DOC_DIR}/nco.txt: ${MY_DOC_DIR}/nco.texi |
| 1957 |
cd ${MY_DOC_DIR}; makeinfo --no-headers --no-split --output=$@ $< |
| 1958 |
# Neither of these xml formats seems to be viewable |
| 1959 |
${MY_DOC_DIR}/nco.xml: ${MY_DOC_DIR}/nco.texi |
| 1960 |
cd ${MY_DOC_DIR}; makeinfo --xml --no-split --output=$@ $< |
| 1961 |
# cd ${MY_DOC_DIR}; makeinfo --docbook --no-split --output=$@ $< |
| 1962 |
docclean: doc_cln |
| 1963 |
doc_cln: |
| 1964 |
cd ${MY_DOC_DIR}; rm -f nco.info* nco.dvi nco.html* nco.ps nco.pdf *~ |
| 1965 |
# Targets in dpn |
| 1966 |
depend: dpn |
| 1967 |
dpn: ${MDL_DPN} |
| 1968 |
dpn_cln: |
| 1969 |
rm -f ${MDL_DPN} |
| 1970 |
# Targets in inc |
| 1971 |
include: inc |
| 1972 |
inc: ${MDL_INC} |
| 1973 |
inc_cln: |
| 1974 |
rm -f ${MDL_INC} |
| 1975 |
love: |
| 1976 |
echo "Not war?" |
| 1977 |
# Targets in lib |
| 1978 |
library: lib |
| 1979 |
lib : inc ${libnco}.a |
| 1980 |
ifeq (${PVM_ARCH},MACOS) |
| 1981 |
ranlib ${libnco}.a |
| 1982 |
endif # !LINUX |
| 1983 |
# If not using glibc, build Sittler's getopt() and getopt_long() functions |
| 1984 |
ifeq (${null},$(findstring ${PVM_ARCH},FREEBSDLINUXALPHALINUXAMD64LINUXARMMACOSWINOS)) |
| 1985 |
${libnco}.a: ${libnco}.a(${MY_OBJ_DIR}/nco_getopt.o) |
| 1986 |
endif # !not glibc |
| 1987 |
${libnco}.a: ${libnco}.a(${MY_OBJ_DIR}/nco_att_utl.o) \ |
| 1988 |
${libnco}.a(${MY_OBJ_DIR}/nco_aux.o) \ |
| 1989 |
${libnco}.a(${MY_OBJ_DIR}/nco_bnr.o) \ |
| 1990 |
${libnco}.a(${MY_OBJ_DIR}/nco_cln_utl.o) \ |
| 1991 |
${libnco}.a(${MY_OBJ_DIR}/nco_cnf_dmn.o) \ |
| 1992 |
${libnco}.a(${MY_OBJ_DIR}/nco_cnf_typ.o) \ |
| 1993 |
${libnco}.a(${MY_OBJ_DIR}/nco_cnk.o) \ |
| 1994 |
${libnco}.a(${MY_OBJ_DIR}/nco_cnv_arm.o) \ |
| 1995 |
${libnco}.a(${MY_OBJ_DIR}/nco_cnv_csm.o) \ |
| 1996 |
${libnco}.a(${MY_OBJ_DIR}/nco_crt.o) \ |
| 1997 |
${libnco}.a(${MY_OBJ_DIR}/nco_ctl.o) \ |
| 1998 |
${libnco}.a(${MY_OBJ_DIR}/nco_dbg.o) \ |
| 1999 |
${libnco}.a(${MY_OBJ_DIR}/nco_dmn_utl.o) \ |
| 2000 |
${libnco}.a(${MY_OBJ_DIR}/nco_fl_utl.o) \ |
| 2001 |
${libnco}.a(${MY_OBJ_DIR}/nco_flt.o) \ |
| 2002 |
${libnco}.a(${MY_OBJ_DIR}/nco_grp_trv.o) \ |
| 2003 |
${libnco}.a(${MY_OBJ_DIR}/nco_grp_utl.o) \ |
| 2004 |
${libnco}.a(${MY_OBJ_DIR}/nco_kd.o) \ |
| 2005 |
${libnco}.a(${MY_OBJ_DIR}/nco_lmt.o) \ |
| 2006 |
${libnco}.a(${MY_OBJ_DIR}/nco_lst_utl.o) \ |
| 2007 |
${libnco}.a(${MY_OBJ_DIR}/nco_map.o) \ |
| 2008 |
${libnco}.a(${MY_OBJ_DIR}/nco_md5.o) \ |
| 2009 |
${libnco}.a(${MY_OBJ_DIR}/nco_mmr.o) \ |
| 2010 |
${libnco}.a(${MY_OBJ_DIR}/nco_msa.o) \ |
| 2011 |
${libnco}.a(${MY_OBJ_DIR}/nco_mss_val.o) \ |
| 2012 |
${libnco}.a(${MY_OBJ_DIR}/nco_mta.o) \ |
| 2013 |
${libnco}.a(${MY_OBJ_DIR}/nco_netcdf.o) \ |
| 2014 |
${libnco}.a(${MY_OBJ_DIR}/nco_omp.o) \ |
| 2015 |
${libnco}.a(${MY_OBJ_DIR}/nco_pck.o) \ |
| 2016 |
${libnco}.a(${MY_OBJ_DIR}/nco_ply.o) \ |
| 2017 |
${libnco}.a(${MY_OBJ_DIR}/nco_ply_lst.o) \ |
| 2018 |
${libnco}.a(${MY_OBJ_DIR}/nco_ppc.o) \ |
| 2019 |
${libnco}.a(${MY_OBJ_DIR}/nco_prn.o) \ |
| 2020 |
${libnco}.a(${MY_OBJ_DIR}/nco_rec_var.o) \ |
| 2021 |
${libnco}.a(${MY_OBJ_DIR}/nco_rgr.o) \ |
| 2022 |
${libnco}.a(${MY_OBJ_DIR}/nco_rth_flt.o) \ |
| 2023 |
${libnco}.a(${MY_OBJ_DIR}/nco_rth_utl.o) \ |
| 2024 |
${libnco}.a(${MY_OBJ_DIR}/nco_s1d.o) \ |
| 2025 |
${libnco}.a(${MY_OBJ_DIR}/nco_scl_utl.o) \ |
| 2026 |
${libnco}.a(${MY_OBJ_DIR}/nco_scm.o) \ |
| 2027 |
${libnco}.a(${MY_OBJ_DIR}/nco_sld.o) \ |
| 2028 |
${libnco}.a(${MY_OBJ_DIR}/nco_sng_utl.o) \ |
| 2029 |
${libnco}.a(${MY_OBJ_DIR}/nco_sph.o) \ |
| 2030 |
${libnco}.a(${MY_OBJ_DIR}/nco_srm.o) \ |
| 2031 |
${libnco}.a(${MY_OBJ_DIR}/nco_var_avg.o) \ |
| 2032 |
${libnco}.a(${MY_OBJ_DIR}/nco_var_lst.o) \ |
| 2033 |
${libnco}.a(${MY_OBJ_DIR}/nco_var_rth.o) \ |
| 2034 |
${libnco}.a(${MY_OBJ_DIR}/nco_var_scv.o) \ |
| 2035 |
${libnco}.a(${MY_OBJ_DIR}/nco_var_utl.o) |
| 2036 |
$(AR) rsv $@ $^ |
| 2037 |
libclean: lib_cln |
| 2038 |
lib_cln: |
| 2039 |
rm -f ${libnco}.* ${libnco}*.* ${libnco}++.a ${libnco}_c++.a |
| 2040 |
# Targets in man |
| 2041 |
man: ${MDL_MAN} |
| 2042 |
cd ../man;sudo cp -f *.1 ${MY_MAN_DIR}/man1 |
| 2043 |
man_cln: |
| 2044 |
rm -f ${MDL_MAN} |
| 2045 |
# Targets in obj |
| 2046 |
object: obj |
| 2047 |
obj: ${MDL_OBJ} |
| 2048 |
objclean: obj_cln |
| 2049 |
obj_cln: |
| 2050 |
rm -f ${MDL_OBJ} |
| 2051 |
# Targets in root |
| 2052 |
autotools: dst_cln |
| 2053 |
- cd ..; aclocal;autoheader;automake --foreign;autoconf ; ./configure --enable-optimize-custom --prefix=${HOME} --bindir=${MY_BIN_DIR} --datadir=${HOME}/nco/data --libdir=${MY_LIB_DIR} --mandir=${HOME}/nco/man ; ${MAKE} install |
| 2054 |
rootclean: root_cln |
| 2055 |
root_cln: |
| 2056 |
- cd ..; rm -f config.h config.guess config.log config.status config.sub libtool Makefile stamp-h1; rm -r -f autom4te.cache conftest |
| 2057 |
# Targets in src |
| 2058 |
src: ${MDL_NCAP} |
| 2059 |
src_cln: |
| 2060 |
rm -f ${MDL_NCAP} |
| 2061 |
# Targets in /usr/local |
| 2062 |
sys: ${MDL_BIN_TRG} ${MDL_BIN_SPT} |
| 2063 |
- cd ${MY_BIN_DIR};sudo /bin/cp -f ${MDL_BIN_TRG} ${MDL_BIN_SPT} ncap2 /usr/local/bin; cd /usr/local/bin; sudo rm -f ncdiff ncea nces ncrcat ncunpack; sudo ln -s -f ncbo ncdiff; sudo ln -s -f ncra ncea; sudo ln -s -f ncra nces; sudo ln -s -f ncra ncrcat; sudo ln -s -f ncpdq ncunpack; sudo ln -s -f ncpdq ncpack; cd ${HOME}/nco/src/nco++; ${MAKE} -f Makefile.old OPTS=${OPTS} $@ |
| 2064 |
sys_cln: |
| 2065 |
- cd /usr/local/bin;rm -f ${MDL_BIN_TRG} ${MDL_BIN_SPT} ${MDL_BIN_SYM_LNK} |
| 2066 |
|
| 2067 |
# Housekeeping |
| 2068 |
clean: cln |
| 2069 |
cln: lib_cln dpn_cln obj_cln src_cln tst_cln |
| 2070 |
cd ${MY_DOC_DIR}; rm -f nco.aux nco.cp nco.cps nco.fn nco.ky nco.log nco.pg nco.toc nco.tp nco.vr |
| 2071 |
debug: dbg |
| 2072 |
dbg: |
| 2073 |
@printf "ABI = ${ABI}\n" |
| 2074 |
@printf "AR = ${AR}\n" |
| 2075 |
@printf "ARFLAGS = ${ARFLAGS}\n" |
| 2076 |
@printf "BNR_SFX = ${BNR_SFX}\n" |
| 2077 |
@printf "CC = ${CC}\n" |
| 2078 |
@printf "CCACHE = ${CCACHE}\n" |
| 2079 |
@printf "CFLAGS = ${CFLAGS}\n" |
| 2080 |
@printf "CNK = ${CNK}\n" |
| 2081 |
@printf "CPP = ${CPP}\n" |
| 2082 |
@printf "CPPFLAGS = ${CPPFLAGS}\n" |
| 2083 |
@printf "CPP_PTH = ${CPP_PTH}\n" |
| 2084 |
@printf "CPP_TKN = ${CPP_TKN}\n" |
| 2085 |
@printf "CURL_LIB = ${CURL_LIB}\n" |
| 2086 |
@printf "CXX = ${CXX}\n" |
| 2087 |
@printf "CXXFLAGS = ${CXXFLAGS}\n" |
| 2088 |
@printf "DAP = ${DAP}\n" |
| 2089 |
@printf "DAP_ROOT = ${DAP_ROOT}\n" |
| 2090 |
@printf "DBG = ${DBG}\n" |
| 2091 |
@printf "FC = ${FC}\n" |
| 2092 |
@printf "FFLAGS = ${FFLAGS}\n" |
| 2093 |
@printf "FL_FMT = ${FL_FMT}\n" |
| 2094 |
@printf "GCC_RCH_ARG = ${GCC_RCH_ARG}\n" |
| 2095 |
@printf "GSL = ${GSL}\n" |
| 2096 |
@printf "GSL_INC_FLG = ${GSL_INC_FLG}\n" |
| 2097 |
@printf "GSL_LIB_FLG = ${GSL_LIB_FLG}\n" |
| 2098 |
@printf "HDF5_ROOT = ${HDF5_ROOT}\n" |
| 2099 |
@printf "HDF5_INC = ${HDF5_INC}\n" |
| 2100 |
@printf "HDF5_LIB = ${HDF5_LIB}\n" |
| 2101 |
@printf "HOST = ${HOST}\n" |
| 2102 |
@printf "HOSTNAME = ${HOSTNAME}\n" |
| 2103 |
@printf "ICC_RCH_ARG = ${ICC_RCH_ARG}\n" |
| 2104 |
@printf "INC_NCAR = ${INC_NCAR}\n" |
| 2105 |
@printf "LAMMPICC = ${LAMMPICC}\n" |
| 2106 |
@printf "LAMMPICXX = ${LAMMPICXX}\n" |
| 2107 |
@printf "LDFLAGS = ${LDFLAGS}\n" |
| 2108 |
@printf "LEX = ${LEX}\n" |
| 2109 |
@printf "LFLAGS = ${LFLAGS}\n" |
| 2110 |
@printf "LIB_NCAR = ${LIB_NCAR}\n" |
| 2111 |
@printf "LINUX_CC = ${LINUX_CC}\n" |
| 2112 |
@printf "LINUX_CXX = ${LINUX_CXX}\n" |
| 2113 |
@printf "MDL_BIN = ${MDL_BIN}\n" |
| 2114 |
@printf "MDL_BIN_SPT = ${MDL_BIN_SPT}\n" |
| 2115 |
@printf "MDL_BIN_SYM_LNK = ${MDL_BIN_SYM_LNK}\n" |
| 2116 |
@printf "MDL_BIN_TRG = ${MDL_BIN_TRG}\n" |
| 2117 |
@printf "MDL_DPN = ${MDL_DPN}\n" |
| 2118 |
@printf "MDL_MAN = ${MDL_MAN}\n" |
| 2119 |
@printf "MDL_MPI_TRG = ${MDL_MPI_TRG}\n" |
| 2120 |
@printf "MDL_OBJ = ${MDL_OBJ}\n" |
| 2121 |
@printf "MDL_PTH = ${MDL_PTH}\n" |
| 2122 |
@printf "MDL_RPM_NST_NM = ${MDL_RPM_NST_NM}\n" |
| 2123 |
@printf "MDL_SRC = ${MDL_SRC}\n" |
| 2124 |
@printf "MPI = ${MPI}\n" |
| 2125 |
@printf "MPICC = ${MPICC}\n" |
| 2126 |
@printf "MPICH_CC = ${MPICH_CC}\n" |
| 2127 |
@printf "MPICH_CXX = ${MPICH_CXX}\n" |
| 2128 |
@printf "MPICXX = ${MPICXX}\n" |
| 2129 |
@printf "MPI_PRC = ${MPI_PRC}\n" |
| 2130 |
@printf "MPI_PRC_SNG = ${MPI_PRC_SNG}\n" |
| 2131 |
@printf "MPI_ROOT = ${MPI_ROOT}\n" |
| 2132 |
@printf "MY_BIN_DIR = ${MY_BIN_DIR}\n" |
| 2133 |
@printf "MY_BLD_DIR = ${MY_BLD_DIR}\n" |
| 2134 |
@printf "MY_BLD_DIR = ${MY_BLD_DIR}\n" |
| 2135 |
@printf "MY_DAT_DIR = ${MY_DAT_DIR}\n" |
| 2136 |
@printf "MY_DOC_DIR = ${MY_DOC_DIR}\n" |
| 2137 |
@printf "MY_DPN_DIR = ${MY_DPN_DIR}\n" |
| 2138 |
@printf "MY_INC_DIR = ${MY_INC_DIR}\n" |
| 2139 |
@printf "MY_LIB_DIR = ${MY_LIB_DIR}\n" |
| 2140 |
@printf "MY_MAN_DIR = ${MY_MAN_DIR}\n" |
| 2141 |
@printf "MY_OBJ_DIR = ${MY_OBJ_DIR}\n" |
| 2142 |
@printf "NCO_LDFLAGS = ${NCO_LDFLAGS}\n" |
| 2143 |
@printf "NCO_VRS = ${NCO_VRS}\n" |
| 2144 |
@printf "NC_CFLAGS = ${NC_CFLAGS}\n" |
| 2145 |
@printf "NC_LDFLAGS = ${NC_LDFLAGS}\n" |
| 2146 |
@printf "NETCDF4 = ${NETCDF4}\n" |
| 2147 |
@printf "NETCDF4_ROOT = ${NETCDF4_ROOT}\n" |
| 2148 |
@printf "NETCDF_INC = ${NETCDF_INC}\n" |
| 2149 |
@printf "NETCDF_LIB = ${NETCDF_LIB}\n" |
| 2150 |
@printf "NETCDF_ROOT = ${NETCDF_ROOT}\n" |
| 2151 |
@printf "OMP = ${OMP}\n" |
| 2152 |
@printf "OPTS = ${OPTS}\n" |
| 2153 |
@printf "OTHER_CFLAGS = ${OTHER_CFLAGS}\n" |
| 2154 |
@printf "OTHER_LDFLAGS = ${OTHER_LDFLAGS}\n" |
| 2155 |
@printf "PGI_RCH_ARG = ${PGI_RCH_ARG}\n" |
| 2156 |
@printf "PNETCDF = ${PNETCDF}\n" |
| 2157 |
@printf "PSC_RCH_ARG = ${PSC_RCH_ARG}\n" |
| 2158 |
@printf "PVM_ARCH = ${PVM_ARCH}\n" |
| 2159 |
@printf "RPM = ${RPM}\n" |
| 2160 |
@printf "SRC_LST = ${SRC_LST}\n" |
| 2161 |
@printf "STC = ${STC}\n" |
| 2162 |
@printf "SZ = ${SZ}\n" |
| 2163 |
@printf "SZ_LIB = ${SZ_LIB}\n" |
| 2164 |
@printf "TAGS_FILES = ${TAGS_FILES}\n" |
| 2165 |
@printf "TAGS_FILTER_FILES = ${TAGS_FILTER_FILES}\n" |
| 2166 |
@printf "THR_NBR = ${THR_NBR}\n" |
| 2167 |
@printf "THR_NBR_SNG = ${THR_NBR_SNG}\n" |
| 2168 |
@printf "UDUNITS = ${UDUNITS}\n" |
| 2169 |
@printf "UDUNITS_INC = ${UDUNITS_INC}\n" |
| 2170 |
@printf "UDUNITS_LIB = ${UDUNITS_LIB}\n" |
| 2171 |
@printf "UDUNITS_INC_FLG = ${UDUNITS_INC_FLG}\n" |
| 2172 |
@printf "UDUNITS_LIB_FLG = ${UDUNITS_LIB_FLG}\n" |
| 2173 |
@printf "VPATH = ${VPATH}\n" |
| 2174 |
@printf "VRS_SNG = ${VRS_SNG}\n" |
| 2175 |
@printf "YACC = ${YACC}\n" |
| 2176 |
@printf "YFLAGS = ${YFLAGS}\n" |
| 2177 |
distclean: dst_cln |
| 2178 |
dst_cln: cln bin_cln dat_cln doc_cln root_cln |
| 2179 |
cd ${MY_BLD_DIR}; rm -f *~ |
| 2180 |
cd ${MY_DAT_DIR}; rm -f buggy.nc cmip5.nc dsm.nc obs.nc hdf.hdf mdl_1.nc mdl_2.nc mdl_3.nc in.nc in_4c.nc in_4.nc in_grp.nc in_grp_1.nc in_grp_2.nc in_grp_3.nc in_grp_4.nc in_grp_5.nc in_grp_6.nc in_grp_7.nc in_grp_8.nc in_mlt_rec1.nc in_mlt_rec2.nc in_rec_zero.nc *~ |
| 2181 |
tags: |
| 2182 |
etags ${TAGS_FILES} |
| 2183 |
# etags ${MY_SRC_DIR}/*.h $(filter-out ${TAGS_FILTER_FILES},${SRC_LST}) ${MDL_DOC_SRC} ${MDL_MAN} ${MDL_BLD_SRC} ${MDL_CXX_SRC} ${MDL_NCAP_SRC} |
| 2184 |
|
| 2185 |
# Reset internal YACC and LEX patterns |
| 2186 |
%.c : %.y |
| 2187 |
%.c : %.l |
| 2188 |
|
| 2189 |
# It is safest to do both YACC and LEX after either file changes |
| 2190 |
# Otherwise only changing one and then switching, e.g., from bison to yacc, can cause problems |
| 2191 |
# NB: Bison has problem when bison.simple declares yyparse() as int yyparse (void); |
| 2192 |
# Solution is to comment out that definition in bison.simple |
| 2193 |
ifeq (${YACC},bison) |
| 2194 |
${MY_SRC_DIR}/%_yacc.c ${MY_SRC_DIR}/%_yacc.h : ${MY_SRC_DIR}/%_yacc.y |
| 2195 |
${YACC} ${YFLAGS} --output=$(basename $<).c -d $< |
| 2196 |
#${MY_SRC_DIR}/%_yacc.c ${MY_SRC_DIR}/%_yacc.h : ${MY_SRC_DIR}/%_yacc.y |
| 2197 |
# ${YACC} ${YFLAGS} --file-prefix=$(notdir $($(basename $<))) -d $< |
| 2198 |
#%_yacc.c %_yacc.h : %_yacc.y |
| 2199 |
# ${YACC} ${YFLAGS} --file-prefix=$(notdir $($(basename $<))) -d $< |
| 2200 |
endif |
| 2201 |
ifeq (${YACC},yacc) |
| 2202 |
%.tab.c %.tab.h : %.y |
| 2203 |
${YACC} ${YFLAGS} $< |
| 2204 |
mv y.tab.c $(basename $<).c |
| 2205 |
mv y.tab.h $(basename $<).h |
| 2206 |
endif |
| 2207 |
|
| 2208 |
%_lex.c : %_lex.l |
| 2209 |
${LEX} ${LFLAGS} $< |
| 2210 |
mv lex.${NCO_YY_PFX}.c $(basename $<).c |
| 2211 |
|
| 2212 |
# Target-specific variable values syntax TARGET ... : VARIABLE-ASSIGNMENT |
| 2213 |
# Rules begin in leftmost column else interpreted as commands |
| 2214 |
ifneq (${null},$(findstring ${PVM_ARCH},LINUXALPHALINUXAMD64LINUXARMFREEBSD)) |
| 2215 |
ifeq (gcc,$(firstword ${CC})) |
| 2216 |
${MY_OBJ_DIR}/nco_grp_trv.o : CFLAGS := $(filter-out -Wcast-qual,${CFLAGS}) |
| 2217 |
${MY_OBJ_DIR}/nco_grp_trv.o : CXXFLAGS := $(filter-out -Wcast-qual,${CXXFLAGS}) |
| 2218 |
endif # !GCC |
| 2219 |
endif # !LINUX |
| 2220 |
|
| 2221 |
# ncap, and only ncap, requires AIX system C++ library |
| 2222 |
ifneq (${null},$(findstring AIX,${PVM_ARCH})) |
| 2223 |
ifneq (${null},$(findstring xl,${CC})) |
| 2224 |
# Target-specific variable values syntax TARGET ... : VARIABLE-ASSIGNMENT |
| 2225 |
# Rules begin in leftmost column else interpreted as commands |
| 2226 |
ncap : LDFLAGS += -lC |
| 2227 |
endif # !AIX VA Compiler Collection |
| 2228 |
endif # !AIX |
| 2229 |
# For some reason, ncap_lex.c is not remade when I expect it to be, so I explicitly remove the object file every time |
| 2230 |
ncap: ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${libnco}.a |
| 2231 |
|
| 2232 |
ncap2 : |
| 2233 |
-cd ../src/nco++; ${MAKE} -f Makefile.old DAP=${DAP} DBG=${DBG} GSL=${GSL} MPI=${MPI} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} PNETCDF=${PNETCDF} SZ=${SZ} UDUNITS=${UDUNITS} all |
| 2234 |
|
| 2235 |
# /bin/rm -f ${MDL_NCAP} ${MY_OBJ_DIR}/$@_lex.o |
| 2236 |
|
| 2237 |
# Create dependency files only if they will not be immediately deleted |
| 2238 |
INCLUDE_DPN := TRUE |
| 2239 |
GOALS_WHICH_DELETE_DEPENDENCY_FILES := cln clean dir distclean dst_cln dpn_cln tags uninstall |
| 2240 |
ifeq (${null},$(findstring $(MAKECMDGOALS),${GOALS_WHICH_DELETE_DEPENDENCY_FILES})) |
| 2241 |
INCLUDE_DPN := TRUE |
| 2242 |
else |
| 2243 |
INCLUDE_DPN := FALSE |
| 2244 |
endif |
| 2245 |
ifeq (${INCLUDE_DPN},TRUE) |
| 2246 |
-include ${MDL_DPN} |
| 2247 |
endif |