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