Subject: Top level make problems (and others) + fixes (2 of 11 - #107)
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 (#107) and the following patches (108,109,110,111,
	112,113,114,115, and 116).  "ps.c" is updated to correct a
	typo (wrong size was used in a 'strncpy').  In 'sh' a redundant
	macro definition is removed from a .h file.

	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/bin/Makefile.old	Thu May  3 10:27:01 1990
--- /usr/src/bin/Makefile	Mon Jan 18 08:45:15 1993
***************
*** 57,63 ****
  ${STD} ${SETUID} ${OPERATOR} ${TTY}:
  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ $@.c
  
! install:
  	install -s -m 751 -g staff ${STD} ${NSTD} ${DESTDIR}/bin
  	-for i in ${SUBDIR}; do \
  		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
--- 57,63 ----
  ${STD} ${SETUID} ${OPERATOR} ${TTY}:
  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ $@.c
  
! install: ${BINS}
  	install -s -m 751 -g staff ${STD} ${NSTD} ${DESTDIR}/bin
  	-for i in ${SUBDIR}; do \
  		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
*** /usr/src/bin/adb/Makefile.old	Sat Aug  1 16:21:20 1987
--- /usr/src/bin/adb/Makefile	Mon Jan 18 08:45:16 1993
***************
*** 22,28 ****
  		-Z ${OV1} -Z ${OV2} -Z ${OV3} -Y ${BASE} -lc; \
  	fi
  
! install:
  	install -s adb ${DESTDIR}/bin
  
  clean:
--- 22,28 ----
  		-Z ${OV1} -Z ${OV2} -Z ${OV3} -Y ${BASE} -lc; \
  	fi
  
! install: adb
  	install -s adb ${DESTDIR}/bin
  
  clean:
*** /usr/src/bin/as/Makefile.old	Sun Dec 24 02:06:24 1989
--- /usr/src/bin/as/Makefile	Mon Jan 18 08:45:17 1993
***************
*** 18,24 ****
  	${AS} ${ASFLAGS} -o as2.o as2?.s
  	ld ${SEPFLAG} -o $@ as2.o -lc
  
! install:
  	install -s as ${DESTDIR}/bin
  	install -s as2 ${DESTDIR}/lib
  
--- 18,24 ----
  	${AS} ${ASFLAGS} -o as2.o as2?.s
  	ld ${SEPFLAG} -o $@ as2.o -lc
  
! install: all
  	install -s as ${DESTDIR}/bin
  	install -s as2 ${DESTDIR}/lib
  
*** /usr/src/bin/awk/Makefile.old	Wed Oct 12 20:15:02 1988
--- /usr/src/bin/awk/Makefile	Mon Jan 18 08:45:18 1993
***************
*** 26,32 ****
  		cp /usr/src/bin/awk/$$i .;
  	done
  
! install:
  	install -s awk ${DESTDIR}/bin
  
  profile:	awk.g.o $(FILES) mon.o
--- 26,32 ----
  		cp /usr/src/bin/awk/$$i .;
  	done
  
! install: awk
  	install -s awk ${DESTDIR}/bin
  
  profile:	awk.g.o $(FILES) mon.o
*** /usr/src/bin/chpass/Makefile.old	Thu May 10 22:24:22 1990
--- /usr/src/bin/chpass/Makefile	Mon Jan 18 08:45:19 1993
***************
*** 16,27 ****
  #
  #	@(#)Makefile	5.1 (Berkeley) 2/22/89
  #
! CFLAGS=	-I. -O -DUSHRT_MAX=0xffff
  SEPFLAG= -i
  LIBC=	/lib/libc.a
  SRCS=	chpass.c field.c util.c
  OBJS=	chpass.o field.o util.o
  MAN=	chpass.0
  
  all: chpass
  
--- 16,28 ----
  #
  #	@(#)Makefile	5.1 (Berkeley) 2/22/89
  #
! CFLAGS=	-I. -O
  SEPFLAG= -i
  LIBC=	/lib/libc.a
  SRCS=	chpass.c field.c util.c
  OBJS=	chpass.o field.o util.o
  MAN=	chpass.0
+ MANSRC=	chpass.1
  
  all: chpass
  
***************
*** 28,47 ****
  chpass: ${LIBC} ${OBJS}
  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS}
  
  clean:
! 	rm -f ${OBJS} core chpass
  
  cleandir: clean
! 	rm -f ${MAN} tags .depend
  
  depend: ${SRCS}
  	mkdep ${CFLAGS} ${SRCS}
  
! install: ${MAN}
! 	-install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
  	install -s -o root -g bin -m 4755 chpass ${DESTDIR}/bin/chpass
  	rm -f ${DESTDIR}/bin/chfn; ln ${DESTDIR}/bin/chpass ${DESTDIR}/bin/chfn
  	rm -f ${DESTDIR}/bin/chsh; ln ${DESTDIR}/bin/chpass ${DESTDIR}/bin/chsh
  	rm -f ${DESTDIR}/usr/man/cat1/chfn.0
  	rm -f ${DESTDIR}/usr/man/cat1/chsh.0
  	-ln ${DESTDIR}/usr/man/cat1/chpass.0 ${DESTDIR}/usr/man/cat1/chfn.0
--- 29,51 ----
  chpass: ${LIBC} ${OBJS}
  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS}
  
+ chpass.0: ${MANSRC}
+ 	/usr/man/manroff ${MANSRC} > ${MAN}
+ 
  clean:
! 	rm -f ${OBJS} ${MAN} core chpass
  
  cleandir: clean
! 	rm -f tags .depend
  
  depend: ${SRCS}
  	mkdep ${CFLAGS} ${SRCS}
  
! install: ${MAN} chpass
  	install -s -o root -g bin -m 4755 chpass ${DESTDIR}/bin/chpass
  	rm -f ${DESTDIR}/bin/chfn; ln ${DESTDIR}/bin/chpass ${DESTDIR}/bin/chfn
  	rm -f ${DESTDIR}/bin/chsh; ln ${DESTDIR}/bin/chpass ${DESTDIR}/bin/chsh
+ 	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
  	rm -f ${DESTDIR}/usr/man/cat1/chfn.0
  	rm -f ${DESTDIR}/usr/man/cat1/chsh.0
  	-ln ${DESTDIR}/usr/man/cat1/chpass.0 ${DESTDIR}/usr/man/cat1/chfn.0
*** /usr/src/bin/diff/Makefile.old	Sat Feb 14 03:08:30 1987
--- /usr/src/bin/diff/Makefile	Mon Jan 18 08:45:19 1993
***************
*** 22,27 ****
  clean:
  	rm -f diff diffh ${OBJS} diffh.o
  
! install:
  	install -s diff ${DESTDIR}/bin/diff
  	install -s diffh ${DESTDIR}/usr/lib/diffh
--- 22,27 ----
  clean:
  	rm -f diff diffh ${OBJS} diffh.o
  
! install: all
  	install -s diff ${DESTDIR}/bin/diff
  	install -s diffh ${DESTDIR}/usr/lib/diffh
*** /usr/src/bin/login/Makefile.old	Tue Sep 19 14:56:37 1989
--- /usr/src/bin/login/Makefile	Mon Jan 18 08:45:20 1993
***************
*** 37,43 ****
  depend: ${SRCS}
  	mkdep -p ${CFLAGS} ${SRCS}
  
! install:
  	install -s -o root -g bin -m 4755 login ${DESTDIR}/bin/login
  
  lint: ${SRCS}
--- 37,43 ----
  depend: ${SRCS}
  	mkdep -p ${CFLAGS} ${SRCS}
  
! install: login
  	install -s -o root -g bin -m 4755 login ${DESTDIR}/bin/login
  
  lint: ${SRCS}
*** /usr/src/bin/make/Makefile.old	Sat Aug 10 11:49:49 1991
--- /usr/src/bin/make/Makefile	Mon Jan 18 08:45:21 1993
***************
*** 27,33 ****
  clean:
  	-rm -f *.o gram.c make a.out errs x.c xs.c strings
  
! install:
  	install -s make ${DESTDIR}/bin/make
  
  lint :  dosys.c doname.c files.c main.c misc.c ident.c gram.c
