Makefile.lib is included by Makefile.modfinal as well as Makefile.build. Move modkern_cflags to Makefile.lib in order to simplify cmd_cc_o_c in Makefile.modfinal. Move modkern_cflags as well for consistency.
Showing the changes to scripts (3 of 3 files). Show all
Unified · Split
| @@ -92,15 +92,6 @@ endif · 91 unmodified lines | ||
| 92 | 92 | # Compile C sources (.c) |
| 93 | 93 | # --------------------------------------------------------------------------- |
| 94 | 94 | |
| 95 | −# Default is built-in, unless we know otherwise | |
| 96 | −part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y) | |
| 97 | − | |
| 98 | −modkern_cflags = \ | |
| 99 | − $(if $(part-of-module), \ | |
| 100 | − $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ | |
| 101 | − $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | |
| 102 | −quiet_modtag = $(if $(part-of-module),[M], ) | |
| 103 | − | |
| 104 | 95 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ |
| 105 | 96 | cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< |
| 106 | 97 | |
| @@ -304,10 +295,6 @@ $(obj)/%.h.s: $(src)/%.h FORCE · 197 unmodified lines | ||
| 304 | 295 | # Compile assembler sources (.S) |
| 305 | 296 | # --------------------------------------------------------------------------- |
| 306 | 297 | |
| 307 | −modkern_aflags = $(if $(part-of-module), \ | |
| 308 | − $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \ | |
| 309 | − $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)) | |
| 310 | − | |
| 311 | 298 | # .S file exports must have their C prototypes defined in asm/asm-prototypes.h |
| 312 | 299 | # or a file that it includes, in order to get versioned symbols. We build a |
| 313 | 300 | # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from |
| @@ -159,6 +159,18 @@ _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) · 158 unmodified lines | ||
| 159 | 159 | endif |
| 160 | 160 | endif |
| 161 | 161 | |
| 162 | +part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y) | |
| 163 | +quiet_modtag = $(if $(part-of-module),[M], ) | |
| 164 | + | |
| 165 | +modkern_cflags = \ | |
| 166 | + $(if $(part-of-module), \ | |
| 167 | + $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ | |
| 168 | + $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | |
| 169 | + | |
| 170 | +modkern_aflags = $(if $(part-of-module), \ | |
| 171 | + $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \ | |
| 172 | + $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)) | |
| 173 | + | |
| 162 | 174 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
| 163 | 175 | -include $(srctree)/include/linux/compiler_types.h \ |
| 164 | 176 | $(_c_flags) $(modkern_cflags) \ |
| @@ -17,12 +17,12 @@ modules := $(sort $(shell cat $(MODORDER))) · 16 unmodified lines | ||
| 17 | 17 | __modfinal: $(modules) |
| 18 | 18 | @: |
| 19 | 19 | |
| 20 | −# modname is set to make c_flags define KBUILD_MODNAME | |
| 20 | +# modname and part-of-module are set to make c_flags define proper module flags | |
| 21 | 21 | modname = $(notdir $(@:.mod.o=)) |
| 22 | +part-of-module = y | |
| 22 | 23 | |
| 23 | 24 | quiet_cmd_cc_o_c = CC [M] $@ |
| 24 | − cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \ | |
| 25 | − -c -o $@ $< | |
| 25 | + cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | |
| 26 | 26 | |
| 27 | 27 | %.mod.o: %.mod.c FORCE |
| 28 | 28 | $(call if_changed_dep,cc_o_c) |