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