From: Ido Schimmel <idosch@idosch.org>
To: David Ahern <dsahern@kernel.org>
Cc: netdev@vger.kernel.org, stephen@networkplumber.org
Subject: Re: [PATCH iproute2-next] configure: Allow command line override of toolchain
Date: Wed, 2 Mar 2022 15:56:15 +0200 [thread overview]
Message-ID: <Yh93f0XP0DijocNa@shredder> (raw)
In-Reply-To: <20220228015435.1328-1-dsahern@kernel.org>
On Sun, Feb 27, 2022 at 06:54:35PM -0700, David Ahern wrote:
> Easy way to build for both gcc and clang.
>
> Signed-off-by: David Ahern <dsahern@kernel.org>
> ---
> configure | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 8ddff43c6a7d..13f2d1739b99 100755
> --- a/configure
> +++ b/configure
> @@ -19,10 +19,10 @@ check_toolchain()
> : ${AR=ar}
> : ${CC=gcc}
> : ${YACC=bison}
> - echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG
> - echo "AR:=${AR}" >>$CONFIG
> - echo "CC:=${CC}" >>$CONFIG
> - echo "YACC:=${YACC}" >>$CONFIG
> + echo "PKG_CONFIG?=${PKG_CONFIG}" >>$CONFIG
> + echo "AR?=${AR}" >>$CONFIG
> + echo "CC?=${CC}" >>$CONFIG
> + echo "YACC?=${YACC}" >>$CONFIG
> }
David, are you sure this patch is needed? Even without it I can override
from the command line:
$ make V=1 CC=gcc
lib
make[1]: Entering directory '/home/idosch/code/iproute2/lib'
gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -pipe -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/var/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DHAVE_SETNS -DHAVE_HANDLE_AT -DHAVE_SELINUX -DHAVE_ELF -DHAVE_LIBMNL -DNEED_STRLCPY -DHAVE_LIBCAP -DHAVE_SETNS -DHAVE_HANDLE_AT -DHAVE_SELINUX -DHAVE_ELF -DHAVE_LIBMNL -DNEED_STRLCPY -DHAVE_LIBCAP -fPIC -c -o libgenl.o libgenl.c
...
$ make V=1 CC=clang
lib
make[1]: Entering directory '/home/idosch/code/iproute2/lib'
clang -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -pipe -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/var/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DHAVE_SETNS -DHAVE_HANDLE_AT -DHAVE_SELINUX -DHAVE_ELF -DHAVE_LIBMNL -DNEED_STRLCPY -DHAVE_LIBCAP -DHAVE_SETNS -DHAVE_HANDLE_AT -DHAVE_SELINUX -DHAVE_ELF -DHAVE_LIBMNL -DNEED_STRLCPY -DHAVE_LIBCAP -fPIC -c -o libgenl.o libgenl.c
Also created this test file:
$ cat bla.mk
CC := foo
all:
echo $(origin CC)
echo $(CC)
$ make -f bla.mk
echo file
file
echo foo
foo
$ make -f bla.mk CC=clang
echo command line
command line
echo clang
clang
$ make -v
GNU Make 4.3
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
I'm asking because this change broke the build on our Fedora machines
and my laptop. None of them have 'yacc' installed, but they do have
'bison', which was used unconditionally before the change. After the
change, 'YACC' is set to 'yacc', as it's an implicit variable that
defaults to 'yacc':
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
next prev parent reply other threads:[~2022-03-02 13:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 1:54 [PATCH iproute2-next] configure: Allow command line override of toolchain David Ahern
2022-02-28 17:11 ` Stephen Hemminger
2022-02-28 17:50 ` patchwork-bot+netdevbpf
2022-03-02 13:56 ` Ido Schimmel [this message]
2022-03-05 18:11 ` David Ahern
2022-03-05 19:32 ` Stephen Hemminger
2022-03-07 15:09 ` Ido Schimmel
2022-03-08 16:26 ` David Ahern
2022-03-08 16:41 ` Ido Schimmel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yh93f0XP0DijocNa@shredder \
--to=idosch@idosch.org \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).