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