From arnej@math.ntnu.no  Fri Apr 17 10:03:27 1998
Received: from romberg.math.ntnu.no (153@romberg.math.ntnu.no [129.241.15.150])
          by hub.freebsd.org (8.8.8/8.8.8) with SMTP id KAA20403
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Apr 1998 10:03:25 GMT
          (envelope-from arnej@math.ntnu.no)
Received: (qmail 1201 invoked from network); 17 Apr 1998 10:03:23 -0000
Received: from cauchy.math.ntnu.no (129.241.15.128)
  by romberg.math.ntnu.no with SMTP; 17 Apr 1998 10:03:23 -0000
Received: (from root@localhost)
          by cauchy.math.ntnu.no (8.8.8/8.8.4)
	  id MAA11252; Fri, 17 Apr 1998 12:03:22 +0200 (CEST)
Message-Id: <199804171003.MAA11252@cauchy.math.ntnu.no>
Date: Fri, 17 Apr 1998 12:03:22 +0200 (CEST)
From: arnej@math.ntnu.no
Reply-To: arnej@math.ntnu.no
To: FreeBSD-gnats-submit@freebsd.org
Subject: "make install" should not touch the obj tree
X-Send-Pr-Version: 3.2

>Number:         6330
>Category:       bin
>Synopsis:       "make install" should not touch the obj tree
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bde
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 17 03:10:01 PDT 1998
>Closed-Date:    Mon Apr 20 09:12:12 PDT 1998
>Last-Modified:  Mon Apr 20 09:14:52 PDT 1998
>Originator:     Arne Henrik Juul
>Release:        FreeBSD 2.2.6-STABLE i386
>Organization:
Norwegian University og Technology and Science
>Environment:

	I've been using this patch for some time now in the 2.2 branch.

>Description:

	It should be possible to do a "make install" even if
	your /usr/src and /usr/obj are mounted read-only (e.g.
	with NFS from another machine, as I do).  However, in
	two places "make install" builds files in the obj
	tree on the fly, then installs them.

>How-To-Repeat:

	mount -u -r /usr/src
	mount -u -r /usr/obj
	cd /usr/src; make install

>Fix:

	Apply the patch below.  The first one should be pretty
	straight-forward (modulo style guidelines for Makefiles),
	and applies to -current unchanged.

	The second changes how osreldate.h is created the same
	way it was already changed in -current (rev 1.55).

Index: src/gnu/usr.bin/groff/tmac/Makefile
===================================================================
RCS file: /usr/cvs/src/gnu/usr.bin/groff/tmac/Makefile,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 Makefile
--- Makefile	1998/03/03 06:37:09	1.12.2.1
+++ Makefile	1998/04/15 10:14:02
@@ -11,7 +11,7 @@
 LINKS=          ${TMACDIR}/tmac.andoc ${TMACDIR}/tmac.an
 
 MANDEPEND=	${MAN7}
-CLEANFILES+=    temp ${MANDEPEND} tmac.groff_an
+CLEANFILES+=    temp ${MANDEPEND} tmac.groff_an *.strip *.mdoc
 
 FILES=          tmac.andoc tmac.pic tmac.ps tmac.psnew tmac.psold\
 		tmac.pspic tmac.psatk tmac.dvi tmac.tty tmac.tty-char tmac.X\
@@ -19,29 +19,41 @@
 STRIPFILES=     tmac.e tmac.s tmac.doc
 MDOCFILES=	doc-common doc-ditroff doc-nroff doc-syms
 
+SFILES = ${STRIPFILES:S;$;.strip;} 
+MFILES = ${MDOCFILES:S;$;.mdoc;}
 
+all: tmac.groff_an ${SFILES} ${MFILES}
+
+${SFILES}:
+	for f in ${STRIPFILES}; do \
+	  	sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/$$f > $$f.strip; \
+	done
+
+${MFILES}:
+	for f in ${MDOCFILES}; do \
+		sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/$$f > $$f.mdoc; \
+	done
+
+tmac.groff_an:
+	sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/tmac.an >tmac.groff_an
+
 beforeinstall:
 	for f in ${FILES}; do \
-		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
+		${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 			${DIST_DIR}/$$f ${DESTDIR}${TMACDIR}; \
 	done
-	sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/tmac.an >tmac.groff_an
 	${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 		tmac.groff_an ${DESTDIR}${TMACDIR}
 	for f in ${STRIPFILES}; do \
-		rm -f temp; \
-	  	sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/$$f >temp; \
 		${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
-			temp ${DESTDIR}${TMACDIR}/$$f; \
+			$$f.strip ${DESTDIR}${TMACDIR}/$$f; \
 	done
 	for f in ${MDOCFILES}; do \
-		rm -f temp; \
-		sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/$$f >temp; \
 		${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
-			temp ${DESTDIR}${MDOCDIR}/$$f; \
+			$$f.mdoc ${DESTDIR}${MDOCDIR}/$$f; \
 	done
 	test -f ${DESTDIR}${TMACDIR}/man.local || \
-		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
+		${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 			${DIST_DIR}/man.local ${DESTDIR}${TMACDIR}
 
 .include "../Makefile.cfg"
Index: src/include/Makefile
===================================================================
RCS file: /usr/cvs/src/include/Makefile,v
retrieving revision 1.45.2.8
diff -u -r1.45.2.8 Makefile
--- Makefile	1998/02/01 16:21:52	1.45.2.8
+++ Makefile	1998/04/17 09:58:08
@@ -6,7 +6,7 @@
 # The ``rm -rf''s used below are safe because rm doesn't follow symbolic
 # links.
 #
-all depend lint tags:
+depend lint tags:
 
 CLEANFILES= osreldate.h version vers.c
 SUBDIR= rpcsvc
@@ -45,6 +45,24 @@
 #SHARED=	symlinks
 SHARED?=	copies
 
+
+.if exists (${.CURDIR}/../sys/conf/newvers.sh)
+all:	osreldate.h
+
+osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh
+	@${ECHO} creating osreldate.h from newvers.sh
+	. ${.CURDIR}/../sys/conf/newvers.sh;			\
+	echo "$$COPYRIGHT" > osreldate.h;			\
+	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
+	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
+.else
+all:
+	@${ECHO} creating osreldate.h from sysctl info
+	echo \#'undef __FreeBSD_version' > osreldate.h
+	echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
+		>> osreldate.h
+.endif
+
 beforeinstall: installhdrs ${SHARED}
 
 .if make(installhdrs)
@@ -63,19 +81,6 @@
 	cd ${.CURDIR}/rpc; \
 		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
 		${RPCFILES} ${DESTDIR}/usr/include/rpc
-	@rm -f osreldate.h
-.if exists (${.CURDIR}/../sys/conf/newvers.sh)
-	@${ECHO} creating osreldate.h from newvers.sh
-	. ${.CURDIR}/../sys/conf/newvers.sh;			\
-	echo "$$COPYRIGHT" > osreldate.h;			\
-	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
-	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
-.else
-	@${ECHO} creating osreldate.h from sysctl info
-	@echo \#'undef __FreeBSD_version' > osreldate.h
-	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
-		>> osreldate.h
-.endif
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
 		${.OBJDIR}/osreldate.h \
 		${DESTDIR}/usr/include
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: arnej@math.ntnu.no, FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: bin/6330: "make install" should not touch the obj tree
Date: Fri, 17 Apr 1998 21:08:14 +1000

 >>Fix:
 >
 >	Apply the patch below.  The first one should be pretty
 >	straight-forward (modulo style guidelines for Makefiles),
 >	and applies to -current unchanged.
 
 It (a patch to tmac/Makefile) only applies to not-very-current :-).
 
 >	The second changes how osreldate.h is created the same
 >	way it was already changed in -current (rev 1.55).
 
 The first change should be obtained from -current too.
 
 Bruce

From: arnej@math.ntnu.no
To: FreeBSD-gnats-submit@FreeBSD.ORG, bde@zeta.org.au
Cc:  Subject: Re: bin/6330: "make install" should not touch the obj tree
Date: 17 Apr 1998 11:39:41 -0000

  > >	Apply the patch below.  The first one should be pretty
  > >	straight-forward (modulo style guidelines for Makefiles),
  > >	and applies to -current unchanged.
  > 
  > It (a patch to tmac/Makefile) only applies to not-very-current :-).
 
 oops, sorry about that, my -current wasn't current enough :-)
 
  > >	The second changes how osreldate.h is created the same
  > >	way it was already changed in -current (rev 1.55).
  > 
  > The first change should be obtained from -current too.
 
 Doesn't work, because -current makes use of the fact that the
 original groff sources are in contrib/groff.  I can't see how
 it can be done the 'same way' using the sources as organized
 in 2.2, at least.
 
   -arnej

From: Bruce Evans <bde@zeta.org.au>
To: arnej@math.ntnu.no, bde@zeta.org.au, FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: bin/6330: "make install" should not touch the obj tree
Date: Sat, 18 Apr 1998 01:05:12 +1000

 > > The first change should be obtained from -current too.
 >
 >Doesn't work, because -current makes use of the fact that the
 >original groff sources are in contrib/groff.  I can't see how
 >it can be done the 'same way' using the sources as organized
 >in 2.2, at least.
 
 They are in contrib for 2.2 too :-).  Only 2.1 has them in gnu.
 I think name conflicts can be handled in general by forcing use
 of an obj dir.
 
 Bruce
Responsible-Changed-From-To: freebsd-bugs->bde 
Responsible-Changed-By: jkh 
Responsible-Changed-When: Fri Apr 17 09:07:39 PDT 1998 
Responsible-Changed-Why:  
Bruce is Mr. /usr/obj stuff. 

From: Arne Henrik Juul <arnej@stud.math.ntnu.no>
To: FreeBSD-gnats-submit@FreeBSD.ORG, bde@zeta.org.au
Cc:  Subject: Re: bin/6330: "make install" should not touch the obj tree
Date: Sat, 18 Apr 1998 10:39:36 +0200

 I said:
  > Doesn't work, because -current makes use of the fact that the
  > original groff sources are in contrib/groff.  I can't see how
  > it can be done the 'same way' using the sources as organized
  > in 2.2, at least.
 
 Now why did I think this?  I plead temporary insanity :-)
 I'm sorry for the confusion.
 
 In fact the change to groff/tmac/Makefile from -current can just be
 pulled into the 2.2 branch without modification, so please disregard
 my previous patch and apply this one instead, on the 2.2 branch only.
 (and I really really hope I got it right this time...)
 
   -arnej
 
 Index: src/include/Makefile
 ===================================================================
 RCS file: /usr/cvs/src/include/Makefile,v
 retrieving revision 1.45.2.8
 diff -u -r1.45.2.8 Makefile
 --- Makefile	1998/02/01 16:21:52	1.45.2.8
 +++ Makefile	1998/04/17 09:58:08
 @@ -6,7 +6,7 @@
  # The ``rm -rf''s used below are safe because rm doesn't follow symbolic
  # links.
  #
 -all depend lint tags:
 +depend lint tags:
  
  CLEANFILES= osreldate.h version vers.c
  SUBDIR= rpcsvc
 @@ -45,6 +45,24 @@
  #SHARED=	symlinks
  SHARED?=	copies
  
 +
 +.if exists (${.CURDIR}/../sys/conf/newvers.sh)
 +all:	osreldate.h
 +
 +osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh
 +	@${ECHO} creating osreldate.h from newvers.sh
 +	. ${.CURDIR}/../sys/conf/newvers.sh;			\
 +	echo "$$COPYRIGHT" > osreldate.h;			\
 +	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
 +	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
 +.else
 +all:
 +	@${ECHO} creating osreldate.h from sysctl info
 +	echo \#'undef __FreeBSD_version' > osreldate.h
 +	echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
 +		>> osreldate.h
 +.endif
 +
  beforeinstall: installhdrs ${SHARED}
  
  .if make(installhdrs)
 @@ -63,19 +81,6 @@
  	cd ${.CURDIR}/rpc; \
  		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
  		${RPCFILES} ${DESTDIR}/usr/include/rpc
 -	@rm -f osreldate.h
 -.if exists (${.CURDIR}/../sys/conf/newvers.sh)
 -	@${ECHO} creating osreldate.h from newvers.sh
 -	. ${.CURDIR}/../sys/conf/newvers.sh;			\
 -	echo "$$COPYRIGHT" > osreldate.h;			\
 -	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
 -	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
 -.else
 -	@${ECHO} creating osreldate.h from sysctl info
 -	@echo \#'undef __FreeBSD_version' > osreldate.h
 -	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
 -		>> osreldate.h
 -.endif
  	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
  		${.OBJDIR}/osreldate.h \
  		${DESTDIR}/usr/include
 Index: src/gnu/usr.bin/groff/tmac/Makefile
 ===================================================================
 RCS file: /usr/cvs/src/gnu/usr.bin/groff/tmac/Makefile,v
 retrieving revision 1.12.2.1
 diff -u -r1.12.2.1 Makefile
 --- Makefile	1998/03/03 06:37:09	1.12.2.1
 +++ Makefile	1998/04/18 06:49:52
 @@ -1,5 +1,7 @@
 -# Makefile for groff macros
 +#	$Id: Makefile,v 1.15 1998/03/21 12:12:55 bde Exp $
  
 +.include "../Makefile.inc"
 +
  TMACOWN?=	${BINOWN}
  TMACGRP?=	${BINGRP}
  TMACMODE?=	${NOBINMODE}
 @@ -10,8 +12,7 @@
  MLINKS=		groff_ms.7 ms.7 me.7 groff_me.7
  LINKS=          ${TMACDIR}/tmac.andoc ${TMACDIR}/tmac.an
  
 -MANDEPEND=	${MAN7}
 -CLEANFILES+=    temp ${MANDEPEND} tmac.groff_an
 +CLEANFILES=	${MAN7} ${MDOCFILES} ${STRIPFILES} tmac.groff_an
  
  FILES=          tmac.andoc tmac.pic tmac.ps tmac.psnew tmac.psold\
  		tmac.pspic tmac.psatk tmac.dvi tmac.tty tmac.tty-char tmac.X\
 @@ -19,30 +20,28 @@
  STRIPFILES=     tmac.e tmac.s tmac.doc
  MDOCFILES=	doc-common doc-ditroff doc-nroff doc-syms
  
 +all: ${MDOCFILES} ${STRIPFILES} tmac.groff_an
 +
 +.for f in ${MDOCFILES} ${STRIPFILES}
 +$f: ${DIST_DIR}/$f
 +	sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET}
 +.endfor
  
 +tmac.groff_an: tmac.an
 +	sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET}
 +
  beforeinstall:
 -	for f in ${FILES}; do \
 -		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 -			${DIST_DIR}/$$f ${DESTDIR}${TMACDIR}; \
 -	done
 -	sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/tmac.an >tmac.groff_an
 +	${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 +	    ${MDOCFILES} ${DESTDIR}${MDOCDIR}
  	${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 -		tmac.groff_an ${DESTDIR}${TMACDIR}
 -	for f in ${STRIPFILES}; do \
 -		rm -f temp; \
 -	  	sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/$$f >temp; \
 -		${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 -			temp ${DESTDIR}${TMACDIR}/$$f; \
 -	done
 -	for f in ${MDOCFILES}; do \
 -		rm -f temp; \
 -		sed -f ${DIST_DIR}/strip.sed ${DIST_DIR}/$$f >temp; \
 -		${INSTALL} ${COPY} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 -			temp ${DESTDIR}${MDOCDIR}/$$f; \
 -	done
 -	test -f ${DESTDIR}${TMACDIR}/man.local || \
 -		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 -			${DIST_DIR}/man.local ${DESTDIR}${TMACDIR}
 +	    ${STRIPFILES} tmac.groff_an ${DESTDIR}${TMACDIR}
 +	cd ${DIST_DIR}; \
 +	    ${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 +	    ${FILES} ${DESTDIR}${TMACDIR}
 +.if !exists(${DESTDIR}${TMACDIR}/man.local)
 +	${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
 +	    ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR}
 +.endif
  
  .include "../Makefile.cfg"
  .include <bsd.prog.mk>
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Mon Apr 20 09:12:12 PDT 1998 
State-Changed-Why:  
Fixed in both 2.2 and -current.. 
>Unformatted:
