diff options
author | Michal Marek <mmarek@suse.com> | 2015-10-27 09:02:24 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.com> | 2015-11-25 05:23:25 -0500 |
commit | cf4f21938e13ea1533ebdcb21c46f1d998a44ee8 (patch) | |
tree | b26af8415bc9f916124e27b4bbfd3209270e40f6 /scripts | |
parent | 0046a46a8f93f5b99b499118779521ba3b017d69 (diff) |
kbuild: Allow to specify composite modules with modname-m
This allows to write
drm-$(CONFIG_AGP) += drm_agpsupport.o
without having to handle CONFIG_AGP=y vs. CONFIG_AGP=m. Only support
this syntax for modules, since built-in code depending on something
modular cannot work and init/Makefile actually relies on the current
semantics. There are a few drivers which adapted to the current
semantics out of necessity; these are fixed to also work when the
respective subsystem is modular.
Acked-by: Peter Chen <peter.chen@freescale.com> [chipidea]
Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.build | 8 | ||||
-rw-r--r-- | scripts/Makefile.lib | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 01df30af4d4a..2c47f9c305aa 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -372,10 +372,14 @@ endif | |||
372 | # <composite-object>-objs := <list of .o files> | 372 | # <composite-object>-objs := <list of .o files> |
373 | # or | 373 | # or |
374 | # <composite-object>-y := <list of .o files> | 374 | # <composite-object>-y := <list of .o files> |
375 | # or | ||
376 | # <composite-object>-m := <list of .o files> | ||
377 | # The -m syntax only works if <composite object> is a module | ||
375 | link_multi_deps = \ | 378 | link_multi_deps = \ |
376 | $(filter $(addprefix $(obj)/, \ | 379 | $(filter $(addprefix $(obj)/, \ |
377 | $($(subst $(obj)/,,$(@:.o=-objs))) \ | 380 | $($(subst $(obj)/,,$(@:.o=-objs))) \ |
378 | $($(subst $(obj)/,,$(@:.o=-y)))), $^) | 381 | $($(subst $(obj)/,,$(@:.o=-y))) \ |
382 | $($(subst $(obj)/,,$(@:.o=-m)))), $^) | ||
379 | 383 | ||
380 | quiet_cmd_link_multi-y = LD $@ | 384 | quiet_cmd_link_multi-y = LD $@ |
381 | cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) | 385 | cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) |
@@ -390,7 +394,7 @@ $(call multi_depend, $(multi-used-y), .o, -objs -y) | |||
390 | $(multi-used-m): FORCE | 394 | $(multi-used-m): FORCE |
391 | $(call if_changed,link_multi-m) | 395 | $(call if_changed,link_multi-m) |
392 | @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) | 396 | @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) |
393 | $(call multi_depend, $(multi-used-m), .o, -objs -y) | 397 | $(call multi_depend, $(multi-used-m), .o, -objs -y -m) |
394 | 398 | ||
395 | targets += $(multi-used-y) $(multi-used-m) | 399 | targets += $(multi-used-y) $(multi-used-m) |
396 | 400 | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 79e86613712f..e18957b7a830 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -48,7 +48,7 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) | |||
48 | 48 | ||
49 | # if $(foo-objs) exists, foo.o is a composite object | 49 | # if $(foo-objs) exists, foo.o is a composite object |
50 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | 50 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) |
51 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | 51 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) |
52 | multi-used := $(multi-used-y) $(multi-used-m) | 52 | multi-used := $(multi-used-y) $(multi-used-m) |
53 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) | 53 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) |
54 | 54 | ||
@@ -67,7 +67,7 @@ obj-dirs := $(dir $(multi-objs) $(obj-y)) | |||
67 | 67 | ||
68 | # Replace multi-part objects by their individual parts, look at local dir only | 68 | # Replace multi-part objects by their individual parts, look at local dir only |
69 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) | 69 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) |
70 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) | 70 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) |
71 | 71 | ||
72 | # Add subdir path | 72 | # Add subdir path |
73 | 73 | ||