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