LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: David Laight <David.Laight@aculab.com>
Cc: "linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
	Vineet Gupta <vgupta@synopsys.com>,
	Alexey Brodkin <abrodkin@synopsys.com>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>,
	linux-stable <stable@vger.kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kbuild: use more portable 'command -v' for cc-cross-prefix
Date: Wed, 5 Jun 2019 01:55:54 +0900	[thread overview]
Message-ID: <CAK7LNARfX_Vk+iW_B3XTOmoEx-43WENNtEk4vNCv-PWk9R2r3A@mail.gmail.com> (raw)
In-Reply-To: <96b710063de5464ea347bfa1e03308b5@AcuMS.aculab.com>

On Tue, Jun 4, 2019 at 6:01 PM David Laight <David.Laight@aculab.com> wrote:
>
> From: Masahiro Yamada
> > Sent: 04 June 2019 04:31
> ...
> > > > > You could use:
> > > > >         $(shell sh -c "command -v $(c)gcc")
> > > > > or maybe:
> > > > >         $(shell command$${x:+} -v $(c)gcc)
> > > >
> > > >
> > > > How about this?
> > > >
> > > >           $(shell : ~; command -v $(c)gcc)
> > >
> > > Overcomplicated ....
> > >
> > > I've not looked at the list of 'special characters' in make,
> > > but I suspect any variable expansion is enough.
> > > Since ${x:+} always expands to the empty string (whether or
> > > not 'x' is defined) it can't have any unfortunate side effects.
> >
> >
> > Probably, my eyes are used to Makefile.
> > ":" is a no-op command, and it is used everywhere in kernel Makefiles
> > in the form of "@:'
> >
> > It depends on people which solution seems simpler.
> > So, this argument tends to end up with bikesheding.
>
> I am fully aware of ':', it is a shell builtin that always return success.
> Usually used when you want the side-effects of substitutions without
> executing anything (eg : ${foo:=bar} ), to change the result of a
> sequence of shell commands or as a dummy (eg while :; do :; done; )
> Very annoyingly bash parses !: as something other than 'not true'.
>
> $(shell command$${x:+} -v $(c)gcc) will be marginally faster
> because it is less parsing.
>

I will use this:

$(shell command -v $(c)gcc 2>/dev/null)

Make does not handle redirection by itself.

'2>/dev/null' is easy to understand,
and might be useful as extra safety.




-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2019-06-04 16:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 10:49 Masahiro Yamada
2019-06-03 11:04 ` Alexey Brodkin
2019-06-03 11:14 ` David Laight
2019-06-03 11:38   ` Masahiro Yamada
2019-06-03 13:09     ` David Laight
2019-06-04  3:30       ` Masahiro Yamada
2019-06-04  9:01         ` David Laight
2019-06-04 16:55           ` Masahiro Yamada [this message]
2019-06-03 11:16 ` David Laight
2019-06-03 11:45   ` Masahiro Yamada
2019-06-03 12:43     ` David Laight
2019-06-04  3:44       ` Masahiro Yamada

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=CAK7LNARfX_Vk+iW_B3XTOmoEx-43WENNtEk4vNCv-PWk9R2r3A@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=David.Laight@aculab.com \
    --cc=abrodkin@synopsys.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=michal.lkml@markovi.net \
    --cc=stable@vger.kernel.org \
    --cc=vgupta@synopsys.com \
    --subject='Re: [PATCH] kbuild: use more portable '\''command -v'\'' for cc-cross-prefix' \
    /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

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).