From patchwork Fri Mar 9 17:49:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 146253 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 18258B6FAF for ; Tue, 13 Mar 2012 08:20:44 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1S7Ce5-00027g-Oh; Mon, 12 Mar 2012 21:19:10 +0000 Received: from bombadil.infradead.org ([2001:4830:2446:ff00:4687:fcff:fea6:5117]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1S7BVM-0002xr-Fp for linux-mtd@merlin.infradead.org; Mon, 12 Mar 2012 20:06:04 +0000 Received: from mail-pz0-f49.google.com ([209.85.210.49]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1S63vs-0004zO-TN for linux-mtd@lists.infradead.org; Fri, 09 Mar 2012 17:48:49 +0000 Received: by dakp5 with SMTP id p5so1868160dak.36 for ; Fri, 09 Mar 2012 09:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=XBT2q4CB7ly5HHqP5DAt3y9pXcZ6kVHalP1JRHRR3GI=; b=hu5lILmNdP2Ywu8tRUFUuqYIkfbgOt3lrXRZ0ciIK1O3POOx6VNs2jB0zpyLeNglEa hN5vcpYGE6ITQ9ieVHhTVySrb+do5hzN6WBAX3rMJFeWFQ16myN5/qg9Kv4plt9Yt8rO zSMkwzoLuBis3Ez2IBLYznFeVVb+aczBJlRrdTaMCx6085Xi+bPbIlsXZ3DUSQV90MLX 88OXrH75RpbkL8R2l+Z3IV9JDMNd1cBRbvQVzLL+MOhhey3gu1Ui5id4h68Zkq0BwNrJ 6XtxCfJUzxyjConSSrbQthSNl76Fz6r2QHEazYEHPMsX/U70duXADz0M4Oj4mWrqI/y2 uAuQ== Received: by 10.68.196.226 with SMTP id ip2mr5722087pbc.75.1331315324982; Fri, 09 Mar 2012 09:48:44 -0800 (PST) Received: from localhost.localdomain (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPS id r6sm4836229pbq.56.2012.03.09.09.48.43 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Mar 2012 09:48:44 -0800 (PST) From: Brian Norris To: Artem Bityutskiy Subject: [PATCH v2] Makefile: fix "make clean" for old GNU find Date: Fri, 9 Mar 2012 09:49:09 -0800 Message-Id: <1331315349-8541-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.5.4.2.g519b1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20120309_124849_168005_E33F4AE9 X-CRM114-Status: GOOD ( 10.34 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Brian Norris , linux-mtd@lists.infradead.org, Mike Frysinger X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org findutils v4.1.x does not have the `-exec CMD {} +' syntax. We can just as easily use the `-exec CMD {} \;' syntax. However, it will launch a lot more `rm' processes, so we only use it if the first form fails with an error. This isn't a perfect solution (`find -exec +' can fail for other reasons) but it works well enough. This problem manifests itself in RHEL 4, findutils 4.1.20: $ make clean rm -f /XXX/mtd-utils/*.o /XXX/mtd-utils/ftl_format ... find: missing argument to `-exec' make: *** [clean] Error 1 Signed-off-by: Brian Norris Cc: Mike Frysinger Acked-by: Mike Frysinger --- v2: try '+' syntax, then fall back to old format Makefile | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 17a1216..7506ed4 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,8 @@ OBJDEPS = $(BUILDDIR)/include/version.h include common.mk +CLEAN_FIND = find "$(BUILDDIR)/" -xdev '(' -name '*.[ao]' -o -name '.*.c.dep' ')' + clean:: ifneq ($(BUILDDIR)/.git,) ifneq ($(BUILDDIR),.) @@ -50,10 +52,10 @@ ifneq ($(BUILDDIR),$(CURDIR)) endif endif endif + # findutils v4.1.x (RHEL 4) do not have '+' syntax @if test -d "$(BUILDDIR)/"; then \ - find $(BUILDDIR)/ -xdev \ - '(' -name '*.[ao]' -o -name '.*.c.dep' ')' \ - -exec rm -f {} + ; \ + $(CLEAN_FIND) -exec rm -f {} + 2> /dev/null || \ + $(CLEAN_FIND) -exec rm -f {} \; ; \ fi rm -f $(BUILDDIR)/include/version.h $(MAKE) -C $(TESTS) clean