xref: /netbsd/share/man/man0/Makefile (revision bf9ec67e)
1#	from: @(#)Makefile	5.9 (Berkeley) 7/1/91
2#	$NetBSD: Makefile,v 1.10 2001/12/12 12:24:23 lukem Exp $
3
4NOOBJ=		# defined
5
6.include <bsd.own.mk>
7
8.if ${MKSHARE} != "no"
9FILES=		makewhatis.sed COPYRIGHT
10FILESDIR=	/usr/share/man
11.endif
12
13CLEANFILES+=	man?
14CLEANFILES+=	man?pages.tmp
15CLEANFILES+=	man?pages.ps
16CLEANFILES+=	man?pages.pdf
17CLEANFILES+=	toc? tocx?
18
19SECTIONS?=	1 2 3 4 5 6 7 8 9
20
21# Takes out some fluff from the PostScript files created bye
22# grops which does some VM saving/restoring that bloats the
23# PDF file pdf2ps generates.              By uwe@netbsd.org.
24OPTIMIZE_PDF?=	\
25			-e '/^\/level0 0 def/d' 		\
26			-e '/^\/level0 save/d' 			\
27			-e '/^level0 restore/d'
28
29man:
30	sh mkman
31
32man.ps:
33	for i in ${SECTIONS} ; 					\
34	do							\
35		for f in `grep "$${i}\$$" intros` `cat man$${i}` ; \
36		do						\
37			if [ ! -f $${f} ]; then 		\
38				continue ; 			\
39			fi ;					\
40			if grep -q ^\\.TS back ;		\
41			then					\
42				echo >&2 $${f} ; 			\
43				cat $${f} | tbl | troff -msafer -man -Tps $${f} ; \
44			else 					\
45				echo >&2 $${f} "(tbl)" ;	\
46				cat $${f} | troff -msafer -man -Tps $${f} ; \
47			fi ; 					\
48		done >man$${i}pages.tmp ;			\
49		grops <man$${i}pages.tmp >man$${i}pages.ps ;	\
50		rm man$${i}pages.tmp ; 		\
51	done
52
53man.pdf:
54	for i in ${SECTIONS} ; 					\
55	do							\
56		echo Chewing on man$${i}pages.pdf ;		\
57		sed 						\
58			${OPTIMIZE_PDF} 			\
59			<man$${i}pages.ps >man$${i}pages.ps.tmp ; \
60		ps2pdf man$${i}pages.ps.tmp man$${i}pages.pdf ;	\
61		rm man$${i}pages.ps.tmp ; 			\
62	done
63
64man.tgz:
65	tar plzvcf manpages-ps.tgz man?pages.ps
66	tar plzvcf manpages-pdf.tgz man?pages.pdf
67
68.include <bsd.prog.mk>
69