ENH: support libz disabling via WM_COMPILE_CONTROL (as ~libz)

- eg, for partially incomplete systems (without libz devel header)

ENH: clearer binding of dummy Pstream in OpenFOAM/Make/options

- link of dummy stub Pstream now contingent on linking libOpenFOAM as
  well. This makes the purpose slightly clearer

ENH: cleaner option naming/handling in wmake script

- allow special purpose -no-openfoam option.
  Eg, compiling test programs without OpenFOAM and Pstream libraries
  but using the rest of the wmake system.

ENH: add +openmp support into WM_COMPILE_CONTROL (#2633)

- this adds compile/link flags for openmp.
  For single-use, can also use 'wmake -openmp'.

  If both +openmp and ~openmp are specified in WM_COMPILE_CONTROL
  the ~openmp will have priority.

  This is actually done indirectly since ~openmp will set empty
  COMP_OPENMP, LINK_OPENMP internal variables, which the +openmp then
  adds to the c++FLAGS and linkexe targets (ie, won't actually add
  anything).

ENH: add +ccache or ccache=... support into WM_COMPILE_CONTROL (#2633)

- with the first version (+ccache), simply use ccache from the path
  without any extra options.

- with the second version (ccache=...), can be more specific about
  what is called.

  Using "+ccache" is identical to "ccache=ccache", but the later could
  be used in other ways. For example,

     ccache=/strange/install/path/ccache
     ccache=</path/my-tooling --option>

  Have the choice of unquoted, single or double quoted or '< >' quoted

STYLE: relocate FOAM_EXTRA_LDFLAGS in general makefile

- removes clutter for different linkers (eg, gold, mold, ldd)
  making it easier to extend for other linkers.

STYLE: protect makefile checks with 'strip' function
This commit is contained in:
Mark Olesen 2022-11-01 12:15:08 +01:00
parent e15b103003
commit 9f7cfa9419
76 changed files with 430 additions and 193 deletions

View File

@ -7,6 +7,7 @@ cd "${0%/*}" || exit # Run from this directory
library/Allwmake
wmake
# Does not use libOpenFOAM or libPstream...
wmake -no-openfoam
#------------------------------------------------------------------------------

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
# Does not use libOpenFOAM or libPstream...
wmake -no-openfoam
#------------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,6 +59,7 @@ void print(const char* name, bool showLimits = true)
int main(int argc, char *argv[])
{
std::cout<< "c++ = " << __cplusplus << '\n';
std::cout<< "machine sizes\n---\n\n";
print<short>("short");

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
# Does not use libOpenFOAM or libPstream...
wmake -no-openfoam
#------------------------------------------------------------------------------

View File

@ -41,8 +41,13 @@ Description
int main(int argc, char *argv[])
{
std::cout
<< "c++ = " << __cplusplus << '\n';
#if _OPENMP
std::cout << "_OPENMP = " << _OPENMP << "\n\n";
std::cout
<< "openmp = " << _OPENMP << '\n'
<< "Initial threads = " << omp_get_num_threads() << "\n\n";
// Fork threads with their own copies of variables
int nThreads, threadId;
@ -52,15 +57,15 @@ int main(int argc, char *argv[])
threadId = omp_get_thread_num();
nThreads = omp_get_num_threads();
// Printf rather than cout to ensure that it emits in one go
printf("Called from thread = %d\n", threadId);
// Master thread
if (threadId == 0)
{
// Printf rather than cout to ensure that it emits in one go
printf("Number of threads = %d\n", nThreads);
}
// Printf rather than cout to ensure that it emits in one go
printf("Called from thread = %d\n", threadId);
}
#else
std::cout << "Compiled without openmp!\n";

View File

@ -82,11 +82,15 @@ export WM_LABEL_SIZE=32
# = Opt | Dbg | Debug | Prof
export WM_COMPILE_OPTION=Opt
# [WM_COMPILE_CONTROL] - additional control for compiler rules
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
# +gold : with gold linker
# +lld : with lld linker (with clang)
# +mold : with mold linker (with clang)
# ~libz : without libz compression
# +openmp : with openmp
# ~openmp : without openmp
# +ccache : use ccache
# ccache=... : ccache command (unquoted, single/double or <> quoted)
# version=... : compiler suffix (eg, "11" for gcc-11)
#export WM_COMPILE_CONTROL="+gold"

View File

@ -82,11 +82,15 @@ setenv WM_LABEL_SIZE 32
# = Opt | Dbg | Debug | Prof
setenv WM_COMPILE_OPTION Opt
# [WM_COMPILE_CONTROL] - additional control for compiler rules
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
# +gold : with gold linker
# +lld : with lld linker (with clang)
# +mold : with mold linker (with clang)
# ~libz : without libz compression
# +openmp : with openmp
# ~openmp : without openmp
# +ccache : use ccache
# ccache=... : ccache command (unquoted, single/double or <> quoted)
# version=... : compiler suffix (eg, "11" for gcc-11)
#setenv WM_COMPILE_CONTROL "+gold"

View File

@ -4,17 +4,19 @@ EXE_INC = \
LIB_LIBS = \
$(FOAM_LIBBIN)/libOSspecific.o
/* libz: (not disabled) */
ifeq (,$(findstring ~libz,$(WM_COMPILE_CONTROL)))
EXE_INC += -DHAVE_LIBZ
LIB_LIBS += -lz
endif
/* Never self-link (WM_PROJECT == OpenFOAM), but do link to Pstream */
PROJECT_LIBS =
ifeq (libo,$(FOAM_LINK_DUMMY_PSTREAM))
LIB_LIBS += $(FOAM_LIBBIN)/dummy/libPstream.o
else
LIB_LIBS += -L$(FOAM_LIBBIN)/dummy -lPstream
endif
/* libz */
EXE_INC += -DHAVE_LIBZ
LIB_LIBS += -lz
/* Project lib dependencies. Never self-link (WM_PROJECT == OpenFOAM) */
PROJECT_LIBS =

View File

@ -17,6 +17,12 @@
# Description
# Makefile used by wmake to make dependency files and libs and applications
#
# Embedded Control Parameters
#
# WM_COMPILE_CONTROL (+openmp)
# WM_COMPILE_CONTROL (~openfoam)
# WM_OSTYPE (windows)
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
@ -25,7 +31,7 @@
SHELL = /bin/sh
ifeq (,$(WM_OSTYPE))
ifeq (,$(strip $(WM_OSTYPE)))
WM_OSTYPE := POSIX
endif
@ -55,22 +61,34 @@ OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
SYS_INC =
SYS_LIBS =
# Add linkage for openmp into the system libraries
ifneq (,$(findstring +openmp,$(WM_COMPILE_CONTROL)))
SYS_LIBS = $(LINK_OPENMP)
endif
# These are set by Make/options
EXE_INC =
EXE_LIBS =
LIB_LIBS =
# Project include/libraries
PROJECT_INC = \
-I$(LIB_SRC)/$(WM_PROJECT)/lnInclude \
-I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
PROJECT_LIBS = -l$(WM_PROJECT) -ldl
EXE_INC =
EXE_LIBS =
LIB_LIBS =
# Special compilation without OpenFOAM at all
ifneq (,$(findstring ~openfoam,$(WM_COMPILE_CONTROL)))
PROJECT_INC =
PROJECT_LIBS =
endif
# These variables are used for some builds - provide fallback values
ifeq (,$(FOAM_SOLVERS))
ifeq (,$(strip $(FOAM_SOLVERS)))
FOAM_SOLVERS = $(WM_PROJECT_DIR)/applications/solvers
endif
ifeq (,$(FOAM_UTILITIES))
ifeq (,$(strip $(FOAM_UTILITIES)))
FOAM_UTILITIES = $(WM_PROJECT_DIR)/applications/utilities
endif
@ -134,6 +152,8 @@ LIB_HEADER_DIRS = \
#------------------------------------------------------------------------------
# Define link statements for executables
#
# Tweak with FOAM_EXTRA_LDFLAGS
#------------------------------------------------------------------------------
.PHONY: all
@ -147,7 +167,7 @@ silent:
$(EXE)$(EXT_EXE): $(OBJECTS)
@$(WM_SCRIPTS)/makeTargetDir $(EXE)
$(call QUIET_MESSAGE,link,$(EXE)$(EXT_EXE))
$E $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
$E $(LINKEXE) $(FOAM_EXTRA_LDFLAGS) $(OBJECTS) -L$(LIB_PLATFORMS) \
$(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
$(LINK_LIBS) $(GLIBS) -o $(EXE)$(EXT_EXE)
@ -157,12 +177,14 @@ exe: $(SEXE)$(EXT_EXE) | silent
$(SEXE)$(EXT_EXE): $(OBJECTS)
@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
$(call QUIET_MESSAGE,link,$(SEXE)$(EXT_EXE))
$E $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
$E $(LINKEXE) $(FOAM_EXTRA_LDFLAGS) $(OBJECTS) $(EXE_LIBS) \
$(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)$(EXT_EXE)
#------------------------------------------------------------------------------
# Define link statements for libraries
#
# Tweak with FOAM_EXTRA_LDFLAGS
#------------------------------------------------------------------------------
.PHONY: objects
@ -175,13 +197,13 @@ ifneq (,$(findstring windows,$(WM_OSTYPE)))
$(LIB)$(EXT_SO): $(OBJECTS)
@$(WM_SCRIPTS)/makeTargetDir $(LIB)
$(call QUIET_MESSAGE,link,$(LIB)$(EXT_SO))
$E $(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
$E $(LINKLIBSO) $(FOAM_EXTRA_LDFLAGS) $(OBJECTS) -L$(LIB_PLATFORMS) \
$(PROJECT_LIBS) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB)$(EXT_SO)
else
$(LIB)$(EXT_SO): $(OBJECTS)
@$(WM_SCRIPTS)/makeTargetDir $(LIB)
$(call QUIET_MESSAGE,link,$(LIB)$(EXT_SO))
$E $(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
$E $(LINKLIBSO) $(FOAM_EXTRA_LDFLAGS) $(OBJECTS) -L$(LIB_PLATFORMS) \
$(LIB_LIBS) $(GLIB_LIBS) -o $(LIB)$(EXT_SO)
endif

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2021 OpenCFD Ltd.
# Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -96,6 +96,17 @@ cflags-arch:
cxxflags-arch:
@echo "$(strip $(c++ARCH))"
.PHONY: openmp-compile
openmp-compile:
@echo "$(strip $(COMP_OPENMP))"
.PHONY: openmp-link
openmp-link:
@echo "$(strip $(LINK_OPENMP))"
.PHONY: openmp
openmp: openmp-compile
# Like openmpi mpicc --showme:compile
.PHONY: mpi-compile
mpi-compile:

View File

@ -1,5 +1,9 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker -z -Xlinker nodefs
#------------------------------------------------------------------------------

View File

@ -1,8 +1,14 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG) -Wl,--as-needed
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
$(FOAM_EXTRA_LDFLAGS)
LINKLIBSO = $(CC) $(c++FLAGS) -shared
LINKEXE = $(CC) $(c++FLAGS) \
-L$(FOAM_LIBBIN)/dummy -lPstream \
$(FOAM_EXTRA_LDFLAGS)
LINKEXE = $(CC) $(c++FLAGS)
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
endif
#------------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@ c++LESSWARN = \
-Wno-unknown-warning-option \
-Wno-deprecated-copy-with-user-provided-copy \
-Wno-tautological-overlap-compare \
-Wno-#pragma-messages
-Wno-\#pragma-messages
# Tuning
sinclude $(GENERAL_RULES)/common/c++$(WM_COMPILE_OPTION)

View File

@ -1,5 +1,9 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
#------------------------------------------------------------------------------

View File

@ -1,8 +1,10 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
$(FOAM_EXTRA_LDFLAGS)
LINKLIBSO = $(CC) $(c++FLAGS) -shared
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --add-needed
#------------------------------------------------------------------------------

View File

@ -1,10 +1,16 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-fuse-ld=gold \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=gold
LINKEXE = $(CC) $(c++FLAGS) \
-fuse-ld=gold \
-L$(FOAM_LIBBIN)/dummy -lPstream \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=gold
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
endif
#------------------------------------------------------------------------------

View File

@ -1,10 +1,16 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-fuse-ld=lld \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=lld
LINKEXE = $(CC) $(c++FLAGS) \
-fuse-ld=lld \
-L$(FOAM_LIBBIN)/dummy -lPstream \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=lld
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
endif
#------------------------------------------------------------------------------

View File

@ -1,10 +1,16 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-fuse-ld=mold \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=mold
LINKEXE = $(CC) $(c++FLAGS) \
-fuse-ld=mold \
-L$(FOAM_LIBBIN)/dummy -lPstream \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=mold
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
endif
#------------------------------------------------------------------------------

View File

@ -1,5 +1,9 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
#------------------------------------------------------------------------------

View File

@ -1,11 +1,13 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --no-as-needed
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --no-as-needed
#------------------------------------------------------------------------------

View File

@ -1,10 +1,16 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-fuse-ld=gold \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=gold
LINKEXE = $(CC) $(c++FLAGS) \
-fuse-ld=gold \
-L$(FOAM_LIBBIN)/dummy -lPstream \
$(FOAM_EXTRA_LDFLAGS)
-fuse-ld=gold
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
endif
#------------------------------------------------------------------------------

View File

@ -1,5 +1,9 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cFLAGS) -shared
LINKEXE = $(cc) $(cFLAGS) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
#------------------------------------------------------------------------------

View File

@ -1,11 +1,13 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --no-as-needed
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --no-as-needed
#------------------------------------------------------------------------------

View File

@ -1,5 +1,9 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cFLAGS) -shared
LINKEXE = $(cc) $(cFLAGS) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
#------------------------------------------------------------------------------

View File

@ -1,11 +1,13 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --no-as-needed
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
-Xlinker --no-as-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --no-as-needed
#------------------------------------------------------------------------------

View File

@ -1,5 +1,9 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) $(cARCH) -shared
LINKEXE = $(cc) $(cARCH) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
#------------------------------------------------------------------------------

View File

@ -1,8 +1,10 @@
#------------------------------------------------------------------------------
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
$(FOAM_EXTRA_LDFLAGS)
LINKLIBSO = $(CC) $(c++FLAGS) -shared
LINKEXE = $(CC) $(c++FLAGS) \
-Xlinker --add-needed \
$(FOAM_EXTRA_LDFLAGS)
-Xlinker --add-needed
#------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
SUFFIXES += .cu
ifeq (,$(NVARCH))
ifeq (,$(strip $(NVARCH)))
NVARCH = 70
endif

View File

@ -33,7 +33,7 @@ else
endif
# Default compilation is 'Opt' - never permit an empty value
ifeq (,$(WM_COMPILE_OPTION))
ifeq (,$(strip $(WM_COMPILE_OPTION)))
WM_COMPILE_OPTION := Opt
endif
@ -46,6 +46,12 @@ ifneq ("$(COMPILER_FAMILY)","$(WM_COMPILER)")
sinclude $(RULES)/general
sinclude $(RULES)/c++
endif
# Add compile flags for openmp
ifneq (,$(findstring +openmp,$(WM_COMPILE_CONTROL)))
c++FLAGS += $(COMP_OPENMP)
endif
include $(GENERAL_RULES)/transform
#------------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@ ifneq ("$(MPLIB_FAMILY)","$(WM_MPLIB)")
endif
# Specific rules
ifneq ("","$(WM_MPLIB)")
ifneq (,$(strip $(WM_MPLIB)))
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
# system-specific
@ -32,7 +32,7 @@ ifneq ("","$(WM_MPLIB)")
endif
# Default target MPI libdir is PROJECT lib/<mpi-name>
ifeq (,$(FOAM_MPI_LIBBIN))
ifeq (,$(strip $(FOAM_MPI_LIBBIN)))
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif

View File

@ -11,7 +11,7 @@ WMKDEP := $(WMAKE_BIN)/wmkdepend
WMKDEP_FLAGS := -eWM_PROJECT_DIR -eWM_THIRD_PARTY_DIR
ifneq ("","$(WM_QUIET)")
ifneq (,$(strip $(WM_QUIET)))
E=@
define QUIET_MESSAGE
@echo " $1: $2";
@ -38,7 +38,7 @@ $(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))
$(OBJECTS_DIR)/%.dep : %
$(call QUIET_MESSAGE,dep,$(<F))
$(call VERBOSE_MESSAGE,Making dependency list for source file,$(<F))
$(call VERBOSE_MESSAGE,Making dependencies:,$(<F))
@$(WM_SCRIPTS)/makeTargetDir $@
@$(WMKDEP) $(WMKDEP_FLAGS) -o$@ -I$(*D) $(LIB_HEADER_DIRS) $<

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c
cARCH := -m64 -ftrapping-math
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c++
c++ARCH := -m64 -pthread -ftrapping-math
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -5,7 +5,7 @@ include $(GENERAL_RULES)/Clang/c
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -4,7 +4,7 @@ include $(GENERAL_RULES)/Clang/c++
c++ARCH := -m64 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c++
c++ARCH := -m64 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Gcc/c
cc := cc
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Gcc/c++
CC := CC -std=c++14
c++ARCH := -m64 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c++
c++ARCH := -m64 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Icc/c
cARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Icc/c++
c++ARCH := -pthread -fp-trap=common -fp-model precise
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Icx/c
cARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Icx/c++
c++ARCH := -fp-model precise
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Gcc/c
cc := x86_64-w64-mingw32-gcc
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -7,7 +7,7 @@ include $(GENERAL_RULES)/Gcc/c++
CC := x86_64-w64-mingw32-g++ -std=gnu++14
c++ARCH := -m64 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif
@ -32,13 +32,11 @@ LINKLIBSO = $(CC) $(c++FLAGS) -shared \
-Wl,--enable-runtime-pseudo-reloc \
-Wl,--enable-auto-import \
-Wl,--enable-auto-image-base \
-Wl,--strip-all \
$(FOAM_EXTRA_LDFLAGS)
-Wl,--strip-all
LINKEXE = $(CC) $(c++FLAGS) \
-Wl,--enable-auto-import \
-Wl,--strip-all \
-Wl,--force-exe-suffix \
$(FOAM_EXTRA_LDFLAGS)
-Wl,--force-exe-suffix
#------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Nvidia/c
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Nvidia/c++
c++ARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Clang/c
cc := armclang$(COMPILER_VERSION)
cARCH := -mcpu=native
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Clang/c++
CC := armclang++$(COMPILER_VERSION) -std=c++14
c++ARCH := -mcpu=native -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c
cARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c++
c++ARCH := -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Clang/c
cc := fcc$(COMPILER_VERSION)
cARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@ include $(GENERAL_RULES)/Clang/c++
CC := FCC$(COMPILER_VERSION) -std=c++14
c++ARCH := -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c
cARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c++
c++ARCH := -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Nvidia/c
cARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Nvidia/c++
c++ARCH :=
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c
cARCH := -m32
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c++
c++ARCH := -m32 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c
cARCH := -m32
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c++
c++ARCH := -m32 -pthread
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Icc/c
cARCH := -gcc-version=400
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Icc/c++
c++ARCH := -pthread -fp-trap=common -fp-model precise
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c
cARCH := -m64 -mcpu=power5+
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c++
c++ARCH := -m64 -mcpu=power5+
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c
cARCH := -m64 -mcpu=power8
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c++
c++ARCH := -m64 -mcpu=power8
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c
cARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
endif

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Gcc/c++
c++ARCH := -m64
ifneq (,$(WM_COMPILE_OPTION))
ifneq (,$(strip $(WM_COMPILE_OPTION)))
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
endif

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2014-2017 OpenFOAM Foundation
# Copyright (C) 2019-2021 OpenCFD Ltd.
# Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -81,11 +81,13 @@ USAGE
#------------------------------------------------------------------------------
# Parse the arguments and options
# Parse the arguments and options.
# Prefix with 'wmakeOpt_' to avoid affecting the sourcing environment.
#
#------------------------------------------------------------------------------
unset optDebug optLog optNonRecursive optQueue
unset optWmakeFrontend
unset wmakeOpt_frontend wmakeOpt_nonRecursive
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_queue
for arg in "$@"
do
@ -99,13 +101,13 @@ do
-with-bear)
# Use 'bear' as frontend wrapper to wmake
optWmakeFrontend="-with-bear"
wmakeOpt_frontend="-with-bear"
continue # Argument handled, remove it
;;
-no-recurs* | -fromWmake)
# Avoid recursion (eg, if called from wmake)
optNonRecursive=true
wmakeOpt_nonRecursive=true
# Pass onwards to other Allwmake scripts
;;
@ -155,29 +157,29 @@ do
;;
-l | -log)
optLog="log.${WM_OPTIONS:-build}"
wmakeOpt_log="log.${WM_OPTIONS:-build}"
continue # Argument handled, remove it
;;
-log=*)
optLog="${arg##*=}"
if [ -d "$optLog" ]
wmakeOpt_log="${arg##*=}"
if [ -d "$wmakeOpt_log" ]
then
optLog="${optLog%/}/log.${WM_OPTIONS:-build}"
elif [ -z "$optLog" ]
wmakeOpt_log="${wmakeOpt_log%/}/log.${WM_OPTIONS:-build}"
elif [ -z "$wmakeOpt_log" ]
then
optLog="log.${WM_OPTIONS:-build}"
wmakeOpt_log="log.${WM_OPTIONS:-build}"
fi
continue # Argument handled, remove it
;;
-debug | -debug-O[0123])
optDebug="$arg"
-debug | -debug-O[g0123])
wmakeOpt_debug="$arg"
continue # Argument handled, remove it
;;
-q | -queue)
optQueue="-queue"
wmakeOpt_queue="-queue"
continue # Argument handled, remove it
;;
@ -196,21 +198,22 @@ done
# Execute wmake -all if not called from wmake
#------------------------------------------------------------------------------
if [ -z "$optNonRecursive" ]
if [ -z "$wmakeOpt_nonRecursive" ]
then
if [ -z "$optLog" ]
if [ -z "$wmakeOpt_log" ]
then
exec wmake $optWmakeFrontend -all \
$optDebug $optQueue $*
exec wmake $wmakeOpt_frontend -all \
$wmakeOpt_debug $wmakeOpt_queue $wmakeOpt_openmp $*
exit $? # Unneeded, but just in case something went wrong
else
echo "Logging wmake -all output to '$optLog'" 1>&2
echo "Logging wmake -all output to '$wmakeOpt_log'" 1>&2
echo 1>&2
exec wmake $optWmakeFrontend -all \
$optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
exec wmake $wmakeOpt_frontend -all \
$wmakeOpt_debug $wmakeOpt_queue $wmakeOpt_openmp $* 2>&1 | \
/usr/bin/tee $wmakeOpt_log
# Need to cleanup after the tee
rc=$? # Error code from tee (not wmake), but not entirely important
echo "Done logging to '$optLog'" 1>&2
echo "Done logging to '$wmakeOpt_log'" 1>&2
exit "$rc"
fi
fi
@ -230,8 +233,8 @@ fi
# Cleanup local variables and functions
#------------------------------------------------------------------------------
unset optWmakeFrontend
unset optNonRecursive optDebug optLog optQueue
unset wmakeOpt_frontend wmakeOpt_nonRecursive
unset wmakeOpt_debug wmakeOpt_log wmakeOpt_queue
unset -f usage

