xref: /titanic_44/usr/src/cmd/devfsadm/Makefile.com (revision 61491074b8a9b27fe22ce320f874f909877c6d91)
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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
22# Use is subject to license terms.
23#
24
25include ../../Makefile.cmd
26
27COMMON = ..
28UTSBASE = $(COMMON)/../../uts
29
30DEVFSADM_MOD = devfsadm
31
32DEVALLOCSRC =	devalloc.c
33
34PLCYSRC = devpolicy.c plcysubr.c
35
36MODLOADDIR = $(COMMON)/../modload
37
38DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \
39		$(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%)
40DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o)
41
42DEVFSADM_DAEMON = devfsadmd
43
44LINKMOD_DIR = linkmod
45DEVFSADM_DIR = devfsadm
46
47CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
48
49LINK_OBJS_CMN =			\
50	disk_link.o		\
51	ieee1394_link.o		\
52	dcam1394_link.o		\
53	tape_link.o		\
54	usb_link.o		\
55	port_link.o		\
56	audio_link.o		\
57	cfg_link.o		\
58	misc_link.o		\
59	lofi_link.o		\
60	ramdisk_link.o		\
61	fssnap_link.o           \
62	sgen_link.o		\
63	smp_link.o		\
64	md_link.o		\
65	dtrace_link.o		\
66	vscan_link.o		\
67	zfs_link.o		\
68	zut_link.o
69
70LINK_OBJS =	$(LINK_OBJS_CMN) \
71		$(LINK_OBJS_$(MACH))
72
73LINK_SRCS =	$(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \
74		$(LINK_OBJS_$(MACH):%.o=%.c)
75
76LINT_MODULES = $(LINK_SRCS:%.c=%.ln)
77
78LINK_MODS =	$(LINK_OBJS:%.o=SUNW_%.so)
79
80DEVLINKTAB = devlink.tab
81DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
82
83COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
84
85CPPFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
86		-I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR)
87CFLAGS += $(CCVERBOSE) $(C_PICFLAGS)
88
89LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
90LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
91LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
92
93LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -ldoor -lzonecfg -lbsm
94
95LINK_MOD_LDLIBS=
96SUNW_md_link.so :=	LINK_MOD_LDLIBS=	-lmeta
97
98SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
99OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
100MODS = $(DEVFSADM_MOD) $(LINK_MODS)
101
102POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
103POFILE = pdevfsadm.po
104
105# install specifics
106
107ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
108ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
109
110ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
111
112ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
113
114ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
115
116ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
117
118ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
119
120OWNER= root
121GROUP= sys
122FILEMODE= 755
123
124$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
125
126all :=		TARGET= all
127install :=	TARGET= install
128clean :=	TARGET= clean
129clobber :=	TARGET= clobber
130lint :=		TARGET= lint
131
132
133.KEEP_STATE:
134
135all: $(MODS) $(DEVLINKTAB)
136
137install: all				\
138	$(ROOTLIB_DEVFSADM)		\
139	$(ROOTLIB_DEVFSADM_LINKMOD)	\
140	$(ROOTUSRSBIN_DEVFSADM)		\
141	$(ROOTETC_DEVLINKTAB)		\
142	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
143	$(ROOTUSRINCLUDE)		\
144	$(ROOTLIB_DEVFSADM_DAEMON)	\
145	$(ROOTUSRSBIN_COMPAT_LINKS)
146
147
148clean:
149	$(RM) $(OBJS)
150
151
152lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
153
154devfsadm.ln: $(DEVFSADM_SRC)
155	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
156
157%.ln: $(DEVFSADM_SRC) %.c
158	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
159
160include ../../Makefile.targ
161
162$(POFILE):      $(POFILES)
163	$(RM) $@; cat $(POFILES) > $@
164
165$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
166	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
167	$(POST_PROCESS)
168
169SUNW_%.so: %.o
170	$(LINK.c) -o $@ $(GSHARED) -h $@ $< $(LINK_MOD_LDLIBS)
171	$(POST_PROCESS_SO)
172
173%.o: $(COMMON)/%.c
174	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
175	$(POST_PROCESS_O)
176
177
178$(DEVLINKTAB): $(DEVLINKTAB_SRC)
179	$(RM) $(DEVLINKTAB)
180	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
181
182$(ROOTUSRSBIN):
183	$(INS.dir)
184
185$(ROOTLIB_DEVFSADM):
186	$(INS.dir)
187
188$(ROOTUSRINCLUDE):
189	$(INS.dir)
190
191$(ROOTLIB_DEVFSADM_LINKMOD):
192	$(INS.dir)
193
194$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
195	$(INS.file)
196
197$(ROOTLIB_DEVFSADM_DAEMON):
198	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
199
200$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
201	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
202
203#
204# Source shared with add_drv/update_drv
205#
206../plcysubr.c:
207	rm -f $@
208	ln -s ../modload/plcysubr.c ..
209