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