move 32-bit libs to lib/i386 subdirs & 64-bit libs to lib/
[unleashed.git] / usr / src / cmd / rcm_daemon / Makefile.com
blob656ee453b9d406a39024e18f4d3e1b9966f2fa81
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
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.
28 include ../../Makefile.cmd
30 COMMON = ../common
32 RCM_SRC = \
33         $(COMMON)/rcm_event.c \
34         $(COMMON)/rcm_main.c \
35         $(COMMON)/rcm_impl.c \
36         $(COMMON)/rcm_subr.c \
37         $(COMMON)/rcm_lock.c \
38         $(COMMON)/rcm_script.c
40 RCM_OBJ = \
41         rcm_event.o \
42         rcm_main.o \
43         rcm_impl.o \
44         rcm_subr.o \
45         rcm_lock.o \
46         rcm_script.o
48 COMMON_MOD_SRC = \
49         $(COMMON)/filesys_rcm.c \
50         $(COMMON)/dump_rcm.c \
51         $(COMMON)/swap_rcm.c \
52         $(COMMON)/network_rcm.c \
53         $(COMMON)/vlan_rcm.c \
54         $(COMMON)/vnic_rcm.c \
55         $(COMMON)/ibpart_rcm.c \
56         $(COMMON)/aggr_rcm.c \
57         $(COMMON)/ip_rcm.c \
58         $(COMMON)/pool_rcm.c \
59         $(COMMON)/mpxio_rcm.c \
60         $(COMMON)/ip_anon_rcm.c \
61         $(COMMON)/bridge_rcm.c
63 sparc_MOD_SRC = $(COMMON)/ttymux_rcm.c
65 COMMON_PERL_SCRIPT_SRC =
67 sparc_PERL_SCRIPT_SRC = SUNW,vdevices.pl
69 COMMON_SHELL_SCRIPT_SRC = SUNW,ibsdpu.sh        \
70                         SUNW,rdsv3u.sh
72 COMMON_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         pool_rcm.o \
83         mpxio_rcm.o \
84         ip_anon_rcm.o \
85         bridge_rcm.o
87 sparc_MOD_OBJ = ttymux_rcm.o
89 RCM_DAEMON = rcm_daemon
91 COMMON_RCM_MODS = \
92         SUNW_filesys_rcm.so \
93         SUNW_dump_rcm.so \
94         SUNW_swap_rcm.so \
95         SUNW_network_rcm.so \
96         SUNW_vlan_rcm.so \
97         SUNW_vnic_rcm.so \
98         SUNW_ibpart_rcm.so \
99         SUNW_aggr_rcm.so \
100         SUNW_ip_rcm.so \
101         SUNW_pool_rcm.so \
102         SUNW_mpxio_rcm.so \
103         SUNW_ip_anon_rcm.so \
104         SUNW_bridge_rcm.so
106 sparc_RCM_MODS = SUNW_ttymux_rcm.so
108 RCM_DIR = rcm
109 MOD_DIR = modules
110 SCRIPT_DIR = scripts
112 CLOBBERFILES += $(COMMON_RCM_MODS) $($(MACH)_RCM_MODS) $(RCM_DAEMON)
114 CPPFLAGS += -I..
115 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS
116 CFLAGS += $(C_PICFLAGS)
118 CERRWARN += -Wno-parentheses
119 CERRWARN += -Wno-unused-label
120 CERRWARN += -Wno-uninitialized
121 CERRWARN += -Wno-unused-function
123 # not linted
124 SMATCH=off
126 MAPFILES = ../common/mapfile-intf $(MAPFILE.NGB)
127 rcm_daemon := LDFLAGS += $(MAPFILES:%=-Wl,-M%)
130 LDLIBS_MODULES = -L$(ROOT)/lib/$(MACH32) -L$(ROOT)/usr/lib
131 SUNW_pool_rcm.so := LDLIBS_MODULES += -lpool
132 SUNW_network_rcm.so := LDLIBS_MODULES += -ldladm
133 SUNW_vlan_rcm.so := LDLIBS_MODULES += -ldladm
134 SUNW_vnic_rcm.so := LDLIBS_MODULES += -ldladm
135 SUNW_ibpart_rcm.so := LDLIBS_MODULES += -ldladm
136 SUNW_aggr_rcm.so := LDLIBS_MODULES += -ldladm
137 SUNW_ip_rcm.so := LDLIBS_MODULES += -linetutil -ldladm -lipmp -lipadm
138 SUNW_ip_anon_rcm.so := LDLIBS_MODULES += -linetutil
139 SUNW_bridge_rcm.so := LDLIBS_MODULES += -ldladm
141 LDLIBS += -lgen -lelf -lrcm -lnvpair -ldevinfo
143 SRCS = $(RCM_SRC) $(COMMON_MOD_SRC)
145 POFILES = $(SRCS:.c=.po)
146 POFILE = prcm_daemon.po
148 PERL_SCRIPTS = $(COMMON_PERL_SRC) $($(MACH)_PERL_SCRIPT_SRC)
149 SHELL_SCRIPTS = $(COMMON_SHELL_SCRIPT_SRC)
150 RCM_SCRIPTS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS)
152 # install specifics
154 ROOTLIB_RCM = $(ROOTLIB64)/$(RCM_DIR)
155 ROOTLIB_RCM_MOD = $(ROOTLIB_RCM)/$(MOD_DIR)
156 ROOTLIB_RCM_DAEMON = $(RCM_DAEMON:%=$(ROOTLIB_RCM)/%)
157 ROOTLIB_RCM_MODULES = $(COMMON_RCM_MODS:%=$(ROOTLIB_RCM_MOD)/%) \
158                         $($(MACH)_RCM_MODS:%=$(ROOTLIB_RCM_MOD)/%)
159 ROOTLIB_RCM_SCRIPT = $(ROOTLIB_RCM)/$(SCRIPT_DIR)
160 ROOTLIB_RCM_SCRIPTS = $(RCM_SCRIPTS:%=$(ROOTLIB_RCM_SCRIPT)/%)
161 ROOTETC_RCM = $(ROOTETC)/$(RCM_DIR)
162 ROOTETC_RCM_SCRIPT = $(ROOTETC_RCM)/$(SCRIPT_DIR)
164 all :=          TARGET= all
165 install :=      TARGET= install
166 clean :=        TARGET= clean
167 clobber :=      TARGET= clobber
169 $(ROOTLIB_RCM_SCRIPTS) :=       FILEMODE = 555
171 .KEEP_STATE:
173 all: $(RCM_DAEMON) $(COMMON_RCM_MODS) $($(MACH)_RCM_MODS)
175 install: all                    \
176         $(ROOTLIB_RCM)          \
177         $(ROOTLIB_RCM_DAEMON)   \
178         $(ROOTLIB_RCM_MOD)      \
179         $(ROOTLIB_RCM_MODULES)  \
180         $(ROOTLIB_RCM_SCRIPT)   \
181         $(ROOTETC_RCM)          \
182         $(ROOTETC_RCM_SCRIPT)   \
183         $(ROOTLIB_RCM_SCRIPTS)
185 clean:
186         $(RM) $(RCM_OBJ) $(COMMON_MOD_OBJ) $($(MACH)_MOD_OBJ) $(POFILES)
188 FRC:
190 include ../../Makefile.targ
192 $(POFILE):      $(POFILES)
193         $(RM) $@; cat $(POFILES) > $@
195 $(RCM_DAEMON): $(RCM_OBJ) $(MAPFILES)
196         $(LINK.c) -o $@ $< $(RCM_OBJ) $(LDLIBS)
197         $(POST_PROCESS)
199 SUNW_%.so: %.o
200         $(LINK.c) -o $@ $(GSHARED) -Wl,-h$@ $< $(LDLIBS_MODULES)
202 %.o: $(COMMON)/%.c
203         $(COMPILE.c) -o $@ $<
205 $(ROOTLIB_RCM):
206         $(INS.dir)
208 $(ROOTLIB_RCM)/%: %
209         $(INS.file)
211 $(ROOTLIB_RCM_MOD):
212         $(INS.dir)
214 $(ROOTLIB_RCM_MOD)/%: %
215         $(INS.file)
217 $(ROOTLIB_RCM_SCRIPT):
218         $(INS.dir)
220 $(ROOTETC_RCM):
221         $(INS.dir)
223 $(ROOTETC_RCM_SCRIPT):
224         $(INS.dir)
226 $(ROOTLIB_RCM_SCRIPT)/%: $(COMMON)/%
227         $(INS.file)