xref: /titanic_52/usr/src/cmd/devfsadm/Makefile.com (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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	$(MISC_LINK_ISA).c
66
67LINT_MODULES = $(LINK_SRCS:.c=.ln)
68
69LINK_OBJS =			\
70	disk_link.o		\
71	ieee1394_link.o		\
72	dcam1394_link.o		\
73	tape_link.o		\
74	usb_link.o		\
75	port_link.o		\
76	audio_link.o		\
77	cfg_link.o		\
78	misc_link.o		\
79	lofi_link.o		\
80	ramdisk_link.o		\
81	fssnap_link.o           \
82	sgen_link.o		\
83	md_link.o		\
84	dtrace_link.o		\
85	$(MISC_LINK_ISA).o
86
87LINK_MODS =			\
88	SUNW_disk_link.so	\
89	SUNW_ieee1394_link.so	\
90	SUNW_dcam1394_link.so	\
91	SUNW_tape_link.so	\
92	SUNW_usb_link.so	\
93	SUNW_port_link.so	\
94	SUNW_audio_link.so	\
95	SUNW_cfg_link.so	\
96	SUNW_misc_link.so	\
97	SUNW_lofi_link.so	\
98	SUNW_ramdisk_link.so	\
99	SUNW_fssnap_link.so     \
100	SUNW_sgen_link.so	\
101	SUNW_md_link.so		\
102	SUNW_dtrace_link.so	\
103	SUNW_$(MISC_LINK_ISA).so
104
105DEVLINKTAB = devlink.tab
106DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
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
134ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
135
136ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
137
138ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
139
140ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
141
142ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
143
144OWNER= root
145GROUP= sys
146FILEMODE= 755
147
148$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
149
150all :=		TARGET= all
151install :=	TARGET= install
152clean :=	TARGET= clean
153clobber :=	TARGET= clobber
154lint :=		TARGET= lint
155
156
157.KEEP_STATE:
158
159all: $(MODS) $(DEVLINKTAB)
160
161install: all				\
162	$(ROOTLIB_DEVFSADM)		\
163	$(ROOTLIB_DEVFSADM_LINKMOD)	\
164	$(ROOTUSRSBIN_DEVFSADM)		\
165	$(ROOTETC_DEVLINKTAB)		\
166	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
167	$(ROOTUSRINCLUDE)		\
168	$(ROOTLIB_DEVFSADM_DAEMON)	\
169	$(ROOTUSRSBIN_COMPAT_LINKS)
170
171
172clean:
173	$(RM) $(OBJS)
174
175
176lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
177
178devfsadm.ln: FRC
179	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
180
181%.ln: FRC
182	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
183
184FRC:
185
186include ../../Makefile.targ
187
188$(POFILE):      $(POFILES)
189	$(RM) $@; cat $(POFILES) > $@
190
191$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
192	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
193	$(POST_PROCESS)
194
195SUNW_%.so: %.o
196	$(LINK.c) -o $@ $(GSHARED) -h $@ $<
197
198%.o: $(COMMON)/%.c
199	$(COMPILE.c) -o $@ $<
200
201
202$(DEVLINKTAB): $(DEVLINKTAB_SRC)
203	$(RM) $(DEVLINKTAB)
204	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
205
206$(ROOTUSRSBIN):
207	$(INS.dir)
208
209$(ROOTLIB_DEVFSADM):
210	$(INS.dir)
211
212$(ROOTUSRINCLUDE):
213	$(INS.dir)
214
215$(ROOTLIB_DEVFSADM_LINKMOD):
216	$(INS.dir)
217
218$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
219	$(INS.file)
220
221$(ROOTLIB_DEVFSADM_DAEMON):
222	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
223
224$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
225	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
226
227#
228# Source shared with add_drv/update_drv
229#
230../plcysubr.c:
231	rm -f $@
232	ln -s ../modload/plcysubr.c ..
233