1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
|
1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1997-03-09 00:14:00 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.subdir.mk> contains the default targets
|
2005-01-06 11:12:43 +00:00
|
|
|
# for building subdirectories.
|
1997-03-09 00:14:00 +00:00
|
|
|
#
|
|
|
|
# For all of the directories listed in the variable SUBDIRS, the
|
|
|
|
# specified directory will be visited and the target made. There is
|
|
|
|
# also a default target which allows the command "make subdir" where
|
|
|
|
# subdir is any directory listed in the variable SUBDIRS.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
2002-04-23 22:16:41 +00:00
|
|
|
# DISTRIBUTION Name of distribution. [base]
|
1997-03-09 00:14:00 +00:00
|
|
|
#
|
|
|
|
# SUBDIR A list of subdirectories that should be built as well.
|
|
|
|
# Each of the targets will execute the same target in the
|
|
|
|
# subdirectories.
|
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# distribute:
|
|
|
|
# This is a variant of install, which will
|
|
|
|
# put the stuff into the right "distribution".
|
|
|
|
#
|
2009-12-06 08:59:19 +00:00
|
|
|
# afterinstall, all, all-man, beforeinstall, checkdpadd, clean,
|
|
|
|
# cleandepend, cleandir, cleanilinks depend, install, lint,
|
|
|
|
# maninstall, manlint, obj, objlink, realinstall, regress, tags
|
1997-03-09 00:14:00 +00:00
|
|
|
#
|
|
|
|
|
2012-11-07 22:02:02 +00:00
|
|
|
.if !target(__<bsd.subdir.mk>__)
|
|
|
|
__<bsd.subdir.mk>__:
|
|
|
|
|
2002-04-17 13:49:29 +00:00
|
|
|
.include <bsd.init.mk>
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if defined(.PARSEDIR) && !defined(NEED_SUBDIR)
|
|
|
|
.if ${.MAKE.LEVEL} == 0 && ${.MAKE.MODE:Mmeta*} != "" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
|
|
|
|
.include <meta.subdir.mk>
|
|
|
|
# ignore this
|
|
|
|
_SUBDIR:
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.if !target(_SUBDIR)
|
|
|
|
|
Moved the `distribute' target from bsd.obj.mk to bsd.subdir.mk,
to make it call `install' in the bsd.subdir.mk-driven makefiles
too. (share/examples/Makefile,v 1.29 changed the bsd.prog.mk
to bsd.subdir.mk and many stuff was lost during "make release".
I then merged this change in rev. 1.28.2.2 to work around the
namespace pollution (FILES) in this makefile.)
There was an added complexity here. Both the `distribute' and
`install' targets are recursive (they propagate to SUBDIRs).
So `distribute' first calls `install' in the ${.CURDIR}, then
calls `distribute' in each SUBDIR, etc. The problem is that
`install' (being also recursive) causes the stuff from SUBDIR
to be installed twice, first time thru `install' in ${.CURDIR}
triggered by `distribute', second time by `distribute' run in
the SUBDIR. This problem is not new, but it became apparent
only after I moved the `distribute' target from bsd.obj.mk to
bsd.subdir.mk. My first attempt testing the fix failed due to
this, because the whole world was distributed twice, causing
all the imaginable mess (kerberos5 stuff was installed into both
"base" and "krb5" dists, there was /sbin/init.bak, etc.)
I say the problem is not new because bsd.prog.mk and bsd.lib.mk
makefiles with SUBDIR (even without this fix) had this problem
for years. Try e.g. running ``make distribute DISTDIR=/foo''
from usr.bin/bzip2 or from lib/libcom_err (without the fix) and
watch the output.
So the solution was to make `install' behave non-recursive when
executed by `distribute'. My first attempt in passing SUBDIR=
to the `install' in the `distribute' body failed because of the
way how src/Makefile and src/Makefile.inc1 communicate with each
other. SUBDIR='s assignment precedence on the "make install
SUBDIR=" command line is lowered after src/Makefile wrapper calls
"make ... -f ${.CURDIR}/Makefile.inc1 install" because SUBDIR=
is moved into environment, and Makefile.inc1's assignments now
take higher precedence. This may be fixed someday when we merge
Makefile with Makefile.inc1. For now, this is implemented as a
NO_SUBDIR knob.
Spotted by: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Prodded by: des
MFC after: 3 days
2002-07-12 15:09:35 +00:00
|
|
|
DISTRIBUTION?= base
|
|
|
|
.if !target(distribute)
|
|
|
|
distribute:
|
|
|
|
.for dist in ${DISTRIBUTION}
|
2004-08-09 10:54:05 +00:00
|
|
|
${_+_}cd ${.CURDIR}; \
|
Moved the `distribute' target from bsd.obj.mk to bsd.subdir.mk,
to make it call `install' in the bsd.subdir.mk-driven makefiles
too. (share/examples/Makefile,v 1.29 changed the bsd.prog.mk
to bsd.subdir.mk and many stuff was lost during "make release".
I then merged this change in rev. 1.28.2.2 to work around the
namespace pollution (FILES) in this makefile.)
There was an added complexity here. Both the `distribute' and
`install' targets are recursive (they propagate to SUBDIRs).
So `distribute' first calls `install' in the ${.CURDIR}, then
calls `distribute' in each SUBDIR, etc. The problem is that
`install' (being also recursive) causes the stuff from SUBDIR
to be installed twice, first time thru `install' in ${.CURDIR}
triggered by `distribute', second time by `distribute' run in
the SUBDIR. This problem is not new, but it became apparent
only after I moved the `distribute' target from bsd.obj.mk to
bsd.subdir.mk. My first attempt testing the fix failed due to
this, because the whole world was distributed twice, causing
all the imaginable mess (kerberos5 stuff was installed into both
"base" and "krb5" dists, there was /sbin/init.bak, etc.)
I say the problem is not new because bsd.prog.mk and bsd.lib.mk
makefiles with SUBDIR (even without this fix) had this problem
for years. Try e.g. running ``make distribute DISTDIR=/foo''
from usr.bin/bzip2 or from lib/libcom_err (without the fix) and
watch the output.
So the solution was to make `install' behave non-recursive when
executed by `distribute'. My first attempt in passing SUBDIR=
to the `install' in the `distribute' body failed because of the
way how src/Makefile and src/Makefile.inc1 communicate with each
other. SUBDIR='s assignment precedence on the "make install
SUBDIR=" command line is lowered after src/Makefile wrapper calls
"make ... -f ${.CURDIR}/Makefile.inc1 install" because SUBDIR=
is moved into environment, and Makefile.inc1's assignments now
take higher precedence. This may be fixed someday when we merge
Makefile with Makefile.inc1. For now, this is implemented as a
NO_SUBDIR knob.
Spotted by: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Prodded by: des
MFC after: 3 days
2002-07-12 15:09:35 +00:00
|
|
|
${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2002-04-23 09:03:56 +00:00
|
|
|
_SUBDIR: .USE
|
Moved the `distribute' target from bsd.obj.mk to bsd.subdir.mk,
to make it call `install' in the bsd.subdir.mk-driven makefiles
too. (share/examples/Makefile,v 1.29 changed the bsd.prog.mk
to bsd.subdir.mk and many stuff was lost during "make release".
I then merged this change in rev. 1.28.2.2 to work around the
namespace pollution (FILES) in this makefile.)
There was an added complexity here. Both the `distribute' and
`install' targets are recursive (they propagate to SUBDIRs).
So `distribute' first calls `install' in the ${.CURDIR}, then
calls `distribute' in each SUBDIR, etc. The problem is that
`install' (being also recursive) causes the stuff from SUBDIR
to be installed twice, first time thru `install' in ${.CURDIR}
triggered by `distribute', second time by `distribute' run in
the SUBDIR. This problem is not new, but it became apparent
only after I moved the `distribute' target from bsd.obj.mk to
bsd.subdir.mk. My first attempt testing the fix failed due to
this, because the whole world was distributed twice, causing
all the imaginable mess (kerberos5 stuff was installed into both
"base" and "krb5" dists, there was /sbin/init.bak, etc.)
I say the problem is not new because bsd.prog.mk and bsd.lib.mk
makefiles with SUBDIR (even without this fix) had this problem
for years. Try e.g. running ``make distribute DISTDIR=/foo''
from usr.bin/bzip2 or from lib/libcom_err (without the fix) and
watch the output.
So the solution was to make `install' behave non-recursive when
executed by `distribute'. My first attempt in passing SUBDIR=
to the `install' in the `distribute' body failed because of the
way how src/Makefile and src/Makefile.inc1 communicate with each
other. SUBDIR='s assignment precedence on the "make install
SUBDIR=" command line is lowered after src/Makefile wrapper calls
"make ... -f ${.CURDIR}/Makefile.inc1 install" because SUBDIR=
is moved into environment, and Makefile.inc1's assignments now
take higher precedence. This may be fixed someday when we merge
Makefile with Makefile.inc1. For now, this is implemented as a
NO_SUBDIR knob.
Spotted by: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Prodded by: des
MFC after: 3 days
2002-07-12 15:09:35 +00:00
|
|
|
.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
|
2012-08-22 19:25:57 +00:00
|
|
|
@${_+_}set -e; for entry in ${SUBDIR}; do \
|
2002-04-23 09:03:56 +00:00
|
|
|
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
|
2004-09-07 15:19:40 +00:00
|
|
|
${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \
|
2002-02-06 18:05:53 +00:00
|
|
|
edir=$${entry}.${MACHINE_ARCH}; \
|
|
|
|
cd ${.CURDIR}/$${edir}; \
|
|
|
|
else \
|
2004-09-07 15:19:40 +00:00
|
|
|
${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \
|
2002-02-06 18:05:53 +00:00
|
|
|
edir=$${entry}; \
|
|
|
|
cd ${.CURDIR}/$${edir}; \
|
|
|
|
fi; \
|
|
|
|
${MAKE} ${.TARGET:realinstall=install} \
|
2002-04-23 09:03:56 +00:00
|
|
|
DIRPRFX=${DIRPRFX}$$edir/; \
|
1994-05-30 19:09:18 +00:00
|
|
|
done
|
2002-04-23 09:03:56 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2005-05-31 07:14:51 +00:00
|
|
|
${SUBDIR}: .PHONY
|
2004-08-09 10:54:05 +00:00
|
|
|
${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
|
1999-11-14 13:54:44 +00:00
|
|
|
cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
|
1994-05-30 19:09:18 +00:00
|
|
|
else \
|
|
|
|
cd ${.CURDIR}/${.TARGET}; \
|
|
|
|
fi; \
|
2005-05-31 07:14:51 +00:00
|
|
|
${MAKE} all
|
1994-05-30 19:09:18 +00:00
|
|
|
|
Milestone #1 in cross-arch make releases.
Do not install games and profiled libraries to the ${CHROOTDIR}
with the initial installworld.
Eliminate the need in the second installworld. For that, make sure
_everything_ is built in the "world" environment, using the right
tool chain.
Added SUBDIR_OVERRIDE helper stuff to Makefile.inc1. Split the
buildworld process into stages, and skip some stages when
SUBDIR_OVERRIDE is set (used to build crypto, krb4, and krb5
dists).
Added NO_MAKEDB_RUN knob to Makefile.inc1 to avoid running
makewhatis(1) at the end of installworld (used when making crypto,
krb4, and krb5 dists).
In release/scripts/doFS.sh, ensure that the correct boot blocks are
used.
Moved the creation of the "crypto" dist from release.5 to
release.2.
In release.3 and doMFSKERN, build kernels in the "world"
environment. KERNELS now means "additional" kernels, GENERIC is
always built.
Ensure we build crunched binaries in the "world" environment.
Obfuscate release/Makefile some more (WMAKEENV) to achieve this.
Inline createBOOTMFS target.
Use already built GENERIC kernel modules to augment mfsfd's
/stand/modules. GC doMODULES as such.
Assorted fixes:
Get rid of the "afterdistribute" target by moving the single use
of it from sys/Makefile to etc/Makefile's "distribute".
Makefile.inc1: apparently "etc" no longer needs to be last for
"distribute" to succeed.
gnu/usr.bin/perl/library/Makefile.inc: do not override the
"install" and "distribute" targets, do it the "canonical" way.
release/scripts/{man,cat}pages-make.sh: make sure Perl manpages and
catpages appear in the right dists. Note that because Perl does
not respect the MANBUILDCAT (and NOMAN), this results in a loss of
/usr/share/perl/man/cat* empty directories. This will be fixed
soon.
Turn MAKE_KERBEROS4 into a plain boolean variable (if it is set it
means "make KerberosIV"), as documented in the make.conf(5)
manpage. Most of the userland makefiles did not test it for "YES"
anyway.
XXX Should specialized kerberized libpam versions be included into
the krb4 and krb5 dists? (libpam.a would be incorrect anyway if
both krb4 and krb5 dists were choosen.)
Make sure "games" dist is made before "catpages", otherwise games
catpages settle in the wrong dist.
Fast build machine provided by: Igor Kucherenko <kivvy@sunbay.com>
2002-04-26 17:55:27 +00:00
|
|
|
.for __target in all all-man checkdpadd clean cleandepend cleandir \
|
2009-12-06 08:59:19 +00:00
|
|
|
cleanilinks depend distribute lint maninstall manlint obj objlink \
|
|
|
|
realinstall regress tags ${SUBDIR_TARGETS}
|
2002-04-23 09:03:56 +00:00
|
|
|
${__target}: _SUBDIR
|
1996-04-05 22:22:44 +00:00
|
|
|
.endfor
|
1994-11-13 21:05:28 +00:00
|
|
|
|
2002-06-03 14:49:34 +00:00
|
|
|
.for __target in files includes
|
2002-05-15 16:19:54 +00:00
|
|
|
.for __stage in build install
|
|
|
|
${__stage}${__target}:
|
|
|
|
.if make(${__stage}${__target})
|
|
|
|
${__stage}${__target}: _SUBDIR
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
${__target}:
|
2012-08-22 19:25:57 +00:00
|
|
|
${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target}
|
2002-05-15 16:19:54 +00:00
|
|
|
.endfor
|
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
2002-07-01 14:49:16 +00:00
|
|
|
install: beforeinstall realinstall afterinstall
|
|
|
|
.ORDER: beforeinstall realinstall afterinstall
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2012-11-07 22:02:02 +00:00
|
|
|
|
|
|
|
.endif
|