xref: /illumos-gate/usr/src/lib/scsi/plugins/smp/Makefile.lib (revision 8d0c3d29bb99f6521f2dc5058a7e4debebad7899)
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
63LINTFLAGS += -mu
64LINTFILES = $(SRCS:%.c=%.ln)
65
66DMODLINTTGT = $(DMOD:%=lint_dmod)
67DMODLINTFILES = $(DMOD_SRCS:%.c=%.ln)
68
69APIMAP = ../../../../libsmp/libsmp_api.map
70
71C99MODE = $(C99_ENABLE)
72CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
73CFLAGS += -G $(XREGSFLAG)
74CFLAGS64 += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
75CFLAGS64 += -G $(XREGSFLAG)
76CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
77$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
78LDFLAGS += $(ZTEXT) $(ZCOMBRELOC) $(ZIGNORE)
79
80$(PROG) := LDFLAGS += $(ZDEFS) -M$(APIMAP)
81$(PROG) := LDLIBS += -lc
82
83$(DMODPROG) := LDFLAGS += $(ZNODEFS)
84