From 883c20ae5a3d1a5850b46cac433d7a9b9e8373e0 Mon Sep 17 00:00:00 2001 From: cgd Date: Tue, 23 Mar 1993 07:26:38 +0000 Subject: [PATCH] made .CURDIR be absolute, not relative, thereby eliminating the need for some of the makefile trickery when making objects, and fixing a few .PATH bugs --- share/mk/bsd.lib.mk | 4 +--- share/mk/bsd.prog.mk | 4 +--- usr.bin/make/main.c | 12 ++++-------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index f87b92d7a999..0f5ff5853539 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -146,10 +146,9 @@ tags: ${SRCS} obj: .else obj: - @cd ${.CURDIR}; \ + @cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \ here=`pwd`; subdir=`echo $$here | sed 's,^/usr/src/,,'`; \ if test $$here != $$subdir ; then \ - rm -rf obj; \ dest=/usr/obj/$$subdir ; \ echo "$$here -> $$dest"; ln -s $$dest obj; \ if test -d /usr/obj -a ! -d $$dest; then \ @@ -160,7 +159,6 @@ obj: else \ true ; \ dest=$$here/obj ; \ - /bin/rm -f $$dest 2> /dev/null || true; \ echo "making $$here/obj" ; \ if test ! -d obj ; then \ mkdir $$here/obj; \ diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index ecc598cc5bf7..0f208e128579 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -153,10 +153,9 @@ lint: ${SRCS} _PROGSUBDIR obj: _PROGSUBDIR .else obj: _PROGSUBDIR - @cd ${.CURDIR}; \ + @cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \ here=`pwd`; subdir=`echo $$here | sed 's,^/usr/src/,,'`; \ if test $$here != $$subdir ; then \ - rm -rf obj; \ dest=/usr/obj/$$subdir ; \ echo "$$here -> $$dest"; ln -s $$dest obj; \ if test -d /usr/obj -a ! -d $$dest; then \ @@ -167,7 +166,6 @@ obj: _PROGSUBDIR else \ true ; \ dest=$$here/obj ; \ - /bin/rm -f $$dest 2> /dev/null || true; \ echo "making $$here/obj" ; \ if test ! -d obj ; then \ mkdir $$here/obj; \ diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 959e7b6eea85..0ebf903e05d6 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -365,14 +365,10 @@ main(argc, argv) if (!(path = getenv("MAKEOBJDIR"))) path = _PATH_OBJDIR; if (!lstat(path, &sb)) { - if (S_ISDIR(sb.st_mode)) - curdir = ".."; - else { - curdir = emalloc((u_int)MAXPATHLEN + 1); - if (!getwd(curdir)) { - (void)fprintf(stderr, "make: %s.\n", curdir); - exit(2); - } + curdir = emalloc((u_int)MAXPATHLEN + 1); + if (!getwd(curdir)) { + (void)fprintf(stderr, "make: %s.\n", curdir); + exit(2); } if (chdir(path)) { (void)fprintf(stderr, "make: %s: %s.\n",