xref: /illumos-gate/usr/src/msg/Makefile (revision cd2135d041662c75017487e2d4b9b69b7e0b8349)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27include ../Makefile.master
28
29ROOTDIR=$(ROOT)/usr/lib/locale/C
30ROOTMSGDIR=$(ROOTDIR)/LC_MESSAGES
31ROOTTIMEDIR=$(ROOTDIR)/LC_TIME
32
33#
34# These files either need no build rules, because they're under SCM
35# in the current working directory, or they have explicit build rules
36# that aren't handled by the $(MSGDIRFILES_REMOTE) rule below.
37#
38MSGDIRFILES_LOCAL= \
39	SUNW_OST_LINFO \
40	uxlibc.src
41
42#
43# These files live somewhere else in the build tree (ie not in the
44# directory usr/src/msg).  Each entry here should be accompanied by an
45# explicit action telling where the file lives.  That action should
46# consist only of a dependency, but no action--the action is supplied
47# by the $(MSGDIRFILES_REMOTE) rule below.
48#
49MSGDIRFILES_REMOTE= \
50	magic \
51	mailx.help \
52	more.help \
53	priv_names
54
55MSGDIRFILES= $(MSGDIRFILES_LOCAL) $(MSGDIRFILES_REMOTE)
56
57ROOTMSGDIRFILES=$(MSGDIRFILES:%=$(ROOTMSGDIR)/%)
58
59PO_LABEL=' The following lines are contents of '
60
61.KEEP_STATE:
62
63all: $(MSGDIRFILES)
64
65install: all _msg
66
67#
68# The _msg target gathers the output of the top-level _msg target into
69# text-domain-specific message files under the ROOTMSGDIR for packaging.
70# It also processes time-message files in subdirectories of the LC_TIME
71# directory and copies or creates other files needed by this package.
72#
73
74$(ROOTTIMEDIR) $(ROOTMSGDIR):
75	$(INS.dir)
76
77$(ROOTMSGDIR)/%: $(ROOTMSGDIR) %
78	$(INS.file)
79
80magic: $(SRC)/cmd/file/magic
81
82priv_names: $(ROOT)/etc/security/priv_names
83
84mailx.help: $(SRC)/cmd/mailx/misc/mailx.help
85
86more.help: $(SRC)/cmd/more/more.help
87
88$(MSGDIRFILES_REMOTE):
89	$(RM) $@; $(CP) $? $@
90
91_msg: $(ROOTMSGDIR) .WAIT $(ROOTTIMEDIR) $(ROOTMSGDIRFILES) FRC
92	[ -d $(MSGROOT) ] || $(ECHO) "need to build _msg in $(SRC)"
93	(cd $(MSGROOT); \
94	for d in SUNW*;\
95	do \
96		x="`$(ECHO) $$d/*.po`"; \
97		y="$$d/"'*.po'; \
98		$(RM) $(ROOTMSGDIR)/$$d.po; \
99		if test "$$x" != "$$y"; then \
100		for f in $$d/*.po; \
101		do \
102			$(ECHO) '#'$(PO_LABEL)$$f >> $(ROOTMSGDIR)/$$d.po; \
103			$(SED) -e '/^# msg/d' -e '/^domain/d' $$f >> \
104			    $(ROOTMSGDIR)/$$d.po; \
105		done; \
106		$(CHMOD) $(FILEMODE) $(ROOTMSGDIR)/$$d.po; \
107		fi; \
108		x="`$(ECHO) $$d/*.msg`"; \
109		y="$$d/"'*.msg'; \
110		if test "$$x" != "$$y"; then \
111		for f in $$d/*.msg; \
112		do \
113			x="`basename $$f`"; \
114			$(RM) $(ROOTMSGDIR)/$$x; \
115			$(CP) $$f $(ROOTMSGDIR); \
116			$(CHMOD) $(FILEMODE) $(ROOTMSGDIR)/$$x; \
117		done; \
118		fi; \
119	done)
120	(cd $(MSGROOT)/LC_TIME; \
121	for d in SUNW*;\
122	do \
123		$(RM) $(ROOTTIMEDIR)/$$d.po; \
124		for f in $$d/*.po; \
125		do \
126			$(ECHO) '#'$(PO_LABEL)$$f >> $(ROOTTIMEDIR)/$$d.po; \
127			$(SED) -e '/^# msg/d' -e '/^domain/d' $$f >> \
128			    $(ROOTTIMEDIR)/$$d.po; \
129		done; \
130		$(CHMOD) $(FILEMODE) $(ROOTTIMEDIR)/$$d.po; \
131	done)
132
133FRC:
134