aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-06-24 04:26:21 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-06-24 04:26:21 +0000
commitcd9a2f5c280b40222d21ca68b5b0962ff712d6cf (patch)
treedc80da53186aab7c56424c2574b0cd7928930721 /usr.bin/make
parent2388d5d1cef849c6482878f223517c38456feecf (diff)
downloadsrc-cd9a2f5c280b40222d21ca68b5b0962ff712d6cf.tar.gz
src-cd9a2f5c280b40222d21ca68b5b0962ff712d6cf.zip
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.
Notes
Notes: svn path=/head/; revision=16663
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/main.c33
-rw-r--r--usr.bin/make/pathnames.h4
2 files changed, 9 insertions, 28 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 169800046717..4094276d236f 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 2c25ead53ed5..a96942c6cf81 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"