URL: <https://savannah.gnu.org/bugs/?62469>
Summary: Make honors MAKEFLAGS=<value> definition on the command line. Project: make Submitted by: dgoncharov Submitted on: Mon 16 May 2022 02:12:20 AM UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: SCM Operating System: None Fixed Release: None Triage Status: None _______________________________________________________ Details: Make honors MAKEFLAGS=<value> definition on the command line. Such command line definition wipes out command line switches from the resultant MAKEFLAGS definition, even though the command line switches are active. In this example switch -d is active, but the value of MAKEFLAGS in make's memory is 'r'. ++++ $ cat makefile $(info at parse time MAKEFLAGS="$(MAKEFLAGS)") all:;$(info in a recipe MAKEFLAGS="$(MAKEFLAGS)") $ /usr/bin/make -d MAKEFLAGS=r GNU Make 4.3 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Reading makefile 'makefile'... at parse time MAKEFLAGS="r" Updating makefiles.... Considering target file 'makefile'. Looking for an implicit rule for 'makefile'. No implicit rule found for 'makefile'. Finished prerequisites of target file 'makefile'. No need to remake target 'makefile'. Updating goal targets.... Considering target file 'all'. File 'all' does not exist. Finished prerequisites of target file 'all'. Must remake target 'all'. in a recipe MAKEFLAGS="r" Successfully remade target file 'all'. make: 'all' is up to date. ---- Parent make then passes this incorrect value of MAKEFLAGS to each recursive child make. The manual already describes that MAKEFLAGS should only be specified in makefile or in the environment. E.g. appendix a says "MAKEFLAGS The flags given to make. You can set this in the environment or a makefile to set flags." and In 5.7.3 the manual says "If you do not want to pass the other flags down, you must change the value of MAKEFLAGS, like this: subsystem: cd subdir && $(MAKE) MAKEFLAGS=" The manual does not explicitly describe what happens when MAKEFLAGS=<value> is defined on the command line. This patch adds a piece of code which causes make to ignore MAKEFLAGS=<value> command line argument and print a warning. This patch also adds a piece of documentation to the manual to explicitly prohibit MAKEFLAGS=<value> arguments. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62469> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/