help-make
[Top][All Lists]
Advanced

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

Re: Is there a rule counter?


From: Paul D. Smith
Subject: Re: Is there a rule counter?
Date: Tue, 28 Mar 2006 09:44:06 -0500

%% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:

  pb> I'm doing a lot of foreach ... eval to create a lot of rules from
  pb> lists.  Is there anyway I can count the number of rules that I
  pb> create?

Not easily.  You could change your eval to add a token to a variable
every time you create a rule:

    __COUNT += a

then use $(words $(__COUNT)).  In the next version of GNU make (3.82)
there will be a $(.TARGETS) special variable, similar to $(.VARIABLES)
for variables.  This will let you count the number of targets total in
the makefile, which is not quite the same thing.

Also you can run "make -p" to print the entire make database; it should
be pretty straightforward to grep out the targets and use "wc -l" or
whatever to count them.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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