From patchwork Thu Sep 5 21:27:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 272972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id F0CB62C00AC for ; Fri, 6 Sep 2013 07:28:01 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 05EAA8D07E; Thu, 5 Sep 2013 21:28:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2JbkCEAqfxdn; Thu, 5 Sep 2013 21:27:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id A5CC187F73; Thu, 5 Sep 2013 21:27:55 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 7089F1BF842 for ; Thu, 5 Sep 2013 21:27:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5E536317AA for ; Thu, 5 Sep 2013 21:27:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jQvEJU7r9QVw for ; Thu, 5 Sep 2013 21:27:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by silver.osuosl.org (Postfix) with ESMTP id 5ED5C1FE3B for ; Thu, 5 Sep 2013 21:27:42 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id F1F0A93F; Thu, 5 Sep 2013 23:27:52 +0200 (CEST) Received: from localhost (AToulouse-651-1-138-58.w109-222.abo.wanadoo.fr [109.222.217.58]) by mail.free-electrons.com (Postfix) with ESMTPSA id B7C938EC for ; Thu, 5 Sep 2013 23:27:52 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Thu, 5 Sep 2013 23:27:39 +0200 Message-Id: <1378416469-17708-2-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378416469-17708-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1378416469-17708-1-git-send-email-thomas.petazzoni@free-electrons.com> Subject: [Buildroot] [RFCv1 01/11] Makefile: make $(BUILD_DIR)/.root rule idempotent X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net The $(BUILD_DIR)/.root rule is executed as part of the 'dirs' target. The 'dirs' target is re-executed at every execution of 'make external-deps', and make external-deps explicitly tells make to ignore targets that have already been made (through the -B option). This means that the $(BUILD_DIR)/.root rule has to be idempotant, which was not the case this the introduction of the lib32/lib64 symbolic link. Running 'make external-deps' three times in a row was sufficient to trigger an error due to symbolic links being incorrectly created. This patch fixes that. Signed-off-by: Thomas Petazzoni Acked-by: Thomas De Schampheleire Acked-by: Luca Ceresoli Tested-by: Luca Ceresoli --- This should probably be taken for 2013.08.1 as a fix of 'make external-deps'. --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 09faeba..93fc6ea 100644 --- a/Makefile +++ b/Makefile @@ -447,9 +447,13 @@ $(BUILD_DIR)/.root: --exclude .hg --exclude=CVS --exclude '*~' \ $(TARGET_SKELETON)/ $(TARGET_DIR)/ cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE) - @ln -s lib $(TARGET_DIR)/$(LIB_SYMLINK) - @mkdir -p $(TARGET_DIR)/usr - @ln -s lib $(TARGET_DIR)/usr/$(LIB_SYMLINK) + $(Q)if [ ! -L $(TARGET_DIR)/$(LIB_SYMLINK) ]; then \ + ln -s lib $(TARGET_DIR)/$(LIB_SYMLINK) ; \ + fi + $(Q)mkdir -p $(TARGET_DIR)/usr + $(Q)if [ ! -L $(TARGET_DIR)/usr/$(LIB_SYMLINK) ]; then \ + ln -s lib $(TARGET_DIR)/usr/$(LIB_SYMLINK) ; \ + fi touch $@ $(TARGET_DIR): $(BUILD_DIR)/.root