1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

Merge pull request #9479 from cgundogan/pr/make_USEMODULE_INCLUDES_dedup

make: dedup USEMODULE_INCLUDES w/o shelling out
This commit is contained in:
Martine Lenders 2018-07-09 15:38:57 +02:00 committed by GitHub
commit beb2f0bf0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -327,7 +327,15 @@ $(info $(USEPKG:%=$(RIOTPKG)/%/Makefile.include))
.PHONY: $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
USEMODULE_INCLUDES_ = $(shell echo $(USEMODULE_INCLUDES) | tr ' ' '\n' | awk '!a[$$0]++' | tr '\n' ' ')
# Deduplicate includes without sorting them
# see https://stackoverflow.com/questions/16144115/makefile-remove-duplicate-words-without-sorting
define uniq =
$(eval seen :=)
$(foreach _,$1,$(if $(filter $_,$(seen)),,$(eval seen += $_)))
$(seen)
endef
USEMODULE_INCLUDES_ = $(strip $(call uniq,$(USEMODULE_INCLUDES)))
INCLUDES += $(USEMODULE_INCLUDES_:%=-I%)