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)
95 CLEANFILES += ../common/fmd_rpc_api.h ../common/fmd_rpc_adm.h
96 CLEANFILES += fmd_svc_adm.c fmd_svc_api.c fmd_xdr_adm.c fmd_xdr_api.c
97 CLEANFILES += ../common/fmd_error.c
100 ROOTDMOD = $(ROOT)/usr/lib/mdb/proc/$(DMOD)
101 DMOD_SRCS = fmd_mdb.c
102 DMOD_OBJS = $(DMOD_SRCS:%.c=%.o)
104 HDRS = fmd_api.h fmd_fmri.h
105 ROOTCDIR = $(ROOT)/etc/fm/$(PROG)
106 ROOTHDIR = $(ROOT)/usr/include/fm
107 ROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%)
109 $(ROOTHDRS) := FILEMODE = 0644
110 $(ROOTVSUB) := DIRMODE = 0755
111 $(ROOTMANIFEST) := FILEMODE = 0444
113 $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
114 CPPFLAGS += -I. -I../common
115 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS
116 CFLAGS += $(CTF_FLAGS)
117 CERRWARN += -Wno-switch
118 CERRWARN += -Wno-parentheses
119 CERRWARN += -Wno-uninitialized
120 CERRWARN += -Wno-unused-variable
121 CERRWARN += -Wno-clobbered
123 $(PROG) := LDFLAGS += -R/usr/lib/fm
124 $(PROG) := LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios \
125 -luuid -lnvpair -lexacct -lumem -ldevinfo -lfmd_msg
127 $(DMOD) := CFLAGS += $(CC_PICFLAGS) $(GSHARED) $(XREGSFLAG)
128 $(DMOD) := LDFLAGS += $(ZTEXT) $(ZDEFS) $(MAPFILE-DMOD:%=-Wl,-M%)
131 # rpcgen(1) produces code that wants to be in the foreground if we're compiled
132 # DEBUG, which isn't appropriate for our daemon. Forcibly undefine this code.
134 fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
135 fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
140 all: $(PROG) $(DMOD) install_h
145 $(LOGADMDIR)/%.conf: ../common/%.conf
149 $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
150 $(CTFMERGE) -L VERSION -o $@ $(OBJS)
153 $(DMOD): $(DMOD_OBJS)
154 $(LINK.c) $(DMOD_OBJS) -o $@ $(LDLIBS) -lc
165 ../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h
166 sh ../common/mkerror.sh < ../common/fmd_error.h > $@
168 ../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h
170 ../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h
172 ../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x
173 $(RPCGEN) -CMN -h -o $@ $<
175 fmd_svc_%.c: ../common/fmd_rpc_%.h
176 $(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'`
178 fmd_xdr_%.c: ../common/fmd_rpc_%.h
179 $(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'`
182 $(RM) $(OBJS) $(DMOD_OBJS)
186 $(RM) $(PROG) $(DMOD)
191 $(ROOTCDIR): $(ROOT)/etc/fm
197 $(ROOTHDIR)/%.h: ../common/%.h
200 $(ROOTMANIFESTDIR)/%.xml: ../common/%.xml
206 $(ROOTVDIR): $(ROOT)/var/fm
209 $(ROOTVSUB): $(ROOTVDIR)
215 $(ROOTPDIR): $(ROOT)/usr/lib/fm
218 $(ROOTPROG): $(ROOTPDIR) $(PROG)
219 $(INS) -m 0555 $(PROG) $@
221 $(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb
224 $(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD)
225 $(INS) -m 0555 $(DMOD) $@
227 install_h: $(ROOTHDIR) $(ROOTHDRS)
229 install: all install_h $(ROOTPROG) $(ROOTDMOD) $(LOGADMDIR) $(LOGADMENT) \
230 $(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST)
232 check: $(CHKMANIFEST)