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