It appears to me that either I have a wrong version of awk or
this Makefile.inc1 is wrong:
#
# $FreeBSD: src/Makefile.inc1,v 1.499.2.11 2006/04/04 14:24:03 glebius Exp $
#
<Snippage>
MAKEOBJDIRPREFIX?= /usr/obj
.if !defined(OSRELDATE)
.if exists(/usr/include/osreldate.h)
OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }'
\
/usr/include/osreldate.h
.else
OSRELDATE= 0
In particular with the double dollar sign in the awk statement,
I get no return, therefore OSRELDATE gets set to 0. The awk
statement also fails from the command line. But if I use only
one $, the awk statement succeeds.
Is there a reason for the double dollar sign? Is something
wrong with my awk? Or is the Makefile.inc1 wrong? I can't seem
to find a switch to get awk to return its version number.
Here is /usr/include/osreldate.h
/*-
* Copyright (c) 1992-2006 The FreeBSD Project.
* All rights reserved.
*
<snippage>
* SUCH DAMAGE.
*
*/
#ifdef _KERNEL
#error "<osreldate.h> cannot be used in the kernel, use
<sys/param.h>"
#else
#undef __FreeBSD_version
#define __FreeBSD_version 504105
#endif
Here are the two awk statements run in an editor shell:
[1;42;37mTue Apr 04 16:09:48 bash3.1:ttyp0:eighner
goodwill~$awk '/^\#define __FreeBSD_version/ {print $$3}'
/usr/include/os<ne __FreeBSD_version/ {print $$3}'
/usr/include/osreldate.h
[1;42;37mTue Apr 04 16:11:08 bash3.1:ttyp0:eighner
goodwill~$awk '/^\#define __FreeBSD_version/ {print $3}'
/usr/include/osr<ne __FreeBSD_version/ {print $3}'
/usr/include/osreldate.h
504105
[1;42;37mTue Apr 04 16:12:12 bash3.1:ttyp0:eighner
goodwill~$exit
exit
In otherwords, $$= no return, $= right answer.
Should I upgrade my awk in some way? Or should I hope the
maintainer will fix the Makefile?
--
Lars Eighner
eighner@io.com lars@larseighner.com
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266