about summary refs log tree commit diff
path: root/programs.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 /programs.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 'programs.mk')
-rw-r--r--programs.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/programs.mk b/programs.mk
index 52e55598cbae..a97a51635264 100644
--- a/programs.mk
+++ b/programs.mk
@@ -17,7 +17,7 @@ programs_list :=
 #   installed; defaults to $(bindir).
 define build-program =
   _d := $$($(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))
   $(1)_PATH := $$(_d)/$(1)