1# $OpenBSD: bsd.man.mk,v 1.41 2015/01/16 01:58:17 schwarze Exp $ 2# $NetBSD: bsd.man.mk,v 1.23 1996/02/10 07:49:33 jtc Exp $ 3# @(#)bsd.man.mk 5.2 (Berkeley) 5/11/90 4 5.if !target(.MAIN) 6. if exists(${.CURDIR}/../Makefile.inc) 7. include "${.CURDIR}/../Makefile.inc" 8. endif 9 10.MAIN: all 11.endif 12 13BEFOREMAN?= 14 15# Add / so that we don't have to specify it. 16.if defined(MANSUBDIR) && !empty(MANSUBDIR) 17MANSUBDIR:=${MANSUBDIR:S,^,/,:S,$,/,} 18.else 19MANSUBDIR=/ 20.endif 21 22# Files contained in ${BEFOREMAN} must be built before generating any 23# manual page source code. 24.for page in ${MAN} 25. if target(${page}) 26${page}: ${BEFOREMAN} 27. endif 28.endfor 29 30# Install the real manuals. 31.for page in ${MAN} 32. for sub in ${MANSUBDIR} 33_MAN_INST=${DESTDIR}${MANDIR}${page:E}${sub}${page:T} 34${_MAN_INST}: ${page} 35 ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ 36 ${.ALLSRC} ${.TARGET} 37 38maninstall: ${_MAN_INST} 39 40.PHONY: ${_MAN_INST} 41. endfor 42.endfor 43 44# Install the manual hardlinks, if any. 45maninstall: 46.if defined(MLINKS) && !empty(MLINKS) 47. for sub in ${MANSUBDIR} 48. for lnk file in ${MLINKS} 49 @l=${DESTDIR}${MANDIR}${lnk:E}${sub}${lnk}; \ 50 t=${DESTDIR}${MANDIR}${file:E}${sub}${file}; \ 51 echo $$t -\> $$l; \ 52 rm -f $$t; ln $$l $$t; 53. endfor 54. endfor 55.endif 56 57# Explicitly list ${BEFOREMAN} to get it done even if ${MAN} is empty. 58all: ${BEFOREMAN} ${MAN} 59 60manlint: ${MAN} 61.if defined(MAN) && !empty(MAN) 62 mandoc -Tlint ${.ALLSRC} 63.endif 64 65.PHONY: manlint 66