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