# 
# Mach Operating System
# Copyright (c) 1992 Carnegie Mellon University
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 
# CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
# 
# Carnegie Mellon requests users of this software to return to
# 
#  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
#  School of Computer Science
#  Carnegie Mellon University
#  Pittsburgh PA 15213-3890
# 
# any improvements or extensions that they make and grant Carnegie the
# rights to redistribute these changes.
# 
#
# HISTORY
# $Log:	Makefile-man,v $
# Revision 2.2  92/03/05  23:16:06  rpd
# 	Created.
# 	[92/02/29            rpd]
# 

# Makefile-man is intended for installing man pages.
# Makefiles using it should look like
#
#	include ${MAKETOP}Makefile-common
#
#	MAN1PAGES = foo ...
#	MAN2PAGES = bar ...
#	MAN3PAGES = baz ...
#
#	include ${MAKETOP}Makefile-man
#	-include Makedep
#
# The sources are foo.man, bar.man, baz.man, etc.
# and they are installed in man/man1/foo.1, man/man2/foo.2,
# man/man3/baz.3, etc.
#
# Makefile-man will work in conjunction with Makefile-bin and Makefile-lib.

MAN1SRC = ${MAN1PAGES/.*/&.man}
MAN2SRC = ${MAN2PAGES/.*/&.man}
MAN3SRC = ${MAN3PAGES/.*/&.man}
MANSRC = ${MAN1SRC} ${MAN2SRC} ${MAN3SRC}

IMAN1TARGET = ${MAN1PAGES;.*;${INSTALLDIR}/man/man1/&.1}
IMAN2TARGET = ${MAN2PAGES;.*;${INSTALLDIR}/man/man2/&.2}
IMAN3TARGET = ${MAN3PAGES;.*;${INSTALLDIR}/man/man3/&.3}
IMANTARGET = ${IMAN1TARGET} ${IMAN2TARGET} ${IMAN3TARGET}

TMAN1TARGET = ${MAN1PAGES;.*;${TRELEASEDIR}/man/man1/&.1}
TMAN2TARGET = ${MAN2PAGES;.*;${TRELEASEDIR}/man/man2/&.2}
TMAN3TARGET = ${MAN3PAGES;.*;${TRELEASEDIR}/man/man3/&.3}
TMANTARGET = ${TMAN1TARGET} ${TMAN2TARGET} ${TMAN3TARGET}

# Top-level targets:
# If the Makefile wants to do more stuff, it can also have its own
# all/install/release/clean rules.

all :: ${MANSRC}

install :: ${IMANTARGET}

release :: ${TMANTARGET}

clean ::
	${RM} ${IMANTARGET}

# installation rules

${IMAN1TARGET} : $${@;.*/man/man1/(.*)\.1;\1.man}
	${RM} $@
	${CP} $? $@
	${CHMOD_MAN} $@

${IMAN2TARGET} : $${@;.*/man/man2/(.*)\.2;\1.man}
	${RM} $@
	${CP} $? $@
	${CHMOD_MAN} $@

${IMAN3TARGET} : $${@;.*/man/man3/(.*)\.3;\1.man}
	${RM} $@
	${CP} $? $@
	${CHMOD_MAN} $@

# release rules

${TMAN1TARGET} : $${@;.*/(man/man1/.*\.1);${FRELEASEDIR}/\1}
	${RM} $@
	${CP} $? $@

${TMAN2TARGET} : $${@;.*/(man/man2/.*\.2);${FRELEASEDIR}/\1}
	${RM} $@
	${CP} $? $@

${TMAN3TARGET} : $${@;.*/(man/man3/.*\.3);${FRELEASEDIR}/\1}
	${RM} $@
	${CP} $? $@
