Annotation of src/share/mk/bsd.man.mk, Revision 1.42
1.42 ! espie 1: # $OpenBSD: bsd.man.mk,v 1.41 2015/01/16 01:58:17 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:
1.42 ! espie 40: # XXX not really a phony target, but force installation each time
! 41: # maninstall is run.
1.38 schwarze 42: .PHONY: ${_MAN_INST}
1.33 schwarze 43: . endfor
1.25 espie 44: .endfor
45:
1.37 schwarze 46: # Install the manual hardlinks, if any.
1.33 schwarze 47: maninstall:
1.1 deraadt 48: .if defined(MLINKS) && !empty(MLINKS)
1.23 espie 49: . for sub in ${MANSUBDIR}
50: . for lnk file in ${MLINKS}
1.35 schwarze 51: @l=${DESTDIR}${MANDIR}${lnk:E}${sub}${lnk}; \
52: t=${DESTDIR}${MANDIR}${file:E}${sub}${file}; \
1.23 espie 53: echo $$t -\> $$l; \
54: rm -f $$t; ln $$l $$t;
55: . endfor
1.18 espie 56: . endfor
1.1 deraadt 57: .endif
58:
1.37 schwarze 59: # Explicitly list ${BEFOREMAN} to get it done even if ${MAN} is empty.
1.41 schwarze 60: all: ${BEFOREMAN} ${MAN}
61:
62: manlint: ${MAN}
63: .if defined(MAN) && !empty(MAN)
64: mandoc -Tlint ${.ALLSRC}
65: .endif
66:
67: .PHONY: manlint