xref: /illumos-gate/usr/src/man/Makefile.man (revision 7f3d7c9289dee6488b3cd2848a68c0b8580d750c)
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 2017 Nexenta Systems, Inc.
15#
16
17MANDOC=		$(ONBLD_TOOLS)/bin/${MACH}/mandoc
18ROOTMAN=	$(ROOT)/usr/share/man
19ROOTHASMAN=	$(ROOT)/usr/has/man
20FILEMODE=	0444
21
22# The manual section being built, client Makefiles must set this to, for e.g.
23# "3perl", with case matching that of the section name as installed.
24#
25# MANSECT=
26
27MANCHECKS=	$(MANFILES:%=%.check)
28ROOTMANFILES=	$(MANFILES:%=$(ROOTMAN)/man$(MANSECT)/%)
29ROOTMANLINKS=	$(MANLINKS:%=$(ROOTMAN)/man$(MANSECT)/%)
30
31$(ROOTMAN)/man$(MANSECT) $(ROOTHASMAN)/man$(MANSECT):
32		$(INS.dir)
33
34$(ROOTHASMAN)/man$(MANSECT)/%: % $(ROOTHASMAN)/man$(MANSECT)
35		$(INS.file)
36
37$(ROOTMAN)/man$(MANSECT)/% : % $(ROOTMAN)/man$(MANSECT)
38		$(INS.file)
39
40MANLINK_SRCS=	Manlink $($(MACH)_MANLINK_SRC)
41
42MANLINK_INSTALL=$(MANLINK) -d $(ROOTMAN)/man$(MANSECT) $(MANLINK_SRCS)
43
44# Note that new mandoc adds some checks for lots of extra whitespace.
45# We don't want to check our legacy pages for that.  There are thousands
46# and thousands of them in our man pages.  Please still check them
47# manually when editing (git pbchk will do so for you.)
48#
49$(MANCHECKS):
50		@$(ECHO) "checking $(@:%.check=%)"; \
51		if $(EGREP) -q "^.TH" $(@:%.check=%); then \
52		$(MANDOC) -Tlint -Werror $(@:%.check=%); \
53		else; \
54		$(MANDOC) -Tlint -Wwarning $(@:%.check=%); \
55		fi
56
57all:
58
59check:		$(MANCHECKS)
60
61clean:
62
63clobber:
64
65.PARALLEL:
66
67FRC:
68