help-make
[Top][All Lists]
Advanced

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

Re: How to write rule that gets all items referenced in a given makefile


From: Tim Murphy
Subject: Re: How to write rule that gets all items referenced in a given makefile
Date: Wed, 6 Jul 2016 07:38:17 +0300

Ok, so you want the state of make just after parsing finishes.  Without
patching make or modifying every rule I think your plan for using the
printed database is the best you can manage.   The database output is
quicker to parse than your original makefile usually.

If your makefiles use $(shell) then that might possibly cause trouble with
this scheme.

Regards,

Tim

On 6 July 2016 at 07:13, Adrian Muresan <address@hidden> wrote:

> Yes, I am using it and yes the info it gives is very useful, parseable and
> excellent in general.
>
> The problem is that this information is only outputted by `make` AFTER the
> makefile is finished executing whereas I need to access this information -
> via some function that apparently doesn't exist - BEFORE the makefile rules
> start executing so that I can create rules that act on his information.
>
> As it stands, I'd have to run my build twice: once to get the info and
> another time to use the info.
>
> Given my esoteric task, it's not unreasonable for me to do this.
>
> 1. Make all
> 2. Parse output, generate whatever rules I need -> Generated_Rules.mk
> 3. Make all MAKEFILES=Generated_Rules.mk
>
> > On Jul 5, 2016, at 11:44 PM, Tim Murphy <address@hidden> wrote:
> >
> > You might want to use makes -p option (--print-data-base) to print out
> the targets and prereqs that it has read.   The format of this output is
> simplified - all variables etc are expanded - so in python it's very easy
> to parse.
> >
> > Regards,
> >
> > Tim
>


reply via email to

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