From patchwork Thu Jan 17 04:10:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10767503 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 057FE1390 for ; Thu, 17 Jan 2019 04:11:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1A0E2F55B for ; Thu, 17 Jan 2019 04:11:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D44252F577; Thu, 17 Jan 2019 04:11:06 +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 6002C2F55B for ; Thu, 17 Jan 2019 04:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728532AbfAQELF (ORCPT ); Wed, 16 Jan 2019 23:11:05 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:22827 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728525AbfAQELF (ORCPT ); Wed, 16 Jan 2019 23:11:05 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x0H4AYQb007102; Thu, 17 Jan 2019 13:10:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x0H4AYQb007102 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547698234; bh=DeGTimLs2LDTF0UV0F/cvayXY2TZfd8t27YTASSPmfM=; h=From:To:Cc:Subject:Date:From; b=kqnlTzrlMSwg8JjpaxTOmqJktov4P0X058ZiUE096VHgLi9LZzzPw6LPYlcK3g++h cwKwXKhggYQHafV6PdmuA6ioUH1/4d42JFXk+lmMgo1zfeA1nYsoMJxCy+JHF1OepO o9ASRpIjF8dK1tpukxJh/s1m/tokzuLSGcM72rUY/Jp9ZAm8nS0lnIr1CJV/v9tHkD crVk9bSjvvMxUUIZw9k+SdDsQSEREYDC9Vw1+4dnsvjfkCdQxRNY368qt7QhzJbGpv qMKvH6C+zOD9mp9jEqgVzU0e8NHBToYg3jGLAPiW3vBm2EqzEksEQK4R2VO11izuzP zQ5yksCSP8QPw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: simplify rules of data compression with size appending Date: Thu, 17 Jan 2019 13:10:29 +0900 Message-Id: <1547698231-20985-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 All the callers of size_append pass $(filter-out FORCE,$^). Move $(filter-out FORCE,$^) to the definition of size_append. This makes the callers cleaner because $(call ...) can be omitted to expand a macro with no argument. Signed-off-by: Masahiro Yamada --- scripts/Makefile.lib | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ecad15b..ebaa348 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -321,7 +321,7 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) # append the size as a 32-bit littleendian number as gzip does. size_append = printf $(shell \ dec_size=0; \ -for F in $1; do \ +for F in $(filter-out FORCE,$^); do \ fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \ dec_size=$$(expr $$dec_size + $$fsize); \ done; \ @@ -335,23 +335,20 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ -cmd_bzip2 = (cat $(filter-out FORCE,$^) | \ - bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_bzip2 = (cat $(filter-out FORCE,$^) | bzip2 -9 && $(size_append)) > $@ # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ -cmd_lzma = (cat $(filter-out FORCE,$^) | \ - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_lzma = (cat $(filter-out FORCE,$^) | lzma -9 && $(size_append)) > $@ quiet_cmd_lzo = LZO $@ -cmd_lzo = (cat $(filter-out FORCE,$^) | \ - lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_lzo = (cat $(filter-out FORCE,$^) | lzop -9 && $(size_append)) > $@ quiet_cmd_lz4 = LZ4 $@ -cmd_lz4 = (cat $(filter-out FORCE,$^) | \ - lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_lz4 = (cat $(filter-out FORCE,$^) | lz4c -l -c1 stdin stdout && \ + $(size_append)) > $@ # U-Boot mkimage # --------------------------------------------------------------------------- @@ -394,8 +391,7 @@ quiet_cmd_uimage = UIMAGE $@ # decompression mode. A BCJ filter isn't used either. quiet_cmd_xzkern = XZKERN $@ cmd_xzkern = (cat $(filter-out FORCE,$^) | \ - sh $(srctree)/scripts/xz_wrap.sh && \ - $(call size_append, $(filter-out FORCE,$^))) > $@ + sh $(srctree)/scripts/xz_wrap.sh && $(size_append)) > $@ quiet_cmd_xzmisc = XZMISC $@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ From patchwork Thu Jan 17 04:10:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10767509 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 BD7F16C5 for ; Thu, 17 Jan 2019 04:14:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD16F2A9E3 for ; Thu, 17 Jan 2019 04:14:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A02B42A88D; Thu, 17 Jan 2019 04:14:39 +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=unavailable 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 F0C842A88D for ; Thu, 17 Jan 2019 04:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728622AbfAQEOd (ORCPT ); Wed, 16 Jan 2019 23:14:33 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:29656 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbfAQEOc (ORCPT ); Wed, 16 Jan 2019 23:14:32 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x0H4AYQc007102; Thu, 17 Jan 2019 13:10:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x0H4AYQc007102 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547698236; bh=JY3BYQGb/kU005BaRHePECiaIna4iSfJDiAYyMN769Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2AjNI2tTZhq2aC/HdORR5aEXdCpVeKFlFjCeaRCE4SMfXLC+0WjMUxNPyAV6JJX0k jVR/w1isf6RN9KBKHqoRPD5ikUCMiWeItEfkuh/AkVn1uxtIdsiDTGBjwwK9/B8/l6 ShmpypK1oeQVbpD+F5NpGPoKqOZxJHied9dRiRi7hlqo02im0fhYKz9L3HBePmkTNj fRSpUNVc/U9Y1Of1lMCczR2KCIk4I4+nuSPP+tvskF80H9Tbj8kElKxUZMiRE3JYfO +y8pXDqchqI0ULp0wCbZVhNlb8QepFLdvmt6owJccDM2/BSoDYZSXBR00qqcFYo6CD ieaZVwsejjfMg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Borislav Petkov , linux-mips@vger.kernel.org, Rob Herring , Nicholas Piggin , James Hogan , x86@kernel.org, Thomas Gleixner , "Mauro S. M. Rodrigues" , Ralf Baechle , Mark Greer , devicetree@vger.kernel.org, "H. Peter Anvin" , Benjamin Herrenschmidt , Michal Marek , Paul Burton , Ingo Molnar , Joel Stanley , Kees Cook , Michael Ellerman , linux-kernel@vger.kernel.org, Paul Mackerras , Mark Rutland , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/3] kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^) Date: Thu, 17 Jan 2019 13:10:30 +0900 Message-Id: <1547698231-20985-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> References: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> 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 In Kbuild, if_changed and friends must have FORCE as a prerequisite. Hence, $(filter-out FORCE,$^) or $(filter-out $(PHONY),$^) is a common pattern to get the names of all the prerequisites except phony targets. Add real-prereqs as a shorthand. Note: We cannot replace $(filter %.o,$^) in cmd_link_multi-m because $^ may include auto-generated dependencies from the .*.cmd file when a single object module is changed into a multi object module. For details, see commit 69ea912fda74 ("kbuild: remove unneeded link_multi_deps"). I added a comment to avoid accidental breakage. Signed-off-by: Masahiro Yamada --- Documentation/devicetree/bindings/Makefile | 2 +- arch/mips/boot/Makefile | 2 +- arch/powerpc/boot/Makefile | 2 +- arch/x86/realmode/rm/Makefile | 3 +-- scripts/Kbuild.include | 4 ++++ scripts/Makefile.build | 9 ++++++--- scripts/Makefile.lib | 18 +++++++++--------- scripts/Makefile.modpost | 2 +- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index 6e5cef0..e4eb5d1 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -15,7 +15,7 @@ DT_TMP_SCHEMA := processed-schema.yaml extra-y += $(DT_TMP_SCHEMA) quiet_cmd_mk_schema = SCHEMA $@ - cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(filter-out FORCE, $^) + cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) DT_DOCS = $(shell cd $(srctree)/$(src) && find * -name '*.yaml') DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile index 35704c2..3ce4dd5 100644 --- a/arch/mips/boot/Makefile +++ b/arch/mips/boot/Makefile @@ -115,7 +115,7 @@ endif targets += vmlinux.its.S quiet_cmd_its_cat = CAT $@ - cmd_its_cat = cat $(filter-out $(PHONY), $^) >$@ + cmd_its_cat = cat $(real-prereqs) >$@ $(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE $(call if_changed,its_cat) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 0e8dadd..73d1f35 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -218,7 +218,7 @@ quiet_cmd_bootas = BOOTAS $@ cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< quiet_cmd_bootar = BOOTAR $@ - cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ + cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@ $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE $(call if_changed_dep,bootcc) diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile index 4463fa7..394377c 100644 --- a/arch/x86/realmode/rm/Makefile +++ b/arch/x86/realmode/rm/Makefile @@ -37,8 +37,7 @@ REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p' quiet_cmd_pasyms = PASYMS $@ - cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \ - sed $(sed-pasyms) | sort | uniq > $@ + cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@ targets += pasyms.h $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 3081603..d93250b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -24,6 +24,10 @@ depfile = $(subst $(comma),_,$(dot-target).d) basetarget = $(basename $(notdir $@)) ### +# real prerequisites without phony targets +real-prereqs = $(filter-out $(PHONY), $^) + +### # Escape single quote for use in echo statements escsq = $(subst $(squote),'\$(squote)',$1) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 681ab58..9800178 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -399,8 +399,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; ifdef builtin-target quiet_cmd_ar_builtin = AR $@ - cmd_ar_builtin = rm -f $@; \ - $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^) + cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) $(builtin-target): $(real-obj-y) FORCE $(call if_changed,ar_builtin) @@ -428,7 +427,7 @@ ifdef lib-target quiet_cmd_link_l_target = AR $@ # lib target archives do get a symbol table and index -cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y) +cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) $(lib-target): $(lib-y) FORCE $(call if_changed,link_l_target) @@ -453,6 +452,10 @@ targets += $(obj)/lib-ksyms.o endif +# NOTE: +# Do not replace $(filter %.o,^) with $(real-prereqs). When a single object +# module is turned into a multi object module, $^ will contain header file +# dependencies recorded in the .*.cmd file. quiet_cmd_link_multi-m = LD [M] $@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ebaa348..c6fc295 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -231,7 +231,7 @@ $(obj)/%: $(src)/%_shipped # --------------------------------------------------------------------------- quiet_cmd_ld = LD $@ -cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@ + cmd_ld = $(LD) $(ld_flags) $(real-prereqs) -o $@ # Objcopy # --------------------------------------------------------------------------- @@ -243,7 +243,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ # --------------------------------------------------------------------------- quiet_cmd_gzip = GZIP $@ - cmd_gzip = cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@ + cmd_gzip = cat $(real-prereqs) | gzip -n -f -9 > $@ # DTC # --------------------------------------------------------------------------- @@ -321,7 +321,7 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) # append the size as a 32-bit littleendian number as gzip does. size_append = printf $(shell \ dec_size=0; \ -for F in $(filter-out FORCE,$^); do \ +for F in $(real-prereqs); do \ fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \ dec_size=$$(expr $$dec_size + $$fsize); \ done; \ @@ -335,19 +335,19 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ - cmd_bzip2 = (cat $(filter-out FORCE,$^) | bzip2 -9 && $(size_append)) > $@ + cmd_bzip2 = (cat $(real-prereqs) | bzip2 -9 && $(size_append)) > $@ # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | lzma -9 && $(size_append)) > $@ + cmd_lzma = (cat $(real-prereqs) | lzma -9 && $(size_append)) > $@ quiet_cmd_lzo = LZO $@ - cmd_lzo = (cat $(filter-out FORCE,$^) | lzop -9 && $(size_append)) > $@ + cmd_lzo = (cat $(real-prereqs) | lzop -9 && $(size_append)) > $@ quiet_cmd_lz4 = LZ4 $@ - cmd_lz4 = (cat $(filter-out FORCE,$^) | lz4c -l -c1 stdin stdout && \ + cmd_lz4 = (cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ $(size_append)) > $@ # U-Boot mkimage @@ -390,11 +390,11 @@ quiet_cmd_uimage = UIMAGE $@ # big dictionary would increase the memory usage too much in the multi-call # decompression mode. A BCJ filter isn't used either. quiet_cmd_xzkern = XZKERN $@ -cmd_xzkern = (cat $(filter-out FORCE,$^) | \ + cmd_xzkern = (cat $(real-prereqs) | \ sh $(srctree)/scripts/xz_wrap.sh && $(size_append)) > $@ quiet_cmd_xzmisc = XZMISC $@ -cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ + cmd_xzmisc = (cat $(real-prereqs) | \ xz --check=crc32 --lzma2=dict=1MiB) > $@ # ASM offsets diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 7d4af0d0..c0b7f52 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -122,7 +122,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ cmd_ld_ko_o = \ $(LD) -r $(KBUILD_LDFLAGS) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ - -o $@ $(filter-out FORCE,$^) ; \ + -o $@ $(real-prereqs) ; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) $(modules): %.ko :%.o %.mod.o FORCE From patchwork Thu Jan 17 04:10:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10767505 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 E48E26C5 for ; Thu, 17 Jan 2019 04:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3AC72F55B for ; Thu, 17 Jan 2019 04:11:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7C942F577; Thu, 17 Jan 2019 04:11:20 +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 507012F55B for ; Thu, 17 Jan 2019 04:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728525AbfAQELG (ORCPT ); Wed, 16 Jan 2019 23:11:06 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:22828 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728531AbfAQELF (ORCPT ); Wed, 16 Jan 2019 23:11:05 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x0H4AYQd007102; Thu, 17 Jan 2019 13:10:36 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x0H4AYQd007102 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547698236; bh=foZhPygMSwpgwvy1W1X5gzceFVUJQ5+RKAbXMqBY8vU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ThLbu6Nlf/V9qCZH3gR9r+yQEarrI7G39j9DGLHu/8dTW0qYKxGe/zw8+ni39tdRl LtANIV5hewjy6k8rlOYYWaMI22QOdENkN1usg6R3Achs3nK6qXsITP8aiyQMV36EOx ah3G9aAib3Q+TvmCz8Jq+/jPOWIvmgjfbyBwvd93Iue4FK4mClIA1XQ1oC8zbDzPR5 xLOM7PP7pAnwRxn1CUVe6qooGoOSw5nI8MFgHuKgJaSuCQeoROdwz7uLHNCMJawCfF Pvj/c3caP9UGQOlO2EJ82HRSaGzJxEO+pt68/r9DbCF+ZGznbLn0OlWFgZkdOXwPG+ auVb1d84g3/gA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] kbuild: remove unnecessary in-subshell execution Date: Thu, 17 Jan 2019 13:10:31 +0900 Message-Id: <1547698231-20985-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> References: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> 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 The commands surrounded by ( ) are executed in a subshell, but in most cases, we do not need to spawn an extra subshell. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 4 ++-- scripts/Makefile.lib | 21 ++++++++++----------- scripts/mkcompile_h | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9800178..f8e2794 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -312,11 +312,11 @@ $(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) # # These mirror gensymtypes_c and co above, keep them in synch. cmd_gensymtypes_S = \ - (echo "\#include " ; \ + { echo "\#include " ; \ echo "\#include " ; \ $(CPP) $(a_flags) $< | \ grep "\<___EXPORT_SYMBOL\>" | \ - sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ) | \ + sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \ $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ $(GENKSYMS) $(if $(1), -T $(2)) \ $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index c6fc295..c0abd9a 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -271,7 +271,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_dt_S_dtb= DTB $@ cmd_dt_S_dtb= \ -( \ +{ \ echo '\#include '; \ echo '.section .dtb.init.rodata,"a"'; \ echo '.balign STRUCT_ALIGNMENT'; \ @@ -281,7 +281,7 @@ cmd_dt_S_dtb= \ echo '__dtb_$(subst -,_,$(*F))_end:'; \ echo '.global __dtb_$(subst -,_,$(*F))_end'; \ echo '.balign STRUCT_ALIGNMENT'; \ -) > $@ +} > $@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE $(call if_changed,dt_S_dtb) @@ -335,20 +335,20 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ - cmd_bzip2 = (cat $(real-prereqs) | bzip2 -9 && $(size_append)) > $@ + cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@ # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(real-prereqs) | lzma -9 && $(size_append)) > $@ + cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@ quiet_cmd_lzo = LZO $@ - cmd_lzo = (cat $(real-prereqs) | lzop -9 && $(size_append)) > $@ + cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@ quiet_cmd_lz4 = LZ4 $@ - cmd_lz4 = (cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ - $(size_append)) > $@ + cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ + $(size_append); } > $@ # U-Boot mkimage # --------------------------------------------------------------------------- @@ -390,12 +390,11 @@ quiet_cmd_uimage = UIMAGE $@ # big dictionary would increase the memory usage too much in the multi-call # decompression mode. A BCJ filter isn't used either. quiet_cmd_xzkern = XZKERN $@ - cmd_xzkern = (cat $(real-prereqs) | \ - sh $(srctree)/scripts/xz_wrap.sh && $(size_append)) > $@ + cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \ + $(size_append); } > $@ quiet_cmd_xzmisc = XZMISC $@ - cmd_xzmisc = (cat $(real-prereqs) | \ - xz --check=crc32 --lzma2=dict=1MiB) > $@ + cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@ # ASM offsets # --------------------------------------------------------------------------- diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 87f1fc9..2339f86 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -62,7 +62,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" # Generate a temporary compile.h -( echo /\* This file is auto generated, version $VERSION \*/ +{ echo /\* This file is auto generated, version $VERSION \*/ if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi echo \#define UTS_MACHINE \"$ARCH\" @@ -73,7 +73,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" -) > .tmpcompile +} > .tmpcompile # Only replace the real compile.h if the new one is different, # in order to preserve the timestamp and avoid unnecessary