tech-pkg archive

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

Re: != vs :sh

> [:sh] defers evaluation of the command until it is used.
Which may or may not be what you want.

> 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.
You could also wrap the != in .ifmake()

I don't object to the comment that :sh may be preferrable in this case, 
but I object to a general ":sh is preferrable" rule based on evaluation order.

You may be using the expansion several times and you may or may not want 
the shell commands to be executed on every usage of the term.

Home | Main Index | Thread Index | Old Index