Commit 32fe9406 authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

CONFIG: eliminate compiler/linker enviroment variables (#517)

- with the changes added in #1256 and corresponding updates to
  ThirdParty we can stop exporting these variables:

  WM_CC WM_CFLAGS WM_CXX WM_CXXFLAGS WM_LDFLAGS
parent c320892a
......@@ -22,14 +22,8 @@
setenv WM_ARCH `uname -s` # System name
## if (! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX # System type (POSIX is default)
# Default compiler = gcc/g++ and C++11
setenv WM_CC "gcc"
setenv WM_CXX "g++"
setenv WM_CFLAGS "-fPIC"
setenv WM_CXXFLAGS "-fPIC -std=c++11"
setenv WM_COMPILER_ARCH # Defined but empty
setenv WM_COMPILER_LIB_ARCH # Defined but empty: default for 32bit
unsetenv WM_LDFLAGS
setenv WM_COMPILER_ARCH # Host compiler type (when different than target)
setenv WM_COMPILER_LIB_ARCH # Additional ending for lib directories
# Adjust according to system and architecture
switch ($WM_ARCH)
......@@ -45,18 +39,12 @@ case Linux:
if (! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64 # Default to 64-bit
switch ($WM_ARCH_OPTION)
case 32:
setenv WM_COMPILER_ARCH 64
setenv WM_CFLAGS "$WM_CFLAGS -m32"
setenv WM_CXXFLAGS "$WM_CXXFLAGS -m32"
setenv WM_LDFLAGS "-m32"
setenv WM_COMPILER_ARCH 64 # 64-bit compiler, 32-bit target
breaksw
case 64:
setenv WM_ARCH linux64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CFLAGS "$WM_CFLAGS -m64"
setenv WM_CXXFLAGS "$WM_CXXFLAGS -m64"
setenv WM_LDFLAGS "-m64"
setenv WM_COMPILER_LIB_ARCH 64 # target with lib64
breaksw
default:
......@@ -85,17 +73,11 @@ case Linux:
case ppc64:
setenv WM_ARCH linuxPPC64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CFLAGS "$WM_CFLAGS -m64"
setenv WM_CXXFLAGS "$WM_CXXFLAGS -m64"
setenv WM_LDFLAGS "-m64"
breaksw
case ppc64le:
setenv WM_ARCH linuxPPC64le
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CFLAGS "$WM_CFLAGS -m64"
setenv WM_CXXFLAGS "$WM_CXXFLAGS -m64"
setenv WM_LDFLAGS "-m64"
breaksw
default:
......@@ -108,8 +90,6 @@ case Linux:
case Darwin: # Presumably x86_64
if (! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64 # Default to 64-bit
setenv WM_ARCH darwin64
setenv WM_CFLAGS "$WM_CFLAGS -m64"
setenv WM_CXXFLAGS "$WM_CXXFLAGS -m64"
/bin/cat << INCOMPLETE
===============================================================================
Darwin support (clang only) is incomplete or untested in this OpenFOAM release.
......@@ -227,37 +207,13 @@ setenv FOAM_RUN "$WM_PROJECT_USER_DIR/run"
# Default to system compiler
if (! $?WM_COMPILER_TYPE ) setenv WM_COMPILER_TYPE system
# Cross-compiling
# Non-POSIX systems and cross-compiling
switch ("$WM_COMPILER")
case Mingw*:
setenv WM_OSTYPE MSwindows
breaksw
endsw
# Adjustments for non-gcc compilers
switch ("$WM_COMPILER")
case Clang*: # Clang compiler suite
setenv WM_CC 'clang'
setenv WM_CXX 'clang++'
breaksw
case Cray*: # Cray system compilers
setenv WM_CC 'cc'
setenv WM_CXX 'CC'
breaksw
case Icc*: # Intel compilers
setenv WM_CC 'icc'
setenv WM_CXX 'icpc'
breaksw
case Arm*: # Arm system compilers
setenv WM_CC 'armclang'
setenv WM_CXX 'armclang++'
breaksw
case Pgi*: # Pgi system compilers
setenv WM_CC 'pgcc'
setenv WM_CXX 'pgc++'
breaksw
endsw
# Clear prior to sourcing
unset gcc_version gmp_version mpfr_version mpc_version clang_version
unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
......
......@@ -19,41 +19,32 @@
# Settings for OpenFOAM.
#
#------------------------------------------------------------------------------
export WM_ARCH=$(uname -s) # System name
export WM_ARCH="$(uname -s)" # System name
## : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE # System type (POSIX is default)
# Default compiler = gcc/g++ and C++11
export WM_CC="gcc"
export WM_CXX="g++"
export WM_CFLAGS="-fPIC"
export WM_CXXFLAGS="-fPIC -std=c++11"
unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH WM_LDFLAGS
unset WM_COMPILER_ARCH # Host compiler type (when different than target)
unset WM_COMPILER_LIB_ARCH # Additional ending for lib directories
# Adjust according to system and architecture
case "$WM_ARCH" in
Linux)
WM_ARCH=linux
case $(uname -m) in
case "$(uname -m)" in
i686)
export WM_ARCH_OPTION=32
;;
x86_64)
: ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION # Default to 64-bit
: "${WM_ARCH_OPTION:=64}"; export WM_ARCH_OPTION # Default to 64-bit
case "$WM_ARCH_OPTION" in
32)
export WM_COMPILER_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m32"
export WM_CXXFLAGS="$WM_CXXFLAGS -m32"
export WM_LDFLAGS="-m32"
export WM_COMPILER_ARCH=64 # 64-bit compiler, 32-bit target
;;
64)
WM_ARCH=linux64
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
export WM_LDFLAGS="-m64"
;;
*)
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32|64" 1>&2
......@@ -80,21 +71,15 @@ Linux)
ppc64)
WM_ARCH=linuxPPC64
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
export WM_LDFLAGS="-m64"
;;
ppc64le)
WM_ARCH=linuxPPC64le
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
export WM_LDFLAGS="-m64"
;;
*)
echo Unknown processor type $(uname -m) for Linux 1>&2
echo Unknown processor type "$(uname -m)" for Linux 1>&2
;;
esac
;;
......@@ -102,8 +87,6 @@ Linux)
Darwin) # Presumably x86_64
: ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION # Default to 64-bit
WM_ARCH=darwin64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
/bin/cat << INCOMPLETE 1>&2
===============================================================================
Darwin support (clang only) is incomplete or untested in this OpenFOAM release.
......@@ -227,38 +210,10 @@ export FOAM_RUN="$WM_PROJECT_USER_DIR/run"
# Default to system compiler
: ${WM_COMPILER_TYPE:=system}; export WM_COMPILER_TYPE
# Cross-compiling
# Non-POSIX systems and cross-compiling
case "$WM_COMPILER" in
(Mingw*)
export WM_OSTYPE=MSwindows
export WM_CC="$(wmake -show-c)"
export WM_CXX="$(wmake -show-cxx)"
export WM_CFLAGS="$(wmake -show-cflags)"
export WM_CXXFLAGS="$(wmake -show-cxxflags)"
;;
esac
# Adjust for non-gcc compilers
case "$WM_COMPILER" in
Clang*) # Clang compiler suite
export WM_CC='clang'
export WM_CXX='clang++'
;;
Cray*) # Cray system compilers
export WM_CC='cc'
export WM_CXX='CC'
;;
Icc*) # Intel compilers
export WM_CC='icc'
export WM_CXX='icpc'
;;
Arm*) # Arm system compilers
export WM_CC='armclang'
export WM_CXX='armclang++'
;;
Pgi*) # Pgi system compilers
export WM_CC='pgcc'
export WM_CXX='pgc++'
;;
esac
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment