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