Subject: bug in handling of != in make?
To: None <tech-userlevel@NetBSD.org>
From: Klaus Heinz <k.heinz.jun.sechs@onlinehome.de>
List: tech-userlevel
Date: 06/08/2006 23:49:40
Hi,

given a file test.txt containing the line

  $NetBSD$

and the Makefile

----------------
  VERSION!=3D sed -ne 's/^.*\(\$$NetBSD.*\$$\).*$$/\1/p' test.txt > /tmp/se=
d.txt; cat /tmp/sed.txt

  all:
	@echo '${VERSION}'
	@cat /tmp/sed.txt
----------------

I get this output:
  $ make
  etBSD
  $NetBSD$

Clearly, the sed expression extracts the correct string as /tmp/sed.txt
proves. 'make -dv' tells me

  Global:VERSION =3D $NetBSD$

=46rom the above I conclude that !=3D treats the output of the shell command
as if it were placed directly into the Makefile. This means it will be
evaluated according to the usual rules and thus $N and the trailing $
get cut off.

In comparison, I did a similar test with GNU make's $(shell ) syntax and
did get the result (VERSION contains the string $NetBSD$) I expected in
the first place.

Is this behaviour of BSD make intended or a bug?

Tests done with /usr/bin/make on NetBSD 3.0, GNU make 3.80.

ciao
     Klaus