xref: /titanic_44/usr/src/cmd/fm/modules/Makefile.plugin (revision bc9ec910d60a3256c0b6bb68a13afa62e106730a)
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
60
61CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
62CFLAGS += -G $(XREGSFLAG)
63
64CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
65LDFLAGS += $(ZTEXT) $(ZCOMBRELOC) $(ZDEFS) $(ZIGNORE) -M$(APIMAP)
66LDLIBS += -lnvpair -lc
67
68all: $(PROG)
69
70.NO_PARALLEL:
71.PARALLEL: $(OBJS) $(LINTFILES)
72
73$(PROG): $(OBJS) $(APIMAP)
74	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
75	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
76	$(POST_PROCESS_SO)
77
78%.o: %.c
79	$(COMPILE.c) $<
80	$(CTFCONVERT_O)
81
82clean:
83	$(RM) $(OBJS) $(LINTFILES) $(CLEANFILES)
84
85clobber: clean
86	$(RM) $(PROG)
87
88%.ln: %.c
89	$(LINT.c) -c $<
90
91lint: $(LINTFILES)
92	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
93
94install_h:
95
96$(ROOTPROG): $$(@D) $(PROG)
97	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
98
99$(ROOTCONF): $$(@D) $(CONF)
100	$(RM) $@; $(INS) -s -m 0644 -f $(@D) $(CONF)
101
102install: $(ROOTPROG) $(ROOTCONF)
103
104include ../../Makefile.rootdirs
105