xref: /titanic_52/usr/src/cmd/devfsadm/Makefile.com (revision 8e55d2638713a256e1e595d733e9ea6900834744)
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
120FILEMODE= 755
121
122$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
123
124all :=		TARGET= all
125install :=	TARGET= install
126clean :=	TARGET= clean
127clobber :=	TARGET= clobber
128lint :=		TARGET= lint
129
130
131.KEEP_STATE:
132
133all: $(MODS) $(DEVLINKTAB)
134
135install: all				\
136	$(ROOTLIB_DEVFSADM)		\
137	$(ROOTLIB_DEVFSADM_LINKMOD)	\
138	$(ROOTUSRSBIN_DEVFSADM)		\
139	$(ROOTETC_DEVLINKTAB)		\
140	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
141	$(ROOTUSRINCLUDE)		\
142	$(ROOTLIB_DEVFSADM_DAEMON)	\
143	$(ROOTUSRSBIN_COMPAT_LINKS)
144
145
146clean:
147	$(RM) $(OBJS)
148
149
150lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
151
152devfsadm.ln: $(DEVFSADM_SRC)
153	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
154
155%.ln: $(DEVFSADM_SRC) %.c
156	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
157
158include ../../Makefile.targ
159
160$(POFILE):      $(POFILES)
161	$(RM) $@; cat $(POFILES) > $@
162
163$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
164	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
165	$(POST_PROCESS)
166
167SUNW_%.so: %.o
168	$(LINK.c) -o $@ $(GSHARED) -h $@ $< $(LINK_MOD_LDLIBS)
169	$(POST_PROCESS_SO)
170
171%.o: $(COMMON)/%.c
172	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
173	$(POST_PROCESS_O)
174
175
176$(DEVLINKTAB): $(DEVLINKTAB_SRC)
177	$(RM) $(DEVLINKTAB)
178	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
179
180$(ROOTUSRSBIN):
181	$(INS.dir)
182
183$(ROOTLIB_DEVFSADM):
184	$(INS.dir)
185
186$(ROOTUSRINCLUDE):
187	$(INS.dir)
188
189$(ROOTLIB_DEVFSADM_LINKMOD):
190	$(INS.dir)
191
192$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
193	$(INS.file)
194
195$(ROOTLIB_DEVFSADM_DAEMON):
196	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
197
198$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
199	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
200
201#
202# Source shared with add_drv/update_drv
203#
204../plcysubr.c:
205	rm -f $@
206	ln -s ../modload/plcysubr.c ..
207