Commit 63a18262 authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

ENH: provide 'sanitized' values for wmake -show compiler information (#1256)

- with the wmake rules we may have some compiler options bound to the
  internal compiler variable. For example,

     CC  = g++ -std=c++11 -m64

     c++FLAGS = ...

  So shift any flags from CC to CXXFLAGS for the output of
  'wmake -show-cxx', 'wmake -show-cxxflags', etc.

  This makes it much easier to handle the values correctly elsewhere.
  Eg,

      CXX="$(wmake -show-cxx)" CXXFLAGS="$(wmake -show-cxxflags)" \
         ./configure
parent cd91a252
......@@ -31,6 +31,13 @@ SHELL = /bin/sh
.SUFFIXES:
#------------------------------------------------------------------------------
# Some default values
#------------------------------------------------------------------------------
# Shared library extension (with '.' separator)
EXT_SO = .so
#------------------------------------------------------------------------------
# Compilation rules
#------------------------------------------------------------------------------
......@@ -38,34 +45,44 @@ SHELL = /bin/sh
GENERAL_RULES = $(WM_DIR)/rules/General
include $(GENERAL_RULES)/general
# Commands
COMPILE_C := $(strip $(cc) $(cFLAGS))
COMPILE_CXX := $(strip $(CC) $(c++FLAGS))
#------------------------------------------------------------------------------
# Display information
#------------------------------------------------------------------------------
.PHONY: compile
compile:
@echo "$(strip $(CC) $(c++FLAGS))"
.PHONY: api
api:
@echo "$(WM_VERSION)" | sed -e 's/^.*=//'
@echo "$(lastword $(subst =, ,$(WM_VERSION)))"
.PHONY: ext-so
ext-so:
@echo "$(EXT_SO)"
.PHONY: compile-c
compile-c:
@echo "$(COMP_C)"
.PHONY: c
c:
@echo "$(strip $(cc))"
@echo "$(firstword $(cc))"
.PHONY: cflags
cflags:
@echo "$(strip $(cFLAGS))"
@echo "$(wordlist 2,$(words $(COMPILE_C)), $(COMPILE_C))"
.PHONY: compile-cxx
compile-cxx:
@echo "$(COMPILE_CXX)"
.PHONY: cxx
cxx:
@echo "$(strip $(CC))"
@echo "$(firstword $(CC))"
.PHONY: cxxflags
cxxflags:
@echo "$(strip $(c++FLAGS))"
@echo "$(wordlist 2,$(words $(COMPILE_CXX)), $(COMPILE_CXX))"
#----------------------------- vim: set ft=make: ------------------------------
......@@ -77,7 +77,11 @@ options:
-pwd Print root directory containing a Make/ directory
-update Update lnInclude dirs, dep files, remove deprecated files/dirs
-show-api Print api value
-show-compile Print C++ compiler value and flags (shortcut: -show)
-show-ext-so Print shared library extension (with '.' separator)
-show-compile-c Same as '-show-c -show-cflags'
-show-compile-cxx Same as '-show-cxx -show-cxxflags'
-show-c Print C compiler value
-show-cflags Print C compiler flags
-show-cxx Print C++ compiler value
-show-cxxflags Print C++ compiler flags
-h | -help Print the usage
......@@ -136,11 +140,9 @@ 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)
-show-api | -show-ext-so | \
-show-compile-c | -show-c | -show-cflags | \
-show-compile-cxx | -show-cxx | -show-cxxflags)
$make -f $WM_DIR/makefiles/info "${1#-show-}"
optShow=true
;;
......
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