diff options
author | jkh <jkh@FreeBSD.org> | 1996-06-24 04:26:21 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-06-24 04:26:21 +0000 |
commit | 8eb37231d4405088a481324c2ec41ac851e8d8f7 (patch) | |
tree | dc80da53186aab7c56424c2574b0cd7928930721 /usr.bin/make | |
parent | 3acbd3cce674dab9a0afdee1f6e50196f4585ffa (diff) | |
download | FreeBSD-src-8eb37231d4405088a481324c2ec41ac851e8d8f7.zip FreeBSD-src-8eb37231d4405088a481324c2ec41ac851e8d8f7.tar.gz |
Bring in my changes for removing the pestilent obj links (unless you
really want them) from /usr/src. This is the final version of the
patches, incorporating the feedback I've received from -current.
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/main.c | 33 | ||||
-rw-r--r-- | usr.bin/make/pathnames.h | 4 |
2 files changed, 9 insertions, 28 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 1698000..4094276 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -375,6 +375,7 @@ main(argc, argv) char mdpath[MAXPATHLEN + 1]; char obpath[MAXPATHLEN + 1]; char cdpath[MAXPATHLEN + 1]; + char *realobjdir; /* Where we'd like to go */ struct utsname utsname; char *machine = getenv("MACHINE"); @@ -424,12 +425,10 @@ main(argc, argv) * and modify the paths for the Makefiles apropriately. The * current directory is also placed as a variable for make scripts. */ - if (!(path = getenv("MAKEOBJDIR"))) { + if (!(path = getenv("MAKEOBJDIR"))) path = _PATH_OBJDIR; - (void) sprintf(mdpath, "%s.%s", path, machine); - } - else - (void) strncpy(mdpath, path, MAXPATHLEN + 1); + (void) snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); + realobjdir = mdpath; /* This is where we'd _like_ to be, anyway */ if (stat(mdpath, &sb) == 0 && S_ISDIR(sb.st_mode)) { @@ -447,27 +446,8 @@ main(argc, argv) objdir = mdpath; } } - else { - if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { - - if (chdir(path)) { - (void)fprintf(stderr, "make warning: %s: %s.\n", - path, strerror(errno)); - objdir = curdir; - } - else { - if (path[0] != '/') { - (void) sprintf(obpath, "%s/%s", curdir, - path); - objdir = obpath; - } - else - objdir = obpath; - } - } - else - objdir = curdir; - } + else + objdir = curdir; setenv("PWD", objdir, 1); @@ -509,6 +489,7 @@ main(argc, argv) if (objdir != curdir) Dir_AddDir(dirSearchPath, curdir); Var_Set(".CURDIR", curdir, VAR_GLOBAL); + Var_Set(".TARGETOBJDIR", realobjdir, VAR_GLOBAL); Var_Set(".OBJDIR", objdir, VAR_GLOBAL); /* diff --git a/usr.bin/make/pathnames.h b/usr.bin/make/pathnames.h index 2c25ead..a96942c 100644 --- a/usr.bin/make/pathnames.h +++ b/usr.bin/make/pathnames.h @@ -31,10 +31,10 @@ * SUCH DAMAGE. * * from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90 - * $Id: pathnames.h,v 1.2 1993/08/01 18:11:58 mycroft Exp $ + * $Id: pathnames.h,v 1.2 1995/01/23 21:01:52 jkh Exp $ */ -#define _PATH_OBJDIR "obj" +#define _PATH_OBJDIR "/usr/obj" #define _PATH_DEFSHELLDIR "/bin" #define _PATH_DEFSYSMK "/usr/share/mk/sys.mk" #define _PATH_DEFSYSPATH "/usr/share/mk" |