xref: /illumos-gate/usr/src/cmd/msgfmt/Makefile (revision ac2f5fbefc05314fcd97b03f2338b39e6efe643f)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#       Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
26#         All Rights Reserved
27#
28# Copyright 2017 Joyent, Inc.
29#
30
31# cmd/msgfmt/Makefile
32
33include ../Makefile.cmd
34
35XOBJS=	xgettext.o
36
37LXOBJS=	xgettext.lx.o
38
39GOBJS=	gnu_msgfmt.o gnu_handle.o gnu_lex.o gnu_hash.o gnu_check.o
40
41YOBJS=	gnu_po.o
42
43BOBJS=	gnu_msgs.o
44
45LOBJS=	gnu_msgs_rev.o
46
47SOBJS=	msgfmt.o check_header.o
48
49COBJS=	option.o util.o
50
51BINPROG= msgfmt xgettext
52LIBPROG= gmsgfmt
53PROG=  $(BINPROG) $(LIBPROG)
54
55YFLAGS += -d
56LINTFLAGS +=	-um
57
58POFILE= msgfmt_all.po
59POFILES= $(SOBJS:%.o=%.po) $(GOBJS:%.o=%.po) $(COBJS:%.o=%.po) \
60	$(BOBJS:%.o=%.po) $(YOBJS:%.o=%.po)
61
62CLOBBERFILES += gmsgfmt_rev
63
64ROOTBINPROG= $(BINPROG:%=$(ROOTBIN)/%)
65ROOTLIBPROG= $(LIBPROG:%=$(ROOTLIB)/%)
66
67CERRWARN += -_gcc=-Wno-parentheses
68CERRWARN += -_gcc=-Wno-unused-label
69CERRWARN += $(CNOWARN_UNINIT)
70CERRWARN += -_gcc=-Wno-unused-variable
71
72.KEEP_STATE:
73
74.PARALLEL:	$(SOBJS) $(GOBJS) $(YOBJS) $(COBJS) $(BOBJS) $(LOBJS) \
75		$(XOBJS) $(LXOBJS)
76
77all: $(PROG) gmsgfmt_rev
78
79msgfmt:	$(SOBJS) $(COBJS)
80	$(LINK.c) $(SOBJS) $(COBJS) -o $@ $(LDLIBS)
81	$(POST_PROCESS)
82
83gmsgfmt:	$(GOBJS) $(YOBJS) $(BOBJS) $(COBJS)
84	$(LINK.c) $(GOBJS) $(YOBJS) $(BOBJS) $(COBJS) -o $@ $(LDLIBS)
85	$(POST_PROCESS)
86
87gmsgfmt_rev:	$(GOBJS) $(YOBJS) $(LOBJS) $(COBJS)
88	$(LINK.c) $(GOBJS) $(YOBJS) $(LOBJS) $(COBJS) -o $@ $(LDLIBS)
89	$(POST_PROCESS)
90
91xgettext: $(XOBJS) $(LXOBJS)
92	$(LINK.c) $(XOBJS) $(LXOBJS) -o $@ $(LDLIBS)
93	$(POST_PROCESS)
94
95$(POFILES): y.tab.h
96
97$(POFILE):	$(POFILES)
98	$(RM) $@
99	cat $(POFILES) > $@
100
101install: all $(ROOTBINPROG) $(ROOTLIBPROG)
102
103clean:
104	$(RM) $(SOBJS) $(GOBJS) $(YOBJS) $(COBJS) \
105		$(XOBJS) $(LXOBJS) $(BOBJS) $(LOBJS) \
106		$(POFILE) $(POFILES) gnu_po.c y.tab.h xgettext.lx.c
107
108lint:	gnu_po.c y.tab.h
109	$(LINT.c) $(SOBJS:%.o=%.c) $(COBJS:%.o=%.c) $(LDLIBS)
110	$(LINT.c) $(GOBJS:%.o=%.c) $(BOBJS:%.o=%.c) $(COBJS:%.o=%.c) $(LDLIBS)
111	$(LINT.c) $(GOBJS:%.o=%.c) $(LOBJS:%.o=%.c) $(COBJS:%.o=%.c) $(LDLIBS)
112	$(LINT.c) $(XOBJS:%.o=%.c) $(LDLIBS)
113
114gnu_po.c + y.tab.h:	gnu_po.y
115	$(RM) gnu_po.c y.tab.h
116	$(YACC.y) gnu_po.y
117	mv y.tab.c gnu_po.c
118
119gnu_lex.o:	y.tab.h
120
121include ../Makefile.targ
122