From patchwork Thu Jan 3 01:16:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10746879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3CD41399 for ; Thu, 3 Jan 2019 01:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E84F28409 for ; Thu, 3 Jan 2019 01:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C81F28417; Thu, 3 Jan 2019 01:17:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1206F28409 for ; Thu, 3 Jan 2019 01:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbfACBRR (ORCPT ); Wed, 2 Jan 2019 20:17:17 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:41567 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbfACBRR (ORCPT ); Wed, 2 Jan 2019 20:17:17 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-09.nifty.com with ESMTP id x031GwhQ001151; Thu, 3 Jan 2019 10:16:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x031GwhQ001151 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1546478219; bh=xVvKr37H6GF6qKmnraYMODxr3+soLJC30kP+XSvBu4Q=; h=From:To:Cc:Subject:Date:From; b=1MGepT/8KHk3KqffyGYPE2najb5nDsMpBt7isiihHrq+xnl+c/xVPMhPSAR4yX4Bn FkFoJ7PZUqTEWINgptEMTZKLnaJ/wpw7PqsvzvhQcBbO0Fn6qfHznDdkeRmYuDMdWm xxz64L0WsdM8/Ltc4agi1Ks+v/ZHQolGOHAEhv0thmzqpP8v+A9c31Wg1dX75Y5d09 bpX+P5RFGqWTgpzzhS2Nurhy2F05YPozHNWnZdrZLIqUghW6kJ5WP4ovFJQjFBtK+M 5QMeCIoRdefUWcjLKfE2FoEMcUO0H0qn03PlgI7mJQXIQWX40UmD1cmZNvKd1XymRA QZeoHtVRgwlDg== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-s390@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, Michal Marek , Martin Schwidefsky , Hendrik Brueckner Subject: [PATCH] kbuild: use assignment instead of define ... endef for filechk_* rules Date: Thu, 3 Jan 2019 10:16:54 +0900 Message-Id: <1546478214-20394-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Heiko Carstens --- Kbuild | 4 +--- Makefile | 3 +-- arch/s390/kernel/syscalls/Makefile | 12 +++--------- arch/s390/tools/Makefile | 7 ++----- scripts/Kbuild.include | 8 ++++---- scripts/kconfig/Makefile | 4 +--- 6 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Kbuild b/Kbuild index 06b801e..65db5be 100644 --- a/Kbuild +++ b/Kbuild @@ -26,9 +26,7 @@ timeconst-file := include/generated/timeconst.h targets += $(timeconst-file) -define filechk_gentimeconst - echo $(CONFIG_HZ) | bc -q $< -endef +filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $< $(timeconst-file): kernel/time/timeconst.bc FORCE $(call filechk,gentimeconst) diff --git a/Makefile b/Makefile index 62c9890..39355d1 100644 --- a/Makefile +++ b/Makefile @@ -1041,9 +1041,8 @@ PHONY += $(vmlinux-dirs) $(vmlinux-dirs): prepare $(Q)$(MAKE) $(build)=$@ need-builtin=1 -define filechk_kernel.release +filechk_kernel.release = \ echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" -endef # Store (new) KERNELRELEASE string in include/config/kernel.release include/config/kernel.release: $(srctree)/Makefile FORCE diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile index 4d929ed..b98f250 100644 --- a/arch/s390/kernel/syscalls/Makefile +++ b/arch/s390/kernel/syscalls/Makefile @@ -24,17 +24,11 @@ uapi: $(uapi-hdrs-y) _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \ $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') -define filechk_syshdr - $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $< -endef +filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $< -define filechk_sysnr - $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< -endef +filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< -define filechk_syscalls - $(CONFIG_SHELL) '$(systbl)' -S < $< -endef +filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $< syshdr_abi_unistd_32 := common,32 $(uapi)/unistd_32.h: $(syscall) FORCE diff --git a/arch/s390/tools/Makefile b/arch/s390/tools/Makefile index cf4846a..2342b84 100644 --- a/arch/s390/tools/Makefile +++ b/arch/s390/tools/Makefile @@ -20,13 +20,10 @@ HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE) # Ensure output directory exists _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') -define filechk_facility-defs.h - $(obj)/gen_facilities -endef +filechk_facility-defs.h = $(obj)/gen_facilities -define filechk_dis-defs.h +filechk_dis-defs.h = \ $(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt -endef $(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE $(call filechk,facility-defs.h) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 74a3fe7..525bff6 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -41,11 +41,11 @@ kecho := $($(quiet)kecho) ### # filechk is used to check if the content of a generated file is updated. # Sample usage: -# define filechk_sample -# echo $KERNELRELEASE -# endef -# version.h : Makefile +# +# filechk_sample = echo $(KERNELRELEASE) +# version.h: FORCE # $(call filechk,sample) +# # The rule defined shall write to stdout the content of the new file. # The existing file will be compared with the new one. # - If no file exist it is created diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index ec204fa..679e62e 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -201,9 +201,7 @@ HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) $(obj)/gconf.o: $(obj)/.gconf-cfg # check if necessary packages are available, and configure build flags -define filechk_conf_cfg - $(CONFIG_SHELL) $< -endef +filechk_conf_cfg = $(CONFIG_SHELL) $< $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE $(call filechk,conf_cfg)