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