From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] mk: fix FreeBSD build Date: Mon, 18 Jul 2016 15:25:54 +0200 Message-ID: <2323240.uRAlvIC4g0@xps13> References: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Sergio Gonzalez Monroy , christian.ehrhardt@canonical.com Return-path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id B88B22C07 for ; Mon, 18 Jul 2016 15:25:55 +0200 (CEST) Received: by mail-wm0-f43.google.com with SMTP id f126so103506366wma.1 for ; Mon, 18 Jul 2016 06:25:55 -0700 (PDT) In-Reply-To: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-07-18 14:11, Sergio Gonzalez Monroy: > 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. Christian, an opinion please? > Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") > > Signed-off-by: Sergio Gonzalez Monroy [...] > - 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; \ > + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp2 ; \ > + mv $(RTE_OUTPUT)/.config_tmp2 $(RTE_OUTPUT)/.config_tmp ; \ > + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ You can avoid creating/deleting the file .config_tmp2 by using a variable: config=$(grep -v '^#' $(RTE_OUTPUT)/.config_tmp) echo "$config" | awk ... > $(RTE_OUTPUT)/.config_tmp