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