From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Petazzoni Date: Tue, 21 Feb 2017 10:26:15 +0100 Subject: [Buildroot] [PATCH 1/1] toolchain/helpers.mk: fixup check_gcc_version. In-Reply-To: <1487667876-27245-1-git-send-email-ren_guo@c-sky.com> References: <1487667876-27245-1-git-send-email-ren_guo@c-sky.com> Message-ID: <20170221102615.526d9bce@free-electrons.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net Hello, On Tue, 21 Feb 2017 17:04:36 +0800, Guo Ren wrote: > - real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/;'` ; \ > + real_version=`$(1) --version | sed -r -e '1!d; s/^.+\)[[:space:]]*([^[:space:]]+)/\1/;'` ; \ At some point, isn't something like: echo "__GNUC__.__GNUC_MINOR__" | gcc -P -E - | sed 's/ //g' simpler, more readable and probably more robust? Bonus points if you find a way to not have the spaces around the "." in the output generated by the preprocessor, which would avoid the need to call sed. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com