tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: != vs :sh



On 2019-03-31 15:07, Joerg Sonnenberger wrote:
On Sun, Mar 31, 2019 at 12:16:27PM +0200, Roland Illig wrote:
Am 28.03.2019 um 10:33 schrieb Jonathan Perkin:
* On 2019-03-28 at 09:22 GMT, Edgar Fuß wrote:

Yes, joerg's right, :sh is preferable.
Could someone please elaborate why it is?
It defers evaluation of the command until it is used.  So with a
Makefile like the following:

   UNAME_EXCLAM!= uname
   UNAME_CMD=     uname

   exclam:
     @echo ${UNAME_EXCLAM}

   cmd:
     @echo ${UNAME_CMD:sh}

UNAME_EXCLAM will be executed for every invocation of the Makefile,
whereas UNAME_CMD will only be executed when the "cmd" target is
called.
Thank you for this explanation. After the 2019Q1 branch, pkglint will
warn about cases like this and provide an even more detailed explanation.
I'm against a blatant warning like that. There are valid reasons for
using !=, especially when checking that it happens in the appropiate
phase.

Joerg
It could be a soft warning such as "Consider the alternative of using :sh yada yada..." and limited to a specific -W check that isn't necessarily on by default.  Also depends how smart the check is.

Home | Main Index | Thread Index | Old Index