manpages/Makefile.man.master
author asano
Fri, 26 Feb 2010 14:09:57 +0900
changeset 162 922f5cd3998c
parent 153 94fed77466d0
child 185 f908e0010703
permissions -rw-r--r--
14852 DDU contains references to Sun (l10n syncup with English changes in 14799)

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at $(SRC)/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at $(SRC)/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 1991, Sun Microsystems, Inc.
# Copyright (c) 1991, Nihon Sun Microsystems K.K.
#
.KEEP_STATE:

#
# include master Makefile
#
include		$(SRC)/Makefile.master

#
# reset suffix definition not to cause unexpected rules
#
.SUFFIXES:

#
# pass targets to child Makefiles
#
all:=		TARGET= all
install:=	TARGET= install
clean:=		TARGET= clean
clobber:=	TARGET= clobber
lint:=		TARGET= lint

#
# switch modes of files and directoried, manpages of OpenWindows have
# different mode from others
#
OWNER2		= bin
GROUP2		= bin
FILEMODE2	= 0444
DIROWNER2	= bin
DIRGROUP2	= bin
DIRMODE2	= 0755

OWNER2OWMODE	= bin
GROUP2OWMODE	= bin
FILEMODE2OWMODE	= 0444
DIROWNER2OWMODE	= root
DIRGROUP2OWMODE	= bin
DIRMODE2OWMODE	= 0775

OWNER		= $(OWNER2$(OWMODE))
GROUP		= $(GROUP2$(OWMODE))
FILEMODE	= $(FILEMODE2$(OWMODE))
DIROWNER	= $(DIROWNER2$(OWMODE))
DIRGROUP	= $(DIRGROUP2$(OWMODE))
DIRMODE		= $(DIRMODE2$(OWMODE))
SLOWNER		= root
SLGROUP		= sys

#
## replace the definition in Makefile.master
#
INS             = /usr/sbin/install
INS.dir		= $(INS) -s -d -m $(DIRMODE) $@
$(CH)INS.dir	= $(INS) -s -d -m $(DIRMODE) -u $(DIROWNER) -g $(DIRGROUP) $@
INS.file=       $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
# installs and renames at once
INS.rename=     $(INS.file); $(MV) $(@D)/$(<F) $@

#
# names of symbolic links required by man command,
# to define RPATH_LIBMAC.??? is up to child Makefile
#
MANMACROS	= tmac.an
MANMACROSSUN	= tmac.ansun
TMACAN		= $(RPATH_LIBTMAC)/an.$(LOCALE)
TMACANSUN	= $(RPATH_LIBTMAC)/ansun.$(LOCALE)

## for creating directories, but can be refered only for local make
## at JFP build, directories are created by upper Makefiles

# /usr/share/man
#
$(MANDIR) $(MANDIR)/:
	$(INS.dir)

# /usr/share/man/<locale>
#
$(MANDIR)/$(LOCALE):	$(MANDIR)
	$(INS.dir)

#
# create symbolic links
#

$(MANDIR)/$(LOCALE)/$(MANMACROS):
	@if [ ! -h $@ ]; then \
		$(RM) $@; \
		$(SYMLINK) $(TMACAN) $@; \
		$(CHOWN) $(SLOWNER) $@; \
		$(CHGRP) $(SLGROUP) $@; \
	fi

$(MANDIR)/$(LOCALE)/$(MANMACROSSUN):
	@if [ ! -h $@ ]; then \
		$(RM) $@; \
		$(SYMLINK) $(TMACANSUN) $@; \
		$(CHOWN) $(SLOWNER) $@; \
		$(CHGRP) $(SLGROUP) $@; \
	fi

#
# define required directory names, to define MANDIR is up to
# child Makefiles
#
SECTDIRS	= $(MANDIRS:%=$(MANDIR)/$(LOCALE)/$(DIRPREFIX)%)

$(SECTDIRS):		$(MANDIR)/$(LOCALE) \
			$(MANDIR)/$(LOCALE)/$(MANMACROS) \
			$(MANDIR)/$(LOCALE)/$(MANMACROSSUN)
	$(INS.dir)

#
# define all manpage files as make-target,
# it's a tricky way, so that this list has to cover all possible MANDIRS
#
MANDIRS_TRICK.base	= man1/% man1m/% man4/%
MANDIRS_TRICK		= ${MANDIRS_TRICK.base:%=$(DIRPREFIX)%}

MANTARGETS	= $(MANDIRS_TRICK:%=$(MANDIR)/$(LOCALE)/%)

#
# define how to install manpages into prototype hierarchy
#

$(MANTARGETS):	%
	$(INS.file)

#
# mapping of variables between real directory names
#
MANDIR_1	= $(DIRPREFIX)man1
MANDIR_1M	= $(DIRPREFIX)man1m
MANDIR_4	= $(DIRPREFIX)man4

##################

MANSECTION	= $(MANPAGES$(SECTION))

DIR		= $(MANDIR)/$(LOCALE)/$(MANDIR_$(SECTION))
all:		$(MANSECTION)
install:	$(DIR) $(MANSECTION:%=$(DIR)/%)

#
# targets for cleaning source tree
#
clean: