xref: /titanic_51/usr/src/man/Makefile.man (revision e764248d4606662e466d4ee282fa5ef20e3dc578)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet
9# at http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2011, Richard Lowe
14# Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
15#
16
17MANDOC=		$(ONBLD_TOOLS)/bin/${MACH}/mandoc
18ROOTMAN=	$(ROOT)/usr/share/man
19ROOTHASMAN=	$(ROOT)/usr/has/man
20ROOTPERLMAN=	$(ROOT)/usr/perl5/$(PERL_VERSION)/man
21FILEMODE=	0444
22
23# The manual section being built, client Makefiles must set this to, for e.g.
24# "3perl", with case matching that of the section name as installed.
25#
26# MANSECT=
27
28MANCHECKS=	$(MANFILES:%=%.check)
29ROOTMANFILES= 	$(MANFILES:%=$(ROOTMAN)/man$(MANSECT)/%)
30ROOTMANLINKS=	$(MANLINKS:%=$(ROOTMAN)/man$(MANSECT)/%)
31
32$(ROOTMAN)/man$(MANSECT) \
33$(ROOTHASMAN)/man$(MANSECT) \
34$(ROOTPERLMAN)/man$(MANSECT):
35		$(INS.dir)
36
37$(ROOTHASMAN)/man$(MANSECT)/%: % $(ROOTHASMAN)/man$(MANSECT)
38		$(INS.file)
39
40$(ROOTMAN)/man$(MANSECT)/% : % $(ROOTMAN)/man$(MANSECT)
41		$(INS.file)
42
43$(ROOTPERLMAN)/man$(MANSECT)/%: % $(ROOTPERLMAN)/man$(MANSECT)
44		$(INS.file)
45
46#
47# Note that new mandoc adds some checks for lots of extra whitespace.
48# We don't want to check our legacy pages for that.  There are thousands
49# and thousands of them in our man pages.  Please still check them
50# manually when editing (git pbchk will do so for you.)
51#
52$(MANCHECKS):
53		@$(EGREP) -q "^.TH" $(@:%.check=%) || \
54		( $(ECHO) "checking $(@:%.check=%)"; \
55		$(MANDOC) -Tlint $(@:%.check=%) )
56
57$(MANLINKS):
58		$(RM) $@; $(SYMLINK) $(LINKSRC) $@
59
60$(ROOTMANLINKS): $(MANLINKS) $(ROOTMAN)/man$(MANSECT)
61		$(RM) $@; $(CP) -RP $(@F) $(@D)
62
63all:
64
65check:		$(MANCHECKS)
66
67clean:
68
69clobber:
70		$(RM) $(MANLINKS)
71
72.PARALLEL:
73
74FRC:
75