6396 remove SVM
[unleashed.git] / usr / src / cmd / devfsadm / Makefile.com
blob1585db28942343db65d8699dd05a47bac5f673a6
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
21 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
22 # Use is subject to license terms.
25 # This target builds both a command (daemon) and various shared objects.  This
26 # isn't a typical target, and the inclusion of both library and command
27 # Makefiles were probably not in their original design.  However, there doesn't
28 # presently seem to be a clash of any required definitions.
29 include ../../../lib/Makefile.lib
30 include ../../Makefile.cmd
32 COMMON = ..
33 UTSBASE = $(COMMON)/../../uts
35 DEVFSADM_MOD = devfsadm
37 DEVALLOCSRC =   devalloc.c
39 PLCYSRC = devpolicy.c plcysubr.c
41 MODLOADDIR = $(COMMON)/../modload
43 DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \
44                 $(DEVALLOCSRC:%=$(COMMON)/%) $(PLCYSRC:%=$(COMMON)/%)
45 DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(DEVALLOCSRC:%.c=%.o) $(PLCYSRC:%.c=%.o)
47 DEVFSADM_DAEMON = devfsadmd
49 LINKMOD_DIR = linkmod
50 DEVFSADM_DIR = devfsadm
52 CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
53 CLOBBERFILES += $(POFILE) $(POFILES) ../plcysubr.c
55 LINK_OBJS_CMN =                 \
56         disk_link.o             \
57         ieee1394_link.o         \
58         dcam1394_link.o         \
59         tape_link.o             \
60         usb_link.o              \
61         port_link.o             \
62         audio_link.o            \
63         cfg_link.o              \
64         misc_link.o             \
65         lofi_link.o             \
66         ramdisk_link.o          \
67         fssnap_link.o           \
68         sgen_link.o             \
69         smp_link.o              \
70         dtrace_link.o           \
71         vscan_link.o            \
72         zfs_link.o              \
73         zut_link.o
75 LINK_OBJS =     $(LINK_OBJS_CMN) \
76                 $(LINK_OBJS_$(MACH))
78 LINK_SRCS =     $(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \
79                 $(LINK_OBJS_$(MACH):%.o=%.c)
81 LINT_MODULES = $(LINK_SRCS:%.c=%.ln)
83 LINK_MODS =     $(LINK_OBJS:%.o=SUNW_%.so)
85 DEVLINKTAB = devlink.tab
86 DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
88 COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
90 CPPFLAGS +=     -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
91                 -I$(COMMON) -I$(UTSBASE)/common -I$(MODLOADDIR)
92 CFLAGS += $(CCVERBOSE) $(C_PICFLAGS)
94 LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
95 LINTFLAGS += -erroff=E_NAME_DEF_NOT_USED2
96 LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
98 CERRWARN += -_gcc=-Wno-uninitialized
99 CERRWARN += -_gcc=-Wno-char-subscripts
100 CERRWARN += -_gcc=-Wno-parentheses
102 # Define the dependencies required by devfsadm and all shared objects.
103 LDLIBS +=               -ldevinfo
104 devfsadm :=             LDLIBS += -lgen -lsysevent -lnvpair -lzonecfg -lbsm
105 SUNW_md_link.so :=      LDLIBS += -lmeta
106 SUNW_disk_link.so :=    LDLIBS += -ldevid
107 SUNW_sgen_link.so :=    LDLIBS += -ldevid
109 # All libraries are built from the same SUNW_%.so rule (see below), and define
110 # their own SONAME using -h explicitly.  Null the generic -h macro that gets
111 # inherited from Makefile.lib, otherwise we'll get two -h definitions.
112 HSONAME =
114 SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
115 OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
116 MODS = $(DEVFSADM_MOD) $(LINK_MODS)
118 POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
119 POFILE = pdevfsadm.po
121 # install specifics
123 ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
124 ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
126 ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
128 ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
130 ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
132 ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
134 ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
136 FILEMODE= 755
138 $(ROOTETC_DEVLINKTAB) := FILEMODE = 644
140 all :=          TARGET= all
141 install :=      TARGET= install
142 clean :=        TARGET= clean
143 clobber :=      TARGET= clobber
144 lint :=         TARGET= lint
147 .KEEP_STATE:
149 all: $(MODS) $(DEVLINKTAB)
151 install: all                            \
152         $(ROOTLIB_DEVFSADM)             \
153         $(ROOTLIB_DEVFSADM_LINKMOD)     \
154         $(ROOTUSRSBIN_DEVFSADM)         \
155         $(ROOTETC_DEVLINKTAB)           \
156         $(ROOTLIB_DEVFSADM_LINK_MODS)   \
157         $(ROOTUSRINCLUDE)               \
158         $(ROOTLIB_DEVFSADM_DAEMON)      \
159         $(ROOTUSRSBIN_COMPAT_LINKS)
162 clean:
163         $(RM) $(OBJS) 
166 lint: $(DEVFSADM_MOD).ln $(LINT_MODULES)
168 devfsadm.ln: $(DEVFSADM_SRC)
169         $(LINT.c) $(DEVFSADM_SRC) $(LDLIBS)
171 %.ln: $(DEVFSADM_SRC) %.c
172         $(LINT.c) $(DEVFSADM_SRC) $(@:.ln=.c) $(LDLIBS)
174 include ../../Makefile.targ
176 $(POFILE):      $(POFILES)
177         $(RM) $@; cat $(POFILES) > $@
179 $(DEVFSADM_MOD): $(DEVFSADM_OBJ)
180         $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
181         $(POST_PROCESS)
183 SUNW_%.so: %.o $(MAPFILES)
184         $(CC) -o $@ $(GSHARED) $(DYNFLAGS) -h $@ $< $(LDLIBS) -lc
185         $(POST_PROCESS_SO)
187 %.o: $(COMMON)/%.c
188         $(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
189         $(POST_PROCESS_O)
192 $(DEVLINKTAB): $(DEVLINKTAB_SRC)
193         $(RM) $(DEVLINKTAB)
194         /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
196 $(ROOTUSRSBIN):
197         $(INS.dir)
199 $(ROOTLIB_DEVFSADM):
200         $(INS.dir)
202 $(ROOTUSRINCLUDE):
203         $(INS.dir)
205 $(ROOTLIB_DEVFSADM_LINKMOD):
206         $(INS.dir)
208 $(ROOTLIB_DEVFSADM_LINKMOD)/%: %
209         $(INS.file)
211 $(ROOTLIB_DEVFSADM_DAEMON):
212         $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
214 $(ROOTUSRSBIN_COMPAT_LINKS):    $(ROOTUSRSBIN_DEVFSADM)
215         $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
218 # Source shared with add_drv/update_drv
220 ../plcysubr.c:
221         rm -f $@
222         ln -s ../modload/plcysubr.c ..