xref: /titanic_44/usr/src/lib/fm/topo/modules/Makefile.plugin (revision 5ad1f010a7b934be6e0dd6c13198af62791824be)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26.KEEP_STATE:
27.SUFFIXES:
28
29MODCLASS = plugins
30
31include ../../../../Makefile.lib
32include ../../../../../Makefile.lib
33
34#
35# Set PROG and OBJS based on the values of MODULE and SRCS.  We expect that
36# these macros to be defined by the Makefile that is including this file.
37#
38# SHAREDSRCS is used to share sources between multiple libtopo modules.
39#
40SRCS = $(MODULESRCS:%.c=%.c) $(SHAREDSRCS:%.c=../../common/$(SHAREDMODULE)/%.c)
41PROG = $(MODULE:%=%.so)
42OBJS = $(MODULESRCS:%.c=%.o) $(SHAREDSRCS:%.c=%.o)
43
44#
45# Set ROOTPROG and ROOTCONF based on the values of MODULE, CLASS, and PLATFORMS
46# We expect these macros to be defined by the Makefile that is including us.
47#
48common_ROOTPROG = $(ROOT)/usr/lib/fm/topo/plugins/$(PROG)
49arch_ROOTPROG = $(ROOT)/usr/platform/$(ARCH)/lib/fm/topo/plugins/$(PROG)
50plat_ROOTPROG = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/topo/plugins/$(PROG))
51ROOTPROG = $($(CLASS)_ROOTPROG)
52
53common_ROOTCONF = $(ROOT)/usr/lib/fm/topo/plugins/$(CONF)
54arch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/topo/plugins/$(CONF)
55plat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/topo/plugins/$(CONF))
56ROOTCONF = $($(CLASS)_ROOTCONF)
57
58LINTFLAGS = -msux
59LINTFILES = $(SRCS:%.c=%.ln)
60
61APIMAP = ../../../libtopo/common/topo_mod.map
62MAPFILES =		# use APIMAP instead
63
64C99MODE  = $(C99_ENABLE)
65CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
66CFLAGS += -G $(XREGSFLAG)
67
68CPPFLAGS += -I.
69CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
70LDFLAGS += $(ZIGNORE) -M$(APIMAP)
71LDLIBS += -L$(ROOTLIBDIR)/fm -ltopo -lnvpair -lc
72DYNFLAGS += -R/usr/lib/fm
73
74all: $(PROG)
75
76.NO_PARALLEL:
77.PARALLEL: $(OBJS) $(LINTFILES)
78
79$(PROG): $(OBJS) $(APIMAP)
80	$(LINK.c) $(DYNFLAGS) $(OBJS) -o $@ $(LDLIBS)
81	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
82	$(POST_PROCESS_SO)
83
84%.o: ../../common/$(MODULE)/%.c
85	$(COMPILE.c) $<
86	$(CTFCONVERT_O)
87
88%.o: ../../common/$(SHAREDMODULE)/%.c
89	$(COMPILE.c) $<
90	$(CTFCONVERT_O)
91
92%.o: %.c
93	$(COMPILE.c) $<
94	$(CTFCONVERT_O)
95
96clean:
97	$(RM) $(OBJS) $(LINTFILES) $(CLEANFILES)
98
99clobber: clean
100	$(RM) $(PROG)
101
102%.ln: ../../common/$(MODULE)/%.c
103	$(LINT.c) -c $<
104
105%.ln: %.c
106	$(LINT.c) -c $<
107
108lint: $(LINTFILES)
109	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
110
111check:	$(CHECKHDRS)
112
113install_h:
114
115$(ROOTPROG): $$(@D) $(PROG)
116	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
117
118install: $(ROOTPROG)
119
120include ../../../Makefile.rootdirs
121