Skip to content
Snippets Groups Projects
Commit 2327162c authored by Mark OLESEN's avatar Mark OLESEN
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 3514fb3c
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,13 @@ SHELL = /bin/sh ...@@ -31,6 +31,13 @@ SHELL = /bin/sh
.SUFFIXES: .SUFFIXES:
#------------------------------------------------------------------------------
# Some default values
#------------------------------------------------------------------------------
# Shared library extension (with '.' separator)
EXT_SO = .so
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Compilation rules # Compilation rules
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
...@@ -38,34 +45,44 @@ SHELL = /bin/sh ...@@ -38,34 +45,44 @@ SHELL = /bin/sh
GENERAL_RULES = $(WM_DIR)/rules/General GENERAL_RULES = $(WM_DIR)/rules/General
include $(GENERAL_RULES)/general include $(GENERAL_RULES)/general
# Commands
COMPILE_C := $(strip $(cc) $(cFLAGS))
COMPILE_CXX := $(strip $(CC) $(c++FLAGS))
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Display information # Display information
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.PHONY: compile
compile:
@echo "$(strip $(CC) $(c++FLAGS))"
.PHONY: api .PHONY: api
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 .PHONY: c
c: c:
@echo "$(strip $(cc))" @echo "$(firstword $(cc))"
.PHONY: cflags .PHONY: cflags
cflags: cflags:
@echo "$(strip $(cFLAGS))" @echo "$(wordlist 2,$(words $(COMPILE_C)), $(COMPILE_C))"
.PHONY: compile-cxx
compile-cxx:
@echo "$(COMPILE_CXX)"
.PHONY: cxx .PHONY: cxx
cxx: cxx:
@echo "$(strip $(CC))" @echo "$(firstword $(CC))"
.PHONY: cxxflags .PHONY: cxxflags
cxxflags: cxxflags:
@echo "$(strip $(c++FLAGS))" @echo "$(wordlist 2,$(words $(COMPILE_CXX)), $(COMPILE_CXX))"
#----------------------------- vim: set ft=make: ------------------------------ #----------------------------- vim: set ft=make: ------------------------------
...@@ -77,7 +77,11 @@ options: ...@@ -77,7 +77,11 @@ options:
-pwd Print root directory containing a Make/ directory -pwd Print root directory containing a Make/ directory
-update Update lnInclude dirs, dep files, remove deprecated files/dirs -update Update lnInclude dirs, dep files, remove deprecated files/dirs
-show-api Print api value -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-cxx Print C++ compiler value
-show-cxxflags Print C++ compiler flags -show-cxxflags Print C++ compiler flags
-h | -help Print the usage -h | -help Print the usage
...@@ -136,11 +140,9 @@ do ...@@ -136,11 +140,9 @@ do
-s | -silent) -s | -silent)
export WM_QUIET=true export WM_QUIET=true
;; ;;
-show | -show-compile) -show-api | -show-ext-so | \
$make -f $WM_DIR/makefiles/info compile -show-compile-c | -show-c | -show-cflags | \
optShow=true -show-compile-cxx | -show-cxx | -show-cxxflags)
;;
-show-api | -show-cxx | -show-cxxflags | -show-c | -show-cflags)
$make -f $WM_DIR/makefiles/info "${1#-show-}" $make -f $WM_DIR/makefiles/info "${1#-show-}"
optShow=true optShow=true
;; ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment