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