[09/11] nmk: Make collect-deps to be more precise about targets

Submitted by Cyrill Gorcunov on July 12, 2018, 12:51 p.m.

Details

Message ID 20180712125142.8737-10-gorcunov@gmail.com
State Accepted
Series "build: Fix issue on simultaneous build"
Headers show

Commit Message

Cyrill Gorcunov July 12, 2018, 12:51 p.m.
Thus to choose which deps to include, for example if only
particular file is being build there is no need to include
any other deps.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 scripts/nmk/scripts/build.mk | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index bf5048fcaab1..d01d2b72c9d6 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -277,20 +277,22 @@  define collect-target-deps
         endif
 endef
 define collect-deps
-        ifneq ($(filter-out %.d,$(1)),)
-                ifneq ($(filter %.o %.i %.s,$(1)),)
-                        deps-y += $(addsuffix .d,$(basename $(1)))
-                endif
-        endif
-        $(eval $(call collect-builtin-deps,$(builtin-target),$(1)))
-        $(eval $(call collect-lib-deps,$(lib-target),$(1)))
-        $(foreach t,$(hostprogs-y),$(eval $(call collect-hostprogs-deps,$(t),$(1))))
-        $(foreach t,$(target),$(eval $(call collect-target-deps,$(t),$(1))))
-        ifneq ($(filter all $(filter-out $(builtin-target) $(lib-target), $(all-y)) $(hostprogs-y),$(1)),)
-                deps-y += $(obj-y:.o=.d)
-                deps-y += $(lib-y:.o=.d)
+        ifneq ($(filter all,$(1)),)
+                $(eval $(call collect-builtin-deps,$(builtin-target),$(builtin-target)))
+                $(eval $(call collect-lib-deps,$(lib-target),$(lib-target)))
                 $(foreach t,$(hostprogs-y),$(eval $(call collect-hostprogs-deps,$(t),$(t))))
                 $(foreach t,$(target),$(eval $(call collect-target-deps,$(t),$(t))))
+        else
+                ifneq ($(filter-out %.d $(builtin-target) $(lib-target) $(hostprogs-y) $(target),$(1)),)
+                        ifneq ($(filter %.o %.i %.s,$(1)),)
+                                deps-y += $(addsuffix .d,$(basename $(1)))
+                        endif
+                else
+                        $(eval $(call collect-builtin-deps,$(builtin-target),$(1)))
+                        $(eval $(call collect-lib-deps,$(lib-target),$(1)))
+                        $(foreach t,$(hostprogs-y),$(eval $(call collect-hostprogs-deps,$(t),$(1))))
+                        $(foreach t,$(target),$(eval $(call collect-target-deps,$(t),$(1))))
+                endif
         endif
 endef