mk: fix make defconfig on FreeBSD
PATCH 1/1 mk: fix make defconfig on FreeBSD
--- mk/rte.sdkconfig.mk | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
mk/rte.sdkconfig.mk +15 -4
@@ -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),)
Signature · 1 line
2.14.1
10/04/2018 17:08, David Hunt:
Quoted 3 lines
Fixes bce6c42c4ad5 ("mk: add sensible default target with defconfig")Signed-off-by David Hunt <[email protected]>
I am sorry, I have to nack because the change is not explained.
Quoted 7 lines · Thomas Monjalon
10/04/2018 17:08, David Hunt:
Quoted 3 lines
Fixes bce6c42c4ad5 ("mk: add sensible default target with defconfig")Signed-off-by David Hunt <[email protected]>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.
Quoted 4 lines · David Hunt
Fixes bce6c42c4ad5 ("mk: add sensible default target with defconfig")Signed-off-by David Hunt <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v2 1/1 mk: fix make defconfig on FreeBSD
In reply to David HuntOn 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, we get amd64 out of "uname -m", which was not handled by the list of checks, but which now resolves to x86_64-native
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"
--- mk/rte.sdkconfig.mk | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
mk/rte.sdkconfig.mk +15 -4
@@ -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),)
Signature · 1 line
2.14.1
Quoted 7 lines · David Hunt
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
Quoted 1 line
of checks, but which now resolves to x86_64-native
Probably should end with a period?
Quoted 4 lines
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?
Quoted 5 lines
Fixes bce6c42c4ad5 ("mk: add sensible default target with defconfig")Signed-off-by David Hunt <[email protected]>---
Left out my Tested-by.
Signature · 2 lines
Thanks, Anatoly
10/04/2018 17:44, David Hunt:
Quoted 5 lines
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.
[...]
Quoted 1 line
+compiler:=$(filter clang gcc icc cc,$(shell ${CC} --version))
You should not invoke a shell command outside of a rule. Please try to move it inside the defconfig context.
Reason for this query?
1/ avoid polluting the rest of the makefile
2/ it breaks doc compilation
Why it breaks doc?
Because it breaks "make -R showversion" which is called in doc/guides/conf.py.
Tip: CC is not always defined :)
PATCH v3 1/1 mk: fix make defconfig on FreeBSD
In reply to David HuntOn FreeBSD, make defconfig generates the config as "defconfig_x86_64-bsdapp-", which does not resolve to any known config file.
On 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.
Then we run '$CC --version', and use grep -o with the list of known compilers, and set to either gcc, icc or clang. Grep's '-o' option returns the matched word rather than the whole line, making the result easier to use.
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".
v3 fixes:
Removed the call to $CC outside of the defconfig rule. No longer breaks the 'make -R showversion'. Simplified working out the compiler name using grep -o.
--- mk/rte.sdkconfig.mk | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
mk/rte.sdkconfig.mk +14 -5
@@ -36,7 +36,6 @@ notemplate: @echo "use T=template from the following list:" @$(MAKE) -rR showconfigs | sed 's,^, ,' - .PHONY: defconfig defconfig: @$(MAKE) config T=$(shell \
@@ -47,15 +46,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 \ + ${CC} --version | grep -o 'cc\|gcc\|icc\|clang' | awk \ + '{ \ + if ($$1 == "cc") { \ + print "gcc" } \ + else { \ + print $$1 } \ + }' \ + ) .PHONY: config ifeq ($(RTE_CONFIG_TEMPLATE),)
Signature · 1 line
2.14.1
Thomas Monjalon
Applied23/04/2018 15:09, David Hunt:
Quoted 21 lines
On FreeBSD, make defconfig generates the config as "defconfig_x86_64-bsdapp-", which does not resolve to any known config file.
On 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.
Then we run '$CC --version', and use grep -o with the list of known compilers, and set to either gcc, icc or clang. Grep's '-o' option returns the matched word rather than the whole line, making the result easier to use.
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".
v3 fixes:
Removed the call to $CC outside of the defconfig rule. No longer breaks the 'make -R showversion'. Simplified working out the compiler name using grep -o.
Quoted 4 lines
Fixes bce6c42c4ad5 ("mk: add sensible default target with defconfig")Tested-by Anatoly Burakov <[email protected]>Signed-off-by David Hunt <[email protected]>
Applied, thanks