Bug 6330 - "make install" should not touch the obj tree
Summary: "make install" should not touch the obj tree
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 2.2.6-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bruce Evans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-04-17 11:10 UTC by arnej
Modified: 1998-04-20 17:14 UTC (History)
0 users

See Also:


Attachments
file.diff (4.16 KB, patch)
1998-04-17 11:10 UTC, arnej
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description arnej 1998-04-17 11:10:01 UTC
	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.

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).
How-To-Repeat: 
	mount -u -r /usr/src
	mount -u -r /usr/obj
	cd /usr/src; make install
Comment 1 Bruce Evans 1998-04-17 12:08:14 UTC
>>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
Comment 2 arnej 1998-04-17 12:39:41 UTC
 > >	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
Comment 3 Bruce Evans 1998-04-17 16:05:12 UTC
> > 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
Comment 4 jkh freebsd_committer freebsd_triage 1998-04-17 17:07:39 UTC
Responsible Changed
From-To: freebsd-bugs->bde

Bruce is Mr. /usr/obj stuff. 

Comment 5 arnej 1998-04-18 09:39:36 UTC
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>
Comment 6 Bruce Evans freebsd_committer freebsd_triage 1998-04-20 17:12:12 UTC
State Changed
From-To: open->closed

Fixed in both 2.2 and -current..