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.
24 # Copyright (c) 2018, Joyent, Inc.
76 MANIFEST = ../common/$(PROG).xml
78 MAPFILE-DMOD = $(SRC)/cmd/mdb/common/modules/conf/mapfile-extern
81 LOGADMFILE = $(PROG).logadm.conf
82 LOGADMDIR = $(ROOT)/etc/logadm.d
83 LOGADMENT = $(LOGADMDIR)/$(LOGADMFILE)
84 $(LOGADMENT) := FILEMODE = 444
86 ROOTPDIR = $(ROOT)/usr/lib/fm/$(PROG)
87 ROOTVDIR = $(ROOT)/var/fm/$(PROG)
88 ROOTVSUB = $(ROOTVDIR)/ckpt $(ROOTVDIR)/rsrc $(ROOTVDIR)/xprt
89 ROOTPROG = $(ROOTPDIR)/$(PROG)
91 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
92 ROOTMANIFEST = $(ROOTMANIFESTDIR)/$(PROG).xml
94 OBJS = $(SRCS:%.c=%.o)
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)
105 HDRS = fmd_api.h fmd_fmri.h
106 ROOTCDIR = $(ROOT)/etc/fm/$(PROG)
107 ROOTHDIR = $(ROOT)/usr/include/fm
108 ROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%)
110 $(ROOTHDRS) := FILEMODE = 0644
111 $(ROOTVSUB) := DIRMODE = 0755
112 $(ROOTMANIFEST) := FILEMODE = 0444
114 $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
115 CPPFLAGS += -I. -I../common
116 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS
117 CFLAGS64 += $(CTF_FLAGS)
118 CERRWARN += -Wno-switch
119 CERRWARN += -Wno-parentheses
120 CERRWARN += -Wno-uninitialized
121 CERRWARN += -Wno-unused-variable
122 CERRWARN += -Wno-clobbered
127 $(PROG) := LDFLAGS64 += -R/usr/lib/fm
128 $(PROG) := LDLIBS64 += -L$(ROOTLIB64)/fm -ltopo -ldiagcode -lsysevent -lsmbios \
129 -luuid -lnvpair -lexacct -lumem -ldevinfo -lfmd_msg
131 $(DMOD) := CFLAGS64 += $(CC_PICFLAGS) $(GSHARED) $(XREGSFLAG)
132 $(DMOD) := LDFLAGS64 += $(ZTEXT) $(ZDEFS) $(MAPFILE-DMOD:%=-Wl,-M%)
135 # rpcgen(1) produces code that wants to be in the foreground if we're compiled
136 # DEBUG, which isn't appropriate for our daemon. Forcibly undefine this code.
138 fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
139 fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
144 all: $(PROG) $(DMOD) install_h
149 $(LOGADMDIR)/%.conf: ../common/%.conf
153 $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
154 $(CTFMERGE) -L VERSION -o $@ $(OBJS)
157 $(DMOD): $(DMOD_OBJS)
158 $(LINK.c) $(DMOD_OBJS) -o $@ $(LDLIBS) -lc
169 ../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h
170 sh ../common/mkerror.sh < ../common/fmd_error.h > $@
172 ../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h
174 ../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h
176 ../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x
177 $(RPCGEN) -CMN -h -o $@ $<
179 fmd_svc_%.c: ../common/fmd_rpc_%.h
180 $(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'`
182 fmd_xdr_%.c: ../common/fmd_rpc_%.h
183 $(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'`
186 $(RM) $(OBJS) $(DMOD_OBJS)
190 $(RM) $(PROG) $(DMOD)
195 $(ROOTCDIR): $(ROOT)/etc/fm
201 $(ROOTHDIR)/%.h: ../common/%.h
204 $(ROOTMANIFESTDIR)/%.xml: ../common/%.xml
210 $(ROOTVDIR): $(ROOT)/var/fm
213 $(ROOTVSUB): $(ROOTVDIR)
219 $(ROOTPDIR): $(ROOT)/usr/lib/fm
222 $(ROOTPROG): $(ROOTPDIR) $(PROG)
223 $(INS) -m 0555 $(PROG) $@
225 $(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb
228 $(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD)
229 $(INS) -m 0555 $(DMOD) $@
231 install_h: $(ROOTHDIR) $(ROOTHDRS)
233 install: all install_h $(ROOTPROG) $(ROOTDMOD) $(LOGADMDIR) $(LOGADMENT) \
234 $(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST)
236 check: $(CHKMANIFEST)