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
92# Compile C sources (.c)92# Compile C sources (.c)
93# ---------------------------------------------------------------------------93# ---------------------------------------------------------------------------
94 94
95# Default is built-in, unless we know otherwise
96part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
97
98modkern_cflags = \
99 $(if $(part-of-module), \
100 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
101 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
102quiet_modtag = $(if $(part-of-module),[M], )
103
104quiet_cmd_cc_s_c = CC $(quiet_modtag) $@95quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
105 cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<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# Compile assembler sources (.S)295# Compile assembler sources (.S)
305# ---------------------------------------------------------------------------296# ---------------------------------------------------------------------------
306 297
307modkern_aflags = $(if $(part-of-module), \
308 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
309 $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
310
311# .S file exports must have their C prototypes defined in asm/asm-prototypes.h298# .S file exports must have their C prototypes defined in asm/asm-prototypes.h
312# or a file that it includes, in order to get versioned symbols. We build a299# or a file that it includes, in order to get versioned symbols. We build a
313# dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from300# 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
159endif159endif
160endif160endif
161 161
162part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
163quiet_modtag = $(if $(part-of-module),[M], )
164
165modkern_cflags = \
166 $(if $(part-of-module), \
167 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
168 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
169
170modkern_aflags = $(if $(part-of-module), \
171 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
172 $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
173
162c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \174c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
163 -include $(srctree)/include/linux/compiler_types.h \175 -include $(srctree)/include/linux/compiler_types.h \
164 $(_c_flags) $(modkern_cflags) \176 $(_c_flags) $(modkern_cflags) \
scripts/Makefile.modfinal+3−3
@@ -17,12 +17,12 @@ modules := $(sort $(shell cat $(MODORDER))) · 16 unmodified lines
17__modfinal: $(modules)17__modfinal: $(modules)
18 @:18 @:
19 19
20# modname is set to make c_flags define KBUILD_MODNAME20# modname and part-of-module are set to make c_flags define proper module flags
21modname = $(notdir $(@:.mod.o=))21modname = $(notdir $(@:.mod.o=))
22part-of-module = y
22 23
23quiet_cmd_cc_o_c = CC [M] $@24quiet_cmd_cc_o_c = CC [M] $@
24 cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \25 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
25 -c -o $@ $<
26 26
27%.mod.o: %.mod.c FORCE27%.mod.o: %.mod.c FORCE
28 $(call if_changed_dep,cc_o_c)28 $(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