xref: /illumos-gate/usr/src/cmd/fm/modules/Makefile.plugin (revision a07094369b21309434206d9b3601d162693466fc)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
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
31include ../../../../Makefile.cmd
32MODCLASS = plugins
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#
38PROG = $(MODULE:%=%.so)
39YOBJS = $(YSRCS:%.y=%.o)
40OBJS = $(YOBJS) $(SRCS:%.c=%.o)
41CONF = $(MODULE:%=%.conf)
42
43#
44# Set ROOTPROG and ROOTCONF based on the values of MODULE, CLASS, and PLATFORMS
45# We expect these macros to be defined by the Makefile that is including us.
46#
47common_ROOTPROG = $(ROOT)/usr/lib/fm/fmd/plugins/$(PROG)
48arch_ROOTPROG = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(PROG)
49plat_ROOTPROG = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(PROG))
50ROOTPROG = $($(CLASS)_ROOTPROG)
51
52common_ROOTCONF = $(ROOT)/usr/lib/fm/fmd/plugins/$(CONF)
53arch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(CONF)
54plat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(CONF))
55ROOTCONF = $($(CLASS)_ROOTCONF)
56
57LINTFLAGS += -mu
58LINTFILES = $(SRCS:%.c=%.ln)
59
60APIMAP = ../../../fmd/common/fmd_api.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)
67LDLIBS += -lnvpair -lrt -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