xref: /titanic_52/usr/src/cmd/rcm_daemon/Makefile.com (revision de8c4a14ec9a49bad5e62b2cfa6c1ba21de1c708)
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
26include ../../Makefile.cmd
27
28COMMON = ../common
29
30RCM_SRC = \
31	$(COMMON)/rcm_event.c \
32	$(COMMON)/rcm_main.c \
33	$(COMMON)/rcm_impl.c \
34	$(COMMON)/rcm_subr.c \
35	$(COMMON)/rcm_lock.c \
36	$(COMMON)/rcm_script.c
37
38RCM_OBJ = \
39	rcm_event.o \
40	rcm_main.o \
41	rcm_impl.o \
42	rcm_subr.o \
43	rcm_lock.o \
44	rcm_script.o
45
46COMMON_MOD_SRC = \
47	$(COMMON)/filesys_rcm.c \
48	$(COMMON)/dump_rcm.c \
49	$(COMMON)/swap_rcm.c \
50	$(COMMON)/network_rcm.c \
51	$(COMMON)/vlan_rcm.c \
52	$(COMMON)/vnic_rcm.c \
53	$(COMMON)/aggr_rcm.c \
54	$(COMMON)/ip_rcm.c \
55	$(COMMON)/cluster_rcm.c \
56	$(COMMON)/pool_rcm.c \
57	$(COMMON)/mpxio_rcm.c \
58	$(COMMON)/ip_anon_rcm.c \
59	$(COMMON)/svm_rcm.c
60
61sparc_MOD_SRC = $(COMMON)/ttymux_rcm.c
62
63COMMON_PERL_SCRIPT_SRC =
64
65sparc_PERL_SCRIPT_SRC = SUNW,vdevices.pl
66
67COMMON_SHELL_SCRIPT_SRC = SUNW,ibsdpu.sh
68
69COMMON_MOD_OBJ = \
70	filesys_rcm.o \
71	dump_rcm.o \
72	swap_rcm.o \
73	network_rcm.o \
74	vlan_rcm.o \
75	vnic_rcm.o \
76	aggr_rcm.o \
77	ip_rcm.o \
78	cluster_rcm.o \
79	pool_rcm.o \
80	mpxio_rcm.o \
81	ip_anon_rcm.o \
82	svm_rcm.o
83
84sparc_MOD_OBJ = ttymux_rcm.o
85
86RCM_DAEMON = rcm_daemon
87
88COMMON_RCM_MODS = \
89	SUNW_filesys_rcm.so \
90	SUNW_dump_rcm.so \
91	SUNW_swap_rcm.so \
92	SUNW_network_rcm.so \
93	SUNW_vlan_rcm.so \
94	SUNW_vnic_rcm.so \
95	SUNW_aggr_rcm.so \
96	SUNW_ip_rcm.so \
97	SUNW_cluster_rcm.so \
98	SUNW_pool_rcm.so \
99	SUNW_mpxio_rcm.so \
100	SUNW_ip_anon_rcm.so \
101	SUNW_svm_rcm.so
102
103sparc_RCM_MODS = SUNW_ttymux_rcm.so
104
105RCM_DIR = rcm
106MOD_DIR = modules
107SCRIPT_DIR = scripts
108
109CLOBBERFILES = $(COMMON_RCM_MODS) $($(MACH)_RCM_MODS) $(RCM_DAEMON)
110
111LINT_MODULES = $(COMMON_MOD_SRC:.c=.ln) $($(MACH)_MOD_SRC:.c=.ln)
112
113CPPFLAGS += -I..
114CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
115CFLAGS += $(CCVERBOSE) $(C_PICFLAGS)
116
117MAPFILES = ../common/mapfile-intf $(MAPFILE.NGB)
118rcm_daemon := LDFLAGS += $(MAPFILES:%=-M%)
119
120LINTFLAGS += -u -erroff=E_FUNC_ARG_UNUSED
121
122LDLIBS_MODULES =
123SUNW_pool_rcm.so := LDLIBS_MODULES += -L$(ROOT)/usr/lib -lpool
124SUNW_svm_rcm.so	:= LDLIBS_MODULES += -L$(ROOT)/usr/lib -lmeta
125SUNW_network_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
126SUNW_vlan_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
127SUNW_vnic_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
128SUNW_aggr_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
129SUNW_ip_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -linetutil -ldladm -lipmp
130SUNW_ip_anon_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -linetutil
131
132LDLIBS += -lgen -lelf -lrcm -lnvpair -ldevinfo -lnsl -lsocket
133
134SRCS = $(RCM_SRC) $(COMMON_MOD_SRC)
135
136POFILES = $(SRCS:.c=.po)
137POFILE = prcm_daemon.po
138
139PERL_SCRIPTS = $(COMMON_PERL_SRC) $($(MACH)_PERL_SCRIPT_SRC)
140SHELL_SCRIPTS = $(COMMON_SHELL_SCRIPT_SRC)
141RCM_SCRIPTS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS)
142
143# install specifics
144
145ROOTLIB_RCM = $(ROOTLIB)/$(RCM_DIR)
146ROOTLIB_RCM_MOD = $(ROOTLIB_RCM)/$(MOD_DIR)
147ROOTLIB_RCM_DAEMON = $(RCM_DAEMON:%=$(ROOTLIB_RCM)/%)
148ROOTLIB_RCM_MODULES = $(COMMON_RCM_MODS:%=$(ROOTLIB_RCM_MOD)/%) \
149			$($(MACH)_RCM_MODS:%=$(ROOTLIB_RCM_MOD)/%)
150ROOTLIB_RCM_SCRIPT = $(ROOTLIB_RCM)/$(SCRIPT_DIR)
151ROOTLIB_RCM_SCRIPTS = $(RCM_SCRIPTS:%=$(ROOTLIB_RCM_SCRIPT)/%)
152ROOTETC_RCM = $(ROOTETC)/$(RCM_DIR)
153ROOTETC_RCM_SCRIPT = $(ROOTETC_RCM)/$(SCRIPT_DIR)
154
155all :=		TARGET= all
156install :=	TARGET= install
157clean :=	TARGET= clean
158clobber :=	TARGET= clobber
159lint :=		TARGET= lint
160
161$(ROOTETC_RCM) :=		GROUP = sys
162$(ROOTETC_RCM_SCRIPT) :=	GROUP = sys
163$(ROOTLIB_RCM_SCRIPTS) :=	FILEMODE = 555
164
165.KEEP_STATE:
166
167all: $(RCM_DAEMON) $(COMMON_RCM_MODS) $($(MACH)_RCM_MODS)
168
169install: all			\
170	$(ROOTLIB_RCM)		\
171	$(ROOTLIB_RCM_DAEMON)	\
172	$(ROOTLIB_RCM_MOD)	\
173	$(ROOTLIB_RCM_MODULES)	\
174	$(ROOTLIB_RCM_SCRIPT)	\
175	$(ROOTETC_RCM)		\
176	$(ROOTETC_RCM_SCRIPT)	\
177	$(ROOTLIB_RCM_SCRIPTS)
178
179clean:
180	$(RM) $(RCM_OBJ) $(COMMON_MOD_OBJ) $($(MACH)_MOD_OBJ) $(POFILES)
181
182lint: $(RCM_DAEMON).ln $(LINT_MODULES)
183
184$(RCM_DAEMON).ln: FRC
185	$(LINT.c) $(RCM_SRC) $(LDLIBS)
186
187%.ln: FRC
188	$(LINT.c) $(RCM_SRC) $(@:.ln=.c) $(LDLIBS)
189
190FRC:
191
192include ../../Makefile.targ
193
194$(POFILE):      $(POFILES)
195	$(RM) $@; cat $(POFILES) > $@
196
197$(RCM_DAEMON): $(RCM_OBJ) $(MAPFILES)
198	$(LINK.c) -o $@ $< $(RCM_OBJ) $(LDLIBS)
199	$(POST_PROCESS)
200
201SUNW_%.so: %.o
202	$(LINK.c) -o $@ $(GSHARED) -h $@ $< $(LDLIBS_MODULES)
203
204%.o: $(COMMON)/%.c
205	$(COMPILE.c) -o $@ $<
206
207$(ROOTLIB_RCM):
208	$(INS.dir)
209
210$(ROOTLIB_RCM)/%: %
211	$(INS.file)
212
213$(ROOTLIB_RCM_MOD):
214	$(INS.dir)
215
216$(ROOTLIB_RCM_MOD)/%: %
217	$(INS.file)
218
219$(ROOTLIB_RCM_SCRIPT):
220	$(INS.dir)
221
222$(ROOTETC_RCM):
223	$(INS.dir)
224
225$(ROOTETC_RCM_SCRIPT):
226	$(INS.dir)
227
228$(ROOTLIB_RCM_SCRIPT)/%: $(COMMON)/%
229	$(INS.file)
230