xref: /titanic_51/usr/src/lib/Makefile.astmsg (revision 7c2fbfb345896881c631598ee3852ce9ce33fb07)
1da2e3ebdSchin#
2da2e3ebdSchin# CDDL HEADER START
3da2e3ebdSchin#
4da2e3ebdSchin# The contents of this file are subject to the terms of the
5da2e3ebdSchin# Common Development and Distribution License (the "License").
6da2e3ebdSchin# You may not use this file except in compliance with the License.
7da2e3ebdSchin#
8da2e3ebdSchin# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9da2e3ebdSchin# or http://www.opensolaris.org/os/licensing.
10da2e3ebdSchin# See the License for the specific language governing permissions
11da2e3ebdSchin# and limitations under the License.
12da2e3ebdSchin#
13da2e3ebdSchin# When distributing Covered Code, include this CDDL HEADER in each
14da2e3ebdSchin# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15da2e3ebdSchin# If applicable, add the following below this CDDL HEADER, with the
16da2e3ebdSchin# fields enclosed by brackets "[]" replaced with your own identifying
17da2e3ebdSchin# information: Portions Copyright [yyyy] [name of copyright owner]
18da2e3ebdSchin#
19da2e3ebdSchin# CDDL HEADER END
20da2e3ebdSchin#
21*7c2fbfb3SApril Chin
22da2e3ebdSchin#
23*7c2fbfb3SApril Chin# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24da2e3ebdSchin# Use is subject to license terms.
25da2e3ebdSchin#
26da2e3ebdSchin
27da2e3ebdSchin#
28da2e3ebdSchin# Temporarily control building AST l10n catalogs until all build
29da2e3ebdSchin# machines have been updated.
30da2e3ebdSchin#
31da2e3ebdSchin
32da2e3ebdSchin# Should we build AST l10n catalogs ?
33da2e3ebdSchin# This can be overridden at build time via:
34*7c2fbfb3SApril Chin# $ export ON_BUILD_AST_L10N_CATALOGS=0
35*7c2fbfb3SApril ChinON_BUILD_AST_L10N_CATALOGS=1
36da2e3ebdSchin
37da2e3ebdSchinDO_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:0=$(POUND_SIGN))
38da2e3ebdSchinDONT_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:1=$(POUND_SIGN))
39da2e3ebdSchinDO_BUILD_AST_CATALOGS=		$(DO_BUILD_AST_CATALOGS_1:1=)
40da2e3ebdSchinDONT_BUILD_AST_CATALOGS=	$(DONT_BUILD_AST_CATALOGS_1:0=)
41da2e3ebdSchin
42da2e3ebdSchin#
43da2e3ebdSchin# l10n message catalog generation for AST libraries
44da2e3ebdSchin#
45da2e3ebdSchin
46da2e3ebdSchinMSGLIBNAME= $(LIBRARY:.a=)
47da2e3ebdSchinASTMSGCATALOG= $(ROOT)/usr/lib/locale/C/LC_MESSAGES/$(MSGLIBNAME)
48da2e3ebdSchin
49da2e3ebdSchin$(DO_BUILD_AST_CATALOGS)ASTMSGCC= \
50*7c2fbfb3SApril Chin	PATH="/usr/ast/bin/:/bin:/usr/bin" \
51*7c2fbfb3SApril Chin		/usr/bin/ksh93 /usr/ast/bin/msgcc >>msgcc.out 2>&1
52da2e3ebdSchin
53da2e3ebdSchinASTMSGS=  $(OBJECTS:%.o=msgs/%.mso)
54da2e3ebdSchin
55da2e3ebdSchin# cpp defines needed by msgcc
56da2e3ebdSchini386_ASTMSGCCFLAGS=	-D__i386
57da2e3ebdSchinamd64_ASTMSGCCFLAGS=	-D__amd64
58da2e3ebdSchinsparc_ASTMSGCCFLAGS=	-D__sparc
59da2e3ebdSchinsparcv9_ASTMSGCCFLAGS=	-D__sparcv9
60da2e3ebdSchinASTMSGCCFLAGS= -D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR $($(TARGETMACH)_ASTMSGCCFLAGS)
61da2e3ebdSchin
62da2e3ebdSchinmsgs/%.mso: ../common/%.c
63da2e3ebdSchin	@mkdir -p "$$(dirname "$@")" ; \
64da2e3ebdSchin	print "# Processing file $< to $@" >>msgcc.out  ; \
65da2e3ebdSchin	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
66da2e3ebdSchinmsgs/%.mso: ../%.c
67da2e3ebdSchin	@mkdir -p "$$(dirname "$@")" ; \
68da2e3ebdSchin	print "# Processing file $< to $@" >>msgcc.out  ; \
69da2e3ebdSchin	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
70da2e3ebdSchin
71da2e3ebdSchin$(MSGLIBNAME).msg: $(ASTMSGS)
72da2e3ebdSchin	@print "# Processing files $(ASTMSGS) to $@" >>msgcc.out ; \
73da2e3ebdSchin	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ $(ASTMSGS)
74da2e3ebdSchin
75da2e3ebdSchin$(ASTMSGCATALOG): $(MSGLIBNAME).msg
76da2e3ebdSchin	@$(RM) "$(ASTMSGCATALOG)" ; \
77fd66f38dSchin	sed 's/^$$translation msgcc .*//' <"$(MSGLIBNAME).msg" | gencat "$@" - ; \
78fd66f38dSchin	$(CHMOD) 0644 $(ASTMSGCATALOG)
79da2e3ebdSchin
80da2e3ebdSchin# Main catalog target
81da2e3ebdSchin$(DO_BUILD_AST_CATALOGS)_msg: $(ASTMSGCATALOG)
82da2e3ebdSchin
83da2e3ebdSchin# Create empty catalog file when we do not build it (to avoid that we have to hack the
84da2e3ebdSchin# package database each time we toggle the switch)
85da2e3ebdSchin$(DONT_BUILD_AST_CATALOGS)_msg:
86da2e3ebdSchin$(DONT_BUILD_AST_CATALOGS)	$(RM) $(ASTMSGCATALOG) ; \
87fd66f38dSchin	$(TOUCH) $(ASTMSGCATALOG) ; \
88fd66f38dSchin	$(CHMOD) 0644 $(ASTMSGCATALOG)
89da2e3ebdSchin
90da2e3ebdSchin# Add message catalogs to the list of files to "clobber"
91da2e3ebdSchinCLOBBERFILES += \
92da2e3ebdSchin	$(ASTMSGS) \
93da2e3ebdSchin	$(ASTMSGCATALOG) \
94da2e3ebdSchin	$(MSGLIBNAME).msg \
95da2e3ebdSchin	msgcc.out
96