xref: /titanic_50/usr/src/lib/Makefile.astmsg (revision eab227978ccdaa5a7cc9fd92ace768915dae3a2b)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27#
28# Temporarily control building AST l10n catalogs until all build
29# machines have been updated.
30#
31
32# Should we build AST l10n catalogs ?
33# This can be overridden at build time via:
34# $ export ON_BUILD_AST_L10N_CATALOGS=0
35ON_BUILD_AST_L10N_CATALOGS=1
36
37DO_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:0=$(POUND_SIGN))
38DONT_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:1=$(POUND_SIGN))
39DO_BUILD_AST_CATALOGS=		$(DO_BUILD_AST_CATALOGS_1:1=)
40DONT_BUILD_AST_CATALOGS=	$(DONT_BUILD_AST_CATALOGS_1:0=)
41
42#
43# l10n message catalog generation for AST libraries
44#
45
46MSGLIBNAME= $(LIBRARY:.a=)
47ASTMSGCATALOG= $(ROOT)/usr/lib/locale/C/LC_MESSAGES/$(MSGLIBNAME)
48
49$(DO_BUILD_AST_CATALOGS)ASTMSGCC= \
50	PATH="/usr/ast/bin/:/bin:/usr/bin" \
51		/usr/bin/ksh93 /usr/ast/bin/msgcc >>msgcc.out 2>&1
52
53ASTMSGS=  $(OBJECTS:%.o=msgs/%.mso)
54
55# cpp defines needed by msgcc
56i386_ASTMSGCCFLAGS=	-D__i386
57amd64_ASTMSGCCFLAGS=	-D__amd64
58sparc_ASTMSGCCFLAGS=	-D__sparc
59sparcv9_ASTMSGCCFLAGS=	-D__sparcv9
60ASTMSGCCFLAGS= -D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR $($(TARGETMACH)_ASTMSGCCFLAGS)
61
62msgs/%.mso: ../common/%.c
63	@mkdir -p "$$(dirname "$@")" ; \
64	print "# Processing file $< to $@" >>msgcc.out  ; \
65	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
66msgs/%.mso: ../%.c
67	@mkdir -p "$$(dirname "$@")" ; \
68	print "# Processing file $< to $@" >>msgcc.out  ; \
69	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
70
71$(MSGLIBNAME).msg: $(ASTMSGS)
72	@print "# Processing files $(ASTMSGS) to $@" >>msgcc.out ; \
73	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ $(ASTMSGS)
74
75$(ASTMSGCATALOG): $(MSGLIBNAME).msg
76	@$(RM) "$(ASTMSGCATALOG)" ; \
77	sed 's/^$$translation msgcc .*//' <"$(MSGLIBNAME).msg" | gencat "$@" - ; \
78	$(CHMOD) 0644 $(ASTMSGCATALOG)
79
80# Main catalog target
81$(DO_BUILD_AST_CATALOGS)_msg: $(ASTMSGCATALOG)
82
83# Create empty catalog file when we do not build it (to avoid that we have to hack the
84# package database each time we toggle the switch)
85$(DONT_BUILD_AST_CATALOGS)_msg:
86$(DONT_BUILD_AST_CATALOGS)	$(RM) $(ASTMSGCATALOG) ; \
87	$(TOUCH) $(ASTMSGCATALOG) ; \
88	$(CHMOD) 0644 $(ASTMSGCATALOG)
89
90# Add message catalogs to the list of files to "clobber"
91CLOBBERFILES += \
92	$(ASTMSGS) \
93	$(ASTMSGCATALOG) \
94	$(MSGLIBNAME).msg \
95	msgcc.out
96