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, Version 1.0 only 6# (the "License"). You may not use this file except in compliance 7# with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# 23# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28 29.KEEP_STATE: 30 31SRCS += fmd.c \ 32 fmd_api.c \ 33 fmd_alloc.c \ 34 fmd_asru.c \ 35 fmd_buf.c \ 36 fmd_builtin.c \ 37 fmd_case.c \ 38 fmd_ckpt.c \ 39 fmd_conf.c \ 40 fmd_ctl.c \ 41 fmd_dispq.c \ 42 fmd_dr.c \ 43 fmd_error.c \ 44 fmd_event.c \ 45 fmd_eventq.c \ 46 fmd_fmri.c \ 47 fmd_idspace.c \ 48 fmd_list.c \ 49 fmd_log.c \ 50 fmd_main.c \ 51 fmd_module.c \ 52 fmd_nv.c \ 53 fmd_proc.c \ 54 fmd_protocol.c \ 55 fmd_rpc.c \ 56 fmd_rpc_adm.c \ 57 fmd_rpc_api.c \ 58 fmd_rtld.c \ 59 fmd_scheme.c \ 60 fmd_self.c \ 61 fmd_serd.c \ 62 fmd_string.c \ 63 fmd_subr.c \ 64 fmd_svc_adm.c \ 65 fmd_svc_api.c \ 66 fmd_sysevent.c \ 67 fmd_thread.c \ 68 fmd_time.c \ 69 fmd_timerq.c \ 70 fmd_trace.c \ 71 fmd_ustat.c \ 72 fmd_xdr_adm.c \ 73 fmd_xdr_api.c \ 74 fmd_xprt.c 75 76PROG = fmd 77MANIFEST = ../common/$(PROG).xml 78 79ROOTPDIR = $(ROOT)/usr/lib/fm/$(PROG) 80ROOTVDIR = $(ROOT)/var/fm/$(PROG) 81ROOTVSUB = $(ROOTVDIR)/ckpt $(ROOTVDIR)/rsrc $(ROOTVDIR)/xprt 82ROOTPROG = $(ROOTPDIR)/$(PROG) 83 84ROOTMANIFESTDIR = $(ROOTSVCSYSTEM) 85ROOTMANIFEST = $(ROOTMANIFESTDIR)/$(PROG).xml 86 87OBJS = $(SRCS:%.c=%.o) 88LINTFILES = $(SRCS:%.c=%.ln) 89 90CLEANFILES += ../common/fmd_rpc_api.h ../common/fmd_rpc_adm.h 91CLEANFILES += fmd_svc_adm.c fmd_svc_api.c fmd_xdr_adm.c fmd_xdr_api.c 92CLEANFILES += ../common/fmd_error.c 93 94DMOD = fmd.so 95ROOTDMOD = $(ROOT)/usr/lib/mdb/proc/$(DMOD) 96DMOD_SRCS = fmd_mdb.c 97DMOD_OBJS = $(DMOD_SRCS:%.c=%.o) 98DMOD_LINT = $(DMOD_SRCS:%.c=%.ln) 99 100HDRS = fmd_api.h fmd_fmri.h 101ROOTCDIR = $(ROOT)/etc/fm/$(PROG) 102ROOTHDIR = $(ROOT)/usr/include/fm 103ROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%) 104 105$(ROOTHDRS) := FILEMODE = 0644 106$(ROOTVSUB) := DIRMODE = 0700 107$(ROOTMANIFEST) := FILEMODE = 0444 108 109$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG 110CPPFLAGS += -I. -I../common 111CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT 112CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) 113LINTFLAGS += -mu 114LDFLAGS += -R/usr/lib/fm 115LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios -luuid -lnvpair 116LDLIBS += -lexacct -lnsl -lrt -lumem 117 118$(DMOD) := CFLAGS += $(CC_PICFLAGS) -G $(XREGSFLAG) 119$(DMOD) := LDFLAGS += $(ZTEXT) -z combreloc 120 121# 122# rpcgen(1) produces code that wants to be in the foreground if we're compiled 123# DEBUG, which isn't appropriate for our daemon. Forcibly undefine this code. 124# It also produces various lint warnings; turn these off for these files only. 125# Unfortunately we also have to turn off IGNOR2 for pass2 lint as well. 126# 127fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG 128fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG 129 130fmd_svc_adm.ln fmd_svc_api.ln fmd_xdr_adm.ln fmd_xdr_api.ln := LINTFLAGS += \ 131 -xerroff=E_FUNC_ARG_UNUSED -xerroff=E_FUNC_VAR_UNUSED -xerroff=E_STATIC_UNUSED 132 133lint_prog := LINTFLAGS += -xerroff=E_FUNC_RET_ALWAYS_IGNOR2 134 135.NO_PARALLEL: 136.PARALLEL: $(OBJS) $(LINTFILES) 137 138all: $(PROG) $(DMOD) install_h 139 140$(PROG): $(OBJS) 141 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 142 $(CTFMERGE) -L VERSION -o $@ $(OBJS) 143 $(POST_PROCESS) 144 145$(DMOD): $(DMOD_OBJS) 146 $(LINK.c) $(DMOD_OBJS) -o $@ 147 $(POST_PROCESS) 148 149%.o: ../common/%.c 150 $(COMPILE.c) $< 151 $(CTFCONVERT_O) 152 153%.o: %.c 154 $(COMPILE.c) $< 155 $(CTFCONVERT_O) 156 157../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h 158 sh ../common/mkerror.sh < ../common/fmd_error.h > $@ 159 160../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h 161 162../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h 163 164../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x 165 $(RPCGEN) -CMN -h -o $@ $< 166 167fmd_svc_%.c: ../common/fmd_rpc_%.h 168 $(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'` 169 170fmd_xdr_%.c: ../common/fmd_rpc_%.h 171 $(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'` 172 173clean: 174 $(RM) $(OBJS) $(DMOD_OBJS) $(LINTFILES) $(DMOD_LINT) 175 $(RM) $(CLEANFILES) 176 177clobber: clean 178 $(RM) $(PROG) $(DMOD) 179 180%.ln: ../common/%.c 181 $(LINT.c) -c $< 182 183%.ln: %.c 184 $(LINT.c) -c $< 185 186lint_prog: $(LINTFILES) 187 $(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS) 188 189lint_dmod: $(DMOD_LINT) 190 $(LINT) $(LINTFLAGS) $(DMOD_LINT) $(LDLIBS) 191 192lint: lint_prog lint_dmod 193 194$(ROOT)/etc/fm: 195 $(INS.dir) 196 197$(ROOTCDIR): $(ROOT)/etc/fm 198 $(INS.dir) 199 200$(ROOTHDIR): 201 $(INS.dir) 202 203$(ROOTHDIR)/%.h: ../common/%.h 204 $(INS.file) 205 206$(ROOTMANIFESTDIR)/%.xml: ../common/%.xml 207 $(INS.file) 208 209$(ROOT)/var/%: 210 $(INS.dir) 211 212$(ROOTVDIR): $(ROOT)/var/fm 213 $(INS.dir) 214 215$(ROOTVSUB): $(ROOTVDIR) 216 $(INS.dir) 217 218$(ROOT)/usr/lib/%: 219 $(INS.dir) 220 221$(ROOTPDIR): $(ROOT)/usr/lib/fm 222 $(INS.dir) 223 224$(ROOTPROG): $(ROOTPDIR) $(PROG) 225 $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG) 226 227$(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb 228 $(INS.dir) 229 230$(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD) 231 $(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMOD) 232 233install_h: $(ROOTHDIR) $(ROOTHDRS) 234 235install: all install_h $(ROOTPROG) $(ROOTDMOD) \ 236 $(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST) 237 238check: $(CHKMANIFEST) 239