xref: /titanic_53/usr/src/cmd/devfsadm/Makefile.com (revision bfc848c632c9eacb2a640246d96e198f1b185c03)
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#
21*bfc848c6Sjm199354# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
227c478bd9Sstevel@tonic-gate# Use is subject to license terms.
237c478bd9Sstevel@tonic-gate#
247c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateCOMMON = ..
309acbbeafSnn35248UTSBASE = $(COMMON)/../../uts
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateDEVFSADM_MOD = devfsadm
337c478bd9Sstevel@tonic-gate
3445916cd2SjpkDEVALLOCSRC =	devalloc.c
3545916cd2Sjpk
367c478bd9Sstevel@tonic-gatePLCYSRC = devpolicy.c plcysubr.c
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateMODLOADDIR = $(COMMON)/../modload
397c478bd9Sstevel@tonic-gate
4045916cd2SjpkDEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \
4145916cd2Sjpk		$(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%)
4245916cd2SjpkDEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o)
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gateDEVFSADM_DAEMON = devfsadmd
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gateLINKMOD_DIR = linkmod
477c478bd9Sstevel@tonic-gateDEVFSADM_DIR = devfsadm
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gateCLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
507c478bd9Sstevel@tonic-gate
519d58cd23SmjnelsonLINK_OBJS_CMN =			\
527c478bd9Sstevel@tonic-gate	disk_link.o		\
537c478bd9Sstevel@tonic-gate	ieee1394_link.o		\
548eea8e29Sap25164	dcam1394_link.o		\
557c478bd9Sstevel@tonic-gate	tape_link.o		\
567c478bd9Sstevel@tonic-gate	usb_link.o		\
577c478bd9Sstevel@tonic-gate	port_link.o		\
587c478bd9Sstevel@tonic-gate	audio_link.o		\
597c478bd9Sstevel@tonic-gate	cfg_link.o		\
607c478bd9Sstevel@tonic-gate	misc_link.o		\
617c478bd9Sstevel@tonic-gate	lofi_link.o		\
627c478bd9Sstevel@tonic-gate	ramdisk_link.o		\
637c478bd9Sstevel@tonic-gate	fssnap_link.o           \
647c478bd9Sstevel@tonic-gate	sgen_link.o		\
65936b7af6Sjw149990	smp_link.o		\
667c478bd9Sstevel@tonic-gate	md_link.o		\
677c478bd9Sstevel@tonic-gate	dtrace_link.o		\
68*bfc848c6Sjm199354	vscan_link.o		\
699d58cd23Smjnelson	zfs_link.o
709d58cd23Smjnelson
719d58cd23SmjnelsonLINK_OBJS =	$(LINK_OBJS_CMN) \
72843e1988Sjohnlev		$(LINK_OBJS_$(MACH))
737c478bd9Sstevel@tonic-gate
749d58cd23SmjnelsonLINK_SRCS =	$(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \
759d58cd23Smjnelson		$(LINK_OBJS_$(MACH):%.o=%.c)
769d58cd23Smjnelson
779d58cd23SmjnelsonLINT_MODULES = $(LINK_SRCS:%.c=%.ln)
789d58cd23Smjnelson
799d58cd23SmjnelsonLINK_MODS =	$(LINK_OBJS:%.o=SUNW_%.so)
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gateDEVLINKTAB = devlink.tab
827c478bd9Sstevel@tonic-gateDEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gateCOMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gateCPPFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
879acbbeafSnn35248		-I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR)
889acbbeafSnn35248CFLAGS += $(CCVERBOSE) $(C_PICFLAGS)
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gateLINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
917c478bd9Sstevel@tonic-gateLINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
927c478bd9Sstevel@tonic-gateLINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
937c478bd9Sstevel@tonic-gate
949acbbeafSnn35248LAZYLIBS =	$(ZLAZYLOAD) -lzonecfg -lbrand -lbsm $(ZNOLAZYLOAD)
959acbbeafSnn35248lint := LAZYLIBS = -lzonecfg -lbrand -lbsm
9606e1a714SrafLDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -ldoor $(LAZYLIBS) -lnsl
977c478bd9Sstevel@tonic-gate
989d58cd23SmjnelsonLINK_MOD_LDLIBS=
999d58cd23SmjnelsonSUNW_md_link.so :=	LINK_MOD_LDLIBS=	-lmeta
1009d58cd23Smjnelson
1017c478bd9Sstevel@tonic-gateSRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
1027c478bd9Sstevel@tonic-gateOBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
1037c478bd9Sstevel@tonic-gateMODS = $(DEVFSADM_MOD) $(LINK_MODS)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gatePOFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
1067c478bd9Sstevel@tonic-gatePOFILE = pdevfsadm.po
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate# install specifics
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
1117c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gateROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
1167c478bd9Sstevel@tonic-gate
1177c478bd9Sstevel@tonic-gateROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gateROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gateROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gateOWNER= root
1247c478bd9Sstevel@tonic-gateGROUP= sys
1257c478bd9Sstevel@tonic-gateFILEMODE= 755
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gateall :=		TARGET= all
1307c478bd9Sstevel@tonic-gateinstall :=	TARGET= install
1317c478bd9Sstevel@tonic-gateclean :=	TARGET= clean
1327c478bd9Sstevel@tonic-gateclobber :=	TARGET= clobber
1337c478bd9Sstevel@tonic-gatelint :=		TARGET= lint
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate.KEEP_STATE:
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gateall: $(MODS) $(DEVLINKTAB)
1397c478bd9Sstevel@tonic-gate
1407c478bd9Sstevel@tonic-gateinstall: all				\
1417c478bd9Sstevel@tonic-gate	$(ROOTLIB_DEVFSADM)		\
1427c478bd9Sstevel@tonic-gate	$(ROOTLIB_DEVFSADM_LINKMOD)	\
1437c478bd9Sstevel@tonic-gate	$(ROOTUSRSBIN_DEVFSADM)		\
1447c478bd9Sstevel@tonic-gate	$(ROOTETC_DEVLINKTAB)		\
1457c478bd9Sstevel@tonic-gate	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
1467c478bd9Sstevel@tonic-gate	$(ROOTUSRINCLUDE)		\
1477c478bd9Sstevel@tonic-gate	$(ROOTLIB_DEVFSADM_DAEMON)	\
1487c478bd9Sstevel@tonic-gate	$(ROOTUSRSBIN_COMPAT_LINKS)
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gateclean:
1527c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gatelint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
1567c478bd9Sstevel@tonic-gate
1579d58cd23Smjnelsondevfsadm.ln: $(DEVFSADM_SRC)
1587c478bd9Sstevel@tonic-gate	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
1597c478bd9Sstevel@tonic-gate
1609d58cd23Smjnelson%.ln: $(DEVFSADM_SRC) %.c
1617c478bd9Sstevel@tonic-gate	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate$(POFILE):      $(POFILES)
1667c478bd9Sstevel@tonic-gate	$(RM) $@; cat $(POFILES) > $@
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
1699d58cd23Smjnelson	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
1707c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1717c478bd9Sstevel@tonic-gate
1727c478bd9Sstevel@tonic-gateSUNW_%.so: %.o
1739d58cd23Smjnelson	$(LINK.c) -o $@ $(GSHARED) -h $@ $< $(LINK_MOD_LDLIBS)
1749d58cd23Smjnelson	$(POST_PROCESS_SO)
1757c478bd9Sstevel@tonic-gate
1767c478bd9Sstevel@tonic-gate%.o: $(COMMON)/%.c
1779d58cd23Smjnelson	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
1789d58cd23Smjnelson	$(POST_PROCESS_O)
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate$(DEVLINKTAB): $(DEVLINKTAB_SRC)
1827c478bd9Sstevel@tonic-gate	$(RM) $(DEVLINKTAB)
1837c478bd9Sstevel@tonic-gate	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
1847c478bd9Sstevel@tonic-gate
1857c478bd9Sstevel@tonic-gate$(ROOTUSRSBIN):
1867c478bd9Sstevel@tonic-gate	$(INS.dir)
1877c478bd9Sstevel@tonic-gate
1887c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM):
1897c478bd9Sstevel@tonic-gate	$(INS.dir)
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gate$(ROOTUSRINCLUDE):
1927c478bd9Sstevel@tonic-gate	$(INS.dir)
1937c478bd9Sstevel@tonic-gate
1947c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM_LINKMOD):
1957c478bd9Sstevel@tonic-gate	$(INS.dir)
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
1987c478bd9Sstevel@tonic-gate	$(INS.file)
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gate$(ROOTLIB_DEVFSADM_DAEMON):
2017c478bd9Sstevel@tonic-gate	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
2027c478bd9Sstevel@tonic-gate
2037c478bd9Sstevel@tonic-gate$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
2047c478bd9Sstevel@tonic-gate	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
2057c478bd9Sstevel@tonic-gate
2067c478bd9Sstevel@tonic-gate#
2077c478bd9Sstevel@tonic-gate# Source shared with add_drv/update_drv
2087c478bd9Sstevel@tonic-gate#
2097c478bd9Sstevel@tonic-gate../plcysubr.c:
2107c478bd9Sstevel@tonic-gate	rm -f $@
2117c478bd9Sstevel@tonic-gate	ln -s ../modload/plcysubr.c ..
212