xref: /titanic_52/usr/src/cmd/fm/modules/Makefile.plugin (revision 1a7c1b724419d3cb5fa6eea75123c6b2060ba31b)
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 2004 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
69#
70# Reset STRIPFLAG to the empty string.  FMA modules are intentionally installed
71# with symbol tables in order to help module developers.
72#
73STRIPFLAG =
74
75all: $(PROG)
76
77.NO_PARALLEL:
78.PARALLEL: $(OBJS) $(LINTFILES)
79
80$(PROG): $(OBJS) $(APIMAP)
81	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
82	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
83	$(POST_PROCESS_SO)
84
85%.o: %.c
86	$(COMPILE.c) $<
87	$(CTFCONVERT_O)
88
89clean:
90	$(RM) $(OBJS) $(LINTFILES)
91
92clobber: clean
93	$(RM) $(PROG)
94
95%.ln: %.c
96	$(LINT.c) -c $<
97
98lint: $(LINTFILES)
99	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
100
101install_h:
102
103$(ROOTPROG): $$(@D) $(PROG)
104	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
105
106$(ROOTCONF): $$(@D) $(CONF)
107	$(RM) $@; $(INS) -s -m 0644 -f $(@D) $(CONF)
108
109install: $(ROOTPROG) $(ROOTCONF)
110
111include ../../Makefile.rootdirs
112