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 2006 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24# 25# ident "%Z%%M% %I% %E% SMI" 26# 27 28include ../../Makefile.cmd 29 30COMMON = .. 31UTSBASE = $(COMMON)/../../uts 32 33DEVFSADM_MOD = devfsadm 34 35DEVALLOCSRC = devalloc.c 36 37PLCYSRC = devpolicy.c plcysubr.c 38 39MODLOADDIR = $(COMMON)/../modload 40 41DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \ 42 $(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%) 43DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o) 44 45DEVFSADM_DAEMON = devfsadmd 46 47LINKMOD_DIR = linkmod 48DEVFSADM_DIR = devfsadm 49 50CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON) 51 52LINK_SRCS = \ 53 $(COMMON)/disk_link.c \ 54 $(COMMON)/ieee1394_link.c \ 55 $(COMMON)/dcam1394_link.c \ 56 $(COMMON)/tape_link.c \ 57 $(COMMON)/usb_link.c \ 58 $(COMMON)/port_link.c \ 59 $(COMMON)/audio_link.c \ 60 $(COMMON)/cfg_link.c \ 61 $(COMMON)/misc_link.c \ 62 $(COMMON)/lofi_link.c \ 63 $(COMMON)/ramdisk_link.c \ 64 $(COMMON)/fssnap_link.c \ 65 $(COMMON)/sgen_link.c \ 66 $(COMMON)/md_link.c \ 67 $(COMMON)/dtrace_link.c \ 68 $(COMMON)/zfs_link.c \ 69 $(LINK_SRCS_($MACH)) 70 71LINT_MODULES = $(LINK_SRCS:.c=.ln) 72 73LINK_OBJS = \ 74 disk_link.o \ 75 ieee1394_link.o \ 76 dcam1394_link.o \ 77 tape_link.o \ 78 usb_link.o \ 79 port_link.o \ 80 audio_link.o \ 81 cfg_link.o \ 82 misc_link.o \ 83 lofi_link.o \ 84 ramdisk_link.o \ 85 fssnap_link.o \ 86 sgen_link.o \ 87 md_link.o \ 88 dtrace_link.o \ 89 zfs_link.o \ 90 $(LINK_OBJS_($MACH)) 91 92LINK_MODS = \ 93 SUNW_disk_link.so \ 94 SUNW_ieee1394_link.so \ 95 SUNW_dcam1394_link.so \ 96 SUNW_tape_link.so \ 97 SUNW_usb_link.so \ 98 SUNW_port_link.so \ 99 SUNW_audio_link.so \ 100 SUNW_cfg_link.so \ 101 SUNW_misc_link.so \ 102 SUNW_lofi_link.so \ 103 SUNW_ramdisk_link.so \ 104 SUNW_fssnap_link.so \ 105 SUNW_sgen_link.so \ 106 SUNW_md_link.so \ 107 SUNW_dtrace_link.so \ 108 SUNW_zfs_link.so \ 109 $(LINK_MODS_$(MACH)) 110 111DEVLINKTAB = devlink.tab 112DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh 113 114COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig 115 116CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ 117 -I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR) 118CFLAGS += $(CCVERBOSE) $(C_PICFLAGS) 119 120LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 121LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2 122LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2 123 124LAZYLIBS = $(ZLAZYLOAD) -lzonecfg -lbrand -lbsm $(ZNOLAZYLOAD) 125lint := LAZYLIBS = -lzonecfg -lbrand -lbsm 126LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -ldoor $(LAZYLIBS) -lnsl 127 128SRCS = $(DEVFSADM_SRC) $(LINK_SRCS) 129OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS) 130MODS = $(DEVFSADM_MOD) $(LINK_MODS) 131 132POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po) 133POFILE = pdevfsadm.po 134 135# install specifics 136 137ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR) 138ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR) 139 140ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%) 141 142ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%) 143 144ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%) 145 146ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON) 147 148ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%) 149 150OWNER= root 151GROUP= sys 152FILEMODE= 755 153 154$(ROOTETC_DEVLINKTAB) := FILEMODE = 644 155 156all := TARGET= all 157install := TARGET= install 158clean := TARGET= clean 159clobber := TARGET= clobber 160lint := TARGET= lint 161 162 163.KEEP_STATE: 164 165all: $(MODS) $(DEVLINKTAB) 166 167install: all \ 168 $(ROOTLIB_DEVFSADM) \ 169 $(ROOTLIB_DEVFSADM_LINKMOD) \ 170 $(ROOTUSRSBIN_DEVFSADM) \ 171 $(ROOTETC_DEVLINKTAB) \ 172 $(ROOTLIB_DEVFSADM_LINK_MODS) \ 173 $(ROOTUSRINCLUDE) \ 174 $(ROOTLIB_DEVFSADM_DAEMON) \ 175 $(ROOTUSRSBIN_COMPAT_LINKS) 176 177 178clean: 179 $(RM) $(OBJS) 180 181 182lint: $(DEVFSADM_MOD).ln $(LINT_MODULES) 183 184devfsadm.ln: FRC 185 $(LINT.c) $(DEVFSADM_SRC) $(LDLIBS) 186 187%.ln: FRC 188 $(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS) 189 190FRC: 191 192include ../../Makefile.targ 193 194$(POFILE): $(POFILES) 195 $(RM) $@; cat $(POFILES) > $@ 196 197$(DEVFSADM_MOD): $(DEVFSADM_OBJ) 198 $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS) -lmeta 199 $(POST_PROCESS) 200 201SUNW_%.so: %.o 202 $(LINK.c) -o $@ $(GSHARED) -h $@ $< 203 204%.o: $(COMMON)/%.c 205 $(COMPILE.c) -o $@ $< 206 207 208$(DEVLINKTAB): $(DEVLINKTAB_SRC) 209 $(RM) $(DEVLINKTAB) 210 /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB) 211 212$(ROOTUSRSBIN): 213 $(INS.dir) 214 215$(ROOTLIB_DEVFSADM): 216 $(INS.dir) 217 218$(ROOTUSRINCLUDE): 219 $(INS.dir) 220 221$(ROOTLIB_DEVFSADM_LINKMOD): 222 $(INS.dir) 223 224$(ROOTLIB_DEVFSADM_LINKMOD)/%: % 225 $(INS.file) 226 227$(ROOTLIB_DEVFSADM_DAEMON): 228 $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@ 229 230$(ROOTUSRSBIN_COMPAT_LINKS): $(ROOTUSRSBIN_DEVFSADM) 231 $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@ 232 233# 234# Source shared with add_drv/update_drv 235# 236../plcysubr.c: 237 rm -f $@ 238 ln -s ../modload/plcysubr.c .. 239