- give precedence to ~openmp (-no-openmp) over +openmp (-openmp) in the general rules and in the Makefile. This makes it robuster when specifying +openmp in general, but ~openmp for specific build components. - disable openmp for OSspecific and Pstream components. Neither should contain any openmp code anyhow. Additionally, since OSspecific is generally built as a static object, it can become problematic (eg, with AMD ROCm) if the compiler generates information that openmp is required but then uses static linkage.
67 lines
1.9 KiB
Makefile
67 lines
1.9 KiB
Makefile
#-------------------------------*- makefile -*---------------------------------
|
|
WM_VERSION = OPENFOAM=2309
|
|
|
|
AR = ar
|
|
ARFLAGS = cr
|
|
RANLIB = ranlib
|
|
CPP = cpp
|
|
LD = ld
|
|
|
|
GFLAGS = -D$(WM_VERSION) \
|
|
-DWM_$(WM_PRECISION_OPTION) -DWM_LABEL_SIZE=$(WM_LABEL_SIZE)
|
|
GINC =
|
|
GLIBS = -lm
|
|
GLIB_LIBS =
|
|
|
|
|
|
ARCHITECTURE_RULES = $(WM_DIR)/rules/$(WM_ARCH)
|
|
COMPILER_FAMILY = $(shell echo "$(WM_COMPILER)" | sed -e 's/[-+.0-9~].*//')
|
|
DEFAULT_RULES = $(ARCHITECTURE_RULES)$(COMPILER_FAMILY)
|
|
RULES = $(ARCHITECTURE_RULES)$(WM_COMPILER)
|
|
WMAKE_BIN = $(WM_PROJECT_DIR)/platforms/tools/$(WM_ARCH)$(WM_COMPILER)
|
|
|
|
# --------
|
|
# Extract compiler version suffix.
|
|
# Most (all?) compilers use the convention <compiler>-<version>
|
|
#
|
|
# Thus (for example) version=11 -> gcc-11
|
|
# --------
|
|
ifneq (,$(findstring version=,$(WM_COMPILE_CONTROL)))
|
|
COMPILER_VERSION := $(shell echo "$(WM_COMPILE_CONTROL)" | sed -ne 's/^.*version=-*\([0-9][.0-9]*\).*/-\1/p')
|
|
else
|
|
COMPILER_VERSION :=
|
|
endif
|
|
|
|
# Enable additional compile-time checks
|
|
ifneq (,$(findstring +strict,$(WM_COMPILE_CONTROL)))
|
|
GFLAGS += -DFOAM_COMPILE_STRICT
|
|
endif
|
|
|
|
# Default compilation is 'Opt' - never permit an empty value
|
|
ifeq (,$(strip $(WM_COMPILE_OPTION)))
|
|
WM_COMPILE_OPTION := Opt
|
|
endif
|
|
|
|
# Older macro for (shell) branching
|
|
AND := &&
|
|
|
|
include $(DEFAULT_RULES)/general
|
|
sinclude $(DEFAULT_RULES)/override
|
|
ifneq ("$(COMPILER_FAMILY)","$(WM_COMPILER)")
|
|
sinclude $(RULES)/general
|
|
sinclude $(RULES)/c++
|
|
endif
|
|
|
|
# Compile flags for openmp
|
|
# - if enabled (+openmp) and not disabled (~openmp).
|
|
# - disable has higher precedence
|
|
ifeq (,$(findstring ~openmp,$(WM_COMPILE_CONTROL)))
|
|
ifneq (,$(findstring +openmp,$(WM_COMPILE_CONTROL)))
|
|
c++FLAGS += $(COMP_OPENMP)
|
|
endif
|
|
endif
|
|
|
|
include $(GENERAL_RULES)/transform
|
|
|
|
#------------------------------------------------------------------------------
|