Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 19:42:28 -0700
From:      Jos Backus <jos@catnook.com>
To:        freebsd-hackers@freebsd.org
Subject:   Improving GNU make compatibility in BSD make (+ patch)
Message-ID:  <20020531024250.GA90997@lizzy.catnook.com>

next in thread | raw e-mail | index | archive | help
The GNU make info file says:

`$^'
     The names of all the prerequisites, with spaces between them.  For
     prerequisites which are archive members, only the member named is
     used (*note Archives::).  A target has only one prerequisite on
     each other file it depends on, no matter how many times each file
     is listed as a prerequisite.  So if you list a prerequisite more
     than once for a target, the value of `$^' contains just one copy
     of the name.
`$+'
     This is like `$^', but prerequisites listed more than once are
     duplicated in the order they were listed in the makefile.  This is
     primarily useful for use in linking commands where it is
     meaningful to repeat library file names in a particular order.

The make(1) manpage says:

 .ALLSRC   The list of all sources for this target; also known as
                       `>'.

So BSD make interpreting either `$^' or `$+' as its own `$>' would improve
compatibility with GNU make Makefiles. I am just not sure which of the two GNU
make variables maps better to our `$>'. This patch implements the former:

--- var.c	Sat Apr 13 03:16:56 2002
+++ var.c.new	Thu May 30 19:32:01 2002
@@ -1489,6 +1489,8 @@
 
 	name[0] = str[1];
 	name[1] = '\0';
+	if (name[0] == '^')
+	    name[0] = '>';
 
 	v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 	if (v == (Var *)NULL) {

-- 
Jos Backus                 _/  _/_/_/        Santa Clara, CA
                          _/  _/   _/
                         _/  _/_/_/             
                    _/  _/  _/    _/
jos@catnook.com     _/_/   _/_/_/            use Std::Disclaimer;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020531024250.GA90997>