From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C03FF2B9D for ; Tue, 19 Jul 2016 15:40:40 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 19 Jul 2016 06:40:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,389,1464678000"; d="scan'208";a="736630095" Received: from sie-lab-212-209.ir.intel.com (HELO silpixa00377983.ir.intel.com) ([10.237.212.209]) by FMSMGA003.fm.intel.com with ESMTP; 19 Jul 2016 06:40:38 -0700 From: Sergio Gonzalez Monroy To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, christian.ehrhardt@canonical.com, ferruh.yigit@intel.com Date: Tue, 19 Jul 2016 14:40:37 +0100 Message-Id: <1468935637-39937-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1468857995-130392-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1468857995-130392-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v3] mk: fix FreeBSD build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 13:40:41 -0000 The sed syntax of '0,/regexp/' is GNU specific and fails with non GNU sed in FreeBSD. To solve the issue we can use awk instead to remove duplicates. The awk script basically keeps the last config value, while maintaining order and comments from original config file. Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.sdkconfig.mk | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk index e93237f..5c94edf 100644 --- a/mk/rte.sdkconfig.mk +++ b/mk/rte.sdkconfig.mk @@ -88,11 +88,13 @@ $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT) $(CPP) -undef -P -x assembler-with-cpp \ -ffreestanding \ -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \ - for config in $$(grep -v "^#" $(RTE_OUTPUT)/.config_tmp | cut -d"=" -f1 | sort | uniq -d); do \ - while [ $$(grep "^$${config}=" $(RTE_OUTPUT)/.config_tmp -c ) -gt 1 ]; do \ - sed -i "0,/^$${config}=/{//d}" $(RTE_OUTPUT)/.config_tmp; \ - done; \ - done; \ + config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \ + echo "$$config" | awk -F '=' 'BEGIN {i=1} \ + /^#/ {pos[i++]=$$0} \ + !/^#/ {if (!s[$$1]) {pos[i]=$$0; s[$$1]=i++} \ + else {pos[s[$$1]]=$$0}} END \ + {for (j=1; j $(RTE_OUTPUT)/.config_tmp ; \ if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \ cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \ cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \ -- 2.4.11