bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #64571] Add option to print targets


From: Dmitry Goncharov
Subject: Re: [bug #64571] Add option to print targets
Date: Thu, 2 Nov 2023 11:00:03 -0400

On Wed, Nov 1, 2023 at 10:26 AM Tim Murphy <tnmurphy@gmail.com> wrote:
> Perhaps make could do with some sort of plugin mechanism?  I know it has the 
> load keyword within makefiles but I'm not sure if functions have access to 
> enough global state to e.g. print out a list of targets.

Currently there is no interface for loadable shared objects to access
make's database. However, such an interface can be added. Such an
interface can provide a greater flexibility than a command line make
switch. With such an interface a plugin can implement
print_phony_targets or print_all_targets or
print_targets_that_match_a_pattern or whatever you want. Also, you
could call your function anywhere in the makefile, e.g.

load printdb.so
$(printdb)
include common.mk
$(printdb)

The price of this flexibility is that each user who needs this will
have to implement and maintain their printdb.so.

>  One might want other entry points like "after parsing" or "before reading a 
> makefiule" or "after updating a target" where one's plugin functions might be 
> called.

There is no such thing as "entry points" here. The load directive is
called at parse time. After that makefile can call the functions that
the shared object provides. You can call your function before or after
updating a target.

i personally, use -p and so far see no need to duplicate the function
of -p in a new switch.
Is there anything that this new switch would provide that -p cannot provide?

regards, Dmitry



reply via email to

[Prev in Thread] Current Thread [Next in Thread]