Skip to content

Commit

Permalink
Makefile: disable 'printvars' and 'show-vars' recipes for Make 4.3
Browse files Browse the repository at this point in the history
Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when
calling 'make printvars' or 'make show-vars', so let's refuse to execute
those recipes if Make 4.3 by adding 'check-make-version' recipe as
depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

Signed-off-by: Giulio Benetti <[email protected]>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
  • Loading branch information
giuliobenetti authored and arnout committed Jan 4, 2022
1 parent 63b1ebe commit 25cec5e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1058,13 +1058,20 @@ ifeq ($(NEED_WRAPPER),y)
$(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
endif

.PHONY: check-make-version
check-make-version:
ifneq ($(filter $(RUNNING_MAKE_VERSION),4.3),)
@echo "Make 4.3 doesn't support 'printvars' and 'show-vars' recipes"
@exit 1
endif

# printvars prints all the variables currently defined in our
# Makefiles. Alternatively, if a non-empty VARS variable is passed,
# only the variables matching the make pattern passed in VARS are
# displayed.
# show-vars does the same, but as a JSON dictionnary.
.PHONY: printvars
printvars:
printvars: check-make-version
@:
$(foreach V, \
$(sort $(filter $(VARS),$(.VARIABLES))), \
Expand All @@ -1077,7 +1084,7 @@ printvars:

.PHONY: show-vars
show-vars: VARS?=%
show-vars:
show-vars: check-make-version
@:
$(info $(call clean-json, { \
$(foreach V, \
Expand Down

0 comments on commit 25cec5e

Please sign in to comment.