History

kbuild: move modkern_{c,a}flags to Makefile.lib from Makefile.build

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.

Masahiro Yamada committed 7 years ago

Commit eb27ea51 parent 2ff2b7e3 files · +15 −16Browse files

Showing the changes to scripts (3 of 3 files). Show all

Unified · Split

3 files
  1. scripts/Makefile.build +0 −13
  2. scripts/Makefile.lib +12 −0
  3. scripts/Makefile.modfinal +3 −3
scripts/Makefile.build+0−13
@@ -92,15 +92,6 @@ endif · 91 unmodified lines
9292 # Compile C sources (.c)
9393 # ---------------------------------------------------------------------------
9494
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−
10495 quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
10596 cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
10697
@@ -304,10 +295,6 @@ $(obj)/%.h.s: $(src)/%.h FORCE · 197 unmodified lines
304295 # Compile assembler sources (.S)
305296 # ---------------------------------------------------------------------------
306297
307−modkern_aflags = $(if $(part-of-module), \
308− $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
309− $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
310−
311298 # .S file exports must have their C prototypes defined in asm/asm-prototypes.h
312299 # or a file that it includes, in order to get versioned symbols. We build a
313300 # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
scripts/Makefile.lib+12−0
@@ -159,6 +159,18 @@ _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) · 158 unmodified lines
159159 endif
160160 endif
161161
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+
162174 c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
163175 -include $(srctree)/include/linux/compiler_types.h \
164176 $(_c_flags) $(modkern_cflags) \
scripts/Makefile.modfinal+3−3
@@ -17,12 +17,12 @@ modules := $(sort $(shell cat $(MODORDER))) · 16 unmodified lines
1717 __modfinal: $(modules)
1818 @:
1919
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
2121 modname = $(notdir $(@:.mod.o=))
22+part-of-module = y
2223
2324 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 $@ $<
2626
2727 %.mod.o: %.mod.c FORCE
2828 $(call if_changed_dep,cc_o_c)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t