I'm sure one of the cool macro libraries has an elegant solution already,
but here's one I just cooked up
------------ cut here ------------------
# Given a list with duplicates
ORIGINAL := A C B C B D A
# Build a new list in order with no dups
$(foreach V,$(ORIGINAL),$(if $(filter $V,$(NEW)),,$(eval NEW := $(NEW) $V)))
# Or just call sort, but the order may be different
SORTED = $(sort $(ORIGINAL))
result:
@echo ORIGINAL = $(ORIGINAL)
@echo NEW = $(NEW)
@echo SORTED = $(SORTED)
------------------------------
Jay
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sam Ravnborg
Sent: Sunday, July 27, 2014 5:59 AM
To: [email protected]
Subject: Find duplicates in a list
Hi all.
I'm trying to find a way to detect duplicate items in a list without
escaping to a shell.
Consider the following:
list := A B C A D C
In the list above A and C is duplicated.
I would like to find a way so I can find which items are duplicated and
print them out.
The solution should preferably work with gmake 3.81 and even better in make
3.80
Thanks in advance,
Sam
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make