From patchwork Sat Jun 22 07:51:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 167475 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1687105ilk; Sat, 22 Jun 2019 00:51:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/FZD7exJBZ8wLrDESC7A8prhR4s0/M5Cs9OyMlsEQU/C/DgsXKH4BJQL9lUCk+2OUh4x6 X-Received: by 2002:a17:90a:32ec:: with SMTP id l99mr11804313pjb.44.1561189894691; Sat, 22 Jun 2019 00:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561189894; cv=none; d=google.com; s=arc-20160816; b=nxLkVosw46htYyyuR4JA653b8ygH0FkUxOLvoKoLVKHWBdvRJ+iEk7Kl8lD+XWE3Zj 707sq1UDRST0nc8hKH2koh4IhGSQ4Ry9Y5tru/MmQY/+oIlCXAoYX1oKy7mTFKlsjfM4 Z0cY1LTRlc8Nt6GBqUoDZmAc4I4Q4q5SY48hMU6/CZgRy+uM1EWm16UNUXCJf78o3ly4 QcNjD+4eXJvYwJ5MhQ2XnbWnr8RjyIRSBdRdq/9ISVivQRkf5EqJ76lnwiw/bT4MzCSS WEEmttkpe8qQmrZA8GfLRa8MXSYSH4NM7lBG7vStn+o7vN4Een4WbYiO3nw9ew4ZUPXT 4khg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=AxOOpqcv/SGmTAp3xuWI78Dh70kU7xGGs2JUaZ37XQ4=; b=HlbsHOL358D/uie+q16FOV5G4diISA2zR1+CPYvXkeftsmkwPys4QBxVfsQA2hqKap ZC5cMIhzXbFGgJiwrM6R9RCFQeCYXJnPjYsttF3nSWYy0cs7djCYwo667kTdq+MjcQja L3c4ODjRx5hkVCyiPNJHbm4d2MExHQJ7fIgPPCy8D0+YSq0uOb35arZcoJy5NcczOgeJ ScTlNrKeo9jN9LJuL3lXLDRYzOgIpS0m9QwGVpLo7zEfXkSvpU6DI4nIjbbF+5yNslwu 9UR59P2tkFuLgKgtYgjg4I6rZ9ZQqGkRSRP+mxPsw696FmoVN0wncLCFDIJw79vuSG53 bPLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=yyqeq5Rk; 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 v126si267824pgb.150.2019.06.22.00.51.33; Sat, 22 Jun 2019 00:51:34 -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=yyqeq5Rk; 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 S1726290AbfFVHv1 (ORCPT + 30 others); Sat, 22 Jun 2019 03:51:27 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:25247 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbfFVHv1 (ORCPT ); Sat, 22 Jun 2019 03:51:27 -0400 Received: from grover.flets-west.jp (softbank126125154139.bbtec.net [126.125.154.139]) (authenticated) by conuserg-08.nifty.com with ESMTP id x5M7p1Gc023090; Sat, 22 Jun 2019 16:51:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x5M7p1Gc023090 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1561189861; bh=AxOOpqcv/SGmTAp3xuWI78Dh70kU7xGGs2JUaZ37XQ4=; h=From:To:Cc:Subject:Date:From; b=yyqeq5RkHhk7pGOVYXUOgx6o2hMziYdwPWXA6mhEsWVd22gXy78H/g8qW6kMzC0pe iMsy+4lcjBzOP8A5DM7pw3bXmuTw4ycz21ICxkZtoD2u+t1U8JwhmUwprNrr52WmOK 3I7ylBuT2zL4C10EI/fgJoBV+Q8X5DbxjI75Uq4Bv/MP/2/+Y+G2q8VOjT1ffg9T47 Gfywh3eyLAI3a6zp07NYtm5vtN9JAT8XT8woRXTDwZCcV50Pe5nTbuEsfv/e8GVvSm l1FgUwb4NKlYiB5qd/F4YyqSQZzdP51J0f//eEvoVMUO++EQNV8axiLCi5d6KcK/wT 1sEUrF8JGayRw== X-Nifty-SrcIP: [126.125.154.139] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Arnd Bergmann , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: fix a warning in double cleaning of separate build directory Date: Sat, 22 Jun 2019 16:51:00 +0900 Message-Id: <20190622075100.17990-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit b91976b7c0e3 ("kbuild: compile-test UAPI headers to ensure they are self-contained"), 'make clean' in a row for the separate output directory emits a warning. $ make -s O=foo allmodconfig; cd foo; make usr/; make clean; make clean [ snip ] CLEAN . CLEAN usr/include/asm usr/include/asm-generic usr/include/drm usr/include/linux usr/include/misc usr/include/mtd usr/include/rdma usr/include/scsi usr/include/sound usr/include/video usr/include/xen CLEAN usr CLEAN arch/x86/tools CLEAN .tmp_versions find: ‘*’: No such file or directory find: ‘*’: No such file or directory In the second 'make clean', $(objtree)/usr/include exists, but it contains nothing, then the 'find' command warns 'No such file or directory'. I replaced the nasty 'find' with $(wildcard ...). [Note] I wish I could write the code more simply, like this: clean-dirs = $(patsubst $(obj)/%/,%,$(wildcard $(obj)/*/)) I did not do that due to the bug of GNU Make <= 4.2.1 $(wildcard $(obj)/*/) should match to only directories since it has a trailing slash, but actually matches to regular files too. This bug was fixed by: | commit b7acb10e86dc8f5fdf2a2bbd87e1059c315e31d6 | Author: spagoveanu@gmail.com | Date: Wed Jun 20 02:03:48 2018 +0300 | | * src/dir.c: Preserve glob d_type field For GNU Make <= 4.2.1, clean-dirs would end up with containing 'usr/include/Makefile'. This would be harmless because Makefile.clean would search for the non-existing 'usr/include/usr/include/Makefile', then it would be filtered out by $(wildcard ...). However, I'd rather try my best to avoid buggy code. Reported-by: Arnd Bergmann Fixes: b91976b7c0e3 ("kbuild: compile-test UAPI headers to ensure they are self-contained") Signed-off-by: Masahiro Yamada --- usr/include/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/usr/include/Makefile b/usr/include/Makefile index 7091e8b5a608..343abba96205 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -128,5 +128,8 @@ endif # Use '=' instead of ':=' to avoid $(shell ...) evaluation when cleaning header-test-y = $(filter-out $(no-header-test), $(all-uapi-headers)) -# Use '=' instead of ':=' to avoid $(shell ...) evaluation when building -clean-dirs = $(shell cd $(obj) 2>/dev/null && find * -maxdepth 0 -type d) +# Use '=' instead of ':=' to avoid $(wildcard ...) evaluation when building +# +# 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)/*/)))