[Top][All Lists]

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

gmake help with removing duplicate files

From: Jonathan
Subject: gmake help with removing duplicate files
Date: Wed, 30 Jan 2008 18:41:57 -0800 (PST)
User-agent: G2/1.0


I have an interesting filter problem (I think).  I would like to
remove duplicate filenames -- unfortunately, it is not quite as easy $
(sort ...).

I have 2 lists of files where one list has files with path prefixes
and one doesn't.  Some of these filenames (but not paths) are
duplicated.  I would like to combine the 2 into 1 list, with no
duplicates of the filenames.

My lists have hundreds of items each, but here is a simple example:

LIST1 := file1.o file2.o file3.o
LIST2 := path/file3.o path/file4.o path/file5.o

Desired result of:

LIST := file1.o file2.o file3.o path/file4.o path/file5.o

I thought that this would do it:

LIST3 = $(foreach xxx,$(LIST1),$(filter-out %$(xxx),$(LIST2)))
LIST = $(LIST1) $(LIST3)

but what that returns is a concatenated result for each loop (!?!):

LIST = file1.o file2.o file3.o path/file3.o path/file4.o path/file5.o
path/file3.o path/file4.o path/file5.o path/file4.o path/file5.o

So "path/file3.o path/file4.o path/file5.o" appears twice (since
file1.o and file2.o didnt filter out any values) then finally "path/
file4.o path/file5.o" (since file3.o filtered out path/file3.o).

The solution would appear to somehow pass the output of the $(filter-
out...) back in recursively.  I am clueless as to do that...

Many thanks for any help...

reply via email to

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