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]
22 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 # Copyright 2015 RackTop Systems.
75 MANIFEST = ../common/$(PROG).xml
77 MAPFILE-DMOD = $(SRC)/cmd/mdb/common/modules/conf/mapfile-extern
80 LOGADMFILE = $(PROG).logadm.conf
81 LOGADMDIR = $(ROOT)/etc/logadm.d
82 LOGADMENT = $(LOGADMDIR)/$(LOGADMFILE)
83 $(LOGADMENT) := FILEMODE = 444
85 ROOTPDIR = $(ROOT)/usr/lib/fm/$(PROG)
86 ROOTVDIR = $(ROOT)/var/fm/$(PROG)
87 ROOTVSUB = $(ROOTVDIR)/ckpt $(ROOTVDIR)/rsrc $(ROOTVDIR)/xprt
88 ROOTPROG = $(ROOTPDIR)/$(PROG)
90 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
91 ROOTMANIFEST = $(ROOTMANIFESTDIR)/$(PROG).xml
93 OBJS = $(SRCS:%.c=%.o)
94 LINTFILES = $(SRCS:%.c=%.ln)
96 CLEANFILES += ../common/fmd_rpc_api.h ../common/fmd_rpc_adm.h
97 CLEANFILES += fmd_svc_adm.c fmd_svc_api.c fmd_xdr_adm.c fmd_xdr_api.c
98 CLEANFILES += ../common/fmd_error.c
101 ROOTDMOD = $(ROOT)/usr/lib/mdb/proc/$(DMOD)
102 DMOD_SRCS = fmd_mdb.c
103 DMOD_OBJS = $(DMOD_SRCS:%.c=%.o)
104 DMOD_LINT = $(DMOD_SRCS:%.c=%.ln)
106 HDRS = fmd_api.h fmd_fmri.h
107 ROOTCDIR = $(ROOT)/etc/fm/$(PROG)
108 ROOTHDIR = $(ROOT)/usr/include/fm
109 ROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%)
111 $(ROOTHDRS) := FILEMODE = 0644
112 $(ROOTVSUB) := DIRMODE = 0755
113 $(ROOTMANIFEST) := FILEMODE = 0444
115 $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
116 CPPFLAGS += -I. -I../common
117 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
118 CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
120 CERRWARN += -_gcc=-Wno-switch
121 CERRWARN += -_gcc=-Wno-parentheses
122 CERRWARN += -_gcc=-Wno-uninitialized
123 CERRWARN += -_gcc=-Wno-unused-variable
124 CERRWARN += -_gcc=-Wno-clobbered
126 $(PROG) := LDFLAGS += -R/usr/lib/fm
127 $(PROG) := LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios \
128 -luuid -lnvpair -lexacct -lnsl -lumem -ldevinfo -lfmd_msg
130 $(DMOD) := CFLAGS += $(CC_PICFLAGS) -G $(XREGSFLAG)
131 $(DMOD) := LDFLAGS += $(ZTEXT) $(ZDEFS) $(MAPFILE-DMOD:%=-M%)
134 # rpcgen(1) produces code that wants to be in the foreground if we're compiled
135 # DEBUG, which isn't appropriate for our daemon. Forcibly undefine this code.
136 # It also produces various lint warnings; turn these off for these files only.
137 # Unfortunately we also have to turn off IGNOR2 for pass2 lint as well.
139 fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
140 fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
142 fmd_svc_adm.ln fmd_svc_api.ln fmd_xdr_adm.ln fmd_xdr_api.ln := LINTFLAGS += \
143 -xerroff=E_FUNC_ARG_UNUSED -xerroff=E_FUNC_VAR_UNUSED -xerroff=E_STATIC_UNUSED
145 lint_prog := LINTFLAGS += -xerroff=E_FUNC_RET_ALWAYS_IGNOR2
148 .PARALLEL: $(OBJS) $(LINTFILES)
150 all: $(PROG) $(DMOD) install_h
155 $(LOGADMDIR)/%.conf: ../common/%.conf
159 $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
160 $(CTFMERGE) -L VERSION -o $@ $(OBJS)
163 $(DMOD): $(DMOD_OBJS)
164 $(LINK.c) $(DMOD_OBJS) -o $@ $(LDLIBS) -lc
175 ../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h
176 sh ../common/mkerror.sh < ../common/fmd_error.h > $@
178 ../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h
180 ../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h
182 ../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x
183 $(RPCGEN) -CMN -h -o $@ $<
185 fmd_svc_%.c: ../common/fmd_rpc_%.h
186 $(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'`
188 fmd_xdr_%.c: ../common/fmd_rpc_%.h
189 $(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'`
192 $(RM) $(OBJS) $(DMOD_OBJS) $(LINTFILES) $(DMOD_LINT)
196 $(RM) $(PROG) $(DMOD)
204 lint_prog: $(LINTFILES)
205 $(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
207 lint_dmod: $(DMOD_LINT)
208 $(LINT) $(LINTFLAGS) $(DMOD_LINT) $(LDLIBS)
210 lint: lint_prog lint_dmod
215 $(ROOTCDIR): $(ROOT)/etc/fm
221 $(ROOTHDIR)/%.h: ../common/%.h
224 $(ROOTMANIFESTDIR)/%.xml: ../common/%.xml
230 $(ROOTVDIR): $(ROOT)/var/fm
233 $(ROOTVSUB): $(ROOTVDIR)
239 $(ROOTPDIR): $(ROOT)/usr/lib/fm
242 $(ROOTPROG): $(ROOTPDIR) $(PROG)
243 $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
245 $(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb
248 $(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD)
249 $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMOD)
251 install_h: $(ROOTHDIR) $(ROOTHDRS)
253 install: all install_h $(ROOTPROG) $(ROOTDMOD) $(LOGADMDIR) $(LOGADMENT) \
254 $(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST)
256 check: $(CHKMANIFEST)