Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp506776ybl; Wed, 21 Aug 2019 00:50:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwadiA0FNQ++5k23LEQFCdqx6tcbnb3A9y4RW1j/VCln2RN58pb8pDCkFgcM8KS5BUYg/EL X-Received: by 2002:a62:be02:: with SMTP id l2mr35096004pff.63.1566373848008; Wed, 21 Aug 2019 00:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566373848; cv=none; d=google.com; s=arc-20160816; b=xwIU3CVlq5APHpVdP8R6znjfSpgUOulF9/qcOX45bfOn8sPd7dqTHjupz7tt0KiMW1 FV/vcOXoxKYC/jLczaNyaTEymflYAJqZPD9BwL+L918f3XLNLghg2e8S80B44RTZFU2K 0lg9++KVrfg4Fep6cUsVSSgO2WNDnUEojZ1Z8pTZ/8El9RMK9ysho8+umUJhFqM50v5d JHgIB8hzXC7LrT07anLs296q8Rz/X3eajMmpY2eMfC7DpRV2jkKQOvYL5sZPhLJDgFBm khH0aGivIWzOmm+gOuFzRxfc+DCT72BQWudgf6lBBn5O067w3817ghTxqWPMtxO2opEc BuRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=RaFKffSw+PipHQQxACqqSUGOlGcAb1Ci/wYUrlHdarU=; b=aC7fmYcGnKZRYTAtciCU2I6SZtfqbv9zN1d9AgmwSrX8pLqQr/WlAmws2WGmpm/4ow 2bFOmEZYd6ek28Yzi2eBrydsw5hfOL1NngucyHqhUDsz0LLq7TDBJI2oKQUh52gCrXZ+ 55yRfiCssLv9DeKIiqWo8tqe/vTUhegxHtiOiMDX20Ek8j9vm0wAnoPe4RttEg6tI8Fu 4ywi5vpkMqH5+659pzAOzS7TrTY4ie+Yz8LSafISxr60dRzcdXi/ZrAKpkB/fMCDKyUF sW1x0F0noXT5y0wQnfAO9Nn17WMvuYcjkUNfsPhrjIkW2wM/4SGATxJBIuoBdtqlg1i7 FWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oMNSV3F9; 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 x8si15328794pfj.264.2019.08.21.00.50.33; Wed, 21 Aug 2019 00:50:47 -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=oMNSV3F9; 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 S1727860AbfHUHEa (ORCPT + 99 others); Wed, 21 Aug 2019 03:04:30 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:39557 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726693AbfHUHEa (ORCPT ); Wed, 21 Aug 2019 03:04:30 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x7L727vB010350; Wed, 21 Aug 2019 16:02:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x7L727vB010350 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1566370932; bh=RaFKffSw+PipHQQxACqqSUGOlGcAb1Ci/wYUrlHdarU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMNSV3F9SR5IxWOnFaL2EymiVkvsLtY4gtmfulltW89fku6upTrhdpOsjWYXOk4nA GyvFMFUYjx3vcXqvqFSnSFS2RZeRBsZsxetEskDCQZMK3MAP7Dn9vAiCrcxOBpSPjC VCgJRqPLx5J+QvD3mpeJZNvd7gcjzWfI15RUAnO5kod135kO89A3rzpIaNpFYS3ZUi 6kaigjogibAHpzqR6nb0MQeqX8N3JAKbgw8LLiLi3sjQ9R9+8oNwfIOxozO89WTC4Z mRA1Qk0htQxpNEnHrvrkRZo6B+bwmjbUqWH152F9N3wvHI8Y10fkv1xYFAxwZPdiDX yvY5bSruvZGVg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Heiko Carstens , Jonathan Corbet , Michal Marek , Sam Ravnborg , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] kbuild: pkg: rename scripts/package/Makefile to scripts/Makefile.package Date: Wed, 21 Aug 2019 16:02:04 +0900 Message-Id: <20190821070205.8297-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190821070205.8297-1-yamada.masahiro@socionext.com> References: <20190821070205.8297-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org scripts/package/Makefile does not use $(obj) or $(src) at all. It actually generates files and directories in the top of $(objtree). I do not see much sense in descending into scripts/package/. Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.rst | 16 ++++------------ Makefile | 8 +++----- scripts/Makefile.clean | 14 +------------- scripts/{package/Makefile => Makefile.package} | 5 ++++- scripts/kconfig/Makefile | 2 +- usr/include/Makefile | 4 +--- 6 files changed, 14 insertions(+), 35 deletions(-) rename scripts/{package/Makefile => Makefile.package} (99%) diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst index 68ed20ef37dd..78aa51a6fcd4 100644 --- a/Documentation/kbuild/makefiles.rst +++ b/Documentation/kbuild/makefiles.rst @@ -765,7 +765,8 @@ Files matching the patterns "*.[oas]", "*.ko", plus some additional files generated by kbuild are deleted all over the kernel src tree when "make clean" is executed. -Additional files can be specified in kbuild makefiles by use of $(clean-files). +Additional files or directories can be specified in kbuild makefiles by use of +$(clean-files). Example:: @@ -776,17 +777,8 @@ When executing "make clean", the file "crc32table.h" will be deleted. Kbuild will assume files to be in the same relative directory as the Makefile, except if prefixed with $(objtree). -To delete a directory hierarchy use: - - Example:: - - #scripts/package/Makefile - clean-dirs := $(objtree)/debian/ - -This will delete the directory debian in the toplevel directory, including all -subdirectories. - -To exclude certain files from make clean, use the $(no-clean-files) variable. +To exclude certain files or directories from make clean, use the +$(no-clean-files) variable. Usually kbuild descends down in subdirectories due to "obj-* := dir/", but in the architecture makefiles where the kbuild infrastructure diff --git a/Makefile b/Makefile index e88d4fcd5e87..ec2a6b85a0fa 100644 --- a/Makefile +++ b/Makefile @@ -1448,13 +1448,11 @@ distclean: mrproper # Packaging of the kernel to various formats # --------------------------------------------------------------------------- -package-dir := scripts/package %src-pkg: FORCE - $(Q)$(MAKE) $(build)=$(package-dir) $@ + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ %pkg: include/config/kernel.release FORCE - $(Q)$(MAKE) $(build)=$(package-dir) $@ - + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ # Brief documentation of the typical targets used # --------------------------------------------------------------------------- @@ -1526,7 +1524,7 @@ help: @echo ' or "cd tools; make help"' @echo '' @echo 'Kernel packaging:' - @$(MAKE) $(build)=$(package-dir) help + @$(MAKE) -f $(srctree)/scripts/Makefile.package help @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 0b80e3207b20..798e8717c1d9 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -52,26 +52,14 @@ __clean-files := $(wildcard \ $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \ $(filter $(objtree)/%, $(__clean-files))) -# same as clean-files - -__clean-dirs := $(wildcard \ - $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(clean-dirs))) \ - $(filter $(objtree)/%, $(clean-dirs))) - # ========================================================================== quiet_cmd_clean = CLEAN $(obj) - cmd_clean = rm -f $(__clean-files) -quiet_cmd_cleandir = CLEAN $(__clean-dirs) - cmd_cleandir = rm -rf $(__clean-dirs) - + cmd_clean = rm -rf $(__clean-files) __clean: $(subdir-ymn) ifneq ($(strip $(__clean-files)),) +$(call cmd,clean) -endif -ifneq ($(strip $(__clean-dirs)),) - +$(call cmd,cleandir) endif @: diff --git a/scripts/package/Makefile b/scripts/Makefile.package similarity index 99% rename from scripts/package/Makefile rename to scripts/Makefile.package index 407189d9942a..56eadcc48d46 100644 --- a/scripts/package/Makefile +++ b/scripts/Makefile.package @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only # Makefile for the different targets used to generate full packages of a kernel -# It uses the generic clean infrastructure of kbuild + +include $(srctree)/scripts/Kbuild.include # RPM target # --------------------------------------------------------------------------- @@ -154,3 +155,5 @@ help: @echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball' @echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball' @echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball' + +.PHONY: $(PHONY) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 7656e1137b6b..bed7a5a2fbe9 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -114,7 +114,7 @@ testconfig: $(obj)/conf $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ -o cache_dir=$(abspath $(obj)/tests/.cache) \ $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) -clean-dirs += tests/.cache +clean-files += tests/.cache # Help text used by make help help: diff --git a/usr/include/Makefile b/usr/include/Makefile index 1fb6abe29b2f..05c71ef42f51 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -115,6 +115,4 @@ header-test-y += $(filter-out $(header-test-), \ $(patsubst $(obj)/%,%, $(wildcard \ $(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h)))) -# For GNU Make <= 4.2.1, $(wildcard $(obj)/*/) matches to not only directories -# but also regular files. Use $(filter %/, ...) just in case. -clean-dirs += $(patsubst $(obj)/%/,%,$(filter %/, $(wildcard $(obj)/*/))) +clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*))) -- 2.17.1