From patchwork Fri Aug 4 16:31:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 797910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xPCBJ2pQJz9s0Z for ; Sat, 5 Aug 2017 02:32:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C253B2D18C; Fri, 4 Aug 2017 16:32:02 +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 7WW54DSHFYYL; Fri, 4 Aug 2017 16:31:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id A724C2D1B9; Fri, 4 Aug 2017 16:31:57 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 560491C443D for ; Fri, 4 Aug 2017 16:31:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 50E3F82E88 for ; Fri, 4 Aug 2017 16:31:55 +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 l-SnDOgalwiU for ; Fri, 4 Aug 2017 16:31:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9009D835A5 for ; Fri, 4 Aug 2017 16:31:54 +0000 (UTC) Received: from localhost.localdomain (10.3.7.11) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Fri, 4 Aug 2017 18:31:34 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Fri, 4 Aug 2017 18:31:30 +0200 Message-ID: <20170804163130.15772-2-arnout@mind.be> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170804163130.15772-1-arnout@mind.be> References: <20170804163130.15772-1-arnout@mind.be> MIME-Version: 1.0 X-Originating-IP: [10.3.7.11] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Subject: [Buildroot] [PATCH 2/2] Makefile: create symlink to non-default HOST_DIR X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" If BR2_HOST_DIR is not the default, it can be difficult to find the host directory (i.e., HOST_DIR always has to be passed explicitly in addition to the output directory). For example, the Eclipse plugin assumes that HOST_DIR=BASE_DIR/host. Create a symlink from $(BASE_DIR)/host to $(HOST_DIR) if it is not the default. Also remove it in the clean target. When BR2_HOST_DIR is the default, HOST_DIR_SYMLINK will be empty so there will be no additional dependency to dirs and nothing to remove in clean. Fixes https://bugs.busybox.net/show_bug.cgi?id=10151 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- This depends on the previous patch, otherwise there are two rules for the $(BASE_DIR)/host target. Note that this implementation assumes that HOST_DIR is an absolute path, but that assumption is made in dozens of other places as well. Perhaps an abspath should be added to it. --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6ca5d835f4..77684b5b60 100644 --- a/Makefile +++ b/Makefile @@ -430,6 +430,12 @@ TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf # packages compiled for the host go here HOST_DIR := $(call qstrip,$(BR2_HOST_DIR)) +ifneq ($(HOST_DIR),$(BASE_DIR)/host) +HOST_DIR_SYMLINK = $(BASE_DIR)/host +$(HOST_DIR_SYMLINK): $(BASE_DIR) + ln -snf $(HOST_DIR) $(BASE_DIR)/host +endif + # Quotes are needed for spaces and all in the original PATH content. BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)" @@ -533,7 +539,7 @@ endif .PHONY: dirs dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ - $(HOST_DIR) $(HOST_DIR)/usr $(BINARIES_DIR) + $(HOST_DIR) $(HOST_DIR_SYMLINK) $(HOST_DIR)/usr $(BINARIES_DIR) $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG) $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig @@ -955,7 +961,7 @@ printvars: .PHONY: clean clean: - rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \ + rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) $(HOST_DIR_SYMLINK) \ $(BUILD_DIR) $(BASE_DIR)/staging \ $(LEGAL_INFO_DIR) $(GRAPHS_DIR)