From patchwork Mon Jul 29 20:19:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1138649 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NwUJyoUf"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45y9zd4KC3z9sPG for ; Tue, 30 Jul 2019 06:20:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 320778620F; Mon, 29 Jul 2019 20:20:26 +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 tYZT7jpYNSr0; Mon, 29 Jul 2019 20:20:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 0C30D8614D; Mon, 29 Jul 2019 20:20:23 +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 5D9281BF2BD for ; Mon, 29 Jul 2019 20:20:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D3BF12046C for ; Mon, 29 Jul 2019 20:20:13 +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 YRdmsWXx6lBZ for ; Mon, 29 Jul 2019 20:20:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by silver.osuosl.org (Postfix) with ESMTPS id 3528F20466 for ; Mon, 29 Jul 2019 20:20:11 +0000 (UTC) Received: by mail-wr1-f52.google.com with SMTP id f9so63209646wre.12 for ; Mon, 29 Jul 2019 13:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xP0zHuBfiUBQe2xKDGEqfHrIrj2TJO4f3iuzc3k3kQM=; b=NwUJyoUfKdJX7JCbJfDnzxEai+djRZwkhHers6K91S2TPJJPky2XIKFfnCwyjmwcP7 5u2w5B4+id8gbXUs17kxeACdaUVxdF0EepsTdHfVYagmclfrjLgh5P61UA8MHoRWHbXs LHxcJJ3zqg7w56iXrJhUSe4PJT+RMLOBPSTx6tIN4r5U6z+18lcmFENhNF+1TDxr+TSm BdZKy+ij5qspauGD9QRDBvR5+0vuJgyDtpRvONLjPHRxGbh/cHMY6XhL67iSYW1H8+43 QjMRu27FnvSpQzj1AncMXsJkgN2w0I1o/lxR4kdhnGzgl4C+HpLN6JbIN4qXwsAszOhE 02eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xP0zHuBfiUBQe2xKDGEqfHrIrj2TJO4f3iuzc3k3kQM=; b=cTrEvhH3i9gYMkBAeloJ+wUwRU4/69FRuakAoXUYnPVvibYDIFxtjhDUNqpstuBWGE b3be7MdfB3hDKJurqD7RmMmh4h+KvPQWgOcangIUzmqwFZW6x4+BmzxbkPV/xtu54nny +lUnaB0+xFrHk40bJSk77Ewnr4Hk9dzVU33McUz/EVrQJnys6xXZ3jz36RPO3RYQASfc RlIuwbRcTDkkFPyHP5nPTdRukxqwlVkl6qrvgThvG/ZeW1WVPiDoiJmYfRPj8snUQYKm ey9rDnM6RPAit1G4CxiETz2EyeqJqvuFJS7cNeRgU/Syy44WSBodMedIYsBCm3AAjePX N3jQ== X-Gm-Message-State: APjAAAWSKcCB5rpa2MvIlb2pQvYIj/pb+ERdioH6HLrwpGdBj9ukPEiL pQVO1AhK1TnHhUsstd1e40iss+aH X-Google-Smtp-Source: APXvYqxMhbNv2WAZ0QEmSBY6BFhpOmSzWSc2g8LuVrL3QZkcGa9whQkEAVV83OqbONK8DEY9TW+2bQ== X-Received: by 2002:a05:6000:12c2:: with SMTP id l2mr7163529wrx.65.1564431609483; Mon, 29 Jul 2019 13:20:09 -0700 (PDT) Received: from scaer.home ([2a01:cb19:829a:2800:9142:e193:e0af:96f]) by smtp.gmail.com with ESMTPSA id z1sm63562317wrp.51.2019.07.29.13.20.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 13:20:09 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Mon, 29 Jul 2019 22:19:56 +0200 Message-Id: <5578c81c1007dc2654d886c5de7c3c390845d905.1564431589.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 06/13 v2] core: generate all br2-external files in one go X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vadim Kochan , "Yann E. MORIN" Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" When we introduced support for multiple br2-external trees, we introduced two files, one on the Makefile side, needed very early, and one on the kconfig side, needed later in the configuration process. We naturally introduced a two-step generation, as it looked like the simplest and most obvious way. But now, we are on the verge of generating more files on the kconfig side, and it does not make sense to add even more steps to generate them. And even better yet, we can generate both the Makefile-side and kconfig-side files at the same time, in fact. Make it so. Signed-off-by: "Yann E. MORIN" Cc: Vadim Kochan --- Makefile | 12 ++---------- support/scripts/br2-external | 23 ++++++++--------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 24cb6be85e..78a89f6830 100644 --- a/Makefile +++ b/Makefile @@ -181,8 +181,7 @@ $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist)) BR2_EXTERNAL_FILE = $(BASE_DIR)/.br2-external.mk -include $(BR2_EXTERNAL_FILE) -$(shell support/scripts/br2-external \ - -m -o '$(BR2_EXTERNAL_FILE)' $(BR2_EXTERNAL)) +$(shell support/scripts/br2-external -d '$(BASE_DIR)' $(BR2_EXTERNAL)) BR2_EXTERNAL_ERROR = include $(BR2_EXTERNAL_FILE) ifneq ($(BR2_EXTERNAL_ERROR),) @@ -934,7 +933,7 @@ HOSTCFLAGS = $(CFLAGS_FOR_BUILD) export HOSTCFLAGS .PHONY: prepare-kconfig -prepare-kconfig: outputmakefile $(BASE_DIR)/.br2-external.in +prepare-kconfig: outputmakefile $(BUILD_DIR)/buildroot-config/%onf: mkdir -p $(@D)/lxdialog @@ -1031,13 +1030,6 @@ ifeq ($(NEED_WRAPPER),y) $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O) endif -# Even though the target is a real file, we mark it as PHONY as we -# want it to be re-generated each time make is invoked, in case the -# value of BR2_EXTERNAL is changed. -.PHONY: $(BASE_DIR)/.br2-external.in -$(BASE_DIR)/.br2-external.in: $(BUILD_DIR) - $(Q)support/scripts/br2-external -k -o "$(@)" $(BR2_EXTERNAL) - # printvars prints all the variables currently defined in our # Makefiles. Alternatively, if a non-empty VARS variable is passed, # only the variables matching the make pattern passed in VARS are diff --git a/support/scripts/br2-external b/support/scripts/br2-external index 26a5d230ab..1840cc937b 100755 --- a/support/scripts/br2-external +++ b/support/scripts/br2-external @@ -14,13 +14,11 @@ MANUAL_URL='https://buildroot.org/manual.html\#br2-external-converting' main() { local OPT OPTARG - local br2_ext ofile ofmt + local br2_ext outputdir - while getopts :kmo: OPT; do + while getopts :d: OPT; do case "${OPT}" in - o) ofile="${OPTARG}";; - k) ofmt="kconfig";; - m) ofmt="mk";; + d) outputdir="${OPTARG}";; :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";; \?) error "unknown option '%s'\n" "${OPTARG}";; esac @@ -28,23 +26,18 @@ main() { # Forget options; keep only positional args shift $((OPTIND-1)) - case "${ofmt}" in - mk|kconfig) - ;; - *) error "no output format specified (-m/-k)\n";; - esac - if [ -z "${ofile}" ]; then - error "no output file specified (-o)\n" + if [ -z "${outputdir}" ]; then + error "no output directory specified (-d)\n" fi - exec >"${ofile}" - # Trap any unexpected error to generate a meaningful error message trap "error 'unexpected error while generating ${ofile}\n'" ERR do_validate ${@//:/ } - do_${ofmt} + mkdir -p "${outputdir}" + do_mk >"${outputdir}/.br2-external.mk" + do_kconfig >"${outputdir}/.br2-external.in" } # Validates the br2-external trees passed as arguments. Makes each of