From patchwork Sun Aug 25 01:31:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 172151 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2580049ily; Sat, 24 Aug 2019 18:32:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZ0VJsEUK3qgrf+TS//np0H8BuUiSwcfn1usgnSxM5w73iQYTmCVnKysUxehdXjJBoPgG9 X-Received: by 2002:a17:902:684f:: with SMTP id f15mr12452380pln.332.1566696723682; Sat, 24 Aug 2019 18:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566696723; cv=none; d=google.com; s=arc-20160816; b=HqgxvFL+nn3BeGTwMjEB1TQN5nN+xdNQ96RG6DaFQPhPPrcsscXK46n/cZwtsSZGH7 uHyrcSbccaNGfnAmNMehO1tXf5p4YGF6W1dkLgxcgjIVSqBr+rO72WbLdXCzb5Fk444w B4q6BDUiqIXK/pokf0ieROK1QQTmOkn8XN6v2OO+enZt94PJXayFNxh/5Lw3wYN6A8EU njBEH8CrjhISeSnnOuBvg4ZQ21mDvo7KIqvw6xnRjmdmIWtKEaHJaY2zxnmIiJVjHR5p rGAYpDQZUgGguuwi7ugXihkuqJBDG8Sm7g3YdgWmCTmMOYVUNIWBjtytGIMdlh5kX+2a 2K6g== 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=UySt3IPQMKQvA8Z6xXUcqOfyPtK0Hni6tKUbgs1EZ/I=; b=Og+7/P7ZxMoLFXWMwZ+dR4Va6H9cCwo4kj2id6dXSfm9Jjf/VPqNHoHZqOM4jBHQYT 6Pay9saS2QEq5NH/Gcxs2uDepLKBmsxwL+DeU96D/9+BWaY4tYwCfM5EIyhY0IOTNylC nHpJ4cnzSLRYZQr9xQUfx4Za/3+mbIf9SJAR04/lTQ8/kRwGfzkboanlVsmIBoEBYxT2 z1eLtZpfWlcARXal/Of9/Wr51OVJlrEjXwFLo72oth2EylXnn2nLg9SXOmV08gSNAT07 Hmc4i2Mbk25vnqoLbjKgF4g1HF5CYugTvCJ2oS5sAPXQZHiDz85PWNtJpjyk5lV1AHxM uYWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=eWAcLDCT; 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 69si5401414pge.101.2019.08.24.18.32.03; Sat, 24 Aug 2019 18:32:03 -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=eWAcLDCT; 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 S1728374AbfHYBcC (ORCPT + 28 others); Sat, 24 Aug 2019 21:32:02 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:34351 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728320AbfHYBcB (ORCPT ); Sat, 24 Aug 2019 21:32:01 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-10.nifty.com with ESMTP id x7P1VTtI011335; Sun, 25 Aug 2019 10:31:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x7P1VTtI011335 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1566696690; bh=UySt3IPQMKQvA8Z6xXUcqOfyPtK0Hni6tKUbgs1EZ/I=; h=From:To:Cc:Subject:Date:From; b=eWAcLDCT59y58Rfu/1f5RkY99019OS3+Wlfv0VmdeXHVcwlbhs7LJJpzNqi3TdGDw 9EA6rclq5AGHFwaD2alKpEUtofXI69ZR7RP/PBjN29NtoaYoa0YlQRTvHpflbyPvln I4HMi8kbXkJljsXilZqbE8doE+GF9h8k3BauVzdr6esn79gaI1khmSXC9x+xqa1ntv cF0TMcx3olVOAsZle6/7OFFYHXxvLVVllOeuO22IosFCbNxsXkZpfnE+YlOCK/itaW rJArTylYRZm0jb/OMbgs6iK6KL2h47D9bxqcjwL+Vs5QSpgjkaqIrg9WiP3mAPX0ew wzTCuzu59R1ng== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Jonathan Corbet , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] kbuild: remove clean-dirs syntax Date: Sun, 25 Aug 2019 10:31:27 +0900 Message-Id: <20190825013128.12831-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only the difference between clean-files and clean-dirs is the -r option passed to the 'rm' command. You can always pass -r, and then remove the clean-dirs syntax. Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.rst | 16 ++++------------ scripts/Makefile.clean | 16 ++-------------- scripts/kconfig/Makefile | 2 +- usr/include/Makefile | 4 +--- 4 files changed, 8 insertions(+), 30 deletions(-) -- 2.17.1 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/scripts/Makefile.clean b/scripts/Makefile.clean index 0b80e3207b20..cbfbe13dc87d 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) - +quiet_cmd_clean = CLEAN $(obj) + 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/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)/*)))