help-make
[Top][All Lists]
Advanced

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

Re: Creating a unique list from a bunch of duplicates


From: J . Davison de St . Germain
Subject: Re: Creating a unique list from a bunch of duplicates
Date: Thu, 27 May 2004 09:45:18 -0600

Hi,

Thanks to the people who have sent me responses. While I haven't been able to try them out (as I have make 3.79 and not the required 3.80) they look like just what I need. However, it would be really nice if there was an equivalent for version 3.79. I've looked at all of our systems (SGIs, Linux, Mac) (even new ones we just received) and they all have make 3.79. Does anyone happen to know when 3.80 will become "the standard"? Also, do the developers of gnu make read this list? If so, is this "unique" function something that they are considering adding to the system so a separate function doesn't have to be written by everyone? Thanks again for your help.

    Sincerely,
                      Dave

PS. If you are interested, the reason that the list needs to stay in order is that compilers use the order of the -L (and -I) flags when looking through directories for libraries (and include files). On many systems there are multiple copies of these things (usually having different versions) laying around. Our configure script tries to find the right version and make sure that it is referenced before other versions (such as ones in /usr/lib or /usr/local/lib, etc.)

On Wednesday, May 26, 2004, at 09:04 AM, Noel Yap wrote:

Are you sure you need to preserve the order? Exactly what do you intend to do with the unique list?

If you really need the order preserved, without testing it, try something like:

unique = $(if $(1),$(call unique,$(wordlist 2,$(words $(1)),$(1)),$(if $(filter $(firstword $(1)),$(2)),$(2),$(firstword $(1)) $(2))),$(2))

Noel

J.Davison de St.Germain wrote:

Hi,
I need to be able to take a list of directories and remove the duplicates without sorting the list. For example, if I have "-L/abc/lib -L/def/lib -L/abc/lib" I would like to get back "-L/abc/lib -L/def/lib". I would like to do this within make so that I don't have to call a bunch of shell functions. I've talked to a number of other gmake makefile writers and they agree that this would be very helpful. Is there such a function in make? (Like $(unique list) or some such?) If not, has someone well versed in functional programming put together a bunch of filter/foreach/search/etc functions to do this? Any help on this would be greatly appreciated. Also, if you know of a better location to send this request to, please let me know.
    Sincerely,
              J. Davison de St. Germain
PS. My search of the mailing list archive only gave me one hit and that was to use sort. As I mention above, I need the list to stay in the same order. Thanks!

-----------------------------------------------------------------------
- J. Davison de St. Germain         address@hidden    (801) 581-4078 -
- Chief Software Engineer           http://www.cs.utah.edu/~dav       -
- SCI Institute, SE C-SAFE          University of Utah                -
-----------------------------------------------------------------------





reply via email to

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