xref: /illumos-gate/usr/src/cmd/genmsg/Makefile (revision 33efde4275d24731ef87927237b0ffb0630b6b2d)
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
26include ../Makefile.cmd
27
28PROG=		genmsg
29PSRC_Y=		genmsg.y
30C_OBJS=         main.o util.o
31
32LEXARGS=
33LEXSRCS=	genmsg.l
34LEXINTSRCS=	lex.yy.c
35LEXOBJS=	lex.yy.o
36
37CERRWARN +=	-_gcc=-Wno-parentheses
38CERRWARN +=	-_gcc=-Wno-unused-variable
39
40# because of labels from yacc
41genmsg.o := CERRWARN +=	-_gcc=-Wno-unused-label
42genmsg.o := SMATCH=off
43
44LDLIBS += -ll
45YFLAGS = -d
46CPPFLAGS = -I../head $(CPPFLAGS.master)
47
48# genmsg has a name clash with main() and libl.so.1.  However, genmsg must
49# still export a number of "yy*" (libl) interfaces.  Reduce all other symbols
50# to local scope.
51MAPFILES +=	$(MAPFILE.LEX) $(MAPFILE.NGB)
52MAPOPTS =	$(MAPFILES:%=-Wl,-M%)
53
54LDFLAGS +=	$(MAPOPTS)
55
56OBJS =          $(C_OBJS) $(PSRC_Y:%.y=%.o) $(LEXOBJS)
57PSRC_C =        $(PSRC_Y:%.y=%.c)
58SRCS =          $(C_OBJS:%.o=%.c) $(PSRC_C) $(LEXINTSRCS)
59
60.KEEP_STATE:
61
62all:    $(PROG)
63
64install: all $(ROOTPROG)
65
66$(PROG): $(OBJS) $(MAPFILES)
67	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
68	$(POST_PROCESS)
69
70$(LEXINTSRCS): $(LEXSRCS)
71	$(LEX) $(LEXARGS) $(LEXSRCS)
72
73$(PSRC_C) + y.tab.h:    $(PSRC_Y)
74	$(YACC) $(YFLAGS) $(PSRC_Y)
75	$(MV) y.tab.c $(PSRC_C)
76
77$(OBJS): y.tab.h lex.yy.c
78
79catalog:        $(POFILE)
80
81$(POFILE):      $(SRCS)
82	$(RM) $@
83	$(COMPILE.cpp) $(SRCS)  > $(POFILE).i
84	$(XGETTEXT) $(XGETFLAGS)        $(POFILE).i
85	$(SED) "/^domain/d" messages.po > $@
86	$(RM) $(POFILE).i messages.po
87
88clean:
89	$(RM) $(OBJS) $(PSRC_C) $(LEXINTSRCS) y.tab.h *.po
90
91include ../Makefile.targ
92