diff options
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r-- | scripts/Makefile.lib | 30 |
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 |
2 | extra-y += $(EXTRA_TARGETS) | 2 | asflags-y += $(EXTRA_AFLAGS) |
3 | ccflags-y += $(EXTRA_CFLAGS) | ||
4 | cppflags-y += $(EXTRA_CPPFLAGS) | ||
5 | ldflags-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))) | |||
44 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) | 48 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) |
45 | multi-objs := $(multi-objs-y) $(multi-objs-m) | 49 | multi-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 |
49 | subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) | 53 | subdir-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 |
52 | obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) | 56 | obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) |
@@ -86,9 +90,9 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" | |||
86 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 90 | modname_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) |
109 | endif | 113 | endif |
110 | 114 | ||
111 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 115 | c_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 | ||
115 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 119 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
116 | $(__a_flags) $(modkern_aflags) | 120 | $(__a_flags) $(modkern_aflags) |
117 | 121 | ||
118 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) | 122 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) |
119 | 123 | ||
120 | ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) | 124 | ld_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 |
123 | modname-multi = $(sort $(foreach m,$(multi-used),\ | 127 | modname-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 | ||
149 | quiet_cmd_ld = LD $@ | 153 | quiet_cmd_ld = LD $@ |
150 | cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \ | 154 | cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ |
151 | $(filter-out FORCE,$^) -o $@ | 155 | $(filter-out FORCE,$^) -o $@ |
152 | 156 | ||
153 | # Objcopy | 157 | # Objcopy |