xref: /illumos-gate/usr/src/lib/scsi/plugins/ses/Makefile.lib (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27.KEEP_STATE:
28.SUFFIXES:
29
30include ../../../../../../cmd/Makefile.cmd
31include ../../../../Makefile.defs
32
33#
34# Set PROG and OBJS based on the values of MODULE and SRCS.  We expect that
35# these macros to be defined by the Makefile that is including this file.
36#
37PROG = $(MODULE:%=%.so)
38YOBJS = $(YSRCS:%.y=%.o)
39OBJS = $(YOBJS) $(SRCS:%.c=%.o)
40
41#
42# A module may set DMOD and DMOD_SRCS if it has a mdb proc module.
43# DMOD, if set, must match PROG above (for mdb autoloading) so it will
44# be built in a subdirectory.
45#
46ROOTDMOD = $(DMOD:%.so=$(ROOT)/usr/lib/mdb/proc/%.so)
47ROOTDMOD64 = $(DMOD:%.so=$(ROOT)/usr/lib/mdb/proc/$(MACH64)/%.so)
48DMODPROG = $(DMOD:%=dmod/%)
49DMOD_OBJS = $(DMOD_SRCS:%.c=%.o)
50
51ROOTPLUGINDIR = $(ROOTPLUGINLIBDIR)/ses/$(PLUGINTYPE)
52ROOTPLUGINDIR64 = $(ROOTPLUGINLIBDIR)/ses/$(PLUGINTYPE)/$(MACH64)
53
54ROOTPROG = $(ROOTPLUGINDIR)/$(PROG)
55ROOTPROG64 = $(ROOTPLUGINDIR64)/$(PROG)
56
57#
58# A module can set ALIASES as a list of additional names to correspond to the
59# same library.
60#
61ROOTALIASES = $(ALIASES:%=$(ROOTPLUGINDIR)/%.so)
62ROOTALIASES64 = $(ALIASES:%=$(ROOTPLUGINDIR64)/%.so)
63
64APIMAP = ../../../../libses/libses_api.map
65
66CSTD = $(CSTD_GNU99)
67CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
68CFLAGS += $(GSHARED) $(XREGSFLAG)
69CFLAGS64 += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
70CFLAGS64 += $(GSHARED) $(XREGSFLAG)
71CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
72$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
73LDFLAGS += $(ZTEXT) $(ZIGNORE)
74
75$(PROG) := LDFLAGS += $(ZDEFS) -Wl,-M$(APIMAP)
76$(PROG) := LDLIBS += -lc -lnvpair
77
78$(DMODPROG) := LDFLAGS += $(ZNODEFS)
79