Home | History | Annotate | Line # | Download | only in mk
bsd.man.mk revision 1.56
      1  1.56      phil #	$NetBSD: bsd.man.mk,v 1.56 2000/09/22 05:37:57 phil Exp $
      2  1.26     mikel #	@(#)bsd.man.mk	8.1 (Berkeley) 6/8/93
      3   1.1       cgd 
      4  1.34   mycroft .if !target(__initialized__)
      5  1.34   mycroft __initialized__:
      6   1.1       cgd .if exists(${.CURDIR}/../Makefile.inc)
      7   1.1       cgd .include "${.CURDIR}/../Makefile.inc"
      8   1.9   mycroft .endif
      9  1.34   mycroft .include <bsd.own.mk>
     10  1.34   mycroft .include <bsd.obj.mk>
     11  1.49     perry .include <bsd.depall.mk>
     12  1.28   mycroft .MAIN:		all
     13   1.1       cgd .endif
     14  1.34   mycroft 
     15  1.56      phil .PHONY:		catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
     16  1.44     lukem .if ${MKMAN} != "no"
     17  1.32   mycroft realinstall:	${MANINSTALL}
     18  1.34   mycroft .endif
     19  1.39     lukem cleandir distclean: cleanman
     20  1.28   mycroft 
     21  1.37   thorpej TMACDIR?=	${DESTDIR}/usr/share/tmac
     22  1.56      phil HTMLDIR?=	${DESTDIR}/usr/share/man
     23  1.37   thorpej CATDEPS?=	${TMACDIR}/tmac.andoc \
     24  1.37   thorpej 		${TMACDIR}/tmac.doc \
     25  1.37   thorpej 		${TMACDIR}/tmac.doc-ditroff \
     26  1.37   thorpej 		${TMACDIR}/tmac.doc-common \
     27  1.37   thorpej 		${TMACDIR}/tmac.doc-nroff \
     28  1.37   thorpej 		${TMACDIR}/tmac.doc-syms
     29  1.28   mycroft MANTARGET?=	cat
     30  1.46   mycroft NROFF?=		nroff -Tascii
     31  1.33      phil TBL?=		tbl
     32  1.12       jtc 
     33  1.56      phil 
     34  1.25  christos .SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
     35  1.56      phil 	   .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
     36  1.56      phil 	   .html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
     37  1.12       jtc 
     38  1.37   thorpej .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \
     39  1.37   thorpej     ${CATDEPS}
     40  1.33      phil .if !defined(USETBL)
     41  1.22   thorpej 	@echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
     42  1.25  christos 	@${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \
     43  1.25  christos 	 (rm -f ${.TARGET}; false)
     44  1.33      phil .else
     45  1.33      phil 	@echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
     46  1.33      phil 	@${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
     47  1.33      phil 	 (rm -f ${.TARGET}; false)
     48  1.33      phil .endif
     49  1.12       jtc 
     50  1.56      phil .9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1: \
     51  1.56      phil     ${CATDEPS}
     52  1.56      phil .if !defined(USETBL)
     53  1.56      phil 	@echo "${NROFF} -mdoc2html ${.IMPSRC} > ${.TARGET}"
     54  1.56      phil 	@${NROFF} -mdoc2html ${.IMPSRC} > ${.TARGET} || \
     55  1.56      phil 	 (rm -f ${.TARGET}; false)
     56  1.56      phil .else
     57  1.56      phil 	@echo "${TBL} ${.IMPSRC} | ${NROFF} -mdoc2html > ${.TARGET}"
     58  1.56      phil 	@${TBL} ${.IMPSRC} | ${NROFF} -mdoc2html > ${.TARGET} || \
     59  1.56      phil 	 (rm -f ${.TARGET}; false)
     60  1.56      phil .endif
     61  1.56      phil 
     62  1.16       cgd .if defined(MAN) && !empty(MAN)
     63  1.25  christos MANPAGES=	${MAN}
     64  1.25  christos CATPAGES=	${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
     65  1.51       erh .NOPATH:	${CATPAGES}
     66  1.56      phil .if !defined(NOHTML)
     67  1.56      phil HTMLPAGES=	${MANPAGES:C/(.*).([1-9])/\1.html\2/}
     68  1.56      phil .endif
     69  1.16       cgd .endif
     70   1.1       cgd 
     71  1.47    simonb MINSTALL=	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
     72  1.47    simonb 		    -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
     73  1.25  christos 
     74  1.20       cgd .if defined(MANZ)
     75  1.20       cgd # chown and chmod are done afterward automatically
     76  1.20       cgd MCOMPRESS=	gzip -cf
     77  1.20       cgd MCOMPRESSSUFFIX= .gz
     78  1.20       cgd .endif
     79   1.1       cgd 
     80  1.25  christos catinstall: catlinks
     81  1.25  christos maninstall: manlinks
     82  1.25  christos 
     83  1.25  christos __installpage: .USE
     84  1.25  christos .if defined(MCOMPRESS) && !empty(MCOMPRESS)
     85  1.25  christos 	@rm -f ${.TARGET}
     86  1.25  christos 	${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
     87  1.25  christos 	@chown ${MANOWN}:${MANGRP} ${.TARGET}
     88  1.25  christos 	@chmod ${MANMODE} ${.TARGET}
     89  1.25  christos .else
     90  1.25  christos 	${MINSTALL} ${.ALLSRC} ${.TARGET}
     91  1.25  christos .endif
     92  1.25  christos 
     93  1.25  christos 
     94  1.25  christos # Rules for cat'ed man page installation
     95  1.43     lukem .if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
     96  1.52   mycroft catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
     97  1.53   mycroft .PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
     98  1.53   mycroft .if !defined(UPDATE)
     99  1.52   mycroft .PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
    100  1.53   mycroft .endif
    101  1.52   mycroft 
    102  1.25  christos .   for P in ${CATPAGES}
    103  1.48     fredb .	if !defined(BUILD) && !make(all) && !make(${P})
    104  1.25  christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
    105  1.25  christos .	endif
    106  1.25  christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
    107  1.25  christos .   endfor
    108  1.25  christos .else
    109  1.25  christos catpages::
    110  1.30   mycroft .endif
    111  1.30   mycroft 
    112  1.30   mycroft # Rules for source page installation
    113  1.30   mycroft .if defined(MANPAGES) && !empty(MANPAGES)
    114  1.52   mycroft manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
    115  1.53   mycroft .PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
    116  1.53   mycroft .if !defined(UPDATE)
    117  1.52   mycroft .PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
    118  1.53   mycroft .endif
    119  1.52   mycroft 
    120  1.30   mycroft .   for P in ${MANPAGES}
    121  1.30   mycroft ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
    122  1.30   mycroft .   endfor
    123  1.30   mycroft .else
    124  1.30   mycroft manpages::
    125  1.25  christos .endif
    126  1.25  christos 
    127  1.43     lukem .if ${MKCATPAGES} != "no"
    128  1.25  christos catlinks: catpages
    129  1.25  christos .if defined(MLINKS) && !empty(MLINKS)
    130  1.25  christos 	@set ${MLINKS}; \
    131  1.25  christos 	while test $$# -ge 2; do \
    132  1.25  christos 		name=$$1; \
    133  1.25  christos 		shift; \
    134  1.25  christos 		dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
    135  1.25  christos 		l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
    136  1.25  christos 		name=$$1; \
    137  1.25  christos 		shift; \
    138  1.25  christos 		dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
    139  1.25  christos 		t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
    140  1.55    itojun 		if test $$l -nt $$t -o ! -f $$t; then \
    141  1.55    itojun 			echo $$t -\> $$l; \
    142  1.55    itojun 			ln -f $$l $$t; \
    143  1.55    itojun 		fi; \
    144  1.19    brezak 	done
    145  1.19    brezak .endif
    146  1.43     lukem .else
    147  1.43     lukem catlinks:
    148  1.43     lukem .endif
    149  1.25  christos 
    150  1.25  christos manlinks: manpages
    151   1.1       cgd .if defined(MLINKS) && !empty(MLINKS)
    152   1.1       cgd 	@set ${MLINKS}; \
    153   1.1       cgd 	while test $$# -ge 2; do \
    154   1.1       cgd 		name=$$1; \
    155   1.1       cgd 		shift; \
    156  1.25  christos 		dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
    157  1.27     perry 		l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
    158   1.1       cgd 		name=$$1; \
    159   1.1       cgd 		shift; \
    160  1.25  christos 		dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
    161  1.27     perry 		t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
    162  1.55    itojun 		if test $$l -nt $$t -o ! -f $$t; then \
    163  1.55    itojun 			echo $$t -\> $$l; \
    164  1.55    itojun 			ln -f $$l $$t; \
    165  1.55    itojun 		fi; \
    166  1.20       cgd 	done
    167   1.8   mycroft .endif
    168  1.56      phil 
    169  1.56      phil # Html rules
    170  1.56      phil html: ${HTMLPAGES}
    171  1.56      phil 
    172  1.56      phil .if defined(HTMLPAGES) && !empty(HTMLPAGES)
    173  1.56      phil .for P in ${HTMLPAGES} 
    174  1.56      phil ${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
    175  1.56      phil 	${MINSTALL} ${.ALLSRC} ${.TARGET}
    176  1.56      phil .endfor
    177  1.56      phil .endif
    178  1.56      phil installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
    179  1.56      phil 
    180  1.56      phil cleanhtml:
    181  1.56      phil .if defined(HTMLPAGES) && !empty(HTMLPAGES)
    182  1.56      phil 	rm -f ${HTMLPAGES}
    183  1.56      phil .endif
    184  1.56      phil 
    185  1.31   mycroft 
    186  1.25  christos .if defined(CATPAGES)
    187  1.45  christos .if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
    188  1.50   mycroft realall: ${CATPAGES}
    189  1.35       mrg .else
    190  1.50   mycroft realall:
    191  1.34   mycroft .endif
    192   1.8   mycroft 
    193   1.8   mycroft cleanman:
    194  1.25  christos 	rm -f ${CATPAGES}
    195  1.31   mycroft .else
    196  1.31   mycroft cleanman:
    197   1.1       cgd .endif
    198  1.34   mycroft 
    199  1.34   mycroft # Make sure all of the standard targets are defined, even if they do nothing.
    200  1.34   mycroft clean depend includes lint regress tags:
    201