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

1.21      espie       1: #      $OpenBSD: bsd.man.mk,v 1.20 2000/11/10 02:55:40 deraadt 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: MANTARGET?=    cat
1.20      deraadt     6: NROFF?=                nroff -Tascii
1.13      downsj      7: TBL?=          tbl
1.1       deraadt     8:
                      9: .if !target(.MAIN)
                     10: .if exists(${.CURDIR}/../Makefile.inc)
                     11: .include "${.CURDIR}/../Makefile.inc"
                     12: .endif
                     13:
                     14: .MAIN: all
                     15: .endif
                     16:
1.16      millert    17: .SUFFIXES: .1 .2 .3 .3p .4 .5 .6 .7 .8 .9 .1tbl .2tbl .3tbl .4tbl .5tbl .6tbl \
1.19      deraadt    18:        .7tbl .8tbl .9tbl .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
                     19:        .ps1 .ps2 .ps3 .ps4 .ps5 .ps6 .ps7 .ps8 .ps9
1.1       deraadt    20:
1.16      millert    21: .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3p.cat3p .3.cat3 .2.cat2 .1.cat1:
1.20      deraadt    22:        @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
                     23:        @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false)
1.1       deraadt    24:
1.13      downsj     25: .9tbl.cat9 .8tbl.cat8 .7tbl.cat7 .6tbl.cat6 .5tbl.cat5 .4tbl.cat4 .3tbl.cat3 \
                     26: .2tbl.cat2 .1tbl.cat1:
1.20      deraadt    27:        @echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
                     28:        @${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
1.19      deraadt    29:            (rm -f ${.TARGET}; false)
                     30:
                     31: .9.ps9 .8.ps8 .7.ps7 .6.ps6 .5.ps5 .4.ps4 .3p.ps3p .3.ps3 .2.ps2 .1.ps1:
                     32:        @echo "nroff -Tps -mandoc ${.IMPSRC} > ${.TARGET}"
                     33:        @nroff -Tps -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false)
                     34:
                     35: .9tbl.ps9 .8tbl.ps8 .7tbl.ps7 .6tbl.ps6 .5tbl.ps5 .4tbl.ps4 .3tbl.ps3 \
                     36: .2tbl.ps2 .1tbl.ps1:
                     37:        @echo "${TBL} ${.IMPSRC} | nroff -Tps -mandoc > ${.TARGET}"
                     38:        @${TBL} ${.IMPSRC} | nroff -Tps -mandoc > ${.TARGET} || (rm -f ${.TARGET}; false)
1.13      downsj     39:
1.11      downsj     40: .if defined(MAN) && !empty(MAN) && !defined(MANALL)
1.19      deraadt    41:
1.16      millert    42: MANALL=        ${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.3p$/.cat3p/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g:S/.9$/.cat9/g:S/.1tbl$/.cat1/g:S/.2tbl$/.cat2/g:S/.3tbl$/.cat3/g:S/.4tbl$/.cat4/g:S/.5tbl$/.cat5/g:S/.6tbl$/.cat6/g:S/.7tbl$/.cat7/g:S/.8tbl$/.cat8/g:S/.9tbl$/.cat9/g}
1.19      deraadt    43:
                     44: .if defined(MANPS)
                     45:
                     46: PSALL= ${MAN:S/.1$/.ps1/g:S/.2$/.ps2/g:S/.3$/.ps3/g:S/.3p$/.ps3p/g:S/.4$/.ps4/g:S/.5$/.ps5/g:S/.6$/.ps6/g:S/.7$/.ps7/g:S/.8$/.ps8/g:S/.9$/.ps9/g:S/.1tbl$/.ps1/g:S/.2tbl$/.ps2/g:S/.3tbl$/.ps3/g:S/.4tbl$/.ps4/g:S/.5tbl$/.ps5/g:S/.6tbl$/.ps6/g:S/.7tbl$/.ps7/g:S/.8tbl$/.ps8/g:S/.9tbl$/.ps9/g}
                     47:
                     48: .endif
                     49:
1.1       deraadt    50: .endif
                     51:
1.15      millert    52: MINSTALL=      ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
1.1       deraadt    53: .if defined(MANZ)
                     54: # chown and chmod are done afterward automatically
                     55: MCOMPRESS=     gzip -cf
                     56: MCOMPRESSSUFFIX= .gz
                     57: .endif
                     58:
