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