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