[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.37

1.37    ! schwarze    1: #      $OpenBSD: bsd.man.mk,v 1.36 2011/07/05 04:49:35 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.33      schwarze   57: .  endfor
1.25      espie      58: .endfor
                     59:
1.37    ! schwarze   60: # Install the manual hardlinks, if any.
1.33      schwarze   61: maninstall:
1.1       deraadt    62: .if defined(MLINKS) && !empty(MLINKS)
1.23      espie      63: .  for sub in ${MANSUBDIR}
                     64: .     for lnk file in ${MLINKS}
1.35      schwarze   65:        @l=${DESTDIR}${MANDIR}${lnk:E}${sub}${lnk}; \
                     66:        t=${DESTDIR}${MANDIR}${file:E}${sub}${file}; \
1.23      espie      67:        echo $$t -\> $$l; \
                     68:        rm -f $$t; ln $$l $$t;
                     69: .     endfor
1.18      espie      70: .  endfor
1.1       deraadt    71: .endif
                     72:
1.37    ! schwarze   73: # Explicitly list ${BEFOREMAN} to get it done even if ${MAN} is empty.
        !            74: all: ${BEFOREMAN} ${MAN} ${MANLINT}