xref: /illumos-gate/usr/src/lib/fm/topo/modules/Makefile.plugin (revision 9dd828891378a0a6a509ab601b4c5c20ca5562ec)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27
28.KEEP_STATE:
29.SUFFIXES:
30
31MODCLASS = plugins
32
33include ../../../../Makefile.lib
34include ../../../../../Makefile.lib
35
36#
37# Set PROG and OBJS based on the values of MODULE and SRCS.  We expect that
38# these macros to be defined by the Makefile that is including this file.
39#
40SRCS = $(MODULESRCS:%.c=%.c)
41PROG = $(MODULE:%=%.so)
42OBJS = $(SRCS:%.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 += -mu
59LINTFILES = $(SRCS:%.c=%.ln)
60
61APIMAP = ../../../libtopo/common/topo_mod.map
62
63CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
64CFLAGS += -G $(XREGSFLAG)
65
66CPPFLAGS += -I. -I../../common -I../../../libtopo/common
67CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
68LDFLAGS += $(ZIGNORE) -M$(APIMAP)
69LDLIBS += -L$(ROOTLIBDIR)/fm -R/usr/lib/fm -ltopo -lnvpair -lc
70
71all: $(PROG)
72
73.NO_PARALLEL:
74.PARALLEL: $(OBJS) $(LINTFILES)
75
76$(PROG): $(OBJS) $(APIMAP)
77	$(LINK.c) $(DYNFLAGS) $(OBJS) -o $@ $(LDLIBS)
78	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
79	$(POST_PROCESS_SO)
80
81%.o: ../../common/%.c
82	$(COMPILE.c) $<
83	$(CTFCONVERT_O)
84
85%.o: %.c
86	$(COMPILE.c) $<
87	$(CTFCONVERT_O)
88
89clean:
90	$(RM) $(OBJS) $(LINTFILES) $(CLEANFILES)
91
92clobber: clean
93	$(RM) $(PROG)
94
95%.ln: ../../common/%.c
96	$(LINT.c) -c $<
97
98%.ln: %.c
99	$(LINT.c) -c $<
100
101lint: $(LINTFILES)
102	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
103
104check:	$(CHECKHDRS)
105
106install_h:
107
108$(ROOTPROG): $$(@D) $(PROG)
109	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
110
111install: $(ROOTPROG)
112
113include ../../../Makefile.rootdirs
114