aboutsummaryrefslogtreecommitdiff
path: root/share/mk/bsd.subdir.mk
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2002-07-12 15:09:35 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2002-07-12 15:09:35 +0000
commit8f463ff4c5a8e09bc1d1fbf6ae580b0dc601d4b9 (patch)
tree9b491e2612cc31b2bad26c76739c4c3962b2cfef /share/mk/bsd.subdir.mk
parent7fe7d53b5c7ef5a325d4f7398ebc27831d8047c4 (diff)
downloadsrc-8f463ff4c5a8e09bc1d1fbf6ae580b0dc601d4b9.tar.gz
src-8f463ff4c5a8e09bc1d1fbf6ae580b0dc601d4b9.zip
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
Notes
Notes: svn path=/head/; revision=99875
Diffstat (limited to 'share/mk/bsd.subdir.mk')
-rw-r--r--share/mk/bsd.subdir.mk11
1 files changed, 10 insertions, 1 deletions
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index 11b409b040ea..7cfc4462d546 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -31,8 +31,17 @@
.include <bsd.init.mk>
+DISTRIBUTION?= base
+.if !target(distribute)
+distribute:
+.for dist in ${DISTRIBUTION}
+ cd ${.CURDIR}; \
+ ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies
+.endfor
+.endif
+
_SUBDIR: .USE
-.if defined(SUBDIR) && !empty(SUBDIR)
+.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
@for entry in ${SUBDIR}; do \
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \