[dpdk-dev] [PATCH] mk: fix FreeBSD build
Thomas Monjalon
thomas.monjalon at 6wind.com
Mon Jul 18 15:25:54 CEST 2016
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 <sergio.gonzalez.monroy at intel.com>
[...]
> - 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
More information about the dev
mailing list