URL: <https://savannah.gnu.org/bugs/?61955>
Summary: Remade Makefiles & Phony Targets Project: make Submitted by: None Submitted on: Fri 28 Jan 2022 08:56:59 PM UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 4.3 Operating System: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: Hi! I am using make v4.3. I have a Makefile I always want rebuilt, and included. include test.mk .PHONY: all all: @echo MAKE_RESTARTS: $(MAKE_RESTARTS) .PHONY: test.mk test.mk: touch $@ this results in: make --debug 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... Updating makefiles.... touch test.mk Updating goal targets.... File 'all' does not exist. Must remake target 'all'. MAKE_RESTARTS: Successfully remade target file 'all'. note how test.mk is generated but MAKE_RESTARTS is not set. Using the FORCE approach documented here: https://www.gnu.org/software/make/manual/html_node/Force-Targets.html include test.mk .PHONY: all all: @echo MAKE_RESTARTS: $(MAKE_RESTARTS) FORCE: test.mk: FORCE touch $@ results in somewhat expected behavior. test.mk is generated and MAKE_RESTARTS is set. sometimes Make restarts more than one time, which is unexpected. ➜ test make --debug 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... Updating makefiles.... touch test.mk Re-executing[1]: make --debug 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... Updating makefiles.... touch test.mk Updating goal targets.... File 'all' does not exist. Must remake target 'all'. MAKE_RESTARTS: 1 Successfully remade target file 'all'. ➜ test make --debug 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... Updating makefiles.... touch test.mk Re-executing[1]: make --debug 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... Updating makefiles.... touch test.mk Re-executing[2]: make --debug 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... Updating makefiles.... touch test.mk Updating goal targets.... File 'all' does not exist. Must remake target 'all'. MAKE_RESTARTS: 2 _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?61955> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/