diff --git a/etc/bashrc b/etc/bashrc index 30241548cd..a949d5e11e 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -136,6 +136,11 @@ projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION" # * on a 32-bit OS this option is ignored (always 32-bit) #export WM_ARCH_OPTION=64 +# [FOAM_EXTRA_CXXFLAGS] +# Additional compilation flags - do not inherit from the environment. +# Set after sourcing or via to avoid surprises. +unset FOAM_EXTRA_CXXFLAGS + ################################################################################ # NO (NORMAL) USER EDITING BELOW HERE diff --git a/etc/config.csh/unset b/etc/config.csh/unset index c3405cd65e..94dc6f8490 100644 --- a/etc/config.csh/unset +++ b/etc/config.csh/unset @@ -9,8 +9,7 @@ # Copyright (C) 2016-2019 OpenCFD Ltd. #------------------------------------------------------------------------------ # License -# This file is part of OpenFOAM, licensed under GNU General Public License -# . +# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # File # etc/config.csh/unset @@ -46,20 +45,15 @@ endif unsetenv WM_ARCH unsetenv WM_ARCH_OPTION -unsetenv WM_CC -unsetenv WM_CFLAGS unsetenv WM_COMPILER unsetenv WM_COMPILER_ARCH unsetenv WM_COMPILER_TYPE unsetenv WM_COMPILER_LIB_ARCH unsetenv WM_COMPILE_OPTION -unsetenv WM_CXX -unsetenv WM_CXXFLAGS unsetenv WM_DIR unsetenv WM_HOSTS unsetenv WM_LABEL_OPTION unsetenv WM_LABEL_SIZE -unsetenv WM_LDFLAGS unsetenv WM_MPLIB unsetenv WM_NCOMPPROCS unsetenv WM_OPTIONS @@ -75,6 +69,11 @@ unsetenv WM_PROJECT_VERSION unsetenv WM_SCHEDULER unsetenv WM_THIRD_PARTY_DIR +# Older variables + +# Before 1906 +unsetenv WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS + #------------------------------------------------------------------------------ # Unset FOAM_* environment variables @@ -84,8 +83,9 @@ unsetenv FOAM_APPBIN unsetenv FOAM_APP unsetenv FOAM_CODE_TEMPLATES unsetenv FOAM_ETC +unsetenv FOAM_EXTRA_CXXFLAGS +unsetenv FOAM_EXTRA_LDFLAGS unsetenv FOAM_EXT_LIBBIN -unsetenv FOAM_INST_DIR unsetenv FOAM_JOB_DIR unsetenv FOAM_LIBBIN unsetenv FOAM_MPI @@ -102,6 +102,10 @@ unsetenv FOAM_USER_APPBIN unsetenv FOAM_USER_LIBBIN unsetenv FOAM_UTILITIES +# Old variables + +# Before 1812 +unsetenv FOAM_INST_DIR #------------------------------------------------------------------------------ # Unset MPI-related environment variables diff --git a/etc/config.sh/unset b/etc/config.sh/unset index 3676b19c20..4b9bcbf15f 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -6,11 +6,10 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2019 OpenCFD Ltd. +# Copyright (C) 2016-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License -# This file is part of OpenFOAM, licensed under GNU General Public License -# . +# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # File # etc/config.sh/unset @@ -35,19 +34,14 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \ unset WM_ARCH unset WM_ARCH_OPTION -unset WM_CC -unset WM_CFLAGS unset WM_COMPILER unset WM_COMPILER_TYPE unset WM_COMPILER_LIB_ARCH unset WM_COMPILE_OPTION -unset WM_CXX -unset WM_CXXFLAGS unset WM_DIR unset WM_HOSTS unset WM_LABEL_OPTION unset WM_LABEL_SIZE -unset WM_LDFLAGS unset WM_MPLIB unset WM_NCOMPPROCS unset WM_OPTIONS @@ -63,6 +57,10 @@ unset WM_PROJECT_VERSION unset WM_SCHEDULER unset WM_THIRD_PARTY_DIR +# Older variables + +# Before 1906 +unset WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS #------------------------------------------------------------------------------ # Unset FOAM_* environment variables @@ -72,8 +70,9 @@ unset FOAM_APPBIN unset FOAM_APP unset FOAM_CODE_TEMPLATES unset FOAM_ETC +unset FOAM_EXTRA_CXXFLAGS +unset FOAM_EXTRA_LDFLAGS unset FOAM_EXT_LIBBIN -unset FOAM_INST_DIR unset FOAM_JOB_DIR unset FOAM_LIBBIN unset FOAM_MPI @@ -90,6 +89,10 @@ unset FOAM_USER_APPBIN unset FOAM_USER_LIBBIN unset FOAM_UTILITIES +# Old variables + +# Before 1812 +unset FOAM_INST_DIR #------------------------------------------------------------------------------ # Unset MPI-related environment variables diff --git a/etc/cshrc b/etc/cshrc index b63ba3e4ed..9c3e9a03e2 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -138,6 +138,11 @@ set projectDir=`lsof +p $$ |& \ # * on a 32-bit OS this option is ignored (always 32-bit) #setenv WM_ARCH_OPTION 64 +# [FOAM_EXTRA_CXXFLAGS] +# Additional compilation flags - do not inherit from the environment. +# Set after sourcing or via to avoid surprises. +unsetenv FOAM_EXTRA_CXXFLAGS + ################################################################################ # NO (NORMAL) USER EDITING BELOW HERE diff --git a/wmake/rules/General/Clang/c++ b/wmake/rules/General/Clang/c++ index aa379895cc..4bba0cb569 100644 --- a/wmake/rules/General/Clang/c++ +++ b/wmake/rules/General/Clang/c++ @@ -14,9 +14,12 @@ c++WARN = \ -Wall -Wextra -Wold-style-cast \ -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \ -Wno-undefined-var-template \ - -Wno-unknown-warning-option + -Wno-unknown-warning-option \ + $(FOAM_EXTRA_CXXFLAGS) c++LESSWARN = \ -Wno-old-style-cast -Wno-unused-local-typedefs \ -Wno-tautological-undefined-compare -Wno-shift-negative-value \ -Wno-null-pointer-arithmetic + +#------------------------------------------------------------------------------ diff --git a/wmake/rules/General/Gcc/c++ b/wmake/rules/General/Gcc/c++ index 15b7870a3e..337a7dfe73 100644 --- a/wmake/rules/General/Gcc/c++ +++ b/wmake/rules/General/Gcc/c++ @@ -13,9 +13,12 @@ ptFLAGS = -DNoRepository -ftemplate-depth-100 c++WARN = \ -Wall -Wextra -Wold-style-cast \ -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \ - -Wno-attributes -Wno-unknown-pragmas + -Wno-attributes -Wno-unknown-pragmas \ + $(FOAM_EXTRA_CXXFLAGS) c++LESSWARN = \ -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds \ -Wno-deprecated-declarations \ -fpermissive + +#------------------------------------------------------------------------------ diff --git a/wmake/rules/General/Icc/c++ b/wmake/rules/General/Icc/c++ index 2119fe8faf..e0ad375d2a 100644 --- a/wmake/rules/General/Icc/c++ +++ b/wmake/rules/General/Icc/c++ @@ -14,7 +14,10 @@ c++WARN = \ -Wall -Wextra \ -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \ -Wno-unknown-pragmas \ - -diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076 + -diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076 \ + $(FOAM_EXTRA_CXXFLAGS) c++LESSWARN = \ -diag-disable 1224,2026,2305 + +#------------------------------------------------------------------------------ diff --git a/wmake/rules/General/Pgi/c++ b/wmake/rules/General/Pgi/c++ index b089aab167..e1f41b9425 100644 --- a/wmake/rules/General/Pgi/c++ +++ b/wmake/rules/General/Pgi/c++ @@ -10,5 +10,9 @@ ptFLAGS = -DNoRepository # - Standard warnings # - Less restrictive warnings (may be needed for flex++, CGAL, etc.) -c++WARN = +c++WARN = \ + $(FOAM_EXTRA_CXXFLAGS) + c++LESSWARN = + +#------------------------------------------------------------------------------ diff --git a/wmake/wclean b/wmake/wclean index c7ebcd7bab..3317a802fe 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2017 OpenCFD Ltd. +# Copyright (C) 2017-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -37,37 +37,52 @@ # lnInclude directories generated for libraries. # #------------------------------------------------------------------------------ -Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions -. ${0%/*}/scripts/wmakeFunctions # Source wmake functions +Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions +. "${0%/*}/scripts/wmakeFunctions" # Source wmake functions -usage() { - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat<&2 + echo + echo "Error encountered:" + while [ "$#" -ge 1 ]; do echo " $1"; shift; done + echo + echo "See '${0##*/} -help' for usage" + echo exit 1 } + #------------------------------------------------------------------------------ # Parse arguments and options #------------------------------------------------------------------------------ @@ -78,16 +93,20 @@ MakeDir=Make while [ "$#" -gt 0 ] do case "$1" in - -h | -help*) - usage + -help-f*) # Full help + printHelp -full + ;; + -h | -help*) # Short help + printHelp ;; -a | -all | all) targetType=all ;; -s | -silent) # Ignored - for compatibility with wmake + export WM_QUIET=true ;; -*) - usage "unknown option: '$1'" + die "unknown option: '$1'" ;; *) break diff --git a/wmake/wmake b/wmake/wmake index 8bc070eb4b..ce1a2185a7 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2017-2019 OpenCFD Ltd. +# Copyright (C) 2017-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -94,19 +94,22 @@ cat<