1.18      espie      59: .if defined(MANSUBDIR)
                     60: # Add / so that we don't have to specify it. Better arch -> MANSUBDIR mapping
                     61: MANSUBDIR:=${MANSUBDIR:S,^,/,}
                     62: .else
                     63: # XXX MANSUBDIR must be non empty for the mlink loops to work
                     64: MANSUBDIR=''
                     65: .endif
                     66:
1.1       deraadt    67: maninstall:
                     68: .if defined(MANALL)
                     69:        @for page in ${MANALL}; do \
1.18      espie      70:                set -- ${MANSUBDIR}; \
                     71:                subdir=$$1; \
1.6       niklas     72:                dir=${DESTDIR}${MANDIR}$${page##*.cat}; \
1.10      niklas     73:                base=$${page##*/}; \
1.18      espie      74:                instpage=$${dir}$${subdir}/$${base%.*}.0${MCOMPRESSSUFFIX}; \
1.1       deraadt    75:                if [ X"${MCOMPRESS}" = X ]; then \
                     76:                        echo ${MINSTALL} $$page $$instpage; \
                     77:                        ${MINSTALL} $$page $$instpage; \
                     78:                else \
                     79:                        rm -f $$instpage; \
                     80:                        echo ${MCOMPRESS} $$page \> $$instpage; \
                     81:                        ${MCOMPRESS} $$page > $$instpage; \
                     82:                        chown ${MANOWN}:${MANGRP} $$instpage; \
                     83:                        chmod ${MANMODE} $$instpage; \
1.18      espie      84:                fi; \
                     85:                while test $$# -ge 2; do \
                     86:                        shift; \
                     87:                        extra=$${dir}$$1/$${base%.*}.0${MCOMPRESSSUFFIX}; \
                     88:                        echo $$extra -\> $$instpage; \
                     89:                        ln -f $$instpage $$extra; \
                     90:                done; \
1.1       deraadt    91:        done
                     92: .endif
1.19      deraadt    93: .if defined(PSALL)
                     94:        @for page in ${PSALL}; do \
                     95:                set -- ${MANSUBDIR}; \
                     96:                subdir=$$1; \
                     97:                dir=${DESTDIR}${PSDIR}$${page##*.ps}; \
                     98:                base=$${page##*/}; \
                     99:                instpage=$${dir}$${subdir}/$${base%.*}.ps${MCOMPRESSSUFFIX}; \
                    100:                if [ X"${MCOMPRESS}" = X ]; then \
                    101:                        echo ${MINSTALL} $$page $$instpage; \
                    102:                        ${MINSTALL} $$page $$instpage; \
                    103:                else \
                    104:                        rm -f $$instpage; \
                    105:                        echo ${MCOMPRESS} $$page \> $$instpage; \
                    106:                        ${MCOMPRESS} $$page > $$instpage; \
                    107:                        chown ${PSOWN}:${PSGRP} $$instpage; \
                    108:                        chmod ${PSMODE} $$instpage; \
                    109:                fi; \
                    110:                while test $$# -ge 2; do \
                    111:                        shift; \
                    112:                        extra=$${dir}$$1/$${base%.*}.ps${MCOMPRESSSUFFIX}; \
                    113:                        echo $$extra -\> $$instpage; \
                    114:                        ln -f $$instpage $$extra; \
                    115:                done; \
                    116:        done
                    117: .endif
1.1       deraadt   118: .if defined(MLINKS) && !empty(MLINKS)
1.22    ! mickey    119: .  for _subdir in ${MANSUBDIR}
        !           120:        @set ${MLINKS}; \
        !           121:        while test $$# -ge 2; do \
        !           122:                name=$$1; \
        !           123:                shift; \
        !           124:                dir=${DESTDIR}${MANDIR}$${name##*.}; \
        !           125:                l=$${dir}${_subdir}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
        !           126:                name=$$1; \
        !           127:                shift; \
        !           128:                dir=${DESTDIR}${MANDIR}$${name##*.}; \
        !           129:                t=$${dir}${_subdir}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
        !           130:                echo $$t -\> $$l; \
        !           131:                rm -f $$t; \
        !           132:                ln $$l $$t; \
        !           133:        done
1.18      espie     134: .  endfor
1.1       deraadt   135: .endif
                    136:
1.19      deraadt   137: .if (defined(MANALL) || defined(PSALL)) && !defined(MANLOCALBUILD)
                    138: all: ${MANALL} ${PSALL}
1.1       deraadt   139:
                    140: cleandir: cleanman
                    141: cleanman:
1.19      deraadt   142:        rm -f ${MANALL} ${PSALL}
1.1       deraadt   143: .endif