Home | History | Annotate | Line # | Download | only in mk
bsd.man.mk revision 1.38
      1  1.38      fair #	$NetBSD: bsd.man.mk,v 1.38 1998/04/09 22:08:36 fair 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.28   mycroft .MAIN:		all
     12   1.1       cgd .endif
     13  1.34   mycroft 
     14  1.28   mycroft .PHONY:		catinstall maninstall catpages manpages catlinks manlinks cleanman
     15  1.34   mycroft .if !defined(NOMAN)
     16  1.32   mycroft realinstall:	${MANINSTALL}
     17  1.34   mycroft .endif
     18  1.31   mycroft cleandir:	cleanman
     19  1.28   mycroft 
     20  1.37   thorpej TMACDIR?=	${DESTDIR}/usr/share/tmac
     21  1.37   thorpej CATDEPS?=	${TMACDIR}/tmac.andoc \
     22  1.37   thorpej 		${TMACDIR}/tmac.doc \
     23  1.37   thorpej 		${TMACDIR}/tmac.doc-ditroff \
     24  1.37   thorpej 		${TMACDIR}/tmac.doc-common \
     25  1.37   thorpej 		${TMACDIR}/tmac.doc-nroff \
     26  1.37   thorpej 		${TMACDIR}/tmac.doc-syms
     27  1.28   mycroft MANTARGET?=	cat
     28  1.28   mycroft NROFF?=		nroff
     29  1.33      phil TBL?=		tbl
     30  1.12       jtc 
     31  1.25  christos .SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
     32  1.25  christos 	   .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9
     33  1.12       jtc 
     34  1.37   thorpej .9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \
     35  1.37   thorpej     ${CATDEPS}
     36  1.33      phil .if !defined(USETBL)
     37  1.22   thorpej 	@echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
     38  1.25  christos 	@${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \
     39  1.25  christos 	 (rm -f ${.TARGET}; false)
     40  1.33      phil .else
     41  1.33      phil 	@echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
     42  1.33      phil 	@${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
     43  1.33      phil 	 (rm -f ${.TARGET}; false)
     44  1.33      phil .endif
     45  1.12       jtc 
     46  1.16       cgd .if defined(MAN) && !empty(MAN)
     47  1.25  christos MANPAGES=	${MAN}
     48  1.25  christos CATPAGES=	${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
     49  1.16       cgd .endif
     50   1.1       cgd 
     51  1.24   thorpej MINSTALL=	${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
     52  1.25  christos 
     53  1.20       cgd .if defined(MANZ)
     54  1.20       cgd # chown and chmod are done afterward automatically
     55  1.20       cgd MCOMPRESS=	gzip -cf
     56  1.20       cgd MCOMPRESSSUFFIX= .gz
     57  1.20       cgd .endif
     58   1.1       cgd 
     59  1.25  christos catinstall: catlinks
     60  1.25  christos maninstall: manlinks
     61  1.25  christos 
     62  1.25  christos __installpage: .USE
     63  1.25  christos .if defined(MCOMPRESS) && !empty(MCOMPRESS)
     64  1.25  christos 	@rm -f ${.TARGET}
     65  1.25  christos 	${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
     66  1.25  christos 	@chown ${MANOWN}:${MANGRP} ${.TARGET}
     67  1.25  christos 	@chmod ${MANMODE} ${.TARGET}
     68  1.25  christos .else
     69  1.25  christos 	${MINSTALL} ${.ALLSRC} ${.TARGET}
     70  1.25  christos .endif
     71  1.25  christos 
     72  1.25  christos 
     73  1.25  christos # Rules for cat'ed man page installation
     74  1.25  christos .if defined(CATPAGES) && !empty(CATPAGES)
     75  1.25  christos .   for P in ${CATPAGES}
     76  1.25  christos catpages:: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}
     77  1.25  christos 
     78  1.25  christos .	if !defined(UPDATE)
     79  1.25  christos .PHONY: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}
     80  1.25  christos .	endif
     81  1.25  christos .	if !defined(BUILD)
     82  1.25  christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
     83  1.25  christos .	endif
     84  1.25  christos 
     85  1.29   mycroft .PRECIOUS: ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}
     86  1.25  christos ${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
     87  1.25  christos .   endfor
     88  1.25  christos .else
     89  1.25  christos catpages::
     90  1.30   mycroft .endif
     91  1.30   mycroft 
     92  1.30   mycroft # Rules for source page installation
     93  1.30   mycroft .if defined(MANPAGES) && !empty(MANPAGES)
     94  1.30   mycroft .   for P in ${MANPAGES}
     95  1.30   mycroft manpages:: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}
     96  1.30   mycroft .	if !defined(UPDATE)
     97  1.36     mikel .PHONY: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}
     98  1.30   mycroft .	endif
     99  1.30   mycroft 
    100  1.30   mycroft .PRECIOUS: ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}
    101  1.30   mycroft ${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
    102  1.30   mycroft .   endfor
    103  1.30   mycroft .else
    104  1.30   mycroft manpages::
    105  1.25  christos .endif
    106  1.25  christos 
    107  1.25  christos catlinks: catpages
    108  1.25  christos .if defined(MLINKS) && !empty(MLINKS)
    109  1.25  christos 	@set ${MLINKS}; \
    110  1.25  christos 	while test $$# -ge 2; do \
    111  1.25  christos 		name=$$1; \
    112  1.25  christos 		shift; \
    113  1.25  christos 		dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
    114  1.25  christos 		l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
    115  1.25  christos 		name=$$1; \
    116  1.25  christos 		shift; \
    117  1.25  christos 		dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
    118  1.25  christos 		t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
    119  1.38      fair 		if [ -z "${UPDATE}" -o ! -f $$t ]; then \
    120  1.25  christos 		    echo $$t -\> $$l; \
    121  1.38      fair 		    ln -f $$l $$t; \
    122  1.25  christos 		fi; \
    123  1.19    brezak 	done
    124  1.19    brezak .endif
    125  1.25  christos 
    126  1.25  christos manlinks: manpages
    127   1.1       cgd .if defined(MLINKS) && !empty(MLINKS)
    128   1.1       cgd 	@set ${MLINKS}; \
    129   1.1       cgd 	while test $$# -ge 2; do \
    130   1.1       cgd 		name=$$1; \
    131   1.1       cgd 		shift; \
    132  1.25  christos 		dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
    133  1.27     perry 		l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
    134   1.1       cgd 		name=$$1; \
    135   1.1       cgd 		shift; \
    136  1.25  christos 		dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
    137  1.27     perry 		t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
    138  1.38      fair 		if [ -z "${UPDATE}" -o ! -f $$t ]; then \
    139  1.25  christos 		    echo $$t -\> $$l; \
    140  1.38      fair 		    ln -f $$l $$t; \
    141  1.25  christos 		fi; \
    142  1.20       cgd 	done
    143   1.8   mycroft .endif
    144  1.31   mycroft 
    145  1.25  christos .if defined(CATPAGES)
    146  1.34   mycroft .if !defined(NOMAN)
    147  1.25  christos all: ${CATPAGES}
    148  1.35       mrg .else
    149  1.35       mrg all:
    150  1.34   mycroft .endif
    151   1.8   mycroft 
    152   1.8   mycroft cleanman:
    153  1.25  christos 	rm -f ${CATPAGES}
    154  1.31   mycroft .else
    155  1.31   mycroft cleanman:
    156   1.1       cgd .endif
    157  1.34   mycroft 
    158  1.34   mycroft # Make sure all of the standard targets are defined, even if they do nothing.
    159  1.34   mycroft clean depend includes lint regress tags:
    160