gmake help with removing duplicate files

Jonathan <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <[email protected]>
All,

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...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.