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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26
27.KEEP_STATE:
28.SUFFIXES:
29
30include ../../../../Makefile.cmd
31MODCLASS = plugins
32
33#
34# Set PROG and OBJS based on the values of MODULE and SRCS.  We expect that
35# these macros to be defined by the Makefile that is including this file.
36#
37PROG = $(MODULE:%=%.so)
38YOBJS = $(YSRCS:%.y=%.o)
39OBJS = $(YOBJS) $(SRCS:%.c=%.o)
40CONF = $(MODULE:%=%.conf)
41
42#
43# Set ROOTPROG and ROOTCONF based on the values of MODULE, CLASS, and PLATFORMS
44# We expect these macros to be defined by the Makefile that is including us.
45#
46common_ROOTPROG = $(ROOT)/usr/lib/fm/fmd/plugins/$(PROG)
47arch_ROOTPROG = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(PROG)
48plat_ROOTPROG = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(PROG))
49ROOTPROG = $($(CLASS)_ROOTPROG)
50
51common_ROOTCONF = $(ROOT)/usr/lib/fm/fmd/plugins/$(CONF)
52arch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(CONF)
53plat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(CONF))
54ROOTCONF = $($(CLASS)_ROOTCONF)
55
56LINTFLAGS += -mu
57LINTFILES = $(SRCS:%.c=%.ln)
58
59APIMAP = ../../../fmd/common/fmd_api.map
60FMRIMAP = ../../../fmd/common/fmd_fmri.map
61
62CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
63CFLAGS += -G $(XREGSFLAG)
64
65CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
66LDFLAGS += $(ZTEXT) $(ZCOMBRELOC) $(ZDEFS) $(ZIGNORE) -M$(APIMAP) -M$(FMRIMAP)
67LDLIBS += -lnvpair -lc
68
69all: $(PROG)
70
71.NO_PARALLEL:
72.PARALLEL: $(OBJS) $(LINTFILES)
73
74$(PROG): $(OBJS) $(APIMAP)
75	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
76	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
77	$(POST_PROCESS_SO)
78
79%.o: %.c
80	$(COMPILE.c) $<
81	$(CTFCONVERT_O)
82
83clean:
84	$(RM) $(OBJS) $(LINTFILES) $(CLEANFILES)
85
86clobber: clean
87	$(RM) $(PROG)
88
89%.ln: %.c
90	$(LINT.c) -c $<
91
92lint: $(LINTFILES)
93	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
94
95install_h:
96
97$(ROOTPROG): $$(@D) $(PROG)
98	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
99
100$(ROOTCONF): $$(@D) $(CONF)
101	$(RM) $@; $(INS) -s -m 0644 -f $(@D) $(CONF)
102
103install: $(ROOTPROG) $(ROOTCONF)
104
105include ../../Makefile.rootdirs
106