[dpdk-dev,v1] mk: fix make defconfig on FreeBSD

Message ID 20180410150804.8774-1-david.hunt@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hunt, David April 10, 2018, 3:08 p.m. UTC
  Fixes: bce6c42c4ad5 ("mk: add sensible default target with defconfig")

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 mk/rte.sdkconfig.mk | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon April 10, 2018, 3:28 p.m. UTC | #1
10/04/2018 17:08, David Hunt:
> Fixes: bce6c42c4ad5 ("mk: add sensible default target with defconfig")
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

I am sorry, I have to nack because the change is not explained.
  
Anatoly Burakov April 10, 2018, 3:30 p.m. UTC | #2
On 10-Apr-18 4:08 PM, David Hunt wrote:
> Fixes: bce6c42c4ad5 ("mk: add sensible default target with defconfig")
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Hunt, David April 10, 2018, 3:52 p.m. UTC | #3
On 10/4/2018 4:28 PM, Thomas Monjalon wrote:
> 10/04/2018 17:08, David Hunt:
>> Fixes: bce6c42c4ad5 ("mk: add sensible default target with defconfig")
>>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
> I am sorry, I have to nack because the change is not explained.
>
>

Apologies, Thomas. I have now added an explanation of what's going on on 
the patch and pushed up a v2.

Regards,
Dave.
  
Anatoly Burakov April 10, 2018, 3:55 p.m. UTC | #4
On 10-Apr-18 4:44 PM, David Hunt wrote:
> On FreeBSD, make defconfig generates the config as "defconfig_x86_64-bsdapp-",
> which does not resolve to any known config file.
> 
> This fix starts by introducing a 'compiler' variable which is set by executing
> "${CC} --version" and pulling out the name of the compiler.
> 
> On FreeBDS, 

^^ FreeBSD :)

we get amd64 out of "uname -m", which was not handled by the list
> of checks, but which now resolves to x86_64-native

Probably should end with a period?

> 
> The remaining code in the patch then takes ${compiler}, the "uname -m"
> output and assembles them all together into a valid freebsd config name,
> i.e. "defconfig_x86_64-native-bsdapp-clang"

Same here, end with period?

> 
> Fixes: bce6c42c4ad5 ("mk: add sensible default target with defconfig")
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

Left out my Tested-by.
  

Patch

diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 0664725ee..7b1684375 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -36,6 +36,7 @@  notemplate:
 	@echo "use T=template from the following list:"
 	@$(MAKE) -rR showconfigs | sed 's,^,  ,'
 
+compiler:=$(filter clang gcc icc cc,$(shell ${CC} --version))
 
 .PHONY: defconfig
 defconfig:
@@ -47,15 +48,25 @@  defconfig:
                         print "arm-armv7a"} \
                 else if ($$0 == "ppc64") { \
                         print "ppc_64-power8"} \
+                else if ($$0 == "amd64") { \
+                        print "x86_64-native"} \
                 else { \
-                        printf "%s-native", $$0} }')-$(shell \
+                        printf "%s-native", $$0} }' \
+		)-$(shell \
                 uname | awk '{ \
                 if ($$0 == "Linux") { \
                         print "linuxapp"} \
                 else { \
-                        print "bsdapp"} }')-$(shell \
-                ${CC} -v 2>&1 | \
-                grep " version " | cut -d ' ' -f 1)
+                        print "bsdapp"} }' \
+		)-$(shell \
+		echo | awk -v compiler=${compiler} \
+		'{ \
+		if (compiler == "cc") \
+			{ print "gcc" } \
+		else \
+			{ print compiler } \
+		}' \
+		)
 
 .PHONY: config
 ifeq ($(RTE_CONFIG_TEMPLATE),)