Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Feb 2010 22:43:10 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/144079: Makefile.inc1 ${DESTDIR} make dependency enhancement
Message-ID:  <201002182243.o1IMhA47017367@www.freebsd.org>
Resent-Message-ID: <201002182250.o1IMo0Ks050520@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

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

--------------------------------------------------------------
>How-To-Repeat:
rm -Rf ${DESTDIR}
make buildworld buildkernel
make installworld DESTDIR=${DESTDIR}
>Fix:
1. mkdir -p ${DESTDIR} before installworld is called.

OR

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). 
+#
+${DESTDIR}:
+	mkdir -p "${.TARGET}"
+
+#
 # installcheck
 #
 # Checks to be sure system is ready for installworld/installkernel.
@@ -557,7 +569,9 @@
 #
 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
 .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}
 installcheck_DESTDIR:
 .if !defined(DESTDIR) || empty(DESTDIR)
 	@echo "ERROR: Please set DESTDIR!"; \


>Release-Note:
>Audit-Trail:
>Unformatted:
 >>> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002182243.o1IMhA47017367>