xref: /onnv-gate/usr/src/lib/Makefile.astmsg (revision 8462:6e341f5569ba)
14887Schin#
24887Schin# CDDL HEADER START
34887Schin#
44887Schin# The contents of this file are subject to the terms of the
54887Schin# Common Development and Distribution License (the "License").
64887Schin# You may not use this file except in compliance with the License.
74887Schin#
84887Schin# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94887Schin# or http://www.opensolaris.org/os/licensing.
104887Schin# See the License for the specific language governing permissions
114887Schin# and limitations under the License.
124887Schin#
134887Schin# When distributing Covered Code, include this CDDL HEADER in each
144887Schin# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154887Schin# If applicable, add the following below this CDDL HEADER, with the
164887Schin# fields enclosed by brackets "[]" replaced with your own identifying
174887Schin# information: Portions Copyright [yyyy] [name of copyright owner]
184887Schin#
194887Schin# CDDL HEADER END
204887Schin#
21*8462SApril.Chin@Sun.COM
224887Schin#
23*8462SApril.Chin@Sun.COM# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
244887Schin# Use is subject to license terms.
254887Schin#
264887Schin
274887Schin#
284887Schin# Temporarily control building AST l10n catalogs until all build
294887Schin# machines have been updated.
304887Schin#
314887Schin
324887Schin# Should we build AST l10n catalogs ?
334887Schin# This can be overridden at build time via:
34*8462SApril.Chin@Sun.COM# $ export ON_BUILD_AST_L10N_CATALOGS=0
35*8462SApril.Chin@Sun.COMON_BUILD_AST_L10N_CATALOGS=1
364887Schin
374887SchinDO_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:0=$(POUND_SIGN))
384887SchinDONT_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:1=$(POUND_SIGN))
394887SchinDO_BUILD_AST_CATALOGS=		$(DO_BUILD_AST_CATALOGS_1:1=)
404887SchinDONT_BUILD_AST_CATALOGS=	$(DONT_BUILD_AST_CATALOGS_1:0=)
414887Schin
424887Schin#
434887Schin# l10n message catalog generation for AST libraries
444887Schin#
454887Schin
464887SchinMSGLIBNAME= $(LIBRARY:.a=)
474887SchinASTMSGCATALOG= $(ROOT)/usr/lib/locale/C/LC_MESSAGES/$(MSGLIBNAME)
484887Schin
494887Schin$(DO_BUILD_AST_CATALOGS)ASTMSGCC= \
50*8462SApril.Chin@Sun.COM	PATH="/usr/ast/bin/:/bin:/usr/bin" \
51*8462SApril.Chin@Sun.COM		/usr/bin/ksh93 /usr/ast/bin/msgcc >>msgcc.out 2>&1
524887Schin
534887SchinASTMSGS=  $(OBJECTS:%.o=msgs/%.mso)
544887Schin
554887Schin# cpp defines needed by msgcc
564887Schini386_ASTMSGCCFLAGS=	-D__i386
574887Schinamd64_ASTMSGCCFLAGS=	-D__amd64
584887Schinsparc_ASTMSGCCFLAGS=	-D__sparc
594887Schinsparcv9_ASTMSGCCFLAGS=	-D__sparcv9
604887SchinASTMSGCCFLAGS= -D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR $($(TARGETMACH)_ASTMSGCCFLAGS)
614887Schin
624887Schinmsgs/%.mso: ../common/%.c
634887Schin	@mkdir -p "$$(dirname "$@")" ; \
644887Schin	print "# Processing file $< to $@" >>msgcc.out  ; \
654887Schin	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
664887Schinmsgs/%.mso: ../%.c
674887Schin	@mkdir -p "$$(dirname "$@")" ; \
684887Schin	print "# Processing file $< to $@" >>msgcc.out  ; \
694887Schin	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -c "$<" -o "$@"
704887Schin
714887Schin$(MSGLIBNAME).msg: $(ASTMSGS)
724887Schin	@print "# Processing files $(ASTMSGS) to $@" >>msgcc.out ; \
734887Schin	$(ASTMSGCC) -M-set=ast $(ASTMSGCCFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ $(ASTMSGS)
744887Schin
754887Schin$(ASTMSGCATALOG): $(MSGLIBNAME).msg
764887Schin	@$(RM) "$(ASTMSGCATALOG)" ; \
774941Schin	sed 's/^$$translation msgcc .*//' <"$(MSGLIBNAME).msg" | gencat "$@" - ; \
784941Schin	$(CHMOD) 0644 $(ASTMSGCATALOG)
794887Schin
804887Schin# Main catalog target
814887Schin$(DO_BUILD_AST_CATALOGS)_msg: $(ASTMSGCATALOG)
824887Schin
834887Schin# Create empty catalog file when we do not build it (to avoid that we have to hack the
844887Schin# package database each time we toggle the switch)
854887Schin$(DONT_BUILD_AST_CATALOGS)_msg:
864887Schin$(DONT_BUILD_AST_CATALOGS)	$(RM) $(ASTMSGCATALOG) ; \
874941Schin	$(TOUCH) $(ASTMSGCATALOG) ; \
884941Schin	$(CHMOD) 0644 $(ASTMSGCATALOG)
894887Schin
904887Schin# Add message catalogs to the list of files to "clobber"
914887SchinCLOBBERFILES += \
924887Schin	$(ASTMSGS) \
934887Schin	$(ASTMSGCATALOG) \
944887Schin	$(MSGLIBNAME).msg \
954887Schin	msgcc.out
96