xref: /titanic_51/usr/src/cmd/fm/fmd/Makefile.fmd (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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 2005 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_thread.c \
67	fmd_time.c \
68	fmd_timerq.c \
69	fmd_trace.c \
70	fmd_transport.c \
71	fmd_ustat.c \
72	fmd_xdr_adm.c \
73	fmd_xdr_api.c
74
75PROG = fmd
76MANIFEST = ../common/$(PROG).xml
77
78ROOTPDIR = $(ROOT)/usr/lib/fm/$(PROG)
79ROOTVDIR = $(ROOT)/var/fm/$(PROG)
80ROOTVSUB = $(ROOTVDIR)/ckpt $(ROOTVDIR)/rsrc
81ROOTPROG = $(ROOTPDIR)/$(PROG)
82
83ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
84ROOTMANIFEST = $(ROOTMANIFESTDIR)/$(PROG).xml
85
86OBJS = $(SRCS:%.c=%.o)
87LINTFILES = $(SRCS:%.c=%.ln)
88
89CLEANFILES += ../common/fmd_rpc_api.h ../common/fmd_rpc_adm.h
90CLEANFILES += fmd_svc_adm.c fmd_svc_api.c fmd_xdr_adm.c fmd_xdr_api.c
91CLEANFILES += ../common/fmd_error.c
92
93DMOD = fmd.so
94ROOTDMOD = $(ROOT)/usr/lib/mdb/proc/$(DMOD)
95DMOD_SRCS = fmd_mdb.c
96DMOD_OBJS = $(DMOD_SRCS:%.c=%.o)
97DMOD_LINT = $(DMOD_SRCS:%.c=%.ln)
98
99HDRS = fmd_api.h fmd_fmri.h
100ROOTCDIR = $(ROOT)/etc/fm/$(PROG)
101ROOTHDIR = $(ROOT)/usr/include/fm
102ROOTHDRS = $(HDRS:%=$(ROOTHDIR)/%)
103
104$(ROOTHDRS) := FILEMODE = 0644
105$(ROOTVSUB) := DIRMODE = 0700
106$(ROOTMANIFEST) := FILEMODE = 0444
107
108$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
109CPPFLAGS += -I. -I../common
110CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
111CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
112LINTFLAGS += -mu
113LDFLAGS += -R/usr/lib/fm
114LDLIBS += -L$(ROOTLIB)/fm -ldiagcode -lsysevent -luuid -lnvpair
115LDLIBS += -lexacct -lnsl -lrt -lumem
116
117$(DMOD) := CFLAGS += $(CC_PICFLAGS) -G $(XREGSFLAG)
118$(DMOD) := LDFLAGS += $(ZTEXT) -z combreloc
119
120#
121# rpcgen(1) produces code that wants to be in the foreground if we're compiled
122# DEBUG, which isn't appropriate for our daemon.  Forcibly undefine this code.
123# It also produces various lint warnings; turn these off for these files only.
124# Unfortunately we also have to turn off IGNOR2 for pass2 lint as well.
125#
126fmd_svc_adm.o fmd_svc_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
127fmd_xdr_adm.o fmd_xdr_api.o := CPPFLAGS += -UDEBUG -URPC_SVC_FG
128
129fmd_svc_adm.ln fmd_svc_api.ln fmd_xdr_adm.ln fmd_xdr_api.ln := LINTFLAGS += \
130  -xerroff=E_FUNC_ARG_UNUSED -xerroff=E_FUNC_VAR_UNUSED -xerroff=E_STATIC_UNUSED
131
132lint_prog := LINTFLAGS += -xerroff=E_FUNC_RET_ALWAYS_IGNOR2
133
134#
135# Reset STRIPFLAG to the empty string.  FMD is intentionally installed with
136# a symbol table in order to help agent and diagnosis engine developers.
137#
138STRIPFLAG =
139
140.NO_PARALLEL:
141.PARALLEL: $(OBJS) $(LINTFILES)
142
143all: $(PROG) $(DMOD) install_h
144
145$(PROG): $(OBJS)
146	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
147	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
148	$(POST_PROCESS)
149
150$(DMOD): $(DMOD_OBJS)
151	$(LINK.c) $(DMOD_OBJS) -o $@
152	$(POST_PROCESS)
153
154%.o: ../common/%.c
155	$(COMPILE.c) $<
156	$(CTFCONVERT_O)
157
158%.o: %.c
159	$(COMPILE.c) $<
160	$(CTFCONVERT_O)
161
162../common/fmd_error.c: ../common/mkerror.sh ../common/fmd_error.h
163	sh ../common/mkerror.sh < ../common/fmd_error.h > $@
164
165../common/fmd_rpc_%.c: ../common/fmd_rpc_%.h
166
167../common/fmd_rpc.c: ../common/fmd_rpc_adm.h ../common/fmd_rpc_api.h
168
169../common/fmd_rpc_%.h: ../common/fmd_rpc_%.x
170	$(RPCGEN) -CMN -h -o $@ $<
171
172fmd_svc_%.c: ../common/fmd_rpc_%.h
173	$(RPCGEN) -CMN -m -o $@ `echo $< | sed 's/h$$/x/'`
174
175fmd_xdr_%.c: ../common/fmd_rpc_%.h
176	$(RPCGEN) -CMN -c -o $@ `echo $< | sed 's/h$$/x/'`
177
178clean:
179	$(RM) $(OBJS) $(DMOD_OBJS) $(LINTFILES) $(DMOD_LINT)
180	$(RM) $(CLEANFILES)
181
182clobber: clean
183	$(RM) $(PROG) $(DMOD)
184
185%.ln: ../common/%.c
186	$(LINT.c) -c $<
187
188%.ln: %.c
189	$(LINT.c) -c $<
190
191lint_prog: $(LINTFILES)
192	$(LINT) $(LINTFLAGS) $(LINTFILES) $(LDLIBS)
193
194lint_dmod: $(DMOD_LINT)
195	$(LINT) $(LINTFLAGS) $(DMOD_LINT) $(LDLIBS)
196
197lint: lint_prog lint_dmod
198
199$(ROOT)/etc/fm:
200	$(INS.dir)
201
202$(ROOTCDIR): $(ROOT)/etc/fm
203	$(INS.dir)
204
205$(ROOTHDIR):
206	$(INS.dir)
207
208$(ROOTHDIR)/%.h: ../common/%.h
209	$(INS.file)
210
211$(ROOTMANIFESTDIR)/%.xml: ../common/%.xml
212	$(INS.file)
213
214$(ROOT)/var/%:
215	$(INS.dir)
216
217$(ROOTVDIR): $(ROOT)/var/fm
218	$(INS.dir)
219
220$(ROOTVSUB): $(ROOTVDIR)
221	$(INS.dir)
222
223$(ROOT)/usr/lib/%:
224	$(INS.dir)
225
226$(ROOTPDIR): $(ROOT)/usr/lib/fm
227	$(INS.dir)
228
229$(ROOTPROG): $(ROOTPDIR) $(PROG)
230	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(PROG)
231
232$(ROOT)/usr/lib/mdb/proc: $(ROOT)/usr/lib/mdb
233	$(INS.dir)
234
235$(ROOTDMOD): $(ROOT)/usr/lib/mdb/proc $(DMOD)
236	$(RM) $@; $(INS) -s -m 0555 -f $(@D) $(DMOD)
237
238install_h: $(ROOTHDIR) $(ROOTHDRS)
239
240install: all install_h $(ROOTPROG) $(ROOTDMOD) \
241	$(ROOTCDIR) $(ROOTVDIR) $(ROOTVSUB) $(ROOTMANIFEST)
242
243check: $(CHKMANIFEST)
244