17c478bd9Sstevel@tonic-gate# 27c478bd9Sstevel@tonic-gate# CDDL HEADER START 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 5d7cd8252Stw21770# Common Development and Distribution License (the "License"). 6d7cd8252Stw21770# You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate# and limitations under the License. 127c478bd9Sstevel@tonic-gate# 137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate# 197c478bd9Sstevel@tonic-gate# CDDL HEADER END 207c478bd9Sstevel@tonic-gate# 21e802abbdSTim Haley# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 227c478bd9Sstevel@tonic-gate# Use is subject to license terms. 237c478bd9Sstevel@tonic-gate# 247c478bd9Sstevel@tonic-gate 25*8afbae07SRod Evans# This target builds both a command (daemon) and various shared objects. This 26*8afbae07SRod Evans# isn't a typical target, and the inclusion of both library and command 27*8afbae07SRod Evans# Makefiles were probably not in their original design. However, there doesn't 28*8afbae07SRod Evans# presently seem to be a clash of any required definitions. 29*8afbae07SRod Evansinclude ../../../lib/Makefile.lib 307c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gateCOMMON = .. 339acbbeafSnn35248UTSBASE = $(COMMON)/../../uts 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gateDEVFSADM_MOD = devfsadm 367c478bd9Sstevel@tonic-gate 3745916cd2SjpkDEVALLOCSRC = devalloc.c 3845916cd2Sjpk 397c478bd9Sstevel@tonic-gatePLCYSRC = devpolicy.c plcysubr.c 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gateMODLOADDIR = $(COMMON)/../modload 427c478bd9Sstevel@tonic-gate 4345916cd2SjpkDEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \ 4445916cd2Sjpk $(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%) 4545916cd2SjpkDEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o) 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gateDEVFSADM_DAEMON = devfsadmd 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gateLINKMOD_DIR = linkmod 507c478bd9Sstevel@tonic-gateDEVFSADM_DIR = devfsadm 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gateCLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON) 537c478bd9Sstevel@tonic-gate 549d58cd23SmjnelsonLINK_OBJS_CMN = \ 557c478bd9Sstevel@tonic-gate disk_link.o \ 567c478bd9Sstevel@tonic-gate ieee1394_link.o \ 578eea8e29Sap25164 dcam1394_link.o \ 587c478bd9Sstevel@tonic-gate tape_link.o \ 597c478bd9Sstevel@tonic-gate usb_link.o \ 607c478bd9Sstevel@tonic-gate port_link.o \ 617c478bd9Sstevel@tonic-gate audio_link.o \ 627c478bd9Sstevel@tonic-gate cfg_link.o \ 637c478bd9Sstevel@tonic-gate misc_link.o \ 647c478bd9Sstevel@tonic-gate lofi_link.o \ 657c478bd9Sstevel@tonic-gate ramdisk_link.o \ 667c478bd9Sstevel@tonic-gate fssnap_link.o \ 677c478bd9Sstevel@tonic-gate sgen_link.o \ 68936b7af6Sjw149990 smp_link.o \ 697c478bd9Sstevel@tonic-gate md_link.o \ 707c478bd9Sstevel@tonic-gate dtrace_link.o \ 71bfc848c6Sjm199354 vscan_link.o \ 72e802abbdSTim Haley zfs_link.o \ 73e802abbdSTim Haley zut_link.o 749d58cd23Smjnelson 759d58cd23SmjnelsonLINK_OBJS = $(LINK_OBJS_CMN) \ 76843e1988Sjohnlev $(LINK_OBJS_$(MACH)) 777c478bd9Sstevel@tonic-gate 789d58cd23SmjnelsonLINK_SRCS = $(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \ 799d58cd23Smjnelson $(LINK_OBJS_$(MACH):%.o=%.c) 809d58cd23Smjnelson 819d58cd23SmjnelsonLINT_MODULES = $(LINK_SRCS:%.c=%.ln) 829d58cd23Smjnelson 839d58cd23SmjnelsonLINK_MODS = $(LINK_OBJS:%.o=SUNW_%.so) 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gateDEVLINKTAB = devlink.tab 867c478bd9Sstevel@tonic-gateDEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gateCOMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gateCPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ 919acbbeafSnn35248 -I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR) 929acbbeafSnn35248CFLAGS += $(CCVERBOSE) $(C_PICFLAGS) 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gateLINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 957c478bd9Sstevel@tonic-gateLINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2 967c478bd9Sstevel@tonic-gateLINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2 977c478bd9Sstevel@tonic-gate 98*8afbae07SRod Evans# Define the dependencies required by devfsadm and all shared objects. 99*8afbae07SRod EvansLDLIBS += -ldevinfo 100*8afbae07SRod Evansdevfsadm := LDLIBS += -lgen -lsysevent -lnvpair -lzonecfg -lbsm 101*8afbae07SRod EvansSUNW_md_link.so := LDLIBS += -lmeta 1027c478bd9Sstevel@tonic-gate 103*8afbae07SRod Evans# All libraries are built from the same SUNW_%.so rule (see below), and define 104*8afbae07SRod Evans# their own SONAME using -h explicitly. Null the generic -h macro that gets 105*8afbae07SRod Evans# inherited from Makefile.lib, otherwise we'll get two -h definitions. 106*8afbae07SRod EvansHSONAME = 1079d58cd23Smjnelson 1087c478bd9Sstevel@tonic-gateSRCS = $(DEVFSADM_SRC) $(LINK_SRCS) 1097c478bd9Sstevel@tonic-gateOBJS = $(DEVFSADM_OBJ) $(LINK_OBJS) 1107c478bd9Sstevel@tonic-gateMODS = $(DEVFSADM_MOD) $(LINK_MODS) 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gatePOFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po) 1137c478bd9Sstevel@tonic-gatePOFILE = pdevfsadm.po 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate# install specifics 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR) 1187c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR) 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%) 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gateROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%) 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gateROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON) 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gateROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%) 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gateFILEMODE= 755 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate$(ROOTETC_DEVLINKTAB) := FILEMODE = 644 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gateall := TARGET= all 1357c478bd9Sstevel@tonic-gateinstall := TARGET= install 1367c478bd9Sstevel@tonic-gateclean := TARGET= clean 1377c478bd9Sstevel@tonic-gateclobber := TARGET= clobber 1387c478bd9Sstevel@tonic-gatelint := TARGET= lint 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate.KEEP_STATE: 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gateall: $(MODS) $(DEVLINKTAB) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gateinstall: all \ 1467c478bd9Sstevel@tonic-gate $(ROOTLIB_DEVFSADM) \ 1477c478bd9Sstevel@tonic-gate $(ROOTLIB_DEVFSADM_LINKMOD) \ 1487c478bd9Sstevel@tonic-gate $(ROOTUSRSBIN_DEVFSADM) \ 1497c478bd9Sstevel@tonic-gate $(ROOTETC_DEVLINKTAB) \ 1507c478bd9Sstevel@tonic-gate $(ROOTLIB_DEVFSADM_LINK_MODS) \ 1517c478bd9Sstevel@tonic-gate $(ROOTUSRINCLUDE) \ 1527c478bd9Sstevel@tonic-gate $(ROOTLIB_DEVFSADM_DAEMON) \ 1537c478bd9Sstevel@tonic-gate $(ROOTUSRSBIN_COMPAT_LINKS) 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gateclean: 1577c478bd9Sstevel@tonic-gate $(RM) $(OBJS) 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gatelint: $(DEVFSADM_MOD).ln $(LINT_MODULES) 1617c478bd9Sstevel@tonic-gate 1629d58cd23Smjnelsondevfsadm.ln: $(DEVFSADM_SRC) 1637c478bd9Sstevel@tonic-gate $(LINT.c) $(DEVFSADM_SRC) $(LDLIBS) 1647c478bd9Sstevel@tonic-gate 1659d58cd23Smjnelson%.ln: $(DEVFSADM_SRC) %.c 1667c478bd9Sstevel@tonic-gate $(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS) 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate$(POFILE): $(POFILES) 1717c478bd9Sstevel@tonic-gate $(RM) $@; cat $(POFILES) > $@ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate$(DEVFSADM_MOD): $(DEVFSADM_OBJ) 1749d58cd23Smjnelson $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS) 1757c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1767c478bd9Sstevel@tonic-gate 177*8afbae07SRod EvansSUNW_%.so: %.o $(MAPFILES) 178*8afbae07SRod Evans $(CC) -o $@ $(GSHARED) $(DYNFLAGS) -h $@ $< $(LDLIBS) -lc 1799d58cd23Smjnelson $(POST_PROCESS_SO) 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate%.o: $(COMMON)/%.c 1829d58cd23Smjnelson $(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK) 1839d58cd23Smjnelson $(POST_PROCESS_O) 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate$(DEVLINKTAB): $(DEVLINKTAB_SRC) 1877c478bd9Sstevel@tonic-gate $(RM) $(DEVLINKTAB) 1887c478bd9Sstevel@tonic-gate /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB) 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate$(ROOTUSRSBIN): 1917c478bd9Sstevel@tonic-gate $(INS.dir) 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM): 1947c478bd9Sstevel@tonic-gate $(INS.dir) 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate$(ROOTUSRINCLUDE): 1977c478bd9Sstevel@tonic-gate $(INS.dir) 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM_LINKMOD): 2007c478bd9Sstevel@tonic-gate $(INS.dir) 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM_LINKMOD)/%: % 2037c478bd9Sstevel@tonic-gate $(INS.file) 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM_DAEMON): 2067c478bd9Sstevel@tonic-gate $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@ 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate$(ROOTUSRSBIN_COMPAT_LINKS): $(ROOTUSRSBIN_DEVFSADM) 2097c478bd9Sstevel@tonic-gate $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@ 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate# 2127c478bd9Sstevel@tonic-gate# Source shared with add_drv/update_drv 2137c478bd9Sstevel@tonic-gate# 2147c478bd9Sstevel@tonic-gate../plcysubr.c: 2157c478bd9Sstevel@tonic-gate rm -f $@ 2167c478bd9Sstevel@tonic-gate ln -s ../modload/plcysubr.c .. 217