xref: /titanic_44/usr/src/cmd/fm/fmd/Makefile.fmd (revision dd51520e127b452179a2ce4ea3bd8dee949f9afe)
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
119
120$(PROG) := LDFLAGS += -R/usr/lib/fm
121$(PROG) := LDLIBS += -L$(ROOTLIB)/fm -ltopo -ldiagcode -lsysevent -lsmbios \
122		-luuid -lnvpair -lexacct -lnsl -lumem -ldevinfo -lfmd_msg
123
124$(DMOD) := CFLAGS += $(CC_PICFLAGS) -G $(XREGSFLAG)
125$(DMOD) := LDFLAGS += $(ZTEXT) $(ZDEFS) $(MAPFILE-DMOD:%=-M%)
126
127#
128# rpcgen(1) produces code that wants to be in the foreground if we're compiled
129# DEBUG, which isn't appropriate for our daemon.  Forcibly undefine this code.
130# It also produces various lint warnings; turn these off for these files only.
131# Unfortunately we also have to turn off IGNOR2 for pass2 lint as well.
132#
133fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
134fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
135
136fmd_svc_adm.ln fmd_svc_api.ln fmd_xdr_adm.ln fmd_xdr_api.ln := LINTFLAGS += \
137  -xerroff=E_FUNC_ARG_UNUSED -xerroff=E_FUNC_VAR_UNUSED -xerroff=E_STATIC_UNUSED
138
139lint_prog := LINTFLAGS += -xerroff=E_FUNC_RET_ALWAYS_IGNOR2
140
141.NO_PARALLEL:
142.PARALLEL: $(OBJS) $(LINTFILES)
143
144all: $(PROG) $(DMOD) install_h
145
146$(LOGADMDIR):
147	$(INS.dir)
148
149$(LOGADMDIR)/%.conf: ../common/%.conf
150	$(INS.file)
151
152$(PROG): $(OBJS)
153	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
154	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
155	$(POST_PROCESS)
156
157$(DMOD): $(DMOD_OBJS)
158	$(LINK.c) $(DMOD_OBJS) -o $@ -lc
159	$(POST_PROCESS)
160
161%.o: ../common/%.c
162	$(COMPILE.c) $<
163	$(CTFCONVERT_O)
164
165%.o: %.c
166	$(COMPILE.c) $<
167	$(CTFCONVERT_O)
168
169../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h
170	sh ../common/mkerror.sh < ../common/fmd_error.h > $@
171
172../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h
173
174../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h
175
176../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x
177	$(RPCGEN) -CMN -h -o $@ $<
178
179fmd_svc_%.c: ../common/fmd_rpc_%.h
180	$(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'`
181
182fmd_xdr_%.c: ../common/fmd_rpc_%.h
183	$(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'`
184
185clean:
186	$(RM) $(OBJS) $(DMOD_OBJS) $(LINTFILES) $(DMOD_LINT)
187	$(RM) $(CLEANFILES)
188
189clobber: clean
190	$(RM) $(PROG) $(DMOD)
191
192%.ln: ../common/%.c
193	$(LINT.c) -c $<
194
195%.ln: %.c
196	$(LINT.c) -c $<
197
198lint_prog: $(LINTFILES)
199	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
200
201lint_dmod: $(DMOD_LINT)
202	$(LINT) $(LINTFLAGS) $(DMOD_LINT) $(LDLIBS)
203
204lint: lint_prog lint_dmod
205
206$(ROOT)/etc/fm:
207	$(INS.dir)
208
209$(ROOTCDIR): $(ROOT)/etc/fm
210	$(INS.dir)
211
212$(ROOTHDIR):
213	$(INS.dir)
214
215$(ROOTHDIR)/%.h: ../common/%.h
216	$(INS.file)
217
218$(ROOTMANIFESTDIR)/%.xml: ../common/%.xml
219	$(INS.file)
220
221$(ROOT)/var/%:
222	$(INS.dir)
223
224$(ROOTVDIR): $(ROOT)/var/fm
225	$(INS.dir)
226
227$(ROOTVSUB): $(ROOTVDIR)
228	$(INS.dir)
229
230$(ROOT)/usr/lib/fm:
231	$(INS.dir)
232
233$(ROOTPDIR): $(ROOT)/usr/lib/fm
234	$(INS.dir)
235
236$(ROOTPROG): $(ROOTPDIR) $(PROG)
237	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
238
239$(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb
240	$(INS.dir)
241
242$(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD)
243	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMOD)
244
245install_h: $(ROOTHDIR) $(ROOTHDRS)
246
247install: all install_h $(ROOTPROG) $(ROOTDMOD) $(LOGADMDIR) $(LOGADMENT) \
248	$(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST)
249
250check: $(CHKMANIFEST)
251