[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating a unique list from a bunch of duplicates
From: |
Christoph Schulz |
Subject: |
Re: Creating a unique list from a bunch of duplicates |
Date: |
Wed, 26 May 2004 11:36:30 +0200 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040207) |
Hello!
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.
# Removes duplicates in a list of words without changing order.
# $(1) = list of words
# (put everything below into one line!)
devRemoveDuplicates = $(if $(1),$(strip $(word 1,$(1)) $(call
devRemoveDuplicates,$(filter-out $(word 1,$(1)),$(1)))))
It works with make 3.80 and newer.
HTH,
Christoph