[Top][All Lists]

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

Re: Parsing makefiles.

From: Fredrik Carlsson
Subject: Re: Parsing makefiles.
Date: Tue, 30 Aug 2005 18:43:10 +0000
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050716)

Paul D. Smith wrote:

%% Travis Spencer <address@hidden> writes:

 >> *pass the relevant variables to my program* <-- how can i do this?

 ts> What about using make's `-p' option?  It will output the variables and
 ts> their values in a format that is very easy to parse (e.g.,

I thought of this, too, but note it won't fully evaluate the values
before it prints them.  For example if you have in your makefile:

   FOO = $(BAR)

then the output of -p will print "$(BAR)" as the value; it won't expand
the reference to BAR.

Obviously if you use := instead, then it WILL be expanded in the -p

The other idea is to write a special rule that just prints the values of
variables.  You could use $(.VARIABLES) if you have a new-enough version
of GNU make (beware of blowing out your environment :-/).  Then you
would run "make print-my-vars" or whatever to get the output.

Thanks for the ideas.

I tested the -p option and it did as you mentions not expand the values.

After some testing is think the following could work:
My own makefile with a target and then just pass the values to my program.

I dont know if this optimal but it seems to work.
make -f Makefile.myown -f Makefile mytarget

// Fredrik

reply via email to

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