View File

@ -40,9 +40,12 @@ SHELL = /bin/sh
# Set compilation and dependency building rules
#------------------------------------------------------------------------------
# Locally set optimized compilation
# Locally defined: optimized compilation
WM_COMPILE_OPTION = Opt
# Never want openmp for tools!
WM_COMPILE_CONTROL += ~openmp
GENERAL_RULES = $(WM_DIR)/rules/General
include $(GENERAL_RULES)/general
@ -62,7 +65,7 @@ all: $(WMAKE_BIN)/lemon$(EXT_EXE) $(WMAKE_BIN)/wmkdepend$(EXT_EXE) message
old: $(WMAKE_BIN)/wmkdep$(EXT_EXE)
message:
ifneq ($(archBuild),$(archTarget))
ifneq ("$(archBuild)","$(archTarget)")
@echo "built wmake-bin ($(archTarget)) with $(archBuild)"
else
@echo "built wmake-bin ($(archTarget))"

View File

@ -75,7 +75,10 @@ cat<<HELP_FULL
-module-prefix=PATH Specify FOAM_MODULE_PREFIX as absolute/relative path
-module-prefix=TYPE Specify FOAM_MODULE_PREFIX as predefined type
(u,user | g,group | o,openfoam)
-no-openmp Disable openmp (adds '~openmp' to WM_COMPILE_CONTROL)
-no-openfoam Disable OpenFOAM linking ('~openfoam' WM_COMPILE_CONTROL)
-openmp Compile/link with openmp ('+openmp' WM_COMPILE_CONTROL)
-no-openmp Disable openmp ('~openmp' WM_COMPILE_CONTROL)
-no-scheduler Disable scheduled parallel compilation
-show-api Print api value (from Make rules)
@ -92,6 +95,8 @@ cat<<HELP_FULL
-show-path-cxx Print path to C++ compiler
-show-mpi-compile Print mpi-related flags used when compiling
-show-mpi-link Print mpi-related flags used when linking
-show-openmp-compile Print openmp flags used when compiling
-show-openmp-link Print openmp flags used when compiling
HELP_FULL
fi
@ -202,12 +207,13 @@ allCores()
#------------------------------------------------------------------------------
# Default to compiling the local target only
unset optAll optUpdate optCxx optDebug optQuiet optShow optPwd
unset opt_all opt_update opt_quiet opt_show opt_pwd
unset opt_debug opt_openmp opt_openfoam
# Consistency with inherited values
if [ "$WM_QUIET" = true ]
then
optQuiet=true
opt_quiet=true
elif [ "$WM_QUIET" = false ]
then
# Makefile syntax only checks set/unset, so handle true/false here
@ -237,7 +243,7 @@ do
# Out of order options: (-quiet)
-check-dir) shift
exec "$scriptsDir/wmake-check-dir" \
${optQuiet:+-silent} "$@"
${opt_quiet:+-silent} "$@"
exit $?
;;
@ -248,16 +254,16 @@ do
;;
-s | -silent | -quiet)
optQuiet=true
opt_quiet=true
export WM_QUIET=true
;;
-debug)
optDebug="-g"
opt_debug="-g"
;;
-debug-O[g0123])
optDebug="-g -${1##*-}"
opt_debug="-g -${1##*-}"
;;
-build-root=*)
@ -272,20 +278,26 @@ do
-show-ext-so | \
-show-compile-c | -show-c | -show-cflags | -show-cflags-arch | \
-show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch | \
-show-mpi-compile | -show-mpi-link )
-show-mpi-compile | -show-mpi-link | \
-show-openmp-compile | -show-openmp-link)
printInfo "${1#-show-}"
optShow=true
opt_show=true
;;
-show-path-c | -show-path-cxx )
command -v $(printInfo "${1#-show-path-}")
optShow=true
opt_show=true
;;
# Recursive build all targets
-a | -all | all)
optAll=all
opt_all=all
;;
# Recursive build all with scheduled queuing
-q | -queue | queue)
optAll=queue
opt_all=queue
;;
# Parallel compilation on all cores (or specified number of cores)
-j)
export WM_NCOMPPROCS=0
@ -309,10 +321,17 @@ do
-k | -keep-going | -non-stop)
export WM_CONTINUE_ON_ERROR=true
;;
# Disable use of openmp
# Compile/link with openmp
-openmp)
opt_openmp=true
;;
# Disable openmp
-no-openmp)
WM_COMPILE_CONTROL="$WM_COMPILE_CONTROL ~openmp"
export WM_COMPILE_CONTROL
opt_openmp=false
;;
# Link without openfoam libraries
-no-openfoam)
opt_openfoam=false
;;
# Disable scheduled parallel compilation
-no-scheduler)
@ -320,7 +339,7 @@ do
;;
# Print root directory containing a Make/ directory and exit
-pwd)
optPwd=true
opt_pwd=true
;;
# Meant to be used following a pull, this will:
# - remove dep files that depend on deleted files;
@ -329,8 +348,8 @@ do
# - remove empty directories, along with deprecated object directories
# and respective binaries.
-update)
optUpdate=true
: "${optAll:=all}" # implies 'all', unless previously set
opt_update=true
: "${opt_all:=all}" # implies 'all', unless previously set
;;
-show-api | -version | --version)
@ -348,7 +367,7 @@ do
done
# Can terminate now if it was one of the -showXXX options
if [ "$optShow" = true ]
if [ "$opt_show" = true ]
then
exit 0
fi
@ -397,7 +416,7 @@ MakeDir=Make
unset dir
if [ -n "$optPwd" ]
if [ -n "$opt_pwd" ]
then
if [ $# -ge 1 ]
then
@ -474,11 +493,102 @@ fi
unset dir
#------------------------------------------------------------------------------
# Setup additional compiler settings etc
#------------------------------------------------------------------------------
# Handle openmp flags. Since we are using bash, can easily remove
# conflicting values from WM_COMPILE_CONTROL
case "$opt_openmp" in
(true) # Override: compile/link with openmp
WM_COMPILE_CONTROL="${WM_COMPILE_CONTROL/~openmp/} +openmp"
export WM_COMPILE_CONTROL
;;
(false) # Override: disable use of openmp
WM_COMPILE_CONTROL="${WM_COMPILE_CONTROL/+openmp/} ~openmp"
export WM_COMPILE_CONTROL
;;
esac
# Handle openfoam flags - can currently only disable
case "$opt_openfoam" in
(false) # Override: disable openfoam libraries
WM_COMPILE_CONTROL="${WM_COMPILE_CONTROL} ~openfoam"
export WM_COMPILE_CONTROL
;;
esac
# Debug:
##echo "WM_COMPILE_CONTROL='$WM_COMPILE_CONTROL'" 1>&2
# Handle debug flags
if [ -n "$opt_debug" ]
then
# Add -debug value and -DFULLDEBUG into FOAM_EXTRA_CXXFLAGS
opt_debug="${FOAM_EXTRA_CXXFLAGS:+ }${opt_debug} -DFULLDEBUG"
case "$FOAM_EXTRA_CXXFLAGS" in
(*-DFULLDEBUG*)
# Appears to have already been added
;;
(*)
export FOAM_EXTRA_CXXFLAGS="${FOAM_EXTRA_CXXFLAGS}${opt_debug}"
;;
esac
fi
# Extract ccache controls from WM_COMPILE_CONTROL if possible
# and when queuing is not active
if [ "$opt_all" != queue ]
then
unset opt_ccache
case "$WM_COMPILE_CONTROL" in
(*ccache=*)
opt_ccache="${WM_COMPILE_CONTROL##*ccache=}"
case "$opt_ccache" in
('<'*)
# Angle bracket quoted: ccache=<command ...>
# - extract between < > delimiters
opt_ccache="${opt_ccache#<}"
opt_ccache="${opt_ccache%%>*}"
;;
("'"*)
# Single-quoted
opt_ccache="${opt_ccache#\'}"
opt_ccache="${opt_ccache%%\'*}"
;;
('"'*)
# Double-quoted
opt_ccache="${opt_ccache#\"}"
opt_ccache="${opt_ccache%%\"*}"
;;
(*)
# Plain ccache=command - truncate after first space
opt_ccache="${opt_ccache%% *}"
;;
esac
;;
(*'+ccache'*)
# Simple specification
opt_ccache="ccache"
;;
esac
if [ -n "$opt_ccache" ]
then
export WM_SCHEDULER="$opt_ccache"
fi
fi
# Debug:
##echo "WM_SCHEDULER='$WM_SCHEDULER'" 1>&2
#------------------------------------------------------------------------------
# Recurse the source tree to update all
#------------------------------------------------------------------------------
if [ "$optUpdate" = true ]
if [ "$opt_update" = true ]
then
wrmdep -update
wrmdep -old
@ -487,29 +597,14 @@ then
export WM_UPDATE_DEPENDENCIES=yes
fi
unset exitCode
#------------------------------------------------------------------------------
# Recurse the source tree to compile "all" targets
#------------------------------------------------------------------------------
if [ -n "$optDebug" ]
if [ "$opt_all" = all ]
then
# Add -debug value and -DFULLDEBUG into FOAM_EXTRA_CXXFLAGS
optDebug="${FOAM_EXTRA_CXXFLAGS:+ }$optDebug -DFULLDEBUG"
case "$FOAM_EXTRA_CXXFLAGS" in
(*-DFULLDEBUG*)
# Appears to have already been added
;;
(*)
export FOAM_EXTRA_CXXFLAGS="${FOAM_EXTRA_CXXFLAGS}${optDebug}"
;;
esac
fi
unset exitCode
if [ "$optAll" = all ]
then
if [ -e Allwmake.override ]
then
if [ -x Allwmake.override ]
@ -565,9 +660,10 @@ fi
#------------------------------------------------------------------------------
# Recurse source tree to compile "all" targets using wmakeCollect
#------------------------------------------------------------------------------
if [ "$optAll" = queue ]
if [ "$opt_all" = queue ]
then
[ "$optUpdate" = true ] || wmakeLnIncludeAll $parOpt
[ "$opt_update" = true ] || wmakeLnIncludeAll $parOpt
if [ -n "$FOAM_BUILDROOT" ] && [ -w "$FOAM_BUILDROOT" ]
then
@ -705,6 +801,7 @@ esac
if [ -n "$WM_UPDATE_DEPENDENCIES" ]
then
unset exitCode
$make -f "$WM_DIR"/makefiles/general \
MAKE_DIR="$MakeDir" OBJECTS_DIR="$objectsDir" updatedep