bugmake - Bugs: bug #64002, Improve MAKEFILE_LIST with include

 
 

bug #64002: Improve MAKEFILE_LIST with include

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
Component Version:  None Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 05 Apr 2023 05:00:15 PM UTC, original submission:  

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),)


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.13-c373.
Corresponding source code