about summary refs log tree commit diff
path: root/libraries.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-09T15·54+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-09T15·54+0100
commit814a73227f9571d8fbd831fedced5e87cd9c926b (patch)
treed0f04084b69149c7bb0d9457b602435ad0c8758a /libraries.mk
parent55c9a40613fefda6622aa9acd22cce4006fd1077 (diff)
Remove duplicate elements from *_SOURCES
This is useful when you do:

  foo_SOURCES := $(wildcard *.cc) foo.cc

where foo.cc is a generated file.  In this case, if foo.cc already
exists, you get foo.cc twice in foo_SOURCES, leading to a link error.
Diffstat (limited to 'libraries.mk')
-rw-r--r--libraries.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries.mk b/libraries.mk
index bc258b799f55..98cc9f363f44 100644
--- a/libraries.mk
+++ b/libraries.mk
@@ -35,7 +35,7 @@ libs_list :=
 define build-library =
   $(1)_NAME ?= $(1)
   _d := $$(strip $$($(1)_DIR))
-  _srcs := $$(foreach src, $$($(1)_SOURCES), $$(src))
+  _srcs := $$(sort $$(foreach src, $$($(1)_SOURCES), $$(src)))
   $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))