xref: /titanic_44/usr/src/cmd/devfsadm/Makefile.com (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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)/tape_link.c	\
53	$(COMMON)/usb_link.c	\
54	$(COMMON)/port_link.c	\
55	$(COMMON)/audio_link.c	\
56	$(COMMON)/cfg_link.c	\
57	$(COMMON)/misc_link.c	\
58	$(COMMON)/lofi_link.c	\
59	$(COMMON)/ramdisk_link.c	\
60	$(COMMON)/fssnap_link.c \
61	$(COMMON)/sgen_link.c	\
62	$(COMMON)/md_link.c	\
63	$(COMMON)/dtrace_link.c	\
64	$(MISC_LINK_ISA).c
65
66LINT_MODULES = $(LINK_SRCS:.c=.ln)
67
68LINK_OBJS =			\
69	disk_link.o		\
70	ieee1394_link.o		\
71	tape_link.o		\
72	usb_link.o		\
73	port_link.o		\
74	audio_link.o		\
75	cfg_link.o		\
76	misc_link.o		\
77	lofi_link.o		\
78	ramdisk_link.o		\
79	fssnap_link.o           \
80	sgen_link.o		\
81	md_link.o		\
82	dtrace_link.o		\
83	$(MISC_LINK_ISA).o
84
85LINK_MODS =			\
86	SUNW_disk_link.so	\
87	SUNW_ieee1394_link.so	\
88	SUNW_tape_link.so	\
89	SUNW_usb_link.so	\
90	SUNW_port_link.so	\
91	SUNW_audio_link.so	\
92	SUNW_cfg_link.so	\
93	SUNW_misc_link.so	\
94	SUNW_lofi_link.so	\
95	SUNW_ramdisk_link.so	\
96	SUNW_fssnap_link.so     \
97	SUNW_sgen_link.so	\
98	SUNW_md_link.so		\
99	SUNW_dtrace_link.so	\
100	SUNW_$(MISC_LINK_ISA).so
101
102DEVLINKTAB = devlink.tab
103DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
104
105DEVFSADM_DEFAULT = devfsadm
106DEVFSADM_DEFAULT_SRC = $(COMMON)/devfsadm.dfl
107
108COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
109
110CPPFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
111		-I.. -I../../../uts/common -I$(MODLOADDIR)
112CFLAGS += $(CCVERBOSE) $(C_PICFLAGS) -I.. -I$(MODLOADDIR)
113
114LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
115LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
116LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
117
118LAZYLIBS = -z lazyload -lzonecfg -z nolazyload
119lint := LAZYLIBS = -lzonecfg
120LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -lcmd $(LAZYLIBS)
121
122SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
123OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
124MODS = $(DEVFSADM_MOD) $(LINK_MODS)
125
126POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
127POFILE = pdevfsadm.po
128
129# install specifics
130
131ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
132ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
133
134ETCDEFAULT = $(ROOTETC)/default
135ETCDEFAULT_DEVFSADM = $(DEVFSADM_DEFAULT:%=$(ETCDEFAULT)/%)
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
153$(ETCDEFAULT_DEVFSADM) := FILEMODE = 444
154
155all :=		TARGET= all
156install :=	TARGET= install
157clean :=	TARGET= clean
158clobber :=	TARGET= clobber
159lint :=		TARGET= lint
160
161
162.KEEP_STATE:
163
164all: $(MODS) $(DEVLINKTAB)
165
166install: all				\
167	$(ROOTLIB_DEVFSADM)		\
168	$(ROOTLIB_DEVFSADM_LINKMOD)	\
169	$(ROOTUSRSBIN_DEVFSADM)		\
170	$(ROOTETC_DEVLINKTAB)		\
171	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
172	$(ROOTUSRINCLUDE)		\
173	$(ROOTLIB_DEVFSADM_DAEMON)	\
174	$(ETCDEFAULT)			\
175	$(ETCDEFAULT_DEVFSADM)		\
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)
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$(ETCDEFAULT)/%: %
214	$(RM) -r default
215	mkdir default
216	cp $(DEVFSADM_DEFAULT_SRC) default/$(DEVFSADM_DEFAULT)
217	cd default ; $(INS.file)
218	$(RM) -r default
219
220$(ETCDEFAULT):
221	$(INS.dir)
222
223$(ROOTUSRSBIN):
224	$(INS.dir)
225
226$(ROOTLIB_DEVFSADM):
227	$(INS.dir)
228
229$(ROOTUSRINCLUDE):
230	$(INS.dir)
231
232$(ROOTLIB_DEVFSADM_LINKMOD):
233	$(INS.dir)
234
235$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
236	$(INS.file)
237
238$(ROOTLIB_DEVFSADM_DAEMON):
239	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
240
241$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
242	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
243
244#
245# Source shared with add_drv/update_drv
246#
247../plcysubr.c:
248	rm -f $@
249	ln -s ../modload/plcysubr.c ..
250