xref: /titanic_44/usr/src/cmd/devfsadm/Makefile.com (revision 9df12a23948bd40cbe37ce88d84e272c3894e675)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 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 = ..
32
33DEVFSADM_MOD = devfsadm
34
35PLCYSRC = devpolicy.c plcysubr.c
36
37MODLOADDIR = $(COMMON)/../modload
38
39DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) $(PLCYSRC:%=$(COMMON)/%)
40DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(PLCYSRC:%.c=%.o)
41
42DEVFSADM_DAEMON = devfsadmd
43
44LINKMOD_DIR = linkmod
45DEVFSADM_DIR = devfsadm
46
47CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
48
49LINK_SRCS =			\
50	$(COMMON)/disk_link.c	\
51	$(COMMON)/ieee1394_link.c	\
52	$(COMMON)/dcam1394_link.c	\
53	$(COMMON)/tape_link.c	\
54	$(COMMON)/usb_link.c	\
55	$(COMMON)/port_link.c	\
56	$(COMMON)/audio_link.c	\
57	$(COMMON)/cfg_link.c	\
58	$(COMMON)/misc_link.c	\
59	$(COMMON)/lofi_link.c	\
60	$(COMMON)/ramdisk_link.c	\
61	$(COMMON)/fssnap_link.c \
62	$(COMMON)/sgen_link.c	\
63	$(COMMON)/md_link.c	\
64	$(COMMON)/dtrace_link.c	\
65	$(COMMON)/zfs_link.c	\
66	$(MISC_LINK_ISA).c
67
68LINT_MODULES = $(LINK_SRCS:.c=.ln)
69
70LINK_OBJS =			\
71	disk_link.o		\
72	ieee1394_link.o		\
73	dcam1394_link.o		\
74	tape_link.o		\
75	usb_link.o		\
76	port_link.o		\
77	audio_link.o		\
78	cfg_link.o		\
79	misc_link.o		\
80	lofi_link.o		\
81	ramdisk_link.o		\
82	fssnap_link.o           \
83	sgen_link.o		\
84	md_link.o		\
85	dtrace_link.o		\
86	zfs_link.o		\
87	$(MISC_LINK_ISA).o
88
89LINK_MODS =			\
90	SUNW_disk_link.so	\
91	SUNW_ieee1394_link.so	\
92	SUNW_dcam1394_link.so	\
93	SUNW_tape_link.so	\
94	SUNW_usb_link.so	\
95	SUNW_port_link.so	\
96	SUNW_audio_link.so	\
97	SUNW_cfg_link.so	\
98	SUNW_misc_link.so	\
99	SUNW_lofi_link.so	\
100	SUNW_ramdisk_link.so	\
101	SUNW_fssnap_link.so     \
102	SUNW_sgen_link.so	\
103	SUNW_md_link.so		\
104	SUNW_dtrace_link.so	\
105	SUNW_zfs_link.so	\
106	SUNW_$(MISC_LINK_ISA).so
107
108DEVLINKTAB = devlink.tab
109DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
110
111COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
112
113CPPFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
114		-I.. -I../../../uts/common -I$(MODLOADDIR)
115CFLAGS += $(CCVERBOSE) $(C_PICFLAGS) -I.. -I$(MODLOADDIR)
116
117LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
118LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
119LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
120
121LAZYLIBS = -z lazyload -lzonecfg -z nolazyload
122lint := LAZYLIBS = -lzonecfg
123LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -lcmd $(LAZYLIBS)
124
125SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
126OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
127MODS = $(DEVFSADM_MOD) $(LINK_MODS)
128
129POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
130POFILE = pdevfsadm.po
131
132# install specifics
133
134ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
135ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
136
137ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
138
139ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
140
141ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
142
143ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
144
145ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
146
147OWNER= root
148GROUP= sys
149FILEMODE= 755
150
151$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
152
153all :=		TARGET= all
154install :=	TARGET= install
155clean :=	TARGET= clean
156clobber :=	TARGET= clobber
157lint :=		TARGET= lint
158
159
160.KEEP_STATE:
161
162all: $(MODS) $(DEVLINKTAB)
163
164install: all				\
165	$(ROOTLIB_DEVFSADM)		\
166	$(ROOTLIB_DEVFSADM_LINKMOD)	\
167	$(ROOTUSRSBIN_DEVFSADM)		\
168	$(ROOTETC_DEVLINKTAB)		\
169	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
170	$(ROOTUSRINCLUDE)		\
171	$(ROOTLIB_DEVFSADM_DAEMON)	\
172	$(ROOTUSRSBIN_COMPAT_LINKS)
173
174
175clean:
176	$(RM) $(OBJS)
177
178
179lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
180
181devfsadm.ln: FRC
182	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
183
184%.ln: FRC
185	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
186
187FRC:
188
189include ../../Makefile.targ
190
191$(POFILE):      $(POFILES)
192	$(RM) $@; cat $(POFILES) > $@
193
194$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
195	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
196	$(POST_PROCESS)
197
198SUNW_%.so: %.o
199	$(LINK.c) -o $@ $(GSHARED) -h $@ $<
200
201%.o: $(COMMON)/%.c
202	$(COMPILE.c) -o $@ $<
203
204
205$(DEVLINKTAB): $(DEVLINKTAB_SRC)
206	$(RM) $(DEVLINKTAB)
207	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
208
209$(ROOTUSRSBIN):
210	$(INS.dir)
211
212$(ROOTLIB_DEVFSADM):
213	$(INS.dir)
214
215$(ROOTUSRINCLUDE):
216	$(INS.dir)
217
218$(ROOTLIB_DEVFSADM_LINKMOD):
219	$(INS.dir)
220
221$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
222	$(INS.file)
223
224$(ROOTLIB_DEVFSADM_DAEMON):
225	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
226
227$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
228	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
229
230#
231# Source shared with add_drv/update_drv
232#
233../plcysubr.c:
234	rm -f $@
235	ln -s ../modload/plcysubr.c ..
236