]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
kbuild: move modkern_{c,a}flags to Makefile.lib from Makefile.build
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 19 Aug 2019 08:58:43 +0000 (17:58 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 21 Aug 2019 16:14:11 +0000 (01:14 +0900)
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.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/Makefile.build
scripts/Makefile.lib
scripts/Makefile.modfinal

index 9fa09361aa5ddcc66039e6d2d36cb1c1de8c953a..2a21ca86b720e66270ce1f5ae51ca78b669c588a 100644 (file)
@@ -92,15 +92,6 @@ endif
 # Compile C sources (.c)
 # ---------------------------------------------------------------------------
 
-# Default is built-in, unless we know otherwise
-part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
-
-modkern_cflags =                                          \
-       $(if $(part-of-module),                           \
-               $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
-               $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
-quiet_modtag = $(if $(part-of-module),[M],   )
-
 quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@
       cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
 
@@ -304,10 +295,6 @@ $(obj)/%.h.s: $(src)/%.h FORCE
 # Compile assembler sources (.S)
 # ---------------------------------------------------------------------------
 
-modkern_aflags = $(if $(part-of-module),                               \
-                       $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE),       \
-                       $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
-
 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
 # or a file that it includes, in order to get versioned symbols. We build a
 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
index 264611972c4ad18d0a032a945823b28550abb70b..888e5c830646a53336688c6727294238b57042cc 100644 (file)
@@ -159,6 +159,18 @@ _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
 endif
 endif
 
+part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
+quiet_modtag = $(if $(part-of-module),[M],   )
+
+modkern_cflags =                                          \
+       $(if $(part-of-module),                           \
+               $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
+               $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
+
+modkern_aflags = $(if $(part-of-module),                               \
+                       $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE),       \
+                       $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
+
 c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
                 -include $(srctree)/include/linux/compiler_types.h       \
                 $(_c_flags) $(modkern_cflags)                           \
index c8875f62dd963afef4712b2128d53ad10e6f052f..411c1e600e7dd8680abe75613a825514d6fa02fc 100644 (file)
@@ -17,12 +17,12 @@ modules := $(sort $(shell cat $(MODORDER)))
 __modfinal: $(modules)
        @:
 
-# modname is set to make c_flags define KBUILD_MODNAME
+# modname and part-of-module are set to make c_flags define proper module flags
 modname = $(notdir $(@:.mod.o=))
+part-of-module = y
 
 quiet_cmd_cc_o_c = CC [M]  $@
-      cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \
-                  -c -o $@ $<
+      cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
 
 %.mod.o: %.mod.c FORCE
        $(call if_changed_dep,cc_o_c)