xref: /titanic_50/usr/src/cmd/devfsadm/Makefile.com (revision 9039eeaf76678a41be39feb97b4f724272ef7e18)
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
22#
23# Copyright 2006 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 = ..
32UTSBASE = $(COMMON)/../../uts
33
34DEVFSADM_MOD = devfsadm
35
36DEVALLOCSRC =	devalloc.c
37
38PLCYSRC = devpolicy.c plcysubr.c
39
40MODLOADDIR = $(COMMON)/../modload
41
42DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \
43		$(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%)
44DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o)
45
46DEVFSADM_DAEMON = devfsadmd
47
48LINKMOD_DIR = linkmod
49DEVFSADM_DIR = devfsadm
50
51CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
52
53LINK_SRCS =			\
54	$(COMMON)/disk_link.c	\
55	$(COMMON)/ieee1394_link.c	\
56	$(COMMON)/dcam1394_link.c	\
57	$(COMMON)/tape_link.c	\
58	$(COMMON)/usb_link.c	\
59	$(COMMON)/port_link.c	\
60	$(COMMON)/audio_link.c	\
61	$(COMMON)/cfg_link.c	\
62	$(COMMON)/misc_link.c	\
63	$(COMMON)/lofi_link.c	\
64	$(COMMON)/ramdisk_link.c	\
65	$(COMMON)/fssnap_link.c \
66	$(COMMON)/sgen_link.c	\
67	$(COMMON)/md_link.c	\
68	$(COMMON)/dtrace_link.c	\
69	$(COMMON)/zfs_link.c	\
70	$(LINK_SRCS_($MACH))
71
72LINT_MODULES = $(LINK_SRCS:.c=.ln)
73
74LINK_OBJS =			\
75	disk_link.o		\
76	ieee1394_link.o		\
77	dcam1394_link.o		\
78	tape_link.o		\
79	usb_link.o		\
80	port_link.o		\
81	audio_link.o		\
82	cfg_link.o		\
83	misc_link.o		\
84	lofi_link.o		\
85	ramdisk_link.o		\
86	fssnap_link.o           \
87	sgen_link.o		\
88	md_link.o		\
89	dtrace_link.o		\
90	zfs_link.o		\
91	$(LINK_OBJS_($MACH))
92
93LINK_MODS =			\
94	SUNW_disk_link.so	\
95	SUNW_ieee1394_link.so	\
96	SUNW_dcam1394_link.so	\
97	SUNW_tape_link.so	\
98	SUNW_usb_link.so	\
99	SUNW_port_link.so	\
100	SUNW_audio_link.so	\
101	SUNW_cfg_link.so	\
102	SUNW_misc_link.so	\
103	SUNW_lofi_link.so	\
104	SUNW_ramdisk_link.so	\
105	SUNW_fssnap_link.so     \
106	SUNW_sgen_link.so	\
107	SUNW_md_link.so		\
108	SUNW_dtrace_link.so	\
109	SUNW_zfs_link.so	\
110	$(LINK_MODS_$(MACH))
111
112DEVLINKTAB = devlink.tab
113DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
114
115COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
116
117CPPFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
118		-I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR)
119CFLAGS += $(CCVERBOSE) $(C_PICFLAGS)
120
121LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
122LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
123LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
124
125LAZYLIBS =	$(ZLAZYLOAD) -lzonecfg -lbrand -lbsm $(ZNOLAZYLOAD)
126lint := LAZYLIBS = -lzonecfg -lbrand -lbsm
127LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -lcmd -ldoor $(LAZYLIBS) -lnsl
128
129SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
130OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
131MODS = $(DEVFSADM_MOD) $(LINK_MODS)
132
133POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
134POFILE = pdevfsadm.po
135
136# install specifics
137
138ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
139ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
140
141ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
142
143ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
144
145ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
146
147ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
148
149ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
150
151OWNER= root
152GROUP= sys
153FILEMODE= 755
154
155$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
156
157all :=		TARGET= all
158install :=	TARGET= install
159clean :=	TARGET= clean
160clobber :=	TARGET= clobber
161lint :=		TARGET= lint
162
163
164.KEEP_STATE:
165
166all: $(MODS) $(DEVLINKTAB)
167
168install: all				\
169	$(ROOTLIB_DEVFSADM)		\
170	$(ROOTLIB_DEVFSADM_LINKMOD)	\
171	$(ROOTUSRSBIN_DEVFSADM)		\
172	$(ROOTETC_DEVLINKTAB)		\
173	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
174	$(ROOTUSRINCLUDE)		\
175	$(ROOTLIB_DEVFSADM_DAEMON)	\
176	$(ROOTUSRSBIN_COMPAT_LINKS)
177
178
179clean:
180	$(RM) $(OBJS)
181
182
183lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
184
185devfsadm.ln: FRC
186	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
187
188%.ln: FRC
189	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
190
191FRC:
192
193include ../../Makefile.targ
194
195$(POFILE):      $(POFILES)
196	$(RM) $@; cat $(POFILES) > $@
197
198$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
199	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS) -lmeta
200	$(POST_PROCESS)
201
202SUNW_%.so: %.o
203	$(LINK.c) -o $@ $(GSHARED) -h $@ $<
204
205%.o: $(COMMON)/%.c
206	$(COMPILE.c) -o $@ $<
207
208
209$(DEVLINKTAB): $(DEVLINKTAB_SRC)
210	$(RM) $(DEVLINKTAB)
211	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
212
213$(ROOTUSRSBIN):
214	$(INS.dir)
215
216$(ROOTLIB_DEVFSADM):
217	$(INS.dir)
218
219$(ROOTUSRINCLUDE):
220	$(INS.dir)
221
222$(ROOTLIB_DEVFSADM_LINKMOD):
223	$(INS.dir)
224
225$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
226	$(INS.file)
227
228$(ROOTLIB_DEVFSADM_DAEMON):
229	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
230
231$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
232	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
233
234#
235# Source shared with add_drv/update_drv
236#
237../plcysubr.c:
238	rm -f $@
239	ln -s ../modload/plcysubr.c ..
240