xref: /titanic_44/usr/src/cmd/fm/modules/Makefile.plugin (revision b835471ef432a1cfa4d14312be748ee3e239d9ad)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
534709573Sraf# Common Development and Distribution License (the "License").
634709573Sraf# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
227aec1d6eScindi# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate.KEEP_STATE:
287c478bd9Sstevel@tonic-gate.SUFFIXES:
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateinclude ../../../../Makefile.cmd
317c478bd9Sstevel@tonic-gateMODCLASS = plugins
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate#
347c478bd9Sstevel@tonic-gate# Set PROG and OBJS based on the values of MODULE and SRCS.  We expect that
357c478bd9Sstevel@tonic-gate# these macros to be defined by the Makefile that is including this file.
367c478bd9Sstevel@tonic-gate#
377c478bd9Sstevel@tonic-gatePROG = $(MODULE:%=%.so)
387c478bd9Sstevel@tonic-gateYOBJS = $(YSRCS:%.y=%.o)
397c478bd9Sstevel@tonic-gateOBJS = $(YOBJS) $(SRCS:%.c=%.o)
407c478bd9Sstevel@tonic-gateCONF = $(MODULE:%=%.conf)
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gate#
438a40a695Sgavinm# A module may set DMOD and DMOD_SRCS if it has a mdb proc module.
448a40a695Sgavinm# DMOD, if set, must match PROG above (for mdb autoloading) so it will
458a40a695Sgavinm# be built in a subdirectory.
468a40a695Sgavinm#
478a40a695SgavinmROOTDMOD = $(DMOD:%.so=$(ROOT)/usr/lib/mdb/proc/%.so)
488a40a695SgavinmDMODPROG = $(DMOD:%=dmod/%)
498a40a695SgavinmDMOD_OBJS = $(DMOD_SRCS:%.c=%.o)
508a40a695Sgavinm
518a40a695Sgavinm#
527c478bd9Sstevel@tonic-gate# Set ROOTPROG and ROOTCONF based on the values of MODULE, CLASS, and PLATFORMS
537c478bd9Sstevel@tonic-gate# We expect these macros to be defined by the Makefile that is including us.
547c478bd9Sstevel@tonic-gate#
557c478bd9Sstevel@tonic-gatecommon_ROOTPROG = $(ROOT)/usr/lib/fm/fmd/plugins/$(PROG)
567c478bd9Sstevel@tonic-gatearch_ROOTPROG = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(PROG)
577c478bd9Sstevel@tonic-gateplat_ROOTPROG = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(PROG))
587c478bd9Sstevel@tonic-gateROOTPROG = $($(CLASS)_ROOTPROG)
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gatecommon_ROOTCONF = $(ROOT)/usr/lib/fm/fmd/plugins/$(CONF)
617c478bd9Sstevel@tonic-gatearch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(CONF)
627c478bd9Sstevel@tonic-gateplat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(CONF))
637c478bd9Sstevel@tonic-gateROOTCONF = $($(CLASS)_ROOTCONF)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gateLINTFLAGS += -mu
667c478bd9Sstevel@tonic-gateLINTFILES = $(SRCS:%.c=%.ln)
677c478bd9Sstevel@tonic-gate
688a40a695SgavinmDMODLINTTGT = $(DMOD:%=lint_dmod)
698a40a695SgavinmDMODLINTFILES = $(DMOD_SRCS:%.c=%.ln)
708a40a695Sgavinm
717c478bd9Sstevel@tonic-gateAPIMAP = ../../../fmd/common/fmd_api.map
72816b7274StsienFMRIMAP = ../../../fmd/common/fmd_fmri.map
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gateCFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
757c478bd9Sstevel@tonic-gateCFLAGS += -G $(XREGSFLAG)
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateCPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
78*b835471eSgavinmLDFLAGS += $(ZTEXT) $(ZCOMBRELOC) $(ZIGNORE)
79*b835471eSgavinm
80*b835471eSgavinm$(PROG) := LDFLAGS += $(ZDEFS) -M$(APIMAP) -M$(FMRIMAP)
818a40a695Sgavinm$(PROG) := LDLIBS += -lnvpair -lc
827c478bd9Sstevel@tonic-gate
83*b835471eSgavinm$(DMOD_PROG) := LDFLAGS += $(ZNODEFS)
848a40a695Sgavinm
858a40a695Sgavinmall: $(PROG) $(DMODPROG)
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gate.NO_PARALLEL:
888a40a695Sgavinm.PARALLEL: $(OBJS) $(LINTFILES) $(DMOD_OBJS) $(DMODLINTFILES)
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate$(PROG): $(OBJS) $(APIMAP)
917c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
927c478bd9Sstevel@tonic-gate	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
937c478bd9Sstevel@tonic-gate	$(POST_PROCESS_SO)
947c478bd9Sstevel@tonic-gate
958a40a695Sgavinm$(DMODPROG): $(DMOD_OBJS)
968a40a695Sgavinm	-@mkdir -p $(@D)
978a40a695Sgavinm	$(LINK.c) $(DMOD_OBJS) -o $@
988a40a695Sgavinm	$(POST_PROCESS)
998a40a695Sgavinm
1007c478bd9Sstevel@tonic-gate%.o: %.c
1017c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1027c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gateclean:
1058a40a695Sgavinm	$(RM) $(OBJS) $(DMOD_OBJS) $(LINTFILES) $(DMODLINTFILES) $(CLEANFILES)
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gateclobber: clean
1088a40a695Sgavinm	$(RM) $(PROG) $(DMODPROG)
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate%.ln: %.c
1117c478bd9Sstevel@tonic-gate	$(LINT.c) -c $<
1127c478bd9Sstevel@tonic-gate
1138a40a695Sgavinmlint_prog: $(LINTFILES)
1147c478bd9Sstevel@tonic-gate	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
1157c478bd9Sstevel@tonic-gate
1168a40a695Sgavinmlint_dmod: $(DMODLINTFILES)
1178a40a695Sgavinm	$(LINT) $(LINTFLAGS) $(DMODLINTFILES) $(LDLIBS)
1188a40a695Sgavinm
1198a40a695Sgavinmlint: lint_prog $(DMODLINTTGT)
1208a40a695Sgavinm
1217c478bd9Sstevel@tonic-gateinstall_h:
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gate$(ROOTPROG): $$(@D) $(PROG)
1247c478bd9Sstevel@tonic-gate	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gate$(ROOTCONF): $$(@D) $(CONF)
1277c478bd9Sstevel@tonic-gate	$(RM) $@; $(INS) -s -m 0644 -f $(@D) $(CONF)
1287c478bd9Sstevel@tonic-gate
1298a40a695Sgavinm$(ROOTDMOD): $$(@D) $(DMODPROG)
1308a40a695Sgavinm	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMODPROG)
1318a40a695Sgavinm
1328a40a695Sgavinminstall: $(ROOTPROG) $(ROOTCONF) $(ROOTDMOD)
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gateinclude ../../Makefile.rootdirs
135