1# 2# CDDL HEADER START 3# 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. 7# 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. 12# 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] 18# 19# CDDL HEADER END 20# 21# 22# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 23# Copyright 2015 RackTop Systems. 24# Copyright 2019, Joyent, Inc. 25# 26 27.KEEP_STATE: 28 29SRCS += fmd.c \ 30 fmd_api.c \ 31 fmd_alloc.c \ 32 fmd_asru.c \ 33 fmd_buf.c \ 34 fmd_builtin.c \ 35 fmd_case.c \ 36 fmd_ckpt.c \ 37 fmd_conf.c \ 38 fmd_ctl.c \ 39 fmd_dispq.c \ 40 fmd_dr.c \ 41 fmd_error.c \ 42 fmd_event.c \ 43 fmd_eventq.c \ 44 fmd_fmri.c \ 45 fmd_idspace.c \ 46 fmd_list.c \ 47 fmd_log.c \ 48 fmd_main.c \ 49 fmd_module.c \ 50 fmd_nv.c \ 51 fmd_proc.c \ 52 fmd_protocol.c \ 53 fmd_rpc.c \ 54 fmd_rpc_adm.c \ 55 fmd_rpc_api.c \ 56 fmd_rtld.c \ 57 fmd_scheme.c \ 58 fmd_self.c \ 59 fmd_serd.c \ 60 fmd_string.c \ 61 fmd_subr.c \ 62 fmd_svc_adm.c \ 63 fmd_svc_api.c \ 64 fmd_sysevent.c \ 65 fmd_thread.c \ 66 fmd_time.c \ 67 fmd_timerq.c \ 68 fmd_topo.c \ 69 fmd_trace.c \ 70 fmd_ustat.c \ 71 fmd_xdr_adm.c \ 72 fmd_xdr_api.c \ 73 fmd_xprt.c 74 75PROG = fmd 76MANIFEST = ../common/$(PROG).xml 77 78MAPFILE-DMOD = $(SRC)/cmd/mdb/common/modules/conf/mapfile-extern 79 80 81LOGADMFILE = $(PROG).logadm.conf 82LOGADMDIR = $(ROOT)/etc/logadm.d 83LOGADMENT = $(LOGADMDIR)/$(LOGADMFILE) 84$(LOGADMENT) := FILEMODE = 444 85 86ROOTPDIR = $(ROOT)/usr/lib/fm/$(PROG) 87ROOTVDIR = $(ROOT)/var/fm/$(PROG) 88ROOTVSUB = $(ROOTVDIR)/ckpt $(ROOTVDIR)/rsrc $(ROOTVDIR)/xprt 89ROOTPROG = $(ROOTPDIR)/$(PROG) 90 91ROOTMANIFESTDIR = $(ROOTSVCSYSTEM) 92ROOTMANIFEST = $(ROOTMANIFESTDIR)/$(PROG).xml 93 94OBJS = $(SRCS:%.c=%.o) 95 96CLEANFILES += ../common/fmd_rpc_api.h ../common/fmd_rpc_adm.h 97CLEANFILES += fmd_svc_adm.c fmd_svc_api.c fmd_xdr_adm.c fmd_xdr_api.c 98CLEANFILES += ../common/fmd_error.c 99 100DMOD = fmd.so 101ROOTDMOD = $(ROOT)/usr/lib/mdb/proc/$(DMOD) 102DMOD_SRCS = fmd_mdb.c 103DMOD_OBJS = $(DMOD_SRCS:%.c=%.o) 104 105HDRS = fmd_api.h fmd_fmri.h 106ROOTCDIR = $(ROOT)/etc/fm/$(PROG) 107ROOTHDIR = $(ROOT)/usr/include/fm 108ROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%) 109 110$(ROOTHDRS) := FILEMODE = 0644 111$(ROOTVSUB) := DIRMODE = 0755 112$(ROOTMANIFEST) := FILEMODE = 0444 113 114$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG 115CPPFLAGS += -I. -I../common 116CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT 117CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) 118CERRWARN += -_gcc=-Wno-switch 119CERRWARN += -_gcc=-Wno-parentheses 120CERRWARN += $(CNOWARN_UNINIT) 121CERRWARN += -_gcc=-Wno-clobbered 122$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused-but-set-variable 123CERRWARN += -_gcc=-Wno-unused-variable 124 125# not linted 126SMATCH=off 127 128$(PROG) := LDFLAGS += -R/usr/lib/fm 129$(PROG) := LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios \ 130 -luuid -lnvpair -lexacct -lnsl -lumem -ldevinfo -lfmd_msg 131 132$(DMOD) := CFLAGS += $(CC_PICFLAGS) $(GSHARED) 133$(DMOD) := LDFLAGS += $(ZTEXT) $(ZDEFS) $(MAPFILE-DMOD:%=-Wl,-M%) 134 135# 136# rpcgen(1) produces code that wants to be in the foreground if we're compiled 137# DEBUG, which isn't appropriate for our daemon. Forcibly undefine this code. 138# 139fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG 140fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG 141 142.NO_PARALLEL: 143.PARALLEL: $(OBJS) 144 145all: $(PROG) $(DMOD) install_h 146 147$(LOGADMDIR): 148 $(INS.dir) 149 150$(LOGADMDIR)/%.conf: ../common/%.conf 151 $(INS.file) 152 153$(PROG): $(OBJS) 154 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 155 $(CTFMERGE) -L VERSION -o $@ $(OBJS) 156 $(POST_PROCESS) 157 158$(DMOD): $(DMOD_OBJS) 159 $(LINK.c) $(DMOD_OBJS) -o $@ $(LDLIBS) -lc 160 $(POST_PROCESS) 161 162%.o: ../common/%.c 163 $(COMPILE.c) $< 164 $(CTFCONVERT_O) 165 166%.o: %.c 167 $(COMPILE.c) $< 168 $(CTFCONVERT_O) 169 170../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h 171 sh ../common/mkerror.sh < ../common/fmd_error.h > $@ 172 173../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h 174 175../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h 176 177../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x 178 $(RPCGEN) -CMN -h -o $@ $< 179 180fmd_svc_%.c: ../common/fmd_rpc_%.x 181 $(RPCGEN) -CMN -m -o $@ $< 182 183fmd_xdr_%.c: ../common/fmd_rpc_%.x 184 $(RPCGEN) -CMN -c -o $@ $< 185 186clean: 187 $(RM) $(OBJS) $(DMOD_OBJS) 188 $(RM) $(CLEANFILES) 189 190clobber: clean 191 $(RM) $(PROG) $(DMOD) 192 193$(ROOT)/etc/fm: 194 $(INS.dir) 195 196$(ROOTCDIR): $(ROOT)/etc/fm 197 $(INS.dir) 198 199$(ROOTHDIR): 200 $(INS.dir) 201 202$(ROOTHDIR)/%.h: ../common/%.h 203 $(INS.file) 204 205$(ROOTMANIFESTDIR)/%.xml: ../common/%.xml 206 $(INS.file) 207 208$(ROOT)/var/%: 209 $(INS.dir) 210 211$(ROOTVDIR): $(ROOT)/var/fm 212 $(INS.dir) 213 214$(ROOTVSUB): $(ROOTVDIR) 215 $(INS.dir) 216 217$(ROOT)/usr/lib/fm: 218 $(INS.dir) 219 220$(ROOTPDIR): $(ROOT)/usr/lib/fm 221 $(INS.dir) 222 223$(ROOTPROG): $(ROOTPDIR) $(PROG) 224 $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG) 225 226$(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb 227 $(INS.dir) 228 229$(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD) 230 $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMOD) 231 232install_h: $(ROOTHDIR) $(ROOTHDRS) 233 234install: all install_h $(ROOTPROG) $(ROOTDMOD) $(LOGADMDIR) $(LOGADMENT) \ 235 $(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST) 236 237check: $(CHKMANIFEST) 238