question about use of != assignments

Jev Björsell jev at ecadlabs.com
Wed Mar 22 16:57:43 UTC 2017


Hello,

I'm updating net-mgmt/prometheus for which I am the maintainer.

During build, I have added some ldflags for the `go build` step, so that
build time, version, etc. is recorded in the binary. Before this change
running `prometheus -version` gives a bunch of blank values, my attached
patch fixes that.

I'm using != assignments in my Makefile to get date, user, and host.
portlint warns me[0] not to use != assignments, and the linked post
suggests to use echo $$(${VARIABLE_CMDS}) instead.

If I inline $$(${VARIABLE_CMDS})  into by build targets, without echo, they
do not get evaluated.

The question; is my use of != in this context acceptable use, or is there a
better way?

Much thanks,
-Jev

[0]: portlint warning
WARN: Makefile: [25]: use of != in assignments is almost never a good thing
to do.  Try to avoid using them.  See
http://lists.freebsd.org/pipermail/freebsd-ports/2008-July/049777.html for
some helpful hints on what to do instead.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prometheus-1.5.2.diff
Type: text/x-patch
Size: 839 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20170322/77f83e90/attachment.bin>


More information about the freebsd-ports mailing list