URL: <https://savannah.gnu.org/bugs/?64002>
Summary: Improve MAKEFILE_LIST with include Group: make Submitter: None Submitted: Wed 05 Apr 2023 05:00:15 PM UTC Severity: 3 - Normal Item Group: Enhancement Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: None Operating System: Any Fixed Release: None Triage Status: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Wed 05 Apr 2023 05:00:15 PM UTC By: Anonymous The "include <filepathname>" statement is a way to extend make and re-use existing code and make less copy paste errors. Current state: The MAKEFILE_LIST can be used to detect the name of the current Makefile, e.g. to allow creation of iterative tests for the Makefiles themselves. e.g. sh invocation: for file in (makefiles/*); do make -f $file test; done Issue: However as suggested here https://stackoverflow.com/questions/1400057/getting-the-name-of-the-makefile-from-the-makefile there is not consise and reliable way to get the name of the current Makefile Suggestion: Add one or two automatic variables that allow the running make to determine which file is being processed. e.g. MAKEFILE_LIST would behave unchanged CURRENT_MAKEFILE Would be the filename filename of the relative to CURDIR e.g. work/build/Makefile It would bethe same or similar to: MAKEFILE_JUSTNAME := $(firstword $(MAKEFILE_LIST)) MAKEFILE_COMPLETE := $(CURDIR)/$(MAKEFILE_JUSTNAME) CURRENT_SUBMAKE Would be what file(s) the current *line* came from Makefile Makefile.inc.1 Makefile.inc.1 $(line_num N) Perhaps a new function, something like $(line_num N) which would expand to the line where that first expansion occured less N e.g. (excuse if syntax is not 100%) warn = $(info Value of $1 at $(line_num $2) is not valid) DEBUG = $(intcmp $1,$(MAX_DBG),,$(call warn,DBG_LEL,2))$(intcmp $1,$(CURRENT_DEBUG_LEVEL),$(info $2)) ifneq ($(filter $(DBG_LVL), 0 1 2),) _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?64002> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/