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