move 32-bit libs to lib/i386 subdirs & 64-bit libs to lib/
[unleashed.git] / usr / src / cmd / fm / modules / Makefile.plugin
blob2874a34a998c980215b591dbd6871845a9e0d864
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 # Copyright 2015 RackTop Systems.
26 .KEEP_STATE:
27 .SUFFIXES:
29 include $(SRC)/cmd/Makefile.cmd
30 include $(SRC)/cmd/Makefile.cmd.64
31 MODCLASS = plugins
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.
37 PROG = $(MODULE:%=%.so)
38 YOBJS = $(YSRCS:%.y=%.o)
39 OBJS = $(YOBJS) $(SRCS:%.c=%.o)
40 CONF = $(MODULE:%=%.conf)
43 # We may have sources from directories other than the current, but
44 # we build all objects in the current directory (not necessarily in the
45 # directory of its source).
46 SEDCMDLINE = echo $(OBJS) | sed 's!\.\./[a-z_/]*/!!g'
47 LINKOBJS = $(SEDCMDLINE:sh)
50 # A module may set DMOD and DMOD_SRCS if it has a mdb proc module.
51 # DMOD, if set, must match PROG above (for mdb autoloading) so it will
52 # be built in a subdirectory.
54 ROOTDMOD = $(DMOD:%.so=$(ROOT)/usr/lib/mdb/proc/%.so)
55 DMODPROG = $(DMOD:%=dmod/%)
56 DMOD_OBJS = $(DMOD_SRCS:%.c=%.o)
59 # Set ROOTPROG and ROOTCONF based on the values of MODULE, CLASS, and PLATFORMS
60 # We expect these macros to be defined by the Makefile that is including us.
62 common_ROOTPROG = $(ROOT)/usr/lib/fm/fmd/plugins/$(PROG)
63 arch_ROOTPROG = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(PROG)
64 plat_ROOTPROG = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(PROG))
65 ROOTPROG = $($(CLASS)_ROOTPROG)
67 common_ROOTCONF = $(ROOT)/usr/lib/fm/fmd/plugins/$(CONF)
68 arch_ROOTCONF = $(ROOT)/usr/platform/$(ARCH)/lib/fm/fmd/plugins/$(CONF)
69 plat_ROOTCONF = $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/fmd/plugins/$(CONF))
70 ROOTCONF = $($(CLASS)_ROOTCONF)
74 APIMAP = $(SRC)/cmd/fm/fmd/common/fmd_api.map
75 FMRIMAP = $(SRC)/cmd/fm/fmd/common/fmd_fmri.map
77 CFLAGS64 += $(CTF_FLAGS) $(CC_PICFLAGS)
78 CFLAGS64 += $(GSHARED) $(XREGSFLAG) 
80 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS
81 LDFLAGS64 += $(ZDEFS) $(ZTEXT) $(ZIGNORE)
83 MAPFILE-DMOD = $(SRC)/cmd/mdb/common/modules/conf/mapfile-extern
86 $(PROG) := LDFLAGS64 += -Wl,-M$(APIMAP) -Wl,-M$(FMRIMAP)
87 $(PROG) := LDLIBS64 += -lnvpair -lc
89 all: $(PROG) $(DMODPROG)
91 .NO_PARALLEL:
92 .PARALLEL: $(OBJS) $(DMOD_OBJS)
94 $(PROG): $(OBJS) $(APIMAP)
95         $(LINK.c) $(LINKOBJS) -o $@ $(LDLIBS)
96         $(CTFMERGE) -L VERSION -o $@ $(LINKOBJS)
97         $(POST_PROCESS_SO)
99 $(DMODPROG): $(DMOD_OBJS) $(MAPFILE-DMOD)
100         -@mkdir -p $(@D)
101         $(LINK.c) $(DMOD_OBJS) $(MAPFILE-DMOD:%=-Wl,-M%) -o $@ $(LDLIBS) -lc
102         $(POST_PROCESS)
104 %.o: %.c
105         $(COMPILE.c) $< -o $(@F)
106         $(CTFCONVERT) $(CTFCVTFLAGS) $(@F)
108 clean:
109         $(RM) $(OBJS) $(DMOD_OBJS) $(CLEANFILES) $(LINKOBJS)
111 clobber: clean
112         $(RM) $(PROG) $(DMODPROG)
114 install_h:
116 $(ROOTPROG): $$(@D) $(PROG)
117         $(INS) -m 0555 $(PROG) $@
119 $(ROOTCONF): $$(@D) $(CONF)
120         $(INS) -m 0644 $(CONF) $@
122 $(ROOTDMOD): $$(@D) $(DMODPROG)
123         $(INS) -m 0555 $(DMODPROG) $@
125 install: $(ROOTPROG) $(ROOTCONF) $(ROOTDMOD)
127 include $(SRC)/cmd/fm/modules/Makefile.rootdirs