xref: /titanic_51/usr/src/cmd/devfsadm/Makefile.com (revision 43d5cd3d2ec5c3a1e2b2a9155ae4042c14a99011)
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 2008 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	vscan_link.o		\
69	zfs_link.o
70
71LINK_OBJS =	$(LINK_OBJS_CMN) \
72		$(LINK_OBJS_$(MACH))
73
74LINK_SRCS =	$(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \
75		$(LINK_OBJS_$(MACH):%.o=%.c)
76
77LINT_MODULES = $(LINK_SRCS:%.c=%.ln)
78
79LINK_MODS =	$(LINK_OBJS:%.o=SUNW_%.so)
80
81DEVLINKTAB = devlink.tab
82DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
83
84COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
85
86CPPFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
87		-I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR)
88CFLAGS += $(CCVERBOSE) $(C_PICFLAGS)
89
90LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
91LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
92LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
93
94LDLIBS += -ldevinfo -lgen -lsysevent -lnvpair -ldoor -lzonecfg -lbsm
95
96LINK_MOD_LDLIBS=
97SUNW_md_link.so :=	LINK_MOD_LDLIBS=	-lmeta
98
99SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
100OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
101MODS = $(DEVFSADM_MOD) $(LINK_MODS)
102
103POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
104POFILE = pdevfsadm.po
105
106# install specifics
107
108ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
109ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
110
111ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
112
113ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
114
115ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
116
117ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
118
119ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
120
121OWNER= root
122GROUP= sys
123FILEMODE= 755
124
125$(ROOTETC_DEVLINKTAB) := FILEMODE = 644
126
127all :=		TARGET= all
128install :=	TARGET= install
129clean :=	TARGET= clean
130clobber :=	TARGET= clobber
131lint :=		TARGET= lint
132
133
134.KEEP_STATE:
135
136all: $(MODS) $(DEVLINKTAB)
137
138install: all				\
139	$(ROOTLIB_DEVFSADM)		\
140	$(ROOTLIB_DEVFSADM_LINKMOD)	\
141	$(ROOTUSRSBIN_DEVFSADM)		\
142	$(ROOTETC_DEVLINKTAB)		\
143	$(ROOTLIB_DEVFSADM_LINK_MODS)	\
144	$(ROOTUSRINCLUDE)		\
145	$(ROOTLIB_DEVFSADM_DAEMON)	\
146	$(ROOTUSRSBIN_COMPAT_LINKS)
147
148
149clean:
150	$(RM) $(OBJS)
151
152
153lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
154
155devfsadm.ln: $(DEVFSADM_SRC)
156	$(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
157
158%.ln: $(DEVFSADM_SRC) %.c
159	$(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
160
161include ../../Makefile.targ
162
163$(POFILE):      $(POFILES)
164	$(RM) $@; cat $(POFILES) > $@
165
166$(DEVFSADM_MOD): $(DEVFSADM_OBJ)
167	$(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
168	$(POST_PROCESS)
169
170SUNW_%.so: %.o
171	$(LINK.c) -o $@ $(GSHARED) -h $@ $< $(LINK_MOD_LDLIBS)
172	$(POST_PROCESS_SO)
173
174%.o: $(COMMON)/%.c
175	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
176	$(POST_PROCESS_O)
177
178
179$(DEVLINKTAB): $(DEVLINKTAB_SRC)
180	$(RM) $(DEVLINKTAB)
181	/bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
182
183$(ROOTUSRSBIN):
184	$(INS.dir)
185
186$(ROOTLIB_DEVFSADM):
187	$(INS.dir)
188
189$(ROOTUSRINCLUDE):
190	$(INS.dir)
191
192$(ROOTLIB_DEVFSADM_LINKMOD):
193	$(INS.dir)
194
195$(ROOTLIB_DEVFSADM_LINKMOD)/%: %
196	$(INS.file)
197
198$(ROOTLIB_DEVFSADM_DAEMON):
199	$(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
200
201$(ROOTUSRSBIN_COMPAT_LINKS):	$(ROOTUSRSBIN_DEVFSADM)
202	$(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
203
204#
205# Source shared with add_drv/update_drv
206#
207../plcysubr.c:
208	rm -f $@
209	ln -s ../modload/plcysubr.c ..
210