From: eggert@twinsun.COM (Paul Eggert)
Subject: groff 1.06 Makefile `make depend' circularity; `make install' glitch
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 3 Sep 1992 20:39:58 GMT

GROFF VERSION: 1.06

MACHINE: Sun Sparcstation 1

OS: SunOS 4.1.2

COMPILER: GCC 2.2.2 with local changes

INPUT FILES: none

COMMAND LINE: none

DESCRIPTION OF INCORRECT BEHAVIOUR:
1.  `make prefix=/some/other/prefix install' ignores /some/other/prefix,
and uses the prefix setting inside the Makefile instead.  This makes it
hard to install groff into a staging directory.

2.  `make depend' fails after `make realclean', because `make depend' assumes
that all the Makefile.dep files are already there.  Similarly, `make distfiles'
should not assume that the Makefile.dep files exist, since you must run
`make distfiles' before running `make depend'.


SUGGESTED FIX [optional]:
The patch to lines 238-247 fix the first problem;
the rest of the patch fixes the second problem.

===================================================================
RCS file: Makefile.in,v
retrieving revision 1.6
diff -c -r1.6 Makefile.in
*** Makefile.in	1992/08/25 18:16:50	1.6
--- Makefile.in	1992/09/02 20:55:39
***************
*** 238,247 ****
  
  
  $(TARGETS):
! 	@$(MAKE) do=$@ $(dodirs)
  
  dot: FORCE
! 	@$(MAKE) srcdir=$(srcdir) VPATH=$(srcdir) -f $(srcdir)/Makefile.comm \
  		-f $(srcdir)/Makefile.sub $(do)
  	
  $(LIBDIRS): FORCE
--- 238,248 ----
  
  
  $(TARGETS):
! 	@$(MAKE) $(MDEFINES) do=$@ $(dodirs)
  
  dot: FORCE
! 	@$(MAKE) $(MDEFINES) \
! 		srcdir=$(srcdir) VPATH=$(srcdir) -f $(srcdir)/Makefile.comm \
  		-f $(srcdir)/Makefile.sub $(do)
  	
  $(LIBDIRS): FORCE
***************
*** 249,260 ****
  	then srcdir=.; \
  	else srcdir=`cd $(srcdir); pwd`/$@; \
  	fi; \
  	echo Making $(do) in $@; \
  	test -d $@ || mkdir $@; \
  	cd $@; \
  	$(MAKE) $(MDEFINES) srcdir=$$srcdir VPATH=$$srcdir \
  		-f $$srcdir/../Makefile.comm -f $$srcdir/Makefile.sub \
! 	        -f $$srcdir/../Makefile.lib -f $$srcdir/Makefile.dep $(do)
  
  $(CPROGDIRS): FORCE
  	@if test $(srcdir) = .; \
--- 250,262 ----
  	then srcdir=.; \
  	else srcdir=`cd $(srcdir); pwd`/$@; \
  	fi; \
+ 	case $(do) in depend|distfiles) d='';; *) d="-f $$srcdir/Makefile.dep";; esac; \
  	echo Making $(do) in $@; \
  	test -d $@ || mkdir $@; \
  	cd $@; \
  	$(MAKE) $(MDEFINES) srcdir=$$srcdir VPATH=$$srcdir \
  		-f $$srcdir/../Makefile.comm -f $$srcdir/Makefile.sub \
! 	        -f $$srcdir/../Makefile.lib $$d $(do)
  
  $(CPROGDIRS): FORCE
  	@if test $(srcdir) = .; \
***************
*** 261,272 ****
  	then srcdir=.; \
  	else srcdir=`cd $(srcdir); pwd`/$@; \
  	fi; \
  	echo Making $(do) in $@; \
  	test -d $@ || mkdir $@; \
  	cd $@; \
  	$(MAKE) $(MDEFINES) srcdir=$$srcdir VPATH=$$srcdir \
  		-f $$srcdir/../Makefile.comm -f $$srcdir/Makefile.sub \
! 	        -f $$srcdir/../Makefile.cpg -f $$srcdir/Makefile.dep $(do)
  
  $(CCPROGDIRS): FORCE
  	@if test $(srcdir) = .; \
--- 263,275 ----
  	then srcdir=.; \
  	else srcdir=`cd $(srcdir); pwd`/$@; \
  	fi; \
+ 	case $(do) in depend|distfiles) d='';; *) d="-f $$srcdir/Makefile.dep";; esac; \
  	echo Making $(do) in $@; \
  	test -d $@ || mkdir $@; \
  	cd $@; \
  	$(MAKE) $(MDEFINES) srcdir=$$srcdir VPATH=$$srcdir \
  		-f $$srcdir/../Makefile.comm -f $$srcdir/Makefile.sub \
! 	        -f $$srcdir/../Makefile.cpg $$d $(do)
  
  $(CCPROGDIRS): FORCE
  	@if test $(srcdir) = .; \
***************
*** 273,284 ****
  	then srcdir=.; \
  	else srcdir=`cd $(srcdir); pwd`/$@; \
  	fi; \
  	echo Making $(do) in $@; \
  	test -d $@ || mkdir $@; \
  	cd $@; \
  	$(MAKE) $(MDEFINES) srcdir=$$srcdir VPATH=$$srcdir \
  		-f $$srcdir/../Makefile.comm -f $$srcdir/Makefile.sub \
! 	        -f $$srcdir/../Makefile.ccpg -f $$srcdir/Makefile.dep $(do)
  
  $(DEVDIRS): FORCE
  	@if test $(srcdir) = .; \
--- 276,288 ----
  	then srcdir=.; \
  	else srcdir=`cd $(srcdir); pwd`/$@; \
  	fi; \
+ 	case $(do) in depend|distfiles) d='';; *) d="-f $$srcdir/Makefile.dep";; esac; \
  	echo Making $(do) in $@; \
  	test -d $@ || mkdir $@; \
  	cd $@; \
  	$(MAKE) $(MDEFINES) srcdir=$$srcdir VPATH=$$srcdir \
  		-f $$srcdir/../Makefile.comm -f $$srcdir/Makefile.sub \
! 	        -f $$srcdir/../Makefile.ccpg $$d $(do)
  
  $(DEVDIRS): FORCE
  	@if test $(srcdir) = .; \

Newsgroups: gnu.groff.bug