aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build17
-rw-r--r--scripts/Makefile.lib6
2 files changed, 22 insertions, 1 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index de9836eee8bb..db38ef465a63 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
83builtin-target := $(obj)/built-in.o 83builtin-target := $(obj)/built-in.o
84endif 84endif
85 85
86modorder-target := $(obj)/modules.order
87
86# We keep a list of all modules in $(MODVERDIR) 88# We keep a list of all modules in $(MODVERDIR)
87 89
88__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ 90__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
89 $(if $(KBUILD_MODULES),$(obj-m)) \ 91 $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \
90 $(subdir-ym) $(always) 92 $(subdir-ym) $(always)
91 @: 93 @:
92 94
@@ -276,6 +278,19 @@ targets += $(builtin-target)
276endif # builtin-target 278endif # builtin-target
277 279
278# 280#
281# Rule to create modules.order file
282#
283# Create commands to either record .ko file or cat modules.order from
284# a subdirectory
285modorder-cmds = \
286 $(foreach m, $(modorder), \
287 $(if $(filter %/modules.order, $m), \
288 cat $m;, echo kernel/$m;))
289
290$(modorder-target): $(subdir-ym) FORCE
291 $(Q)(cat /dev/null; $(modorder-cmds)) > $@
292
293#
279# Rule to compile a set of .o files into one .a file 294# Rule to compile a set of .o files into one .a file
280# 295#
281ifdef lib-target 296ifdef lib-target
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3c5e88bfecf1..8e440233c27d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
25# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) 25# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
26# and add the directory to the list of dirs to descend into: $(subdir-m) 26# and add the directory to the list of dirs to descend into: $(subdir-m)
27 27
28# Determine modorder.
29# Unfortunately, we don't have information about ordering between -y
30# and -m subdirs. Just put -y's first.
31modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
32
28__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) 33__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
29subdir-y += $(__subdir-y) 34subdir-y += $(__subdir-y)
30__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) 35__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
@@ -64,6 +69,7 @@ real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)
64extra-y := $(addprefix $(obj)/,$(extra-y)) 69extra-y := $(addprefix $(obj)/,$(extra-y))
65always := $(addprefix $(obj)/,$(always)) 70always := $(addprefix $(obj)/,$(always))
66targets := $(addprefix $(obj)/,$(targets)) 71targets := $(addprefix $(obj)/,$(targets))
72modorder := $(addprefix $(obj)/,$(modorder))
67obj-y := $(addprefix $(obj)/,$(obj-y)) 73obj-y := $(addprefix $(obj)/,$(obj-y))
68obj-m := $(addprefix $(obj)/,$(obj-m)) 74obj-m := $(addprefix $(obj)/,$(obj-m))
69lib-y := $(addprefix $(obj)/,$(lib-y)) 75lib-y := $(addprefix $(obj)/,$(lib-y))