[BACK]Return to bsd.man.mk CVS log [TXT][DIR] Up to [local] / src / share / mk

Annotation of src/share/mk/bsd.man.mk, Revision 1.39

1.39    ! nicm        1: #      $OpenBSD: bsd.man.mk,v 1.38 2011/07/06 20:40:32 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:
1.39    ! nicm       44: .if ${WARNINGS:L} == "yes"
        !            45:        mandoc -Tlint ${.IMPSRC} || [ $$? -lt 4 ]
        !            46: .else
1.37      schwarze   47:        mandoc -Tlint -Wfatal ${.IMPSRC}
1.39    ! nicm       48: .endif
1.34      naddy      49:        @touch ${.TARGET}
1.37      schwarze   50: .endfor
1.34      naddy      51:
1.37      schwarze   52: # Install the real manuals.
                     53: .for page in ${MAN}
1.33      schwarze   54: .  for sub in ${MANSUBDIR}
1.35      schwarze   55: _MAN_INST=${DESTDIR}${MANDIR}${page:E}${sub}${page:T}
                     56: ${_MAN_INST}: ${page}
1.33      schwarze   57:        ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
                     58:                ${.ALLSRC} ${.TARGET}
                     59:
1.35      schwarze   60: maninstall: ${_MAN_INST}
1.38      schwarze   61:
                     62: .PHONY: ${_MAN_INST}
1.33      schwarze   63: .  endfor
1.25      espie      64: .endfor
                     65:
1.37      schwarze   66: # Install the manual hardlinks, if any.
1.33      schwarze   67: maninstall:
1.1       deraadt    68: .if defined(MLINKS) && !empty(MLINKS)
1.23      espie      69: .  for sub in ${MANSUBDIR}
                     70: .     for lnk file in ${MLINKS}
1.35      schwarze   71:        @l=${DESTDIR}${MANDIR}${lnk:E}${sub}${lnk}; \
                     72:        t=${DESTDIR}${MANDIR}${file:E}${sub}${file}; \
1.23      espie      73:        echo $$t -\> $$l; \
                     74:        rm -f $$t; ln $$l $$t;
                     75: .     endfor
1.18      espie      76: .  endfor
1.1       deraadt    77: .endif
                     78:
1.37      schwarze   79: # Explicitly list ${BEFOREMAN} to get it done even if ${MAN} is empty.
                     80: all: ${BEFOREMAN} ${MAN} ${MANLINT}