mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support wmake -show options for compiler information (#1256)
- can be useful for retrieving the compilation flags for use with other make systems (eg, cmake) * wmake -show-compile (C++ not C) * wmake -show-cxx * wmake -show-cxxflags
This commit is contained in:
committed by
Andrew Heather
parent
baddaee77b
commit
51bf7af8ae
@ -31,7 +31,7 @@ endif
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Unset suffices list (suffix rules are not used)
|
||||
# No default suffix rules used
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
74
wmake/makefiles/info
Normal file
74
wmake/makefiles/info
Normal file
@ -0,0 +1,74 @@
|
||||
#----------------------------*- makefile-gmake -*------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# File
|
||||
# wmake/makefiles/info
|
||||
#
|
||||
# Description
|
||||
# Makefile to generate information.
|
||||
# Used by wmake -show-*
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Use POSIX shell. Default to POSIX for the OS.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# No default suffix rules used
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Compilation rules
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
GENERAL_RULES = $(WM_DIR)/rules/General
|
||||
include $(GENERAL_RULES)/general
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Display information
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
export WM_VERSION
|
||||
|
||||
|
||||
.PHONY: compile
|
||||
compile:
|
||||
@echo "$(strip $(CC) $(c++FLAGS))"
|
||||
|
||||
.PHONY: api
|
||||
api:
|
||||
@echo "$${WM_VERSION#*=}"
|
||||
|
||||
.PHONY: c
|
||||
c:
|
||||
@echo "$(strip $(cc))"
|
||||
|
||||
.PHONY: cflags
|
||||
cflags:
|
||||
@echo "$(strip $(cFLAGS))"
|
||||
|
||||
.PHONY: cxx
|
||||
cxx:
|
||||
@echo "$(strip $(CC))"
|
||||
|
||||
.PHONY: cxxflags
|
||||
cxxflags:
|
||||
@echo "$(strip $(c++FLAGS))"
|
||||
|
||||
|
||||
#----------------------------- vim: set ft=make: ------------------------------
|
||||
24
wmake/wmake
24
wmake/wmake
@ -77,6 +77,11 @@ options:
|
||||
-pwd Print root directory containing a Make/ directory and exit
|
||||
-update Update lnInclude directories, dep files, remove deprecated
|
||||
files and directories
|
||||
-show Identical to -show-compile
|
||||
-show-api Print api value and exit
|
||||
-show-compile Print C++ compiler value/flags and exit
|
||||
-show-cxx Print C++ compiler value and exit
|
||||
-show-cxxflags Print C++ compiler flags and exit
|
||||
-h | -help Print the usage
|
||||
|
||||
|
||||
@ -121,7 +126,7 @@ allCores()
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Default to compiling the local target only
|
||||
unset all update optPrintRootDir
|
||||
unset all optShow update optPrintRootDir
|
||||
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
@ -133,6 +138,14 @@ do
|
||||
-s | -silent)
|
||||
export WM_QUIET=true
|
||||
;;
|
||||
-show | -show-compile)
|
||||
$make -f $WM_DIR/makefiles/info compile
|
||||
optShow=true
|
||||
;;
|
||||
-show-api | -show-cxx | -show-cxxflags | -show-c | -show-cflags)
|
||||
$make -f $WM_DIR/makefiles/info "${1#-show-}"
|
||||
optShow=true
|
||||
;;
|
||||
-a | -all | all)
|
||||
all=all
|
||||
;;
|
||||
@ -147,12 +160,12 @@ do
|
||||
|
||||
[ "$nCores" = 0 ] && allCores
|
||||
export WM_NCOMPPROCS=$nCores
|
||||
echo "Compiling enabled on $WM_NCOMPPROCS cores"
|
||||
echo "Compiling enabled on $WM_NCOMPPROCS cores" 1>&2
|
||||
;;
|
||||
# Parallel compilation on specified number of cores
|
||||
-j[1-9]*)
|
||||
export WM_NCOMPPROCS=${1#-j}
|
||||
echo "Compiling enabled on $WM_NCOMPPROCS cores"
|
||||
echo "Compiling enabled on $WM_NCOMPPROCS cores" 1>&2
|
||||
;;
|
||||
# Keep going, ignoring errors
|
||||
-k | -keep-going | -non-stop)
|
||||
@ -190,6 +203,11 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$optShow" = true ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Check environment variables
|
||||
|
||||
Reference in New Issue
Block a user