Subject: Top level make problems (and others) + fixes (6 of 11 - #111)
Index:	src/*/{Makefile,.c} 2.11BSD

Description:
	The process of recompiling the complete system from sources
	does not completely succeed, there are programs not compiled,
	programs installed in the wrong place, files (objects, man pages,etc)
	which are not removed when a "make clean" is done, man pages
	not formatted, other man pages which are the wrong ones being
	installed, programs compiling with errors and so on and so forth.

	In short, most of the Makefiles and a number of sourcefiles
	in the system were in need of repair.

	Much of the credit (or blame ;-)) for the series of patches to
	follow is due to Paul Taylor (taylor@oswego.oswego.edu).  Takes
	a high amount of "patience" to do multiple top level 'make's
	on a pdp-11/73.  Thanks.

Repeat-By:
	cd /usr/src
	make all
	make install
	make clean

	After anywhere between 12 and 18 hours note the debris and errors
	left behind.

Fix:
	Apply this (#111) and the following patches (112,113,114,
	115, and 116).   Several of the programs in '/usr/src/local'
	have only recently been introduced to the system.  If any
	of these patches do not apply you might want to ftp earlier
	updates from the 2BSD archives.

	Some of the patches may not apply because the programs (notably
	in /usr/src/new and /usr/src/local) may not be present in the
	system (having been ported/added since the initial release of
	the system).  There was an earlier posting of these programs
	('popper', 'less', etc), if those articles are not present they
	may be obtained (along with these and previous patches) via 
	anonymous FTP to 'ftp.iipo.gtegsc.com' in the directory pub/2.11BSD.

	The patches have been grouped and split along directory boundaries.

	The contents are:

	#106	- script to remove some redundant man pages and rename
		  others to their correct resting place.

		  /usr/src/Makefile (top level makefile) patch.

		  NOTE: the choice of hostfile or nameserver is made
			only in lib/libc/Makefile now, not in both
			/usr/src/Makefile and lib/libc/Makefile

	#107	- /usr/src/bin updates.  There are two source (.c and
		  .h) updates as well as the Makefile patches.

	#108	- /usr/src/etc updates.  Several source patches are
		  included.

	#109	- /usr/src/games updates.  A couple of .c files are
		  also updated to remove compile time warnings.  NOTE:
		  before doing a top level make you will have to
		  configure 'warp' and do a 'make depend'.

	#110	- /usr/src/lib updates.  Only Makefiles are updated.

	#111	- /usr/src/local updates.  Only Makefile are updated but
		  some of the directories/programs may not exist on all
		  systems.

	#112	- /usr/src/man updates.  One man page (last.1) is updated
		  along with the Makefiles.

	#113	- /usr/src/new updates.  Some programs may not exist
		  ('tcsh') on all systems (but are available via ftp).
		  Other programs (rn, etc) may require some attention
		  if the patches do not apply cleanly.

	#114	- /usr/src/ucb updates.  The 'last' command is updated to
		  handle alternate wtmp files.  A couple other .h or .c
		  files are updated to remove compile time warning errors.

	#115	- /usr/src/usr.bin updates.  The 'struct' and 'tbl' program
		  sources receive numerous updates to remove compile time 
		  errors.  The remaining updates apply to the Makefiles.

	#116	- /usr/src/usr.lib updates.  Makefiles are fixed.
========================================================================
*** /usr/src/local/Makefile.old	Fri Jul 12 06:02:45 1991
--- /usr/src/local/Makefile	Mon Jan 25 19:49:57 1993
***************
*** 5,16 ****
  
  # Programs that live in subdirectories, and have makefiles of their own.
  #
! SUBDIR=	afio mkovmake
  
  # C programs that live in the current directory and do not need
  # explicit make lines.
  #
! STD= trace decompr16
  
  # C programs that live in the current directory and need explicit make lines.
  #
--- 5,16 ----
  
  # Programs that live in subdirectories, and have makefiles of their own.
  #
! SUBDIR= afio cxref ddd less mkovmake mtools popper welcome zmodem
  
  # C programs that live in the current directory and do not need
  # explicit make lines.
  #
! STD= decompr16 trace 
  
  # C programs that live in the current directory and need explicit make lines.
  #
***************
*** 20,25 ****
--- 20,28 ----
  #
  SHELL= none
  
+ # Manpage directory
+ MANDIR= ${DESTDIR}/usr/local/man
+ 
  all:	${SUBDIR} ${STD} ${NSTD}
  
  ${SUBDIR}: FRC
***************
*** 32,38 ****
  
  # Files listed in ${NSTD} have explicit make lines given below.
  
! install: ${SUBDIR} ${STD} ${NSTD}
  	-for i in ${SUBDIR}; do \
  		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
  	-for i in ${STD} ${NSTD}; do \
--- 35,45 ----
  
  # Files listed in ${NSTD} have explicit make lines given below.
  
! install: ${STD} ${NSTD}
! 	-mkdir ${MANDIR}
! 	-chmod a+r ${MANDIR}
! 	-for i in 1 2 3 4 5 6 7 8; do \
! 		(mkdir ${MANDIR}/cat$$i; chmod a+r ${MANDIR}/cat$$i); done
  	-for i in ${SUBDIR}; do \
  		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
  	-for i in ${STD} ${NSTD}; do \
***************
*** 39,46 ****
  		(install $$i ${DESTDIR}/usr/local/$$i); done
  	-chmod 2755 ${DESTDIR}/usr/local/trace
  	-chgrp kmem ${DESTDIR}/usr/local/trace
! 	-for i in ${SHELL}; do \
! 		(install -c -m 755 $$i.sh ${DESTDIR}/usr/local/$$i); done
  
  clean:
  	rm -f a.out core *.s *.o
--- 46,54 ----
  		(install $$i ${DESTDIR}/usr/local/$$i); done
  	-chmod 2755 ${DESTDIR}/usr/local/trace
  	-chgrp kmem ${DESTDIR}/usr/local/trace
! #	-for i in ${SHELL}; do \
! #		(install -c -m 755 $$i.sh ${DESTDIR}/usr/local/$$i); done
! 	-sh /usr/src/usr.lib/makewhatis.sh ${MANDIR}
  
  clean:
  	rm -f a.out core *.s *.o
*** /usr/src/local/afio/Makefile.old	Thu Sep 21 10:15:32 1989
--- /usr/src/local/afio/Makefile	Fri Jan 22 21:41:44 1993
***************
*** 24,37 ****
  CFLAGS	= $1 $2 $3 $4 $5 $6 $7 -O
  
  
! all:		afio afio.1
  
! afio:		afio.o
  	$(CC) -i $(CFLAGS) -o afio afio.o
  
! install:	all
! 	@echo copy afio and afio.1 into the appropriate directories.
! 	install -s -c -m 0751 afio /usr/local/afio
  
  clean:
! 	rm -f *.o afio
--- 24,41 ----
  CFLAGS	= $1 $2 $3 $4 $5 $6 $7 -O
  
  
! all: afio afio.0
  
! afio: afio.o
  	$(CC) -i $(CFLAGS) -o afio afio.o
  
! install: all
! 	install -s -c -m 0751 afio ${DESTDIR}/usr/local/afio
! 	install -c -m 444 -o bin -g bin afio.0 ${DESTDIR}/usr/local/man/cat1
  
+ afio.0:	afio.1
+ 	rm -f afio.0
+ 	/usr/man/manroff afio.1 > afio.0
+ 
  clean:
! 	rm -f *.o afio afio.0
*** /usr/src/local/cxref/makefile.old	Tue Nov  5 11:06:55 1991
--- /usr/src/local/cxref/makefile	Mon Jan 25 22:40:29 1993
***************
*** 29,45 ****
  
  ### system dependant definitions, change when you install cxref
  
! # for my use during development, put in my bin, but see next few lines.
! # DESTDIR= $(BIN)
! # LIB= $(BIN)
! 
! # when installing, use the lines below; change DESTDIR to local bin of choice.
! DESTDIR=/usr/local
  LIB=/usr/local/lib/cxref
  
- # where to put the man page, use 1 instead of l if you don't have a manl.
- MANSEC=l
- 
  # lex library, may be -lln on some systems
  LEXLIB= -ll
  
--- 29,37 ----
  
  ### system dependant definitions, change when you install cxref
  
! BIN=${DESTDIR}/usr/local
  LIB=/usr/local/lib/cxref
  
  # lex library, may be -lln on some systems
  LEXLIB= -ll
  
***************
*** 49,60 ****
  # printer program, prt is for me, use pr on other systems
  P=pr
  
! # the owner and group of the installed program.  Both are 'admin' on our
! # system, but they may different on yours.
! OWNER= admin
! GROUP= admin
! 
! all: $(PROGS)
  	@echo "	all" done
  
  docxref: $(SCANOBJS)
--- 41,47 ----
  # printer program, prt is for me, use pr on other systems
  P=pr
  
! all: $(PROGS) cxref.0
  	@echo "	all" done
  
  docxref: $(SCANOBJS)
***************
*** 81,103 ****
  
  ### edit this before installing!!
  
! install: $(PROGS)
  # don't remove my bin!
! #	rm -fr $(LIB)
! 	rm -f $(DESTDIR)/cxref
! #	mkdir $(LIB)
! 	install -s $(CXREF) $(DESTDIR)/$(CXREF)
  	install -s docxref  $(LIB)/docxref
  	install -s fmtxref  $(LIB)/fmtxref
  	install -s cxrfilt $(LIB)/cxrfilt
! 	install -m 444 -c cxref.1 /usr/man/man$(MANSEC)/cxref.$(MANSEC)
! #	cd $(DESTDIR); chmod 711 cxref; chown $(OWNER) cxref; chgrp $(GROUP) cxref
! #	cd $(LIB); chmod 711 docxref fmtxref cxrfilt
! #	cd $(LIB); chown $(OWNER) docxref fmtxref cxrfilt
! #	cd $(LIB); chgrp $(GROUP) docxref fmtxref cxrfilt
  
  clean:
! 	rm -f $(SCANOBJS)
  
  clobber: clean
  	rm -f $(PROGS) print2
--- 68,88 ----
  
  ### edit this before installing!!
  
! install: $(PROGS) cxref.0
  # don't remove my bin!
! 	rm -f ${BIN}/cxref
! 	-mkdir $(LIB)
! 	install -s $(CXREF) ${BIN}/$(CXREF)
  	install -s docxref  $(LIB)/docxref
  	install -s fmtxref  $(LIB)/fmtxref
  	install -s cxrfilt $(LIB)/cxrfilt
! 	install -m 444 -c cxref.0 /usr/local/man/cat1/cxref.0
  
+ cxref.0:	cxref.1
+ 	/usr/man/manroff cxref.1 > cxref.0
+ 
  clean:
! 	rm -f $(SCANOBJS) cxref.0
  
  clobber: clean
  	rm -f $(PROGS) print2
*** /usr/src/local/ddd/Makefile.old	Mon Nov 19 15:09:16 1990
--- /usr/src/local/ddd/Makefile	Mon Jan 25 21:56:08 1993
***************
*** 5,12 ****
  
  CC = cc
  LINT = lint
! CP = cp
! RM = /bin/rm -f
  
  SRC = ddd.c
  OBJ = ddd.o
--- 5,12 ----
  
  CC = cc
  LINT = lint
! CP = install -s -m 755 
! RM = rm -f
  
  SRC = ddd.c
  OBJ = ddd.o
***************
*** 14,26 ****
  BIN = ddd
  SHAR = ddd.shar
  
! BINDIR = /usr/local/bin
  
! MAN = ddd.1
! MANDIR = /usr/local/man
  
! all: $(BIN) lint
! 	touch all
  
  $(BIN): $(OBJ) $(HEAD) Makefile
  	$(CC) -i $(OBJ) -o $(BIN)
--- 14,26 ----
  BIN = ddd
  SHAR = ddd.shar
  
! BINDIR = /usr/local
  
! MANSRC = ddd.1
! MAN = ddd.0
! MANDIR = /usr/local/man/cat1
  
! all: $(BIN) $(MAN)
  
  $(BIN): $(OBJ) $(HEAD) Makefile
  	$(CC) -i $(OBJ) -o $(BIN)
***************
*** 30,41 ****
  	touch lint
  
  install: all
! 	strip $(BIN)
! 	$(CP) $(BIN) $(BINDIR)
! 	$(CP) $(MAN) $(MANDIR)
  
  clean:
! 	-$(RM) $(BIN) $(OBJ) all lint a.out core *~ #* $(SHAR)
  
  shar: lint README $(MAN) Makefile $(HEAD $(SRC)
  	shar README $(MAN) Makefile $(HEAD) $(SRC) > $(SHAR)
--- 30,43 ----
  	touch lint
  
  install: all
! 	$(CP) $(BIN) ${DESTDIR}$(BINDIR)
! 	install -m 444 -o bin -g bin $(MAN) ${DESTDIR}$(MANDIR)
  
+ $(MAN): $(MANSRC)
+ 	/usr/man/manroff $(MANSRC) > $(MAN)
+ 
  clean:
! 	-$(RM) $(BIN) $(OBJ) all lint a.out core *~ #* $(SHAR) $(MAN)
  
  shar: lint README $(MAN) Makefile $(HEAD $(SRC)
  	shar README $(MAN) Makefile $(HEAD) $(SRC) > $(SHAR)
*** /usr/src/local/mkovmake/Makefile.old	Mon Jul  2 12:24:30 1990
--- /usr/src/local/mkovmake/Makefile	Fri Jan 22 21:42:44 1993
***************
*** 2,7 ****
--- 2,8 ----
  SEPFLAG= -i
  SRCS=	mkovmake.c
  OBJS=	mkovmake.o
+ MANSRC=	mkovmake.1
  MAN=	mkovmake.0
  
  all: mkovmake
***************
*** 10,20 ****
  	${CC} ${SEPFLAG} -o $@ ${CFLAGS} ${OBJS}
  
  clean:
! 	rm -f ${OBJS} core mkovmake
  
! install: all
  	install -s -o bin -g bin -m 755 mkovmake ${DESTDIR}/usr/local
! 	-install -c -o bin -g bin -m 444 mkovmake.0 ${DESTDIR}/usr/local/man/cat1
  
  lint: ${SRCS}
  	lint ${CFLAGS} ${SRCS}
--- 11,25 ----
  	${CC} ${SEPFLAG} -o $@ ${CFLAGS} ${OBJS}
  
  clean:
! 	rm -f ${OBJS} core mkovmake ${MAN}
  
! install: all ${MAN}
  	install -s -o bin -g bin -m 755 mkovmake ${DESTDIR}/usr/local
! 	install -m 444 -o bin -g bin ${MAN} ${DESTDIR}/usr/local/man/cat1
! 
! ${MAN}: ${MANSRC}
! 	rm -f ${MAN}
! 	/usr/man/manroff ${MANSRC} > ${MAN}
  
  lint: ${SRCS}
  	lint ${CFLAGS} ${SRCS}
*** /usr/src/local/mtools/Makefile.old	Sat Jun 27 01:51:31 1992
--- /usr/src/local/mtools/Makefile	Fri Jan 22 21:43:03 1993
***************
*** 10,16 ****
  LINT	= lint
  SHLIB	= 
  SHAR	= shar -a
! BINDIR	= /usr/local/mtools
  MANDIR	= /usr/local/man/cat1
  #
  # for AT&T Unix PC 7300/3b1 style shared libraries.
--- 10,16 ----
  LINT	= lint
  SHLIB	= 
  SHAR	= shar -a
! BINDIR	= /usr/local
  MANDIR	= /usr/local/man/cat1
  #
  # for AT&T Unix PC 7300/3b1 style shared libraries.
***************
*** 128,136 ****
  mwrite.0: Mwrite.1
  	 nroff -man Mwrite.1  >  mwrite.0
  
! install:
! 	install -c -s -m 755 -o bin $(PROGS) $(BINDIR)
! 	install -c -m 444 *.0 $(MANDIR)
  
  clean:
  	rm -f $(PROGS) *.0 *.o
--- 128,136 ----
  mwrite.0: Mwrite.1
  	 nroff -man Mwrite.1  >  mwrite.0
  
! install: $(PROGS) $(MANPAGES)
! 	install -s -m 755 -o bin $(PROGS) ${DESTDIR}$(BINDIR)
! 	install -c -m 444 -o bin -g bin *.0 ${DESTDIR}$(MANDIR)
  
  clean:
  	rm -f $(PROGS) *.0 *.o
*** /usr/src/local/popper/Makefile.old	Wed Jun 24 16:36:46 1992
--- /usr/src/local/popper/Makefile	Fri Jan 29 21:11:22 1993
***************
*** 1,5 ****
--- 1,7 ----
  #@(#)@(#)Makefile	2.5  2.5 4/3/91
  
+ DESTDIR		=
+ 
  CSRCS		=	pop_dele.c pop_dropcopy.c pop_dropinfo.c \
  			pop_get_command.c pop_get_subcommand.c pop_init.c \
  			pop_last.c pop_list.c pop_log.c pop_lower.c \
***************
*** 44,56 ****
  
  TAR		=	${TARGET}.tar
  
! INSTALLDIR	=	/usr/etc
  
  MANPAGE		=	popper.8
  
  CATPAGE		=	popper.0
  
! MANDIR		=	/usr/local/man/cat8
  
  
  
--- 46,58 ----
  
  TAR		=	${TARGET}.tar
  
! INSTALLDIR	=	${DESTDIR}/usr/local
  
  MANPAGE		=	popper.8
  
  CATPAGE		=	popper.0
  
! MANDIR		=	${DESTDIR}/usr/local/man/cat8
  
  
  
***************
*** 70,79 ****
  	mv xae ${TAR}.Z.uuencoded.xae
  
  clean:
! 	rm -f core *.o *.Z*
! 	${SCCS} clean
  
! install: ${TARGET}
  	install -c -m 700 -o root -g staff ${TARGET} ${INSTALLDIR}
  
  installman:
--- 72,80 ----
  	mv xae ${TAR}.Z.uuencoded.xae
  
  clean:
! 	rm -f core *.o *.Z* ${CATPAGE}
  
! install: ${TARGET} installman
  	install -c -m 700 -o root -g staff ${TARGET} ${INSTALLDIR}
  
  installman:
*** /usr/src/local/zmodem/Makefile.old	Fri Jun  5 14:01:49 1992
--- /usr/src/local/zmodem/Makefile	Fri Jan 22 21:44:42 1993
***************
*** 1,36 ****
  # Driver makefile for zmodem.  Calls makefile.generic.
  
  PREFIX = 
! MANSUFF = l
  DESTBIN = $(PREFIX)/usr/local
! DESTMAN = $(PREFIX)/usr/man/man$(MANSUFF)
  
  INSTALL = /usr/bin/install
  
  OBJ = sz rz
  
! all:
! 	make -f makefile.generic bsd
  
! install: all
  	for f in $(OBJ); do\
! 	    $(INSTALL) -c -m 755 $$f $(DESTBIN); \
! 	    $(INSTALL) -c -m 644 ./$$f.1 $(DESTMAN)/$$f.$(MANSUFF); \
  	done
! 	rm -f $(DESTBIN)/sb $(DESTBIN)/sx
! 	ln $(DESTBIN)/sz $(DESTBIN)/sb
! 	ln $(DESTBIN)/sz $(DESTBIN)/sx
! 	rm -f $(DESTBIN)/rb $(DESTBIN)/rx
! 	ln $(DESTBIN)/rz $(DESTBIN)/rb
! 	ln $(DESTBIN)/rz $(DESTBIN)/rx
! 	rm -f $(DESTMAN)/sb.$(MANSUFF) $(DESTMAN)/sx.$(MANSUFF)
! 	ln $(DESTMAN)/sz.$(MANSUFF) $(DESTMAN)/sb.$(MANSUFF)
! 	ln $(DESTMAN)/sz.$(MANSUFF) $(DESTMAN)/sx.$(MANSUFF)
! 	rm -f $(DESTMAN)/rb.$(MANSUFF) $(DESTMAN)/rx.$(MANSUFF)
! 	ln $(DESTMAN)/rz.$(MANSUFF) $(DESTMAN)/rb.$(MANSUFF)
! 	ln $(DESTMAN)/rz.$(MANSUFF) $(DESTMAN)/rx.$(MANSUFF)
  
  clean:
  	rm -f $(OBJ)
! 	rm -f sb sx rb rx
  	rm -f *.o
--- 1,52 ----
  # Driver makefile for zmodem.  Calls makefile.generic.
  
  PREFIX = 
! CC=cc
! OFLAG=-O
! MANSUFF = 1
! CATSUFF = 0
! ROFF  = /usr/man/manroff
  DESTBIN = $(PREFIX)/usr/local
! DESTMAN = $(PREFIX)/usr/local/man/cat$(MANSUFF)
  
  INSTALL = /usr/bin/install
  
  OBJ = sz rz
  
! all: $(OBJ)
  
! sz:
! 	$(CC) $(CFLAGS) $(OFLAG) -DV7 -DTXBSIZE=8192 -DNFGVMIN sz.c -o sz
! 	size sz
! 
! rz:
! 	$(CC) $(CFLAGS) $(OFLAG) -DMD=2 -Dstrchr=index -DV7 rz.c -o rz
! 	size rz
! 
! install: $(OBJ)
  	for f in $(OBJ); do\
! 	    $(INSTALL) -c -m 755 $$f ${DESTDIR}$(DESTBIN); \
! 	    rm -f ${DESTDIR}$(DESTMAN)/$$f.$(CATSUFF); \
! 	    $(ROFF) ./$$f.1 >  ${DESTDIR}$(DESTMAN)/$$f.$(CATSUFF); \
! 	    chmod 444 ${DESTDIR}$(DESTMAN)/$$f.$(CATSUFF); \
! 	    chown bin.bin ${DESTDIR}$(DESTMAN)/$$f.$(CATSUFF); \
! 
  	done
! 	rm -f ${DESTDIR}$(DESTBIN)/sb ${DESTDIR}$(DESTBIN)/sx
! 	ln ${DESTDIR}$(DESTBIN)/sz ${DESTDIR}$(DESTBIN)/sb
! 	ln ${DESTDIR}$(DESTBIN)/sz ${DESTDIR}$(DESTBIN)/sx
! 	rm -f ${DESTDIR}$(DESTBIN)/rb ${DESTDIR}$(DESTBIN)/rx
! 	ln ${DESTDIR}$(DESTBIN)/rz ${DESTDIR}$(DESTBIN)/rb
! 	ln ${DESTDIR}$(DESTBIN)/rz ${DESTDIR}$(DESTBIN)/rx
  
+ 	rm -f ${DESTDIR}$(DESTMAN)/sb.$(CATSUFF) ${DESTDIR}$(DESTMAN)/sx.$(CATSUFF)
+ 	ln ${DESTDIR}$(DESTMAN)/sz.$(CATSUFF) ${DESTDIR}$(DESTMAN)/sb.$(CATSUFF)
+ 	ln ${DESTDIR}$(DESTMAN)/sz.$(CATSUFF) ${DESTDIR}$(DESTMAN)/sx.$(CATSUFF)
+ 	rm -f ${DESTDIR}$(DESTMAN)/rb.$(CATSUFF) ${DESTDIR}$(DESTMAN)/rx.$(CATSUFF)
+ 	ln ${DESTDIR}$(DESTMAN)/rz.$(CATSUFF) ${DESTDIR}$(DESTMAN)/rb.$(CATSUFF)
+ 	ln ${DESTDIR}$(DESTMAN)/rz.$(CATSUFF) ${DESTDIR}$(DESTMAN)/rx.$(CATSUFF)
+ 
  clean:
  	rm -f $(OBJ)
! 	rm -f sb sx rb rx rz sz
  	rm -f *.o
