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