aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r--scripts/Makefile.lib30
1 files changed, 17 insertions, 13 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index fc498fee68ed..3c5e88bfecf1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -1,5 +1,9 @@
1# Backward compatibility - to be removed... 1# Backward compatibility
2extra-y += $(EXTRA_TARGETS) 2asflags-y += $(EXTRA_AFLAGS)
3ccflags-y += $(EXTRA_CFLAGS)
4cppflags-y += $(EXTRA_CPPFLAGS)
5ldflags-y += $(EXTRA_LDFLAGS)
6
3# Figure out what we need to build from the various variables 7# Figure out what we need to build from the various variables
4# =========================================================================== 8# ===========================================================================
5 9
@@ -44,9 +48,9 @@ multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
44multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) 48multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
45multi-objs := $(multi-objs-y) $(multi-objs-m) 49multi-objs := $(multi-objs-y) $(multi-objs-m)
46 50
47# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live 51# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
48# in the local directory 52# tell kbuild to descend
49subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) 53subdir-obj-y := $(filter %/built-in.o, $(obj-y))
50 54
51# $(obj-dirs) is a list of directories that contain object files 55# $(obj-dirs) is a list of directories that contain object files
52obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) 56obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
@@ -86,9 +90,9 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
86modname_flags = $(if $(filter 1,$(words $(modname))),\ 90modname_flags = $(if $(filter 1,$(words $(modname))),\
87 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 91 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
88 92
89_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) 93_c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o)
90_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 94_a_flags = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(basetarget).o)
91_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) 95_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
92 96
93# If building the kernel in a separate objtree expand all occurrences 97# If building the kernel in a separate objtree expand all occurrences
94# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). 98# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
@@ -108,16 +112,16 @@ __a_flags = $(call flags,_a_flags)
108__cpp_flags = $(call flags,_cpp_flags) 112__cpp_flags = $(call flags,_cpp_flags)
109endif 113endif
110 114
111c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ 115c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
112 $(__c_flags) $(modkern_cflags) \ 116 $(__c_flags) $(modkern_cflags) \
113 -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) 117 -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
114 118
115a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ 119a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
116 $(__a_flags) $(modkern_aflags) 120 $(__a_flags) $(modkern_aflags)
117 121
118cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) 122cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags)
119 123
120ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) 124ld_flags = $(LDFLAGS) $(ldflags-y)
121 125
122# Finds the multi-part object the current object will be linked into 126# Finds the multi-part object the current object will be linked into
123modname-multi = $(sort $(foreach m,$(multi-used),\ 127modname-multi = $(sort $(foreach m,$(multi-used),\
@@ -140,14 +144,14 @@ $(obj)/%:: $(src)/%_shipped
140# target: source(s) FORCE 144# target: source(s) FORCE
141# $(if_changed,ld/objcopy/gzip) 145# $(if_changed,ld/objcopy/gzip)
142# 146#
143# and add target to EXTRA_TARGETS so that we know we have to 147# and add target to extra-y so that we know we have to
144# read in the saved command line 148# read in the saved command line
145 149
146# Linking 150# Linking
147# --------------------------------------------------------------------------- 151# ---------------------------------------------------------------------------
148 152
149quiet_cmd_ld = LD $@ 153quiet_cmd_ld = LD $@
150cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \ 154cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \
151 $(filter-out FORCE,$^) -o $@ 155 $(filter-out FORCE,$^) -o $@
152 156
153# Objcopy 157# Objcopy