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