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