conf/144079: Makefile.inc1 ${DESTDIR} make dependency enhancement

Garrett Cooper gcooper at
Thu Feb 18 22:50:01 UTC 2010

>Number:         144079
>Category:       conf
>Synopsis:       Makefile.inc1 ${DESTDIR} make dependency enhancement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 18 22:50:00 UTC 2010
>Originator:     Garrett Cooper
>Release:        RELENG_8
Cisco Systems, Inc
FreeBSD 8.0-STABLE FreeBSD 8.0-STABLE #2: Wed Feb  3 16:57:07 PST 2010     garrcoop at  i386
A minor annoyance I discovered is that if DESTDIR doesn't exist prior to installworld being called, installworld will error out like so:

rm -Rf ${DESTDIR}
make buildworld buildkernel
make installworld DESTDIR=${DESTDIR}
1. mkdir -p ${DESTDIR} before installworld is called.


2. Apply attached patch and invoke with flow shown above.

Patch attached with submission follows:

Index: Makefile.inc1
--- Makefile.inc1	(revision 204027)
+++ Makefile.inc1	(working copy)
@@ -546,6 +546,18 @@
 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
+# A real target which corresponds to ${DESTDIR}. This is outside of the
+# distributeworld check below because a) it's a no-op, and b) it could be a
+# make dependency of another target elsewhere.
+# It doesn't matter if it's either undefined here or empty here. The former
+# case is a no-op and the latter case is user error, but gets translated into
+# a no-op via make(1). 
+	mkdir -p "${.TARGET}"
 # installcheck
 # Checks to be sure system is ready for installworld/installkernel.
@@ -557,7 +569,9 @@
 .if !make(distributeworld)
-installcheck: installcheck_DESTDIR
+# Make sure that the variable isn't empty before marking ${DESTDIR} ok.
+.ORDER: installcheck_DESTDIR ${DESTDIR}
+installcheck: installcheck_DESTDIR ${DESTDIR}
 .if !defined(DESTDIR) || empty(DESTDIR)
 	@echo "ERROR: Please set DESTDIR!"; \

 >>> Making hierarchy
 cd /usr/home/garrcoop/ipcvs/freebsd/src; /usr/bin/make -f Makefile.inc1 hierarchy
 cd /usr/home/garrcoop/ipcvs/freebsd/src/etc;            /usr/bin/make distrib-dirs
 mtree -eU  -f /usr/home/garrcoop/ipcvs/freebsd/src/etc/mtree/BSD.root.dist -p /usr/home/garrcoop/rootfs/
 mtree: /usr/home/garrcoop/rootfs/: No such file or directory
 *** Error code 1
 Stop in /usr/home/garrcoop/ipcvs/freebsd/src/etc.
 *** Error code 1
 Stop in /usr/home/garrcoop/ipcvs/freebsd/src.
 *** Error code 1
 Stop in /usr/home/garrcoop/ipcvs/freebsd/src.
 *** Error code 1
 Stop in /usr/home/garrcoop/ipcvs/freebsd/src.
 *** Error code 1
 Stop in /usr/home/garrcoop/ipcvs/freebsd/src.
 This can be properly worked out by adding a ${DESTDIR} dependency goal, and (at bare minimum) add a dependency goal after installcheck_DESTDIR in installcheck to properly fulfill the minimum requirement such that I don't have to maintain a hacky build sc ript in order to get this to work.
 I implemented the bare minimum set of logic to address the issue with as little churn as possible.

More information about the freebsd-bugs mailing list