mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
kbuild: use assignment instead of define ... endef for filechk_* rules
You do not have to use define ... endef for filechk_* rules. For simple cases, the use of assignment looks cleaner, IMHO. I updated the usage for scripts/Kbuild.include in case somebody misunderstands the 'define ... endif' is the requirement. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
parent
d6e4b3e326
commit
ba97df4558
4
Kbuild
4
Kbuild
@ -26,9 +26,7 @@ timeconst-file := include/generated/timeconst.h
|
|||||||
|
|
||||||
targets += $(timeconst-file)
|
targets += $(timeconst-file)
|
||||||
|
|
||||||
define filechk_gentimeconst
|
filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
|
||||||
echo $(CONFIG_HZ) | bc -q $<
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(timeconst-file): kernel/time/timeconst.bc FORCE
|
$(timeconst-file): kernel/time/timeconst.bc FORCE
|
||||||
$(call filechk,gentimeconst)
|
$(call filechk,gentimeconst)
|
||||||
|
3
Makefile
3
Makefile
@ -1041,9 +1041,8 @@ PHONY += $(vmlinux-dirs)
|
|||||||
$(vmlinux-dirs): prepare
|
$(vmlinux-dirs): prepare
|
||||||
$(Q)$(MAKE) $(build)=$@ need-builtin=1
|
$(Q)$(MAKE) $(build)=$@ need-builtin=1
|
||||||
|
|
||||||
define filechk_kernel.release
|
filechk_kernel.release = \
|
||||||
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
||||||
endef
|
|
||||||
|
|
||||||
# Store (new) KERNELRELEASE string in include/config/kernel.release
|
# Store (new) KERNELRELEASE string in include/config/kernel.release
|
||||||
include/config/kernel.release: $(srctree)/Makefile FORCE
|
include/config/kernel.release: $(srctree)/Makefile FORCE
|
||||||
|
@ -24,17 +24,11 @@ uapi: $(uapi-hdrs-y)
|
|||||||
_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
|
_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
|
||||||
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
|
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
|
||||||
|
|
||||||
define filechk_syshdr
|
filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
|
||||||
$(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define filechk_sysnr
|
filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
|
||||||
$(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define filechk_syscalls
|
filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $<
|
||||||
$(CONFIG_SHELL) '$(systbl)' -S < $<
|
|
||||||
endef
|
|
||||||
|
|
||||||
syshdr_abi_unistd_32 := common,32
|
syshdr_abi_unistd_32 := common,32
|
||||||
$(uapi)/unistd_32.h: $(syscall) FORCE
|
$(uapi)/unistd_32.h: $(syscall) FORCE
|
||||||
|
@ -20,13 +20,10 @@ HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE)
|
|||||||
# Ensure output directory exists
|
# Ensure output directory exists
|
||||||
_dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
|
_dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
|
||||||
|
|
||||||
define filechk_facility-defs.h
|
filechk_facility-defs.h = $(obj)/gen_facilities
|
||||||
$(obj)/gen_facilities
|
|
||||||
endef
|
|
||||||
|
|
||||||
define filechk_dis-defs.h
|
filechk_dis-defs.h = \
|
||||||
$(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt
|
$(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt
|
||||||
endef
|
|
||||||
|
|
||||||
$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE
|
$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE
|
||||||
$(call filechk,facility-defs.h)
|
$(call filechk,facility-defs.h)
|
||||||
|
@ -41,11 +41,11 @@ kecho := $($(quiet)kecho)
|
|||||||
###
|
###
|
||||||
# filechk is used to check if the content of a generated file is updated.
|
# filechk is used to check if the content of a generated file is updated.
|
||||||
# Sample usage:
|
# Sample usage:
|
||||||
# define filechk_sample
|
#
|
||||||
# echo $KERNELRELEASE
|
# filechk_sample = echo $(KERNELRELEASE)
|
||||||
# endef
|
# version.h: FORCE
|
||||||
# version.h : Makefile
|
|
||||||
# $(call filechk,sample)
|
# $(call filechk,sample)
|
||||||
|
#
|
||||||
# The rule defined shall write to stdout the content of the new file.
|
# The rule defined shall write to stdout the content of the new file.
|
||||||
# The existing file will be compared with the new one.
|
# The existing file will be compared with the new one.
|
||||||
# - If no file exist it is created
|
# - If no file exist it is created
|
||||||
|
@ -201,9 +201,7 @@ HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
|
|||||||
$(obj)/gconf.o: $(obj)/.gconf-cfg
|
$(obj)/gconf.o: $(obj)/.gconf-cfg
|
||||||
|
|
||||||
# check if necessary packages are available, and configure build flags
|
# check if necessary packages are available, and configure build flags
|
||||||
define filechk_conf_cfg
|
filechk_conf_cfg = $(CONFIG_SHELL) $<
|
||||||
$(CONFIG_SHELL) $<
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
|
$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
|
||||||
$(call filechk,conf_cfg)
|
$(call filechk,conf_cfg)
|
||||||
|
Loading…
Reference in New Issue
Block a user