Makefile revision 9fb67ea305c66b6a297583b9b0db6796b0dfe497
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CDDL HEADER START
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# The contents of this file are subject to the terms of the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Common Development and Distribution License (the "License").
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# You may not use this file except in compliance with the License.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# See the License for the specific language governing permissions
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# and limitations under the License.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# When distributing Covered Code, include this CDDL HEADER in each
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# If applicable, add the following below this CDDL HEADER, with the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CDDL HEADER END
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Use is subject to license terms.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Note that libcurses installs commands along with its library.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This is a minor bug which probably should be fixed.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Note also that a few extra libraries are kept in cmd source.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Certain libraries are linked with, hence depend on, other libraries.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Although we have historically used .WAIT to express dependencies, it
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# reduces the amount of parallelism and thus lengthens the time it
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# takes to build the libraries. Thus, we now require that any new
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# libraries explicitly call out their dependencies. Eventually, all
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# the library dependencies will be called out explicitly. See
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# "Library interdependencies" near the end of this file.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Aside from explicit dependencies (and legacy .WAITs), all libraries
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# are built in parallel.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# but required due to the "dependencies" of using .WAIT to barrier the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# parallel dmake builds. once 4631488 has been fixed, they can be
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# shown in HDRSUBDIRS
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# clean and clobber targets (for more information, see those targets, below).
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# For the all and install targets, we clearly must respect library
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# dependencies so that the libraries link correctly. However, for
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# the remaining targets (check, clean, clobber, install_h, lint, _dc
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# and _msg), libraries do not have any dependencies on one another
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# and thus respecting dependencies just slows down the build.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# As such, for these rules, we use pattern replacement to explicitly
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# avoid triggering the dependency information. Note that for clean,
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# extra libraries kept in other source areas
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsclean clobber lint: $(NOWAIT_SUBDIRS:%=%-nodepend)
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Library interdependencies are called out explicitly here
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsgss_mechs/mech_krb5: libgss libnsl libsocket libresolv pkcs11
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibdhcpagent: libsocket libdhcputil libuuid libdlpi libcontract
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibdladm: libdevinfo libinetutil libsocket libscf librcm libnvpair \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibiscsit: libc libnvpair libstmf libuuid libnsl
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibrdc: libsocket libnsl libnsctl libunistat libdscfg
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews$(CLOSED_BUILD)libike: libipsecutil libxnet libcryptoutil
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibshell: libast libcmd libdll libsocket libsecdb
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibstmfproxy: libstmf libsocket libnsl libpthread
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibsldap: libldap5 libtsol libnsl libc libscf libresolv
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibzonecfg: libc libsocket libnsl libuuid libnvpair libsysevent libsec \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibproc: ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibwanboot: libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibshare: libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslibexacct/demo: libexacct libproject libsocket libnsl
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewssmbsrv: libsocket libnsl libmd libxnet libpthread librt \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews libshare libidmap pkcs11 libsqlite libcryptoutil libreparse
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsmpapi: libpthread libdevinfo libsysevent libnvpair
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewssun_sas: libdevinfo libsysevent libnvpair libkstat libdevid
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# The reason this rule checks for the existence of the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Makefile is that some of the directories do not exist
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# in certain situations (e.g., exportable source builds,
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# OpenSolaris).
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews @if [ -f $@/Makefile ]; then \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \