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