From patchwork Tue Mar 19 04:02:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 160513 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3410297jad; Mon, 18 Mar 2019 21:03:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLq6Sgj0ibh1MXIrXjs1GRwID1qq89YNhSCLVHCR4WiIjTliX4PyHf6Dwt08+sM4JBULvv X-Received: by 2002:a17:902:6b04:: with SMTP id o4mr4416620plk.323.1552968184159; Mon, 18 Mar 2019 21:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552968184; cv=none; d=google.com; s=arc-20160816; b=sp3DF94IfWRLS1DBJBjDUxeefjsohZOdFGqilV6AABi0EK2Y9A5vnb4m+bz8JvL7BU ZmzmCcy/ZSppzc+X0X2mufSWjmkRL0eP896HMI/yd77o0c7KKKYu2YgdqIL2jUQygOUM umzemUTo4LaZQaPlXuN3t8MpcQ4Vr86MHKCQuFKX84lkCLXvGo++YyWGKcAqkp2ZuXSf A4ZFBDNymh8Nbs6NiFjdQJh1AdieAydHBKen/G/aGxcza5yt9nbx9wHKFbKss+BFU13b Q4yXIMOsboNV/PePeiLvrUdHWO8amSN3BkKswJ1OI0ucl1P7RscsmcGovaAcDt/O+kxp C2nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=O7MKbJr07lS9T3YK/shIxpPzOPu2EAAVm1smdUcASdI=; b=G3LF31aBgBEJ5NMZn9meM4Iy7nDF4+fxNByZd/OHY3LNCvl0uVznrBBMShT32S8yLB vQwRkCYMyGTLYGpIy4g8G5GlT2lFFy9THbxkV/L/WEgaMtq2YvkuunnOW0FW4sZQRkor SJLIQjIJE46P49VOvqefKFVsdJaY7CepNOQ1fYOA4j19wk17uE1jL23ecmehOq8Ggfn/ ppFVFTiwcuaqOMVn5kmcodMFHz6JOIcL9/7c4cDt42T7ZNSUnReZhMuk5B7MqOT3UQ+e Y7e5dSj+rc/za6q0hknoMRS9V8uS61EcqTcPqs/gvBnskNto5LvcotxiZ1GPDs9wGnEJ JzwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dSKzYeBr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si11113353pgd.52.2019.03.18.21.03.03; Mon, 18 Mar 2019 21:03:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dSKzYeBr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726036AbfCSEDC (ORCPT + 31 others); Tue, 19 Mar 2019 00:03:02 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:42725 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbfCSEDB (ORCPT ); Tue, 19 Mar 2019 00:03:01 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x2J42e7u015125; Tue, 19 Mar 2019 13:02:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x2J42e7u015125 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1552968160; bh=O7MKbJr07lS9T3YK/shIxpPzOPu2EAAVm1smdUcASdI=; h=From:To:Cc:Subject:Date:From; b=dSKzYeBrbfEHDIILLh/qbP2cnACyREOIi+7Rd5Tes1YCpC/wu7ENUOig3dhxlnLNS SFSVopG/mkFkkyxcm22TYmTsaDt8w14s93uMhffsUgac0EeSHCPMTDQTdeyD4WNfze BxEELtTJ95611wpBiSCP221i8qx+WkQdkPG6GOmm+mgdrmfaPGuTuKVi/dcf4G5wxH JPOefhrXG3IcbUbC8hQUvsVyq5G9LjlBGgZ8SxLb9ZP0xswYc8kfB56vhGVQ1gB5W4 0TcoHT3T4UTjV+O9fyvRCkQbdUxv/THTL2+bdlx9fdZXtiZz9WtErsS/GK4ICU5Dwa Uz7Jk0Ryzg9kw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Andreas Schwab , David Howells , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: skip sub-make for in-tree build with GNU Make 4.x Date: Tue, 19 Mar 2019 13:02:36 +0900 Message-Id: <1552968156-3920-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 2b50f7ab6368 ("kbuild: add workaround for Debian make-kpkg") annoyed people who want to wrap the top Makefile with GNUmakefile or something in order to customize it for their use. On second thought, we do not need to run the sub-make for in-tree build with Make 4.x because the 'MAKEFLAGS += -rR' issue only happens on GNU Make 3.x. With this commit, people will get back the workflow, and the Debian make-kpkg will still work. Fixes: 2b50f7ab6368 ("kbuild: add workaround for Debian make-kpkg") Reported-by: Andreas Schwab Reported-by: David Howells Signed-off-by: Masahiro Yamada --- Makefile | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 99c0530..d9591f2 100644 --- a/Makefile +++ b/Makefile @@ -31,26 +31,12 @@ _all: # descending is started. They are now explicitly listed as the # prepare rule. -# Ugly workaround for Debian make-kpkg: -# make-kpkg directly includes the top Makefile of Linux kernel. In such a case, -# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but -# displays warning to discourage such abusage. -ifneq ($(word 2, $(MAKEFILE_LIST)),) -$(warning Do not include top Makefile of Linux Kernel) -sub-make-done := 1 -MAKEFLAGS += -rR -endif - ifneq ($(sub-make-done),1) # Do not use make's built-in rules and variables # (this increases performance and avoids hard-to-debug behaviour) MAKEFLAGS += -rR -# 'MAKEFLAGS += -rR' does not become immediately effective for old -# GNU Make versions. Cancel implicit rules for this Makefile. -$(lastword $(MAKEFILE_LIST)): ; - # Avoid funny character set dependencies unexport LC_ALL LC_COLLATE=C @@ -153,6 +139,7 @@ $(if $(KBUILD_OUTPUT),, \ # 'sub-make' below. MAKEFLAGS += --include-dir=$(CURDIR) +need-sub-make := 1 else # Do not print "Entering directory ..." at all for in-tree build. @@ -160,6 +147,15 @@ MAKEFLAGS += --no-print-directory endif # ifneq ($(KBUILD_OUTPUT),) +ifneq ($(filter 3.%,$(MAKE_VERSION)),) +# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x +# We need to run sub-make to avoid implicit rules in the top Makefile. +need-sub-make := 1 +# Cancel implicit rules for this Makefile. +$(lastword $(MAKEFILE_LIST)): ; +endif + +ifeq ($(need-sub-make),1) PHONY += $(MAKECMDGOALS) sub-make $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make @@ -171,8 +167,11 @@ sub-make: $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \ -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) -else # sub-make-done +endif # need-sub-make +endif # sub-make-done + # We process the rest of the Makefile if this is the final invocation of make +ifeq ($(need-sub-make),) # Do not print "Entering directory ...", # but we want to display it when entering to the output directory @@ -1757,7 +1756,7 @@ existing-targets := $(wildcard $(sort $(targets))) endif # ifeq ($(config-targets),1) endif # ifeq ($(mixed-targets),1) -endif # sub-make-done +endif # need-sub-make PHONY += FORCE FORCE: