xref: /illumos-gate/usr/src/cmd/sgs/messages/Makefile.targ (revision 440a8a36792bdf9ef51639066aab0b7771ffcab8)
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# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
26#
27
28all:		$(POFILE)
29
30include		$(SRC)/cmd/Makefile.targ
31
32catalog \
33install:	$(MSGDOMAIN)/$(POFILE)
34
35$(MSGDOMAIN)/$(POFILE): \
36		$(MSGDOMAIN) $(POFILE)
37		$(RM) $(MSGDOMAIN)/$(POFILE)
38		cp $(POFILE) $(MSGDOMAIN)
39
40delete:
41
42clean:
43		$(RM) $(CLEANFILES)
44
45# The elfedit modules message files need a special rule that runs
46# the elfedit catalog target. It generates module messages files
47# as part of that process.
48$(POFILES_ELFEDIT_MODULES) :
49		@ cd ../../elfedit; pwd; $(MAKE) catalog
50
51$(POFILE):	$(POFILES) $(POFILES_ELFEDIT_MODULES)
52		$(RM) $(POFILE)
53		cat $(POFILES) $(POFILES_ELFEDIT_MODULES) > $(POFILE)
54
55
56# Install a local version of the message catalog.  Test using: LANG=piglatin
57
58test:		$(MSGDIR)/$(TEST_MOFILE)
59
60$(MSGDIR)/$(TEST_MOFILE): \
61		$(MSGDIR) $(TEST_MSGID) $(TEST_MSGSTR)
62		$(RM) $(MSGDIR)/$(TEXT_DOMAIN).mo
63		sort -n $(TEST_MSGID) $(TEST_MSGSTR) | \
64			sed -e "s/ *[0-9]*	//" > $(TEST_POFILE)
65		$(MSGFMT) -o $(MSGDIR)/$(TEST_MOFILE) $(TEST_POFILE)
66
67$(TEST_MSGID):	$(POFILE)
68		grep "^msgid" $(POFILE) | \
69			$(SGSMSG_PIGLATIN_NL) 1 > $(TEST_MSGID)
70
71$(TEST_MSGSTR):	$(POFILE)
72		cat $(POFILE) | $(SGSTOOLS)/$(MACH)/piglatin | \
73		    grep "^sgidmay" | sed -e "s/^sgidmay/msgstr/" | \
74		    $(SGSMSG_PIGLATIN_NL) 2 > $(TEST_MSGSTR)
75
76$(MSGDIR):
77		-@mkdir -p $(MSGDIR)
78