--- 27,33 ----
  clean:
  	-rm -f *.o gram.c make a.out errs x.c xs.c strings
  
! install: make
  	install -s make ${DESTDIR}/bin/make
  
  lint :  dosys.c doname.c files.c main.c misc.c ident.c gram.c
*** /usr/src/bin/passwd/Makefile.old	Thu May 10 22:24:55 1990
--- /usr/src/bin/passwd/Makefile	Mon Jan 18 08:45:22 1993
***************
*** 22,27 ****
--- 22,28 ----
  SRCS=	passwd.c
  OBJS=	passwd.o
  MAN=	passwd.0
+ MANSRC=	passwd.1
  
  all: passwd
  
***************
*** 28,45 ****
  passwd: ${LIBC} ${OBJS}
  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS}
  
  clean:
! 	rm -f ${OBJS} core passwd
  
  cleandir: clean
! 	rm -f ${MAN} tags .depend
  
  depend: ${SRCS}
  	mkdep -p ${CFLAGS} ${SRCS}
  
! install: ${MAN}
  	install -s -o root -g bin -m 4755 passwd ${DESTDIR}/bin/passwd
! 	-install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
  
  lint: ${SRCS}
  	lint ${CFLAGS} ${SRCS}
--- 29,49 ----
  passwd: ${LIBC} ${OBJS}
  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS}
  
+ ${MAN}: ${MANSRC}
+ 	/usr/man/manroff ${MANSRC} > ${MAN}
+ 
  clean:
! 	rm -f ${OBJS} ${MAN} core passwd
  
  cleandir: clean
! 	rm -f tags .depend
  
  depend: ${SRCS}
  	mkdep -p ${CFLAGS} ${SRCS}
  
! install: ${MAN} passwd
  	install -s -o root -g bin -m 4755 passwd ${DESTDIR}/bin/passwd
! 	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
  
  lint: ${SRCS}
  	lint ${CFLAGS} ${SRCS}
*** /usr/src/bin/ps.c.old	Sun Jan  3 01:52:58 1993
--- /usr/src/bin/ps.c	Sun Jan 24 00:00:51 1993
***************
*** 496,502 ****
  	a->o_size = ctod(procp->p_dsize + procp->p_ssize + USIZE);
  	a->o_wchan = procp->p_wchan;
  	a->o_pgrp = procp->p_pgrp;
! 	strncpy(a->o_tty, tp, 8);
  	a->o_ttyd = tp[0] == '?' ?  -1 : up->u_ttyd;
  	a->o_stat = procp->p_stat;
  	a->o_flag = procp->p_flag;
--- 496,502 ----
  	a->o_size = ctod(procp->p_dsize + procp->p_ssize + USIZE);
  	a->o_wchan = procp->p_wchan;
  	a->o_pgrp = procp->p_pgrp;
! 	strncpy(a->o_tty, tp, sizeof (a->o_tty));
  	a->o_ttyd = tp[0] == '?' ?  -1 : up->u_ttyd;
  	a->o_stat = procp->p_stat;
  	a->o_flag = procp->p_flag;
*** /usr/src/bin/sh/Makefile.old	Mon Feb 16 00:55:49 1987
--- /usr/src/bin/sh/Makefile	Mon Jan 18 08:45:23 1993
***************
*** 28,34 ****
  sh:
  	cc ${SEPFLAG} -o sh *.o
  
! install:
  	install -s sh $(DESTDIR)/bin
  clean:
  	rm -f sh *.o
--- 28,34 ----
  sh:
  	cc ${SEPFLAG} -o sh *.o
  
! install: all
  	install -s sh $(DESTDIR)/bin
  clean:
  	rm -f sh *.o
*** /usr/src/bin/sh/mac.h.old	Fri Dec 24 18:44:31 1982
--- /usr/src/bin/sh/mac.h	Mon Jan 18 08:45:24 1993
***************
*** 59,63 ****
  #define RQ	'\''
  #define MINUS	'-'
  #define COLON	':'
- 
- #define MAX(a,b)	((a)>(b)?(a):(b))
--- 59,61 ----
