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