17c478bd9Sstevel@tonic-gate# 27c478bd9Sstevel@tonic-gate# CDDL HEADER START 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 582d33c01Sav145390# Common Development and Distribution License (the "License"). 682d33c01Sav145390# You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate# and limitations under the License. 127c478bd9Sstevel@tonic-gate# 137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate# 197c478bd9Sstevel@tonic-gate# CDDL HEADER END 207c478bd9Sstevel@tonic-gate# 217c478bd9Sstevel@tonic-gate# 22f6e214c7SGavin Maltby# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate# 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate.KEEP_STATE: 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gateSRCS += fmd.c \ 287c478bd9Sstevel@tonic-gate fmd_api.c \ 297c478bd9Sstevel@tonic-gate fmd_alloc.c \ 307c478bd9Sstevel@tonic-gate fmd_asru.c \ 317c478bd9Sstevel@tonic-gate fmd_buf.c \ 327c478bd9Sstevel@tonic-gate fmd_builtin.c \ 337c478bd9Sstevel@tonic-gate fmd_case.c \ 347c478bd9Sstevel@tonic-gate fmd_ckpt.c \ 357c478bd9Sstevel@tonic-gate fmd_conf.c \ 367c478bd9Sstevel@tonic-gate fmd_ctl.c \ 377c478bd9Sstevel@tonic-gate fmd_dispq.c \ 387c478bd9Sstevel@tonic-gate fmd_dr.c \ 397c478bd9Sstevel@tonic-gate fmd_error.c \ 407c478bd9Sstevel@tonic-gate fmd_event.c \ 417c478bd9Sstevel@tonic-gate fmd_eventq.c \ 427c478bd9Sstevel@tonic-gate fmd_fmri.c \ 437c478bd9Sstevel@tonic-gate fmd_idspace.c \ 447c478bd9Sstevel@tonic-gate fmd_list.c \ 457c478bd9Sstevel@tonic-gate fmd_log.c \ 467c478bd9Sstevel@tonic-gate fmd_main.c \ 477c478bd9Sstevel@tonic-gate fmd_module.c \ 487c478bd9Sstevel@tonic-gate fmd_nv.c \ 497c478bd9Sstevel@tonic-gate fmd_proc.c \ 507c478bd9Sstevel@tonic-gate fmd_protocol.c \ 517c478bd9Sstevel@tonic-gate fmd_rpc.c \ 527c478bd9Sstevel@tonic-gate fmd_rpc_adm.c \ 537c478bd9Sstevel@tonic-gate fmd_rpc_api.c \ 547c478bd9Sstevel@tonic-gate fmd_rtld.c \ 557c478bd9Sstevel@tonic-gate fmd_scheme.c \ 567c478bd9Sstevel@tonic-gate fmd_self.c \ 577c478bd9Sstevel@tonic-gate fmd_serd.c \ 587c478bd9Sstevel@tonic-gate fmd_string.c \ 597c478bd9Sstevel@tonic-gate fmd_subr.c \ 607c478bd9Sstevel@tonic-gate fmd_svc_adm.c \ 617c478bd9Sstevel@tonic-gate fmd_svc_api.c \ 62d9638e54Smws fmd_sysevent.c \ 637c478bd9Sstevel@tonic-gate fmd_thread.c \ 647c478bd9Sstevel@tonic-gate fmd_time.c \ 657c478bd9Sstevel@tonic-gate fmd_timerq.c \ 660eb822a1Scindi fmd_topo.c \ 677c478bd9Sstevel@tonic-gate fmd_trace.c \ 687c478bd9Sstevel@tonic-gate fmd_ustat.c \ 697c478bd9Sstevel@tonic-gate fmd_xdr_adm.c \ 70d9638e54Smws fmd_xdr_api.c \ 71d9638e54Smws fmd_xprt.c 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gatePROG = fmd 747c478bd9Sstevel@tonic-gateMANIFEST = ../common/$(PROG).xml 757c478bd9Sstevel@tonic-gate 7667e3a03eSrieMAPFILE-DMOD = $(SRC)/cmd/mdb/common/modules/conf/mapfile-extern 7767e3a03eSrie 7867e3a03eSrie 79f6e214c7SGavin MaltbyLOGADMFILE = $(PROG).logadm.conf 80f6e214c7SGavin MaltbyLOGADMDIR = $(ROOT)/etc/logadm.d 81f6e214c7SGavin MaltbyLOGADMENT = $(LOGADMDIR)/$(LOGADMFILE) 82f6e214c7SGavin Maltby$(LOGADMENT) := FILEMODE = 444 83f6e214c7SGavin Maltby 847c478bd9Sstevel@tonic-gateROOTPDIR = $(ROOT)/usr/lib/fm/$(PROG) 857c478bd9Sstevel@tonic-gateROOTVDIR = $(ROOT)/var/fm/$(PROG) 86d9638e54SmwsROOTVSUB = $(ROOTVDIR)/ckpt $(ROOTVDIR)/rsrc $(ROOTVDIR)/xprt 877c478bd9Sstevel@tonic-gateROOTPROG = $(ROOTPDIR)/$(PROG) 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gateROOTMANIFESTDIR = $(ROOTSVCSYSTEM) 907c478bd9Sstevel@tonic-gateROOTMANIFEST = $(ROOTMANIFESTDIR)/$(PROG).xml 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gateOBJS = $(SRCS:%.c=%.o) 937c478bd9Sstevel@tonic-gateLINTFILES = $(SRCS:%.c=%.ln) 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gateCLEANFILES += ../common/fmd_rpc_api.h ../common/fmd_rpc_adm.h 967c478bd9Sstevel@tonic-gateCLEANFILES += fmd_svc_adm.c fmd_svc_api.c fmd_xdr_adm.c fmd_xdr_api.c 977c478bd9Sstevel@tonic-gateCLEANFILES += ../common/fmd_error.c 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gateDMOD = fmd.so 1007c478bd9Sstevel@tonic-gateROOTDMOD = $(ROOT)/usr/lib/mdb/proc/$(DMOD) 1017c478bd9Sstevel@tonic-gateDMOD_SRCS = fmd_mdb.c 1027c478bd9Sstevel@tonic-gateDMOD_OBJS = $(DMOD_SRCS:%.c=%.o) 1037c478bd9Sstevel@tonic-gateDMOD_LINT = $(DMOD_SRCS:%.c=%.ln) 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gateHDRS = fmd_api.h fmd_fmri.h 1067c478bd9Sstevel@tonic-gateROOTCDIR = $(ROOT)/etc/fm/$(PROG) 1077c478bd9Sstevel@tonic-gateROOTHDIR = $(ROOT)/usr/include/fm 1087c478bd9Sstevel@tonic-gateROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%) 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate$(ROOTHDRS) := FILEMODE = 0644 111540db9a9SStephen Hanson$(ROOTVSUB) := DIRMODE = 0755 1127c478bd9Sstevel@tonic-gate$(ROOTMANIFEST) := FILEMODE = 0444 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG 1157c478bd9Sstevel@tonic-gateCPPFLAGS += -I. -I../common 1167c478bd9Sstevel@tonic-gateCPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT 1177c478bd9Sstevel@tonic-gateCFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) 1187c478bd9Sstevel@tonic-gateLINTFLAGS += -mu 119*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 120*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 121*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 122*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 123*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 12467e3a03eSrie 12567e3a03eSrie$(PROG) := LDFLAGS += -R/usr/lib/fm 12667e3a03eSrie$(PROG) := LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios \ 12788045cffSRobert Johnston -luuid -lnvpair -lexacct -lnsl -lumem -ldevinfo -lfmd_msg 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate$(DMOD) := CFLAGS += $(CC_PICFLAGS) -G $(XREGSFLAG) 13067e3a03eSrie$(DMOD) := LDFLAGS += $(ZTEXT) $(ZDEFS) $(MAPFILE-DMOD:%=-M%) 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate# 1337c478bd9Sstevel@tonic-gate# rpcgen(1) produces code that wants to be in the foreground if we're compiled 1347c478bd9Sstevel@tonic-gate# DEBUG, which isn't appropriate for our daemon. Forcibly undefine this code. 1357c478bd9Sstevel@tonic-gate# It also produces various lint warnings; turn these off for these files only. 1367c478bd9Sstevel@tonic-gate# Unfortunately we also have to turn off IGNOR2 for pass2 lint as well. 1377c478bd9Sstevel@tonic-gate# 1387c478bd9Sstevel@tonic-gatefmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG 1397c478bd9Sstevel@tonic-gatefmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gatefmd_svc_adm.ln fmd_svc_api.ln fmd_xdr_adm.ln fmd_xdr_api.ln := LINTFLAGS += \ 1427c478bd9Sstevel@tonic-gate -xerroff=E_FUNC_ARG_UNUSED -xerroff=E_FUNC_VAR_UNUSED -xerroff=E_STATIC_UNUSED 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gatelint_prog := LINTFLAGS += -xerroff=E_FUNC_RET_ALWAYS_IGNOR2 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate.NO_PARALLEL: 1477c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LINTFILES) 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gateall: $(PROG) $(DMOD) install_h 1507c478bd9Sstevel@tonic-gate 151f6e214c7SGavin Maltby$(LOGADMDIR): 152f6e214c7SGavin Maltby $(INS.dir) 153f6e214c7SGavin Maltby 154f6e214c7SGavin Maltby$(LOGADMDIR)/%.conf: ../common/%.conf 155f6e214c7SGavin Maltby $(INS.file) 156f6e214c7SGavin Maltby 1577c478bd9Sstevel@tonic-gate$(PROG): $(OBJS) 1587c478bd9Sstevel@tonic-gate $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 1597c478bd9Sstevel@tonic-gate $(CTFMERGE) -L VERSION -o $@ $(OBJS) 1607c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate$(DMOD): $(DMOD_OBJS) 16367e3a03eSrie $(LINK.c) $(DMOD_OBJS) -o $@ -lc 1647c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate%.o: ../common/%.c 1677c478bd9Sstevel@tonic-gate $(COMPILE.c) $< 1687c478bd9Sstevel@tonic-gate $(CTFCONVERT_O) 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate%.o: %.c 1717c478bd9Sstevel@tonic-gate $(COMPILE.c) $< 1727c478bd9Sstevel@tonic-gate $(CTFCONVERT_O) 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h 1757c478bd9Sstevel@tonic-gate sh ../common/mkerror.sh < ../common/fmd_error.h > $@ 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x 1827c478bd9Sstevel@tonic-gate $(RPCGEN) -CMN -h -o $@ $< 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gatefmd_svc_%.c: ../common/fmd_rpc_%.h 1857c478bd9Sstevel@tonic-gate $(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'` 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gatefmd_xdr_%.c: ../common/fmd_rpc_%.h 1887c478bd9Sstevel@tonic-gate $(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'` 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gateclean: 1917c478bd9Sstevel@tonic-gate $(RM) $(OBJS) $(DMOD_OBJS) $(LINTFILES) $(DMOD_LINT) 1927c478bd9Sstevel@tonic-gate $(RM) $(CLEANFILES) 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gateclobber: clean 1957c478bd9Sstevel@tonic-gate $(RM) $(PROG) $(DMOD) 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate%.ln: ../common/%.c 1987c478bd9Sstevel@tonic-gate $(LINT.c) -c $< 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate%.ln: %.c 2017c478bd9Sstevel@tonic-gate $(LINT.c) -c $< 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gatelint_prog: $(LINTFILES) 2047c478bd9Sstevel@tonic-gate $(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS) 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gatelint_dmod: $(DMOD_LINT) 2077c478bd9Sstevel@tonic-gate $(LINT) $(LINTFLAGS) $(DMOD_LINT) $(LDLIBS) 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gatelint: lint_prog lint_dmod 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate$(ROOT)/etc/fm: 2127c478bd9Sstevel@tonic-gate $(INS.dir) 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate$(ROOTCDIR): $(ROOT)/etc/fm 2157c478bd9Sstevel@tonic-gate $(INS.dir) 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate$(ROOTHDIR): 2187c478bd9Sstevel@tonic-gate $(INS.dir) 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate$(ROOTHDIR)/%.h: ../common/%.h 2217c478bd9Sstevel@tonic-gate $(INS.file) 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate$(ROOTMANIFESTDIR)/%.xml: ../common/%.xml 2247c478bd9Sstevel@tonic-gate $(INS.file) 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate$(ROOT)/var/%: 2277c478bd9Sstevel@tonic-gate $(INS.dir) 2287c478bd9Sstevel@tonic-gate 2297c478bd9Sstevel@tonic-gate$(ROOTVDIR): $(ROOT)/var/fm 2307c478bd9Sstevel@tonic-gate $(INS.dir) 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate$(ROOTVSUB): $(ROOTVDIR) 2337c478bd9Sstevel@tonic-gate $(INS.dir) 2347c478bd9Sstevel@tonic-gate 235162ba6eaSmws$(ROOT)/usr/lib/fm: 2367c478bd9Sstevel@tonic-gate $(INS.dir) 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate$(ROOTPDIR): $(ROOT)/usr/lib/fm 2397c478bd9Sstevel@tonic-gate $(INS.dir) 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate$(ROOTPROG): $(ROOTPDIR) $(PROG) 2427c478bd9Sstevel@tonic-gate $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG) 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate$(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb 2457c478bd9Sstevel@tonic-gate $(INS.dir) 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate$(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD) 2487c478bd9Sstevel@tonic-gate $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMOD) 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gateinstall_h: $(ROOTHDIR) $(ROOTHDRS) 2517c478bd9Sstevel@tonic-gate 252f6e214c7SGavin Maltbyinstall: all install_h $(ROOTPROG) $(ROOTDMOD) $(LOGADMDIR) $(LOGADMENT) \ 2537c478bd9Sstevel@tonic-gate $(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST) 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gatecheck: $(CHKMANIFEST) 256