From patchwork Tue Jul 21 20:23:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 498333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 8E1361402C7 for ; Wed, 22 Jul 2015 06:24:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=fdK1B81l; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A33DDA1B41; Tue, 21 Jul 2015 20:24:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6rl0L_1PkMT2; Tue, 21 Jul 2015 20:24:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id DBEC2A1CF5; Tue, 21 Jul 2015 20:24:08 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 4FAB21C1F71 for ; Tue, 21 Jul 2015 20:24:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4496332D21 for ; Tue, 21 Jul 2015 20:24:07 +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 3C5miOHavuHX for ; Tue, 21 Jul 2015 20:24:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by silver.osuosl.org (Postfix) with ESMTPS id F0FC532D19 for ; Tue, 21 Jul 2015 20:24:05 +0000 (UTC) Received: by wibxm9 with SMTP id xm9so134497342wib.0 for ; Tue, 21 Jul 2015 13:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=QRtUrmkIo0TXwTMmb/rrQ+O8YVb7dTFko5SBqz+W0XQ=; b=fdK1B81lvW04oMe3aHv++hKY7UPeG72wUBBJgVeZBGbWw7oN4WMJM7H5aL5iuaDp+c vsOeIlRdKgCmF4AscTV0zdHN1dI9K/IkH96VeESUda0ARu9SqBPWM1iWM6bo5EGVw1ks R5BQFTNA9DmMI3R2n5Kd0A4x0NonlFDqiLrUnoPImC6jv9TYEm4u97QsT6No52hliJ5M EqEgeSK1hHBwAGDB8xmDw0oCdYIluZ8nC3VMEaYRJMIrZKGmzZFlPm2+ZzJvn+9rYMdy XfOFUmBi0wAkaXxLX5Wh+LvEmnrmVw29QU9QqxISDCME8WKGaXMlzwOiImLG+Ev/7Nbt Naug== X-Received: by 10.194.23.36 with SMTP id j4mr70836556wjf.105.1437510244344; Tue, 21 Jul 2015 13:24:04 -0700 (PDT) Received: from localhost.localdomain (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id v9sm7846017wjq.41.2015.07.21.13.24.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Jul 2015 13:24:02 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Tue, 21 Jul 2015 22:23:54 +0200 Message-Id: <1437510234-19303-1-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.9.1 Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [PATCH] core/pkg-kconfig: do not override @D 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Currently, we override @D for the kconfig configurators, so the fixup commands can use $(@D); otherwise @D would be simply '.' because it is not a real file in the package build dir. However, this breaks the soon-to-be-introduced linux-backports package, which needs to have a dependency on the linux package to be configured. The underlying reason is that @D is an automatic variable that is always set by make to the directory part of the target of the rule. However, automatic variables loose their "automatic" property when they are manually set. Furthermore, a variable that is defined for a rule is inherited by all dependencies of that rule, so our manually-set @D is inherited all the way down the dependency chain of linux-backports, down to the linux' own .config rule, which is thus run with @D pointing to linux-backports' build dir, not linux'. Fix that by using a "static pattern rule", redirecting the configurators to an intermediate stamp-like file which path is in the package build dir, so we get a valid @D from the onset, without having to manually fiddle with it. Thanks to Arnout for suggesting that in the first place. Sorry I did reject it as "too complex" when it was in fact the best solution. Suggested-by: Arnout Vandecappelle Signed-off-by: "Yann E. MORIN" Cc: Arnout Vandecappelle Cc: Thomas Petazzoni Cc: Thomas De Schampheleire --- package/pkg-kconfig.mk | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk index 3e17a70..7b3d359 100644 --- a/package/pkg-kconfig.mk +++ b/package/pkg-kconfig.mk @@ -104,15 +104,16 @@ endif # that is clean wrt. our requirements. # # Because commands in $(1)_FIXUP_KCONFIG are probably using $(@D), we -# fake it for the configurators (otherwise it is set to just '.', i.e. -# the current directory where make is run, which happens to be in -# $(TOPDIR), because the target of the rule is not an actual file, so -# does not have any path component). +# need to have a valid @D set. But, because the configurators rules are +# not real files and do not contain the path to the package build dir, +# @D would be just '.' in this case. So, we use an intermediate rule +# with a stamp-like file wihch path is in the package build dir, so we +# end up having a valid @D. # -$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): @D=$$($(2)_DIR) -$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done +$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $(1)-%: $$($(2)_DIR)/.kconfig_editor_% +$$($(2)_DIR)/.kconfig_editor_%: $$($(2)_DIR)/.stamp_kconfig_fixup_done $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ - $$($(2)_KCONFIG_OPTS) $$(subst $(1)-,,$$@) + $$($(2)_KCONFIG_OPTS) $$(*) rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built} rm -f $$($(2)_DIR)/.stamp_{target,staging,images}_installed $$(call $(2)_FIXUP_DOT_CONFIG) @@ -169,6 +170,7 @@ endif # package enabled $(1)-update-defconfig \ $(1)-savedefconfig \ $(1)-check-configuration-done \ + $$($(2)_DIR)/.kconfig_editor_% \ $$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)) endef # inner-kconfig-package