Annotation of src/share/mk/bsd.man.mk, Revision 1.38
1.38 ! schwarze 1: # $OpenBSD: bsd.man.mk,v 1.37 2011/07/06 04:10:27 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: MANLINT=${MAN:S/$/.manlint/}
15: CLEANFILES+=.man-linted ${MANLINT}
16:
1.35 schwarze 17: # Add / so that we don't have to specify it.
18: .if defined(MANSUBDIR) && !empty(MANSUBDIR)
19: MANSUBDIR:=${MANSUBDIR:S,^,/,:S,$,/,}
1.18 espie 20: .else
1.35 schwarze 21: MANSUBDIR=/
1.18 espie 22: .endif
23:
1.37 schwarze 24: # Files contained in ${BEFOREMAN} must be built before generating any
25: # manual page source code. However, static manual page files contained
26: # in the source tree must not appear as targets, or the ${.IMPSRC} in
27: # the .man.manlint suffix rule below will not find them in the .PATH.
28: .for page in ${MAN}
29: . if target(${page})
30: ${page}: ${BEFOREMAN}
31: . endif
32: .endfor
33:
34: # In any case, ${BEFOREMAN} must be finished before linting any manuals.
35: .if !empty(MANLINT)
36: ${MANLINT}: ${BEFOREMAN}
37: .endif
1.34 naddy 38:
1.37 schwarze 39: # Set up the suffix rules for checking manuals.
40: _MAN_SUFFIXES=1 2 3 3p 4 5 6 7 8 9
41: .for s in ${_MAN_SUFFIXES}
42: .SUFFIXES: .${s} .${s}.manlint
43: .${s}.${s}.manlint:
44: mandoc -Tlint -Wfatal ${.IMPSRC}
1.34 naddy 45: @touch ${.TARGET}
1.37 schwarze 46: .endfor
1.34 naddy 47:
1.37 schwarze 48: # Install the real manuals.
49: .for page in ${MAN}
1.33 schwarze 50: . for sub in ${MANSUBDIR}
1.35 schwarze 51: _MAN_INST=${DESTDIR}${MANDIR}${page:E}${sub}${page:T}
52: ${_MAN_INST}: ${page}
1.33 schwarze 53: ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
54: ${.ALLSRC} ${.TARGET}
55:
1.35 schwarze 56: maninstall: ${_MAN_INST}
1.38 ! schwarze 57:
! 58: .PHONY: ${_MAN_INST}
1.33 schwarze 59: . endfor
1.25 espie 60: .endfor
61:
1.37 schwarze 62: # Install the manual hardlinks, if any.
1.33 schwarze 63: maninstall:
1.1 deraadt 64: .if defined(MLINKS) && !empty(MLINKS)
1.23 espie 65: . for sub in ${MANSUBDIR}
66: . for lnk file in ${MLINKS}
1.35 schwarze 67: @l=${DESTDIR}${MANDIR}${lnk:E}${sub}${lnk}; \
68: t=${DESTDIR}${MANDIR}${file:E}${sub}${file}; \
1.23 espie 69: echo $$t -\> $$l; \
70: rm -f $$t; ln $$l $$t;
71: . endfor
1.18 espie 72: . endfor
1.1 deraadt 73: .endif
74:
1.37 schwarze 75: # Explicitly list ${BEFOREMAN} to get it done even if ${MAN} is empty.
76: all: ${BEFOREMAN} ${MAN} ${MANLINT}