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