xref: /illumos-gate/usr/src/cmd/genmsg/Makefile (revision d1e631af56641f21cde1f1efe3a9623ff9d6ee7c)
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# lex and yacc generates lint-unclean C code.
46LINTSUPPRESS=	\
47	-erroff=E_FUNC_RET_MAYBE_IGNORED2 \
48	-erroff=E_EQUALITY_NOT_ASSIGNMENT \
49	-erroff=E_BLOCK_DECL_UNUSED
50
51LINTFLAGS +=	-um
52
53# genmsg has a name clash with main() and libl.so.1.  However, genmsg must
54# still export a number of "yy*" (libl) interfaces.  Reduce all other symbols
55# to local scope.
56MAPFILES +=	$(MAPFILE.LEX) $(MAPFILE.NGB)
57MAPOPTS =	$(MAPFILES:%=-M%)
58
59LDFLAGS +=	$(MAPOPTS)
60
61OBJS =          $(C_OBJS) $(PSRC_Y:%.y=%.o) $(LEXOBJS)
62PSRC_C =        $(PSRC_Y:%.y=%.c)
63SRCS =          $(C_OBJS:%.o=%.c) $(PSRC_C) $(LEXINTSRCS)
64
65.KEEP_STATE:
66
67all:    $(PROG)
68
69install: all $(ROOTPROG)
70
71$(PROG): $(OBJS) $(MAPFILES)
72	$(CC) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
73	$(POST_PROCESS)
74
75$(LEXINTSRCS): $(LEXSRCS)
76	$(LEX) $(LEXARGS) $(LEXSRCS)
77
78$(PSRC_C) + y.tab.h:    $(PSRC_Y)
79	$(YACC) $(YFLAGS) $(PSRC_Y)
80	$(MV) y.tab.c $(PSRC_C)
81
82$(OBJS): y.tab.h lex.yy.c
83
84catalog:        $(POFILE)
85
86$(POFILE):      $(SRCS)
87	$(RM) $@
88	$(COMPILE.cpp) $(SRCS)  > $(POFILE).i
89	$(XGETTEXT) $(XGETFLAGS)        $(POFILE).i
90	$(SED) "/^domain/d" messages.po > $@
91	$(RM) $(POFILE).i messages.po
92
93lint:	$(LEXINTSRCS) $(PSRC_C)
94	$(LINT.c) $(C_OBJS:%.o=%.c) $(LDLIBS)
95	$(LINT.c) $(LEXINTSRCS) $(PSRC_C) $(LINTSUPPRESS) $(LDLIBS)
96
97clean:
98	$(RM) $(OBJS) $(PSRC_C) $(LEXINTSRCS) y.tab.h *.po
99
100include ../Makefile.targ
101