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]
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
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
50 DEVFSADM_DIR = devfsadm
52 CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
53 CLOBBERFILES += $(POFILE) $(POFILES) ../plcysubr.c
75 LINK_OBJS = $(LINK_OBJS_CMN) \
78 LINK_SRCS = $(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \
79 $(LINK_OBJS_$(MACH):%.o=%.c)
81 LINK_MODS = $(LINK_OBJS:%.o=SUNW_%.so)
83 DEVLINKTAB = devlink.tab
84 DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
86 COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
88 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS \
89 -I$(COMMON) -I$(SRCTOP)/include -I$(MODLOADDIR)
90 CFLAGS += $(C_PICFLAGS)
93 CERRWARN += -Wno-uninitialized
94 CERRWARN += -Wno-char-subscripts
95 CERRWARN += -Wno-parentheses
97 # Define the dependencies required by devfsadm and all shared objects.
99 devfsadm := LDLIBS += -lgen -lsysevent -lnvpair -lzonecfg -lbsm
100 SUNW_md_link.so := LDLIBS += -lmeta
101 SUNW_disk_link.so := LDLIBS += -ldevid
102 SUNW_sgen_link.so := LDLIBS += -ldevid
104 # All libraries are built from the same SUNW_%.so rule (see below), and define
105 # their own SONAME using -h explicitly. Null the generic -h macro that gets
106 # inherited from Makefile.lib, otherwise we'll get two -h definitions.
109 SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
110 OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
111 MODS = $(DEVFSADM_MOD) $(LINK_MODS)
113 POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
114 POFILE = pdevfsadm.po
118 ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
119 ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
121 ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
123 ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
125 ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
127 ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
129 ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
133 $(ROOTETC_DEVLINKTAB) := FILEMODE = 644
136 install := TARGET= install
137 clean := TARGET= clean
138 clobber := TARGET= clobber
143 all: $(MODS) $(DEVLINKTAB)
146 $(ROOTLIB_DEVFSADM) \
147 $(ROOTLIB_DEVFSADM_LINKMOD) \
148 $(ROOTUSRSBIN_DEVFSADM) \
149 $(ROOTETC_DEVLINKTAB) \
150 $(ROOTLIB_DEVFSADM_LINK_MODS) \
152 $(ROOTLIB_DEVFSADM_DAEMON) \
153 $(ROOTUSRSBIN_COMPAT_LINKS)
159 include ../../Makefile.targ
161 $(POFILE): $(POFILES)
162 $(RM) $@; cat $(POFILES) > $@
164 $(DEVFSADM_MOD): $(DEVFSADM_OBJ)
165 $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
168 SUNW_%.so: %.o $(MAPFILES)
169 $(CC) -o $@ $(GSHARED) $(DYNFLAGS) -h $@ $< $(LDLIBS) -lc
173 $(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
177 $(DEVLINKTAB): $(DEVLINKTAB_SRC)
179 /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
190 $(ROOTLIB_DEVFSADM_LINKMOD):
193 $(ROOTLIB_DEVFSADM_LINKMOD)/%: %
196 $(ROOTLIB_DEVFSADM_DAEMON):
197 $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
199 $(ROOTUSRSBIN_COMPAT_LINKS): $(ROOTUSRSBIN_DEVFSADM)
200 $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
203 # Source shared with add_drv/update_drv
207 ln -s ../modload/plcysubr.c ..