# Ad-hoc Makefile for replacing/adding modules from Maintenance Tape Vol. 3
#  to libc.
# Necessary only because Sequent has not updated the source copies.
#
# This Makefile supersedes the similar Makefile for Vol. 2 (i.e., the latter
#  should not be applied).
#
# Where Vol. 2 versions are mentioned below, note that the Vol. 2 installation
#  script patched libc.a only, not libc_p.a, libfpac.a, or libfpac_p.a.
#
# Bruce Jerrick, OGI CS&E.

# Basenames of libraries to modify:
LIBS	= \
	libcrypt \
	libcrypt_p \
	libfpacrypt \
	libfpacrypt_p

# New modules have been extracted from the four libc variants on
#  Maintenance Tape Vol. 3 and are now in ./lib* subdirectories.
# Note that the Vol. 3 libraries are non-encryption; only crypt.o is
#  affected though.
# The subdirectories in . holding the new modules have *crypt* names,
#  to correspond to the names of libraries as built by ../Makfile .

# Modules to be added:
# (Note: Identical to Maint. Tape Vol. 2 versions.)
ADD	= affinitypid.o shfork.o shvfork.o

# Modules to be replaced:
# (Note: Different from the Maint. Tape Vol. 2 version.)
REPLACE	= gethostent.o

all:
	@echo "Do one of:"
	@echo "    'make copy' (to get libs from ..)"
	@echo " or"
	@echo "    'make copy_installed' (to get libs from /lib and /usr/lib)."
	@echo "Then do 'make modify' (new versions will remain in cwd)."
	@echo "See ../Makefile.quickinstall for installation."

copy:
	cp -p ../libcrypt.a .
	cp -p ../libcrypt_p.a .
	cp -p ../libfpacrypt.a .
	cp -p ../libfpacrypt_p.a .

copy_installed:
	cp -p /lib/libc.a libcrypt.a
	cp -p /usr/lib/libc_p.a libcrypt_p.a
	cp -p /usr/lib/libfpac.a libfpacrypt.a
	cp -p /usr/lib/libfpac_p.a libfpacrypt_p.a

modify:
	@for lib in ${LIBS}; do \
	    for i in ${REPLACE}; do \
		echo -n "$${lib}.a: "; ar rv $${lib}.a $$lib/$$i; \
	    done; \
	    for i in ${ADD}; do \
		echo -n "$${lib}.a: "; ar rv $${lib}.a $$lib/$$i; \
	    done; \
	done
