Commit f43e31d5 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

kbuild: factor out genksyms command from cmd_gensymtypes_{c,S}



The genksyms command part in cmd_gensymtypes_{c,S} is duplicated.
Factor it out into the 'genksyms' macro.

For the readability, I slightly refactor the arguments to genksyms.

Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
parent cab802b7
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -125,13 +125,14 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
$(obj)/%.i: $(src)/%.c FORCE
	$(call if_changed_dep,cpp_i_c)

# These mirror gensymtypes_S and co below, keep them in synch.
cmd_gensymtypes_c =                                                         \
    $(CPP) -D__GENKSYMS__ $(c_flags) $< |                                   \
    scripts/genksyms/genksyms $(if $(1), -T $(2))                           \
     $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS))                             \
genksyms = scripts/genksyms/genksyms		\
	$(if $(1), -T $(2))			\
	$(if $(CONFIG_MODULE_REL_CRCS), -R)	\
	$(if $(KBUILD_PRESERVE), -p)		\
     -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
	-r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null)

# These mirror gensymtypes_S and co below, keep them in synch.
cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)

quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
cmd_cc_symtypes_c =                                                         \
@@ -344,11 +345,7 @@ cmd_gensymtypes_S = \
    $(CPP) $(a_flags) $< |                                                  \
     grep "\<___EXPORT_SYMBOL\>" |                                          \
     sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
    $(CPP) -D__GENKSYMS__ $(c_flags) -xc - |                                \
    scripts/genksyms/genksyms $(if $(1), -T $(2))                           \
     $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS))                             \
     $(if $(KBUILD_PRESERVE),-p)                                            \
     -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
    $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)

quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
cmd_cc_symtypes_S =                                                         \