From patchwork Wed Feb 26 11:33:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11406267 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFFB714B4 for ; Wed, 26 Feb 2020 11:35:29 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BF0F2467B for ; Wed, 26 Feb 2020 11:35:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="DJHcEAYB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BF0F2467B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6uxF-0001BF-Q0; Wed, 26 Feb 2020 11:34:17 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6uxE-0001Ar-Vk for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 11:34:17 +0000 X-Inumbo-ID: e2ddc95a-588b-11ea-93fd-12813bfff9fa Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e2ddc95a-588b-11ea-93fd-12813bfff9fa; Wed, 26 Feb 2020 11:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582716841; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JzX7HZJXzphUcMN1byQmSarqS2k5PNItv5nAt1gTphg=; b=DJHcEAYB56FRtYPDguuJ1cmWIgC3RL1J3Fi/9jL4CIH3QC126TTOJeOp KeKICzzy/JD3Bhp0ja6dmCxSdpDon04/JW3ve50Cd8KgzQN7QzpPO7l3f 9mWq3HZbm4/a+0UUS9FzlQL5p4DolsPciAnq6OM50t4aPUV4CLar3SkKq 8=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: jPVB9Q3X+MDPOYYmBHNjRyNxdlxxGTLohPImXJcT1MppDyL7wppKMOfSlZh9Xx536nCgmSPNNJ TNMoDvP8IsfZeUdvZEoi9hKtZS3m5LX+NPlpKp3HPh1XIGBCNHsJbEbGMHxfWNOUt6rz1ENgv8 n1DE0BcjxEkXIWrU9B4mkpdLTyDcTfv1kCm1th/c1TDmFeH+6pM3Qu79KxvCgHcELThF9GGr4L kkn+Bmn+by3BTwwtPf534FAnqldOC3bisFMYfCL0388d09zvqQqKa6CjISvNZm+u6qhnOSzPws sLI= X-SBRS: 2.7 X-MesageID: 13461764 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,487,1574139600"; d="scan'208";a="13461764" From: Anthony PERARD To: Date: Wed, 26 Feb 2020 11:33:41 +0000 Message-ID: <20200226113355.2532224-10-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200226113355.2532224-1-anthony.perard@citrix.com> References: <20200226113355.2532224-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH v3 09/23] xen/build: extract clean target from Rules.mk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Anthony PERARD , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Anthony PERARD Most of the code executed by Rules.mk isn't necessary for the clean target, especially not the CFLAGS. This patch makes running make clean much faster. The patch extract the clean target into a different Makefile, Makefile.clean. Since Makefile.clean, doesn't want to include Config.mk, we need to define the variables DEPS_INCLUDE and DEPS in a place common to Rules.mk and Makefile.clean, this is Kbuild.include. DEPS_RM is only needed in Makefile.clean so can be defined there. Even so Rules.mk includes Config.mk, it includes Kbuild.include after, so the effective definition of DEPS_INCLUDE is "xen/" one and the same one as used by Makefile.clean. This is inspired by Kbuild, with Makefile.clean partially copied from Linux v5.4. Signed-off-by: Anthony PERARD Reviewed-by: Jan Beulich --- Notes: v3: - rewrite of commit message - have only subdir-all, without intermediare variable subdir-y and subdir-n in Makefile.clean xen/Rules.mk | 12 ------------ xen/scripts/Kbuild.include | 7 ++++++- xen/scripts/Makefile.clean | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 xen/scripts/Makefile.clean diff --git a/xen/Rules.mk b/xen/Rules.mk index e3b19319b1f5..0c1a3ee5905d 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -100,8 +100,6 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \ include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk -DEPS = .*.d - include Makefile define gendep @@ -118,10 +116,6 @@ $(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gend subdir-y := $(subdir-y) $(filter %/, $(obj-y)) obj-y := $(patsubst %/, %/built_in.o, $(obj-y)) -subdir-n := $(subdir-n) $(subdir-) $(filter %/, $(obj-n) $(obj-)) - -subdir-all := $(subdir-y) $(subdir-n) - $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY ifeq ($(CONFIG_COVERAGE),y) @@ -185,12 +179,6 @@ FORCE: %/built_in_bin.o: FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in_bin.o -.PHONY: clean -clean:: $(addprefix _clean_, $(subdir-all)) - rm -f *.o .*.o.tmp *~ core $(DEPS_RM) -_clean_%/: FORCE - $(MAKE) $(clean) $* - SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR)) %.o: %.c Makefile diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include index 2465cc4060c3..6a9b0c39da53 100644 --- a/xen/scripts/Kbuild.include +++ b/xen/scripts/Kbuild.include @@ -2,6 +2,11 @@ #### # kbuild: Generic definitions +### +# dependencies +DEPS = .*.d +DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS)))) + # cc-ifversion # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4)) @@ -9,4 +14,4 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e # Shorthand for $(MAKE) clean # Usage: # $(MAKE) $(clean) dir -clean := -f $(BASEDIR)/Rules.mk clean -C +clean := -f $(BASEDIR)/scripts/Makefile.clean clean -C diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean new file mode 100644 index 000000000000..53379e6102cc --- /dev/null +++ b/xen/scripts/Makefile.clean @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# Cleaning up +# ========================================================================== + +clean:: + +include $(BASEDIR)/scripts/Kbuild.include + +include Makefile + +# Figure out what we need to clean from the various variables +# ========================================================================== +subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \ + $(filter %/, $(obj-y) $(obj-n) $(obj-)) + +DEPS_RM = $(DEPS) $(DEPS_INCLUDE) +.PHONY: clean +clean:: $(addprefix _clean_, $(subdir-all)) + rm -f *.o .*.o.tmp *~ core $(DEPS_RM) + +# Descending +# --------------------------------------------------------------------------- + +_clean_%/: FORCE + $(MAKE) $(clean) $* + +# Force execution of pattern rules (for which PHONY cannot be directly used). +.PHONY: FORCE +FORCE: