Skip to content

Commit ba97df4

Browse files
committedJan 6, 2019
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>
1 parent d6e4b3e commit ba97df4

File tree

6 files changed

+12
-26
lines changed

6 files changed

+12
-26
lines changed
 

‎Kbuild

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ timeconst-file := include/generated/timeconst.h
2626

2727
targets += $(timeconst-file)
2828

29-
define filechk_gentimeconst
30-
echo $(CONFIG_HZ) | bc -q $<
31-
endef
29+
filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
3230

3331
$(timeconst-file): kernel/time/timeconst.bc FORCE
3432
$(call filechk,gentimeconst)

‎Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,8 @@ PHONY += $(vmlinux-dirs)
10411041
$(vmlinux-dirs): prepare
10421042
$(Q)$(MAKE) $(build)=$@ need-builtin=1
10431043

1044-
define filechk_kernel.release
1044+
filechk_kernel.release = \
10451045
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
1046-
endef
10471046

10481047
# Store (new) KERNELRELEASE string in include/config/kernel.release
10491048
include/config/kernel.release: $(srctree)/Makefile FORCE

‎arch/s390/kernel/syscalls/Makefile

+3-9
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@ uapi: $(uapi-hdrs-y)
2424
_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
2525
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
2626

27-
define filechk_syshdr
28-
$(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
29-
endef
27+
filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
3028

31-
define filechk_sysnr
32-
$(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
33-
endef
29+
filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
3430

35-
define filechk_syscalls
36-
$(CONFIG_SHELL) '$(systbl)' -S < $<
37-
endef
31+
filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $<
3832

3933
syshdr_abi_unistd_32 := common,32
4034
$(uapi)/unistd_32.h: $(syscall) FORCE

‎arch/s390/tools/Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE)
2020
# Ensure output directory exists
2121
_dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
2222

23-
define filechk_facility-defs.h
24-
$(obj)/gen_facilities
25-
endef
23+
filechk_facility-defs.h = $(obj)/gen_facilities
2624

27-
define filechk_dis-defs.h
25+
filechk_dis-defs.h = \
2826
$(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt
29-
endef
3027

3128
$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE
3229
$(call filechk,facility-defs.h)

‎scripts/Kbuild.include

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ kecho := $($(quiet)kecho)
4141
###
4242
# filechk is used to check if the content of a generated file is updated.
4343
# Sample usage:
44-
# define filechk_sample
45-
# echo $KERNELRELEASE
46-
# endef
47-
# version.h : Makefile
44+
#
45+
# filechk_sample = echo $(KERNELRELEASE)
46+
# version.h: FORCE
4847
# $(call filechk,sample)
48+
#
4949
# The rule defined shall write to stdout the content of the new file.
5050
# The existing file will be compared with the new one.
5151
# - If no file exist it is created

‎scripts/kconfig/Makefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
201201
$(obj)/gconf.o: $(obj)/.gconf-cfg
202202

203203
# check if necessary packages are available, and configure build flags
204-
define filechk_conf_cfg
205-
$(CONFIG_SHELL) $<
206-
endef
204+
filechk_conf_cfg = $(CONFIG_SHELL) $<
207205

208206
$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
209207
$(call filechk,conf_cfg)

0 commit comments

Comments
 (0)
Please sign in to comment.