help-make
[Top][All Lists]
Advanced

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

Re: (should-be) simple directory parsing


From: Paul D. Smith
Subject: Re: (should-be) simple directory parsing
Date: Tue, 16 May 2006 13:53:16 -0400

%% "galathaea galathaea" <address@hidden> writes:

  >> The ability to use recursive functions with "call" was added in
  >> 3.80 I believe.

  gg> I could more easily convince the powers that be to upgrade to 3.80
  gg> than 3.81, so that is good news.

That's really too bad: there are a number of serious bugs in 3.80 which
have been fixed in 3.81, especially in the area of $(eval ...) etc.

To date I don't know of any critical bugs in 3.81, after 6+ weeks.  Note
that some Linux distributions, such as Debian, have already upgraded to
3.81 and are using it for all their builds.

  gg> I used:

  gg> nothing:=
  gg> space:=$(nothing) $(nothing)

  gg> and performed the calculation in three steps:
  gg> 1) exchange directory separators for spaces (so now we have a list!)
  gg> 2) for each item in the list:
  gg>   2a) add it to a calculation list
  gg>   2b) if the current element is the name I am looking for, store a final
  gg> copy of the calculation list
  gg> 3) substitute the directory separators back in for spaces (and an
  gg>    extra one up front)

  gg> Its a very imperative algorithm that I did not like, but at least got me
  gg> past the hurdle.

Similar thinking, but much simpler, is my original suggestion:

    dir := $(word 1,$(subst /TOP/, ,$(CURDIR)/))

This breaks the pathname into two words split at the "/TOP/" delimiter,
then returns the first word.

-- 
-------------------------------------------------------------------------------
 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]