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, Version 1.0 only 6# (the "License"). You may not use this file except in compliance 7# with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# 23# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28 29include ../../Makefile.cmd 30 31COMMON = .. 32 33DEVFSADM_MOD = devfsadm 34 35PLCYSRC = devpolicy.c plcysubr.c 36 37MODLOADDIR = $(COMMON)/../modload 38 39DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) $(PLCYSRC:%=$(COMMON)/%) 40DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(PLCYSRC:%.c=%.o) 41 42DEVFSADM_DAEMON = devfsadmd 43 44LINKMOD_DIR = linkmod 45DEVFSADM_DIR = devfsadm 46 47CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON) 48 49LINK_SRCS = \ 50 $(COMMON)/disk_link.c \ 51 $(COMMON)/ieee1394_link.c \ 52 $(COMMON)/dcam1394_link.c \ 53 $(COMMON)/tape_link.c \ 54 $(COMMON)/usb_link.c \ 55 $(COMMON)/port_link.c \ 56 $(COMMON)/audio_link.c \ 57 $(COMMON)/cfg_link.c \ 58 $(COMMON)/misc_link.c \ 59 $(COMMON)/lofi_link.c \ 60 $(COMMON)/ramdisk_link.c \ 61 $(COMMON)/fssnap_link.c \ 62 $(COMMON)/sgen_link.c \ 63 $(COMMON)/md_link.c \ 64 $(COMMON)/dtrace_link.c \ 65 $(MISC_LINK_ISA).c 66 67LINT_MODULES = $(LINK_SRCS:.c=.ln) 68 69LINK_OBJS = \ 70 disk_link.o \ 71 ieee1394_link.o \ 72 dcam1394_link.o \ 73 tape_link.o \ 74 usb_link.o \ 75 port_link.o \ 76 audio_link.o \ 77 cfg_link.o \ 78 misc_link.o \ 79 lofi_link.o \ 80 ramdisk_link.o \ 81 fssnap_link.o \ 82 sgen_link.o \ 83 md_link.o \ 84 dtrace_link.o \ 85 $(MISC_LINK_ISA).o 86 87LINK_MODS = \ 88 SUNW_disk_link.so \ 89 SUNW_ieee1394_link.so \ 90 SUNW_dcam1394_link.so \ 91 SUNW_tape_link.so \ 92 SUNW_usb_link.so \ 93 SUNW_port_link.so \ 94 SUNW_audio_link.so \ 95 SUNW_cfg_link.so \ 96 SUNW_misc_link.so \ 97 SUNW_lofi_link.so \ 98 SUNW_ramdisk_link.so \ 99 SUNW_fssnap_link.so \ 100 SUNW_sgen_link.so \ 101 SUNW_md_link.so \ 102 SUNW_dtrace_link.so \ 103 SUNW_$(MISC_LINK_ISA).so 104 105DEVLINKTAB = devlink.tab 106DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh 107 108DEVFSADM_DEFAULT = devfsadm 109DEVFSADM_DEFAULT_SRC = $(COMMON)/devfsadm.dfl 110 111COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig 112 113CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ 114 -I.. -I../../../uts/common -I$(MODLOADDIR) 115CFLAGS += $(CCVERBOSE) $(C_PICFLAGS) -I.. -I$(MODLOADDIR) 116 117LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 118LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2 119LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2 120 121LAZYLIBS = -z lazyload -lzonecfg -z nolazyload 122lint := LAZYLIBS = -lzonecfg 123LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -lcmd $(LAZYLIBS) 124 125SRCS = $(DEVFSADM_SRC) $(LINK_SRCS) 126OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS) 127MODS = $(DEVFSADM_MOD) $(LINK_MODS) 128 129POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po) 130POFILE = pdevfsadm.po 131 132# install specifics 133 134ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR) 135ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR) 136 137ETCDEFAULT = $(ROOTETC)/default 138ETCDEFAULT_DEVFSADM = $(DEVFSADM_DEFAULT:%=$(ETCDEFAULT)/%) 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 156$(ETCDEFAULT_DEVFSADM) := FILEMODE = 444 157 158all := TARGET= all 159install := TARGET= install 160clean := TARGET= clean 161clobber := TARGET= clobber 162lint := TARGET= lint 163 164 165.KEEP_STATE: 166 167all: $(MODS) $(DEVLINKTAB) 168 169install: all \ 170 $(ROOTLIB_DEVFSADM) \ 171 $(ROOTLIB_DEVFSADM_LINKMOD) \ 172 $(ROOTUSRSBIN_DEVFSADM) \ 173 $(ROOTETC_DEVLINKTAB) \ 174 $(ROOTLIB_DEVFSADM_LINK_MODS) \ 175 $(ROOTUSRINCLUDE) \ 176 $(ROOTLIB_DEVFSADM_DAEMON) \ 177 $(ETCDEFAULT) \ 178 $(ETCDEFAULT_DEVFSADM) \ 179 $(ROOTUSRSBIN_COMPAT_LINKS) 180 181 182clean: 183 $(RM) $(OBJS) 184 185 186lint: $(DEVFSADM_MOD).ln $(LINT_MODULES) 187 188devfsadm.ln: FRC 189 $(LINT.c) $(DEVFSADM_SRC) $(LDLIBS) 190 191%.ln: FRC 192 $(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS) 193 194FRC: 195 196include ../../Makefile.targ 197 198$(POFILE): $(POFILES) 199 $(RM) $@; cat $(POFILES) > $@ 200 201$(DEVFSADM_MOD): $(DEVFSADM_OBJ) 202 $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS) 203 $(POST_PROCESS) 204 205SUNW_%.so: %.o 206 $(LINK.c) -o $@ $(GSHARED) -h $@ $< 207 208%.o: $(COMMON)/%.c 209 $(COMPILE.c) -o $@ $< 210 211 212$(DEVLINKTAB): $(DEVLINKTAB_SRC) 213 $(RM) $(DEVLINKTAB) 214 /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB) 215 216$(ETCDEFAULT)/%: % 217 $(RM) -r default 218 mkdir default 219 cp $(DEVFSADM_DEFAULT_SRC) default/$(DEVFSADM_DEFAULT) 220 cd default ; $(INS.file) 221 $(RM) -r default 222 223$(ETCDEFAULT): 224 $(INS.dir) 225 226$(ROOTUSRSBIN): 227 $(INS.dir) 228 229$(ROOTLIB_DEVFSADM): 230 $(INS.dir) 231 232$(ROOTUSRINCLUDE): 233 $(INS.dir) 234 235$(ROOTLIB_DEVFSADM_LINKMOD): 236 $(INS.dir) 237 238$(ROOTLIB_DEVFSADM_LINKMOD)/%: % 239 $(INS.file) 240 241$(ROOTLIB_DEVFSADM_DAEMON): 242 $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@ 243 244$(ROOTUSRSBIN_COMPAT_LINKS): $(ROOTUSRSBIN_DEVFSADM) 245 $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@ 246 247# 248# Source shared with add_drv/update_drv 249# 250../plcysubr.c: 251 rm -f $@ 252 ln -s ../modload/plcysubr.c .. 253