From patchwork Fri Jan 17 10:53:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11338759 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 2BF8E17EA for ; Fri, 17 Jan 2020 10:55:21 +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 08D5B20842 for ; Fri, 17 Jan 2020 10:55:20 +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="KAV/BxKf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08D5B20842 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 1isPGY-0004rw-7Y; Fri, 17 Jan 2020 10:54:14 +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 1isPGW-0004rm-TO for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 10:54:12 +0000 X-Inumbo-ID: ad953898-3917-11ea-88b0-12813bfff9fa Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ad953898-3917-11ea-88b0-12813bfff9fa; Fri, 17 Jan 2020 10:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1579258444; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BaVL54Bogf22hBGa7/sAqmT8wuvNZRQ1/2NJj3UBFd0=; b=KAV/BxKfLKTkHA7ctSnpMFWvXBN+bFHq+iL3y/xtbwzxWDRK2UxyKRmv YySzaSYcxvo7TCl6Tcv+pRgK/jILPrYPMThR5JbNGUu9B4bbMpomwzEAt q1CQXdi3hzAkhyQBGgWewnxSTZ1TeR23rEnZV+nFvkgtzrcAs9+1ycMiA E=; Authentication-Results: esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: CgK8RSRYP93o4sJcM7pfI3F88EkDAWf6XUZ2sXgXh1BlTfIMK0eb2ZRcjF4RVm1ENbtl8zFyxd soFOFNcYR8YpKCzxysRK+4ph0X/M3EAXUIpSyVJNQP5vtsdV7KTxBYk70D6vi57SgcHQnjFOpT /dTXfOK1WcQ6RejjSeKducrs5KgxVRYPkNOIfRNeGKiCreEso9xvG2AkpAPI1eDVot5TeL80fI ZYNGVDeRHwQwCAHbCb2PmuurLQWuF54cf0/6nyAsRIZep1kjKCnPYGp8ArdbxTGMC23FKnBQAU kNE= X-SBRS: 2.7 X-MesageID: 11432449 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,329,1574139600"; d="scan'208";a="11432449" From: Anthony PERARD To: Date: Fri, 17 Jan 2020 10:53:50 +0000 Message-ID: <20200117105358.607910-5-anthony.perard@citrix.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200117105358.607910-1-anthony.perard@citrix.com> References: <20200117105358.607910-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH v2 04/12] 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 make running make clean much faster. This extract the code into a different Makefile. It doesn't want to include Config.mk either so variables DEPS_RM and DEPS_INCLUDE are extracted from Config.mk as well. DEPS_INCLUDE is put into Kbuild.include so it could be use by other Makefiles. This is inspired by Kbuild, with Makefile.clean partially copied from Linux v5.4. Signed-off-by: Anthony PERARD --- xen/Rules.mk | 13 ------------- xen/scripts/Kbuild.include | 7 ++++++- xen/scripts/Makefile.clean | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 xen/scripts/Makefile.clean diff --git a/xen/Rules.mk b/xen/Rules.mk index 120323717d87..deab0abd63e1 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -94,8 +94,6 @@ LDFLAGS += $(LDFLAGS-y) include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk -DEPS = .*.d - include Makefile define gendep @@ -113,11 +111,6 @@ __subdir-y := $(filter %/, $(obj-y)) subdir-y += $(__subdir-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) @@ -181,12 +174,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..31cf2b59594e --- /dev/null +++ b/xen/scripts/Makefile.clean @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# Cleaning up +# ========================================================================== + +clean:: + +include $(BASEDIR)/scripts/Kbuild.include + +include Makefile + +# Figure out what we need to build from the various variables +# ========================================================================== +__subdir-y := $(filter %/, $(obj-y)) +subdir-y += $(__subdir-y) +subdir-n := $(subdir-n) $(subdir-) \ + $(filter %/, $(obj-n) $(obj-)) +subdir-all := $(subdir-y) $(subdir-n) + +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: