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.
This commit is contained in:
parent
55c9a40613
commit
814a73227f
2 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@ libs_list :=
|
||||||
define build-library =
|
define build-library =
|
||||||
$(1)_NAME ?= $(1)
|
$(1)_NAME ?= $(1)
|
||||||
_d := $$(strip $$($(1)_DIR))
|
_d := $$(strip $$($(1)_DIR))
|
||||||
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(src))
|
_srcs := $$(sort $$(foreach src, $$($(1)_SOURCES), $$(src)))
|
||||||
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
|
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
|
||||||
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
|
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ programs_list :=
|
||||||
# installed; defaults to $(bindir).
|
# installed; defaults to $(bindir).
|
||||||
define build-program =
|
define build-program =
|
||||||
_d := $$($(1)_DIR)
|
_d := $$($(1)_DIR)
|
||||||
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(src))
|
_srcs := $$(sort $$(foreach src, $$($(1)_SOURCES), $$(src)))
|
||||||
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
|
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
|
||||||
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
|
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
|
||||||
$(1)_PATH := $$(_d)/$(1)
|
$(1)_PATH := $$(_d)/$(1)
|
||||||
|
|
Loading…
Reference in a new issue