summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>2016-07-19 14:40:37 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-07-21 10:26:12 +0200
commit658cf5bc54fa44b13714d0fc6840985db2d7f331 (patch)
treee1eb9ed749a10b52b3ca1e5474cc23fae4377971
parent2f6414f4baf1d34e1c1a08d039ad0e51aead5277 (diff)
downloaddpdk-658cf5bc54fa44b13714d0fc6840985db2d7f331.zip
dpdk-658cf5bc54fa44b13714d0fc6840985db2d7f331.tar.gz
dpdk-658cf5bc54fa44b13714d0fc6840985db2d7f331.tar.xz
mk: fix FreeBSD build
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 <sergio.gonzalez.monroy@intel.com> Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
-rw-r--r--mk/rte.sdkconfig.mk12
1 files 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<i; j++) print pos[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 ; \