diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-08-19 03:34:20 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2014-08-19 04:26:19 -0400 |
commit | c8589d1e9e01debdb4f574afe7c585714353ad79 (patch) | |
tree | d97e91953904fe8db17367b8323410f2003a4faa /scripts/Makefile.build | |
parent | 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff) |
kbuild: handle multi-objs dependency appropriately
The comment in scripts/Makefile.build says as follows:
We would rather have a list of rules like
foo.o: $(foo-objs)
but that's not so easy, so we rather make all composite objects depend
on the set of all their parts
This commit makes it possible!
For example, assume a Makefile like this
obj-m = foo.o bar.o
foo-objs := foo1.o foo2.o
bar-objs := bar1.o bar2.o
Without this patch, foo.o depends on all of
foo1.o foo2.o bar1.o bar2.o.
It looks funny that foo.o is regenerated when bar1.c is updated.
Now we can handle the dependency of foo.o and bar.o separately.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r-- | scripts/Makefile.build | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bf3e6778cd71..5b09d3637855 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -382,16 +382,14 @@ cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalys | |||
382 | quiet_cmd_link_multi-m = LD [M] $@ | 382 | quiet_cmd_link_multi-m = LD [M] $@ |
383 | cmd_link_multi-m = $(cmd_link_multi-y) | 383 | cmd_link_multi-m = $(cmd_link_multi-y) |
384 | 384 | ||
385 | # We would rather have a list of rules like | 385 | $(multi-used-y): FORCE |
386 | # foo.o: $(foo-objs) | ||
387 | # but that's not so easy, so we rather make all composite objects depend | ||
388 | # on the set of all their parts | ||
389 | $(multi-used-y) : %.o: $(multi-objs-y) FORCE | ||
390 | $(call if_changed,link_multi-y) | 386 | $(call if_changed,link_multi-y) |
387 | $(call multi_depend, $(multi-used-y), .o, -objs -y) | ||
391 | 388 | ||
392 | $(multi-used-m) : %.o: $(multi-objs-m) FORCE | 389 | $(multi-used-m): FORCE |
393 | $(call if_changed,link_multi-m) | 390 | $(call if_changed,link_multi-m) |
394 | @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) | 391 | @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) |
392 | $(call multi_depend, $(multi-used-m), .o, -objs -y) | ||
395 | 393 | ||
396 | targets += $(multi-used-y) $(multi-used-m) | 394 | targets += $(multi-used-y) $(multi-used-m) |
397 | 395 | ||