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.
24 # Copyright (c) 2018, Joyent, Inc.
26 # This target builds both a command (daemon) and various shared objects. This
27 # isn't a typical target, and the inclusion of both library and command
28 # Makefiles were probably not in their original design. However, there doesn't
29 # presently seem to be a clash of any required definitions.
30 include ../../../lib/Makefile.lib
31 include ../../Makefile.cmd
34 UTSBASE = $(COMMON)/../../uts
36 DEVFSADM_MOD = devfsadm
38 PLCYSRC = devpolicy.c plcysubr.c
40 MODLOADDIR = $(COMMON)/../modload
42 DEVFSADM_SRC = $(COMMON)/$(DEVFSADM_MOD:%=%.c) \
43 $(PLCYSRC:%=$(COMMON)/%)
44 DEVFSADM_OBJ = $(DEVFSADM_MOD:%=%.o) $(PLCYSRC:%.c=%.o)
46 DEVFSADM_DAEMON = devfsadmd
49 DEVFSADM_DIR = devfsadm
51 CLOBBERFILES = $(MODS) $(DEVLINKTAB) $(DEVFSCOMPATLINKS) $(DEVFSADM_DAEMON)
52 CLOBBERFILES += $(POFILE) $(POFILES) ../plcysubr.c
74 LINK_OBJS = $(LINK_OBJS_CMN) \
77 LINK_SRCS = $(LINK_OBJS_CMN:%.o=$(COMMON)/%.c) \
78 $(LINK_OBJS_$(MACH):%.o=%.c)
80 LINK_MODS = $(LINK_OBJS:%.o=SUNW_%.so)
82 DEVLINKTAB = devlink.tab
83 DEVLINKTAB_SRC = $(COMMON)/$(DEVLINKTAB).sh
85 COMPAT_LINKS = disks tapes ports audlinks devlinks drvconfig
87 CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS \
88 -I$(COMMON) -I$(SRCTOP)/include -I$(MODLOADDIR)
89 CFLAGS += $(C_PICFLAGS)
92 CERRWARN += -Wno-uninitialized
93 CERRWARN += -Wno-char-subscripts
94 CERRWARN += -Wno-parentheses
99 # Define the dependencies required by devfsadm and all shared objects.
101 devfsadm := LDLIBS += -lgen -lsysevent -lnvpair -lzonecfg
102 SUNW_md_link.so := LDLIBS += -lmeta
103 SUNW_disk_link.so := LDLIBS += -ldevid
104 SUNW_sgen_link.so := LDLIBS += -ldevid
106 # All libraries are built from the same SUNW_%.so rule (see below), and define
107 # their own SONAME using -h explicitly. Null the generic -h macro that gets
108 # inherited from Makefile.lib, otherwise we'll get two -h definitions.
111 SRCS = $(DEVFSADM_SRC) $(LINK_SRCS)
112 OBJS = $(DEVFSADM_OBJ) $(LINK_OBJS)
113 MODS = $(DEVFSADM_MOD) $(LINK_MODS)
115 POFILES = $(LINK_SRCS:.c=.po) $(DEVFSADM_SRC:.c=.po)
116 POFILE = pdevfsadm.po
120 ROOTLIB_DEVFSADM = $(ROOTLIB)/$(DEVFSADM_DIR)
121 ROOTLIB_DEVFSADM_LINKMOD = $(ROOTLIB_DEVFSADM)/$(LINKMOD_DIR)
123 ROOTLIB_DEVFSADM_LINK_MODS = $(LINK_MODS:%=$(ROOTLIB_DEVFSADM_LINKMOD)/%)
125 ROOTUSRSBIN_COMPAT_LINKS = $(COMPAT_LINKS:%=$(ROOTUSRSBIN)/%)
127 ROOTUSRSBIN_DEVFSADM = $(DEVFSADM_MOD:%=$(ROOTUSRSBIN)/%)
129 ROOTLIB_DEVFSADM_DAEMON = $(ROOTLIB_DEVFSADM)/$(DEVFSADM_DAEMON)
131 ROOTETC_DEVLINKTAB = $(DEVLINKTAB:%=$(ROOTETC)/%)
135 $(ROOTETC_DEVLINKTAB) := FILEMODE = 644
138 install := TARGET= install
139 clean := TARGET= clean
140 clobber := TARGET= clobber
145 all: $(MODS) $(DEVLINKTAB)
148 $(ROOTLIB_DEVFSADM) \
149 $(ROOTLIB_DEVFSADM_LINKMOD) \
150 $(ROOTUSRSBIN_DEVFSADM) \
151 $(ROOTETC_DEVLINKTAB) \
152 $(ROOTLIB_DEVFSADM_LINK_MODS) \
154 $(ROOTLIB_DEVFSADM_DAEMON) \
155 $(ROOTUSRSBIN_COMPAT_LINKS)
161 include ../../Makefile.targ
163 $(POFILE): $(POFILES)
164 $(RM) $@; cat $(POFILES) > $@
166 $(DEVFSADM_MOD): $(DEVFSADM_OBJ)
167 $(LINK.c) -o $@ $< $(DEVFSADM_OBJ) $(LDLIBS)
170 SUNW_%.so: %.o $(MAPFILES)
171 $(CC) -m32 -o $@ $(GSHARED) $(DYNFLAGS) -Wl,-h$@ $< $(LDLIBS) -lc
175 $(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
179 $(DEVLINKTAB): $(DEVLINKTAB_SRC)
181 /bin/sh $(DEVLINKTAB_SRC) > $(DEVLINKTAB)
192 $(ROOTLIB_DEVFSADM_LINKMOD):
195 $(ROOTLIB_DEVFSADM_LINKMOD)/%: %
198 $(ROOTLIB_DEVFSADM_DAEMON):
199 $(RM) $@; $(SYMLINK) ../../sbin/$(DEVFSADM_DIR) $@
201 $(ROOTUSRSBIN_COMPAT_LINKS): $(ROOTUSRSBIN_DEVFSADM)
202 $(RM) $@ ; $(LN) $(ROOTUSRSBIN_DEVFSADM) $@
205 # Source shared with add_drv/update_drv
209 ln -s ../modload/plcysubr.c ..