xref: /illumos-gate/usr/src/cmd/zonecfg/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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright 2019 Joyent, Inc.
26#
27
28PROG=	zonecfg
29OBJS=	zonecfg.o zonecfg_lex.o zonecfg_grammar.tab.o
30
31include ../Makefile.cmd
32
33# zonecfg has a name clash with main() and libl.so.1.  However, zonecfg must
34# still export a number of "yy*" (libl) interfaces.  Reduce all other symbols
35# to local scope.
36MAPFILES +=	$(MAPFILE.LEX) $(MAPFILE.NGB)
37MAPOPTS =	$(MAPFILES:%=-Wl,-M%)
38
39LFLAGS =	-t
40YFLAGS =	-d -b zonecfg_grammar
41LDLIBS +=	-lzonecfg -ll -lnsl -ltecla -lzfs -lbrand -ldladm -linetutil
42CPPFLAGS +=	-I.
43LDFLAGS +=	$(MAPOPTS)
44CLEANFILES +=	zonecfg_lex.c zonecfg_grammar.tab.c zonecfg_grammar.tab.h
45
46CERRWARN +=	$(CNOWARN_UNINIT)
47CERRWARN +=	-_gcc=-Wno-unused-variable
48CERRWARN +=	-_gcc=-Wno-implicit-function-declaration
49
50SMOFF += all_func_returns
51
52# false positive
53zonecfg_lex.o := SMOFF += free
54
55.KEEP_STATE:
56
57all: $(PROG)
58
59$(PROG): $(OBJS) $(MAPFILES)
60	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
61	$(POST_PROCESS)
62
63install: all $(ROOTUSRSBINPROG)
64
65zonecfg_lex.c:	zonecfg_lex.l zonecfg_grammar.tab.h zonecfg.h
66	$(LEX) $(LFLAGS) zonecfg_lex.l > $@
67
68zonecfg_grammar.tab.h zonecfg_grammar.tab.c:	zonecfg_grammar.y zonecfg.h
69	$(YACC) $(YFLAGS) zonecfg_grammar.y
70
71# because of labels from yacc
72zonecfg_lex.o zonecfg_grammar.tab.o := CCVERBOSE =
73zonecfg_lex.o zonecfg_grammar.tab.o := CERRWARN += -_gcc=-Wno-unused-label
74
75check:	$(PROG).c $(PROG).h
76	$(CSTYLE) -pP $(PROG).c $(PROG).h
77	$(HDRCHK) $(PROG).h
78
79clean:
80	$(RM) $(OBJS) $(CLEANFILES)
81
82include ../Makefile.targ
83