summaryrefslogtreecommitdiffstats
path: root/include/make
diff options
context:
space:
mode:
Diffstat (limited to 'include/make')
-rw-r--r--include/make/options.mk23
-rw-r--r--include/make/verbose.mk3
2 files changed, 21 insertions, 5 deletions
diff --git a/include/make/options.mk b/include/make/options.mk
index 022981c..d212586 100644
--- a/include/make/options.mk
+++ b/include/make/options.mk
@@ -23,14 +23,15 @@ build_options = $(foreach opt,$(use_opts),$(call ignore_implicit,$(opt)))
# Make a list of all known features with +/- prepended depending on their
# activation status. Must be a macro so that dynamically enabled ones are
# evaluated with their current status.
-build_features = $(foreach opt,$(patsubst USE_%,%,$(sort $(use_opts))),$(if $(USE_$(opt)),+$(opt),-$(opt)))
+build_features = $(foreach opt,$(patsubst USE_%,%,$(sort $(use_opts))),$(if $(USE_$(opt):0=),+$(opt),-$(opt)))
-# This returns a list of -DUSE_* for all known USE_* that are set
-opts_as_defines = $(foreach opt,$(use_opts),$(if $($(opt)),-D$(opt),))
+# This returns a list of -DUSE_* for all known USE_* that are set to anything
+# neither empty nor '0'.
+opts_as_defines = $(foreach opt,$(use_opts),$(if $($(opt):0=),-D$(opt),))
# Lists all enabled or disabled options without the "USE_" prefix
-enabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),$(opt),))
-disabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),,$(opt)))
+enabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt):0=),$(opt),))
+disabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt):0=),,$(opt)))
# preset all XXX_{INC,LIB,CFLAGS,LDFLAGS,SRC} variables to empty for $1=XXX
reset_opt_vars = $(foreach name,INC LIB CFLAGS LDFLAGS SRC,$(eval $(1)_$(name)=))
@@ -50,3 +51,15 @@ endef
# collect all enabled USE_foo's foo_{C,LD}FLAGS into OPTIONS_{C,LD}FLAGS
collect_opts_flags = $(foreach opt,$(enabled_opts),$(eval $(call collect_opt_flags,$(opt))))
+
+# Check that any USE_* variable that was forced actually exist. For this we'll
+# build a list of the MAKEOVERRIDES variables that start with USE_*, and keep
+# the ones that do not match any of the patterns built by appending '=%' to all
+# use_opts. The outstanding ones are thus unknown and each of them produces a
+# warning.
+warn_unknown_options = \
+ $(foreach unknown, \
+ $(filter-out $(foreach opt,$(use_opts),$(opt:==%)), \
+ $(foreach opt,$(MAKEOVERRIDES), \
+ $(strip $(filter USE_%,$(opt))))), \
+ $(warning Warning: ignoring unknown build option: $(unknown)))
diff --git a/include/make/verbose.mk b/include/make/verbose.mk
index c37d513..6ee10a0 100644
--- a/include/make/verbose.mk
+++ b/include/make/verbose.mk
@@ -10,6 +10,7 @@ endif
# or to themselves depending on the verbosity level.
ifeq ($V,1)
cmd_CC = $(CC)
+cmd_CXX = $(CXX)
cmd_LD = $(LD)
cmd_AR = $(AR)
cmd_MAKE = +$(MAKE)
@@ -17,12 +18,14 @@ else
ifeq (3.81,$(firstword $(sort $(MAKE_VERSION) 3.81)))
# 3.81 or above
cmd_CC = $(info $ CC $@) $(Q)$(CC)
+cmd_CXX = $(info $ CXX $@) $(Q)$(CXX)
cmd_LD = $(info $ LD $@) $(Q)$(LD)
cmd_AR = $(info $ AR $@) $(Q)$(AR)
cmd_MAKE = $(info $ MAKE $@) $(Q)+$(MAKE)
else
# 3.80 or older
cmd_CC = $(Q)echo " CC $@";$(CC)
+cmd_CXX = $(Q)echo " CXX $@";$(CXX)
cmd_LD = $(Q)echo " LD $@";$(LD)
cmd_AR = $(Q)echo " AR $@";$(AR)
cmd_MAKE = $(Q)echo " MAKE $@";$(MAKE)