On Mon, Jan 31, 2011 at 09:54:03PM +0100, Joerg Sonnenberger wrote:
> On Mon, Jan 31, 2011 at 08:42:59PM +0100, Matthias Drochner wrote:
> > 
> > jo...@britannica.bec.de said:
> > > $ ~/work/NetBSD/obj/clang-base/tools/bin/nbmake-amd64 -V .OBJDIR
> > > /home/joerg/work/NetBSD/obj/clang-base/amd64/lib/csu
> > 
> > This shows that you are not using an .OBJDIR, in the sense that it is
> > different from .CURDIR. See the make(1) manpage.
> > 
> > There are various rules which use this in mk/bsd.obj.mk. I'm
> > setting BUILDID and BSDOBJDIR in my /etc/mk.conf.
> 
> I can comment out the MAKEOBJDIR assignment in nbmake-amd64 and it still
> works fine. BSDOBJDIR doesn't seem to do anything. BUILDID breaks this.
> I have no idea why those variables even exist, the code in bsd.own.mk is
> messy at best and I don't think it justifies the changes to the
> Makefiles. As such, please either kill BUILDID or find a proper fix and
> backout this change.

The attached patch seems to sort this out.

Joerg
Index: src/usr.bin/make/main.c
===================================================================
--- src/usr.bin/make/main.c
+++ src/usr.bin/make/main.c
@@ -179,11 +179,11 @@
 static void		MainParseArgs(int, char **);
 static int		ReadMakefile(const void *, const void *);
 static void		usage(void);
 
 static Boolean		ignorePWD;	/* if we use -C, PWD is meaningless */
-static char curdir[MAXPATHLEN + 1];	/* startup directory */
+char curdir[MAXPATHLEN + 1];	/* startup directory */
 static char objdir[MAXPATHLEN + 1];	/* where we chdir'ed to */
 char *progname;				/* the program name */
 char *makeDependfile;
 pid_t myPid;
 

Index: src/usr.bin/make/parse.c
===================================================================
--- src/usr.bin/make/parse.c
+++ src/usr.bin/make/parse.c
@@ -2206,11 +2206,12 @@
     char *dirname;
     int len;
 
     slash = strrchr(filename, '/');
     if (slash == NULL) {
-	Var_Set(".PARSEDIR", ".", VAR_GLOBAL, 0);
+	extern char curdir[];
+	Var_Set(".PARSEDIR", curdir, VAR_GLOBAL, 0);
 	Var_Set(".PARSEFILE", filename, VAR_GLOBAL, 0);
     } else {
 	len = slash - filename;
 	dirname = bmake_malloc(len + 1);
 	memcpy(dirname, filename, len);

Reply via email to