xref: /illumos-gate/usr/src/cmd/sgs/messages/Makefile.targ (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
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
40clean:
41		$(RM) $(CLEANFILES)
42
43# The elfedit modules message files need a special rule that runs
44# the elfedit catalog target. It generates module messages files
45# as part of that process.
46$(POFILES_ELFEDIT_MODULES) :
47		@ cd ../../elfedit; pwd; $(MAKE) catalog
48
49$(POFILE):	$(POFILES) $(POFILES_ELFEDIT_MODULES)
50		$(RM) $(POFILE)
51		cat $(POFILES) $(POFILES_ELFEDIT_MODULES) > $(POFILE)
52
53
54# Install a local version of the message catalog.  Test using: LANG=piglatin
55
56test:		$(MSGDIR)/$(TEST_MOFILE)
57
58$(MSGDIR)/$(TEST_MOFILE): \
59		$(MSGDIR) $(TEST_MSGID) $(TEST_MSGSTR)
60		$(RM) $(MSGDIR)/$(TEXT_DOMAIN).mo
61		sort -n $(TEST_MSGID) $(TEST_MSGSTR) | \
62			sed -e "s/ *[0-9]*	//" > $(TEST_POFILE)
63		$(MSGFMT) -o $(MSGDIR)/$(TEST_MOFILE) $(TEST_POFILE)
64
65$(TEST_MSGID):	$(POFILE)
66		grep "^msgid" $(POFILE) | \
67			$(SGSMSG_PIGLATIN_NL) 1 > $(TEST_MSGID)
68
69$(TEST_MSGSTR):	$(POFILE)
70		cat $(POFILE) | $(SGSTOOLS)/$(MACH)/piglatin | \
71		    grep "^sgidmay" | sed -e "s/^sgidmay/msgstr/" | \
72		    $(SGSMSG_PIGLATIN_NL) 2 > $(TEST_MSGSTR)
73
74$(MSGDIR):
75		-@mkdir -p $(MSGDIR)
76