From nobody@FreeBSD.org  Tue Mar  2 00:08:16 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7A71106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Mar 2010 00:08:16 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id D61C78FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Mar 2010 00:08:16 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o2208G2h024542
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 2 Mar 2010 00:08:16 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o2208GMP024541;
	Tue, 2 Mar 2010 00:08:16 GMT
	(envelope-from nobody)
Message-Id: <201003020008.o2208GMP024541@www.freebsd.org>
Date: Tue, 2 Mar 2010 00:08:16 GMT
From: Alexander Best <alexbestms@wwu.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] include /usr/obj/lib32 in cleanworld target on amd64 arch
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         144405
>Category:       amd64
>Synopsis:       [build] [patch] include /usr/obj/lib32 in cleanworld target on amd64 arch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-amd64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 02 00:10:07 UTC 2010
>Closed-Date:    
>Last-Modified:  Thu Mar  3 00:40:11 UTC 2011
>Originator:     Alexander Best
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #2 r204494M: Mon Mar  1 02:00:14 CET 2010     root@otaku:/usr/obj/usr/src/sys/ARUNDEL  amd64
>Description:
the patch includes /usr/obj/lib32 in the cleanworld target. the patch only scrubs the directory if it's present (which means cleanworld on anything != amd64 won't change). the patch also honours envar MAKEOBJDIRPREFIX.

this was discussed in [1].

cheers.
alex

[1] http://lists.freebsd.org/pipermail/freebsd-hackers/2010-February/030806.html
>How-To-Repeat:
`cd /usr/src && make cleanworld`

=> /usr/obj/usr/src gets scrubbed, but /usr/obj/lib32/usr/src doesn't.
>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 204540)
+++ Makefile	(working copy)
@@ -159,6 +159,11 @@
 	-chflags -R 0 ${.OBJDIR}
 	rm -rf ${.OBJDIR}/*
 .endif
+.if exists(${MAKEOBJDIRPREFIX}/lib32${.CURDIR}/)
+	-rm -rf ${MAKEOBJDIRPREFIX}/lib32${.CURDIR}/*
+	-chflags -R 0 ${MAKEOBJDIRPREFIX}/lib32${.CURDIR}
+	rm -rf ${MAKEOBJDIRPREFIX}/lib32${.CURDIR}/*
+.endif
 
 #
 # Handle the user-driven targets, using the source relative mk files.


>Release-Note:
>Audit-Trail:

From: Anonymous <swell.k@gmail.com>
To: Alexander Best <alexbestms@wwu.de>
Cc: bug-followup@FreeBSD.org
Subject: Re: amd64/144405: [build] [patch] include /usr/obj/lib32 in cleanworld target on amd64 arch
Date: Fri, 16 Jul 2010 02:12:28 +0400

 What do you think about respecting WITHOUT_LIB32 and TARGET?
 
 --- a.diff begins here ---
 diff --git a/Makefile b/Makefile
 index 5edb4da..7d261c3 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -157,9 +157,7 @@ cleanworld:
  	#   To be safe in this case, fall back to a 'make cleandir'
  	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
  .else
 -	-rm -rf ${.OBJDIR}/*
 -	-chflags -R 0 ${.OBJDIR}
 -	rm -rf ${.OBJDIR}/*
 +	${_+_}@cd ${.CURDIR}; ${_MAKE} cleanworld
  .endif
  
  #
 diff --git a/Makefile.inc1 b/Makefile.inc1
 index d939280..0b9981d 100644
 --- a/Makefile.inc1
 +++ b/Makefile.inc1
 @@ -1508,3 +1503,15 @@ builddtb:
  	dtc -O dtb -o \
  	    ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
  	    -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
 +
 +cleanworld:
 +.if exists(${OBJTREE}${.CURDIR})
 +	-rm -rf ${OBJTREE}${.CURDIR}/*
 +	-chflags -R 0 ${OBJTREE}${.CURDIR}
 +	rm -rf ${OBJTREE}${.CURDIR}/*
 +.endif
 +.if exists(${OBJTREE}/lib32${.CURDIR}) && ${MK_LIB32} != "no"
 +	-rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 +	-chflags -R 0 ${OBJTREE}/lib32${.CURDIR}
 +	rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 +.endif
 --- a.diff ends here ---

From: Alexander Best <alexbestms@uni-muenster.de>
To: Anonymous <swell.k@gmail.com>
Cc: bug-followup@freebsd.org
Subject: Re: amd64/144405: [build] [patch] include /usr/obj/lib32 in 
	cleanworld target on amd64 arch
Date: Mon, 19 Jul 2010 01:36:23 +0200

 2010/7/16 Anonymous <swell.k@gmail.com>:
 > What do you think about respecting WITHOUT_LIB32 and TARGET?
 
 i like it. i'm not sure however if WITHOUT_LIB32 should have an impact
 on cleandir/cleanworld.
 
 if i remember correctly running target clean e.g. also doesn't skip
 certain directories in the tree even if the user has set WITHOUT_* and
 doesn't want specific code to be built. i can't really think of a
 situation where somebody wants to remove all the 64bit objs but keep
 the 32bit ones.
 
 alex
 
 >
 > --- a.diff begins here ---
 > diff --git a/Makefile b/Makefile
 > index 5edb4da..7d261c3 100644
 > --- a/Makefile
 > +++ b/Makefile
 > @@ -157,9 +157,7 @@ cleanworld:
 > =A0 =A0 =A0 =A0# =A0 To be safe in this case, fall back to a 'make cleand=
 ir'
 > =A0 =A0 =A0 =A0${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
 > =A0.else
 > - =A0 =A0 =A0 -rm -rf ${.OBJDIR}/*
 > - =A0 =A0 =A0 -chflags -R 0 ${.OBJDIR}
 > - =A0 =A0 =A0 rm -rf ${.OBJDIR}/*
 > + =A0 =A0 =A0 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleanworld
 > =A0.endif
 >
 > =A0#
 > diff --git a/Makefile.inc1 b/Makefile.inc1
 > index d939280..0b9981d 100644
 > --- a/Makefile.inc1
 > +++ b/Makefile.inc1
 > @@ -1508,3 +1503,15 @@ builddtb:
 > =A0 =A0 =A0 =A0dtc -O dtb -o \
 > =A0 =A0 =A0 =A0 =A0 =A0${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -=
 f1`.dtb -b 0 \
 > =A0 =A0 =A0 =A0 =A0 =A0-p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE=
 }
 > +
 > +cleanworld:
 > +.if exists(${OBJTREE}${.CURDIR})
 > + =A0 =A0 =A0 -rm -rf ${OBJTREE}${.CURDIR}/*
 > + =A0 =A0 =A0 -chflags -R 0 ${OBJTREE}${.CURDIR}
 > + =A0 =A0 =A0 rm -rf ${OBJTREE}${.CURDIR}/*
 > +.endif
 > +.if exists(${OBJTREE}/lib32${.CURDIR}) && ${MK_LIB32} !=3D "no"
 > + =A0 =A0 =A0 -rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 > + =A0 =A0 =A0 -chflags -R 0 ${OBJTREE}/lib32${.CURDIR}
 > + =A0 =A0 =A0 rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 > +.endif
 > --- a.diff ends here ---
 >
 
 
 
 --=20
 Alexander Best

From: Anonymous <swell.k@gmail.com>
To: Alexander Best <alexbestms@uni-muenster.de>
Cc: bug-followup@freebsd.org
Subject: Re: amd64/144405: [build] [patch] include /usr/obj/lib32 in  cleanworld target on amd64 arch
Date: Mon, 19 Jul 2010 05:33:37 +0400

 Alexander Best <alexbestms@uni-muenster.de> writes:
 
 > i can't really think of a situation where somebody wants to remove all
 > the 64bit objs but keep the 32bit ones.
 
 I was concerned about cleanworld invoked by crossbuild breaking normal
 build when running concurrently but looks like that's not the case, i.e.
 
   $ make cleanworld TARGET=i386 # /usr/obj/i386.i386/lib32/usr/src
 
 doesn't wipe out lib32 for normal build (/usr/obj/lib32/usr/src).
 Since crossbuild encloses lib32 in its OBJTREE there is no need for
 MK_LIB32 check.
 
 --- b.diff begins here ---
 diff --git a/Makefile.inc1 b/Makefile.inc1
 index 85669d5..2298eca 100644
 --- a/Makefile.inc1
 +++ b/Makefile.inc1
 @@ -1512,7 +1512,7 @@ cleanworld:
  	-chflags -R 0 ${OBJTREE}${.CURDIR}
  	rm -rf ${OBJTREE}${.CURDIR}/*
  .endif
 -.if exists(${OBJTREE}/lib32${.CURDIR}) && ${MK_LIB32} != "no"
 +.if exists(${OBJTREE}/lib32${.CURDIR})
  	-rm -rf ${OBJTREE}/lib32${.CURDIR}/*
  	-chflags -R 0 ${OBJTREE}/lib32${.CURDIR}
  	rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 --- b.diff ends here ---

From: Alexander Best <alexbestms@uni-muenster.de>
To: Anonymous <swell.k@gmail.com>
Cc: bug-followup@freebsd.org
Subject: Re: amd64/144405: [build] [patch] include /usr/obj/lib32 in 
	cleanworld target on amd64 arch
Date: Wed, 21 Jul 2010 19:15:22 +0200

 2010/7/19 Anonymous <swell.k@gmail.com>:
 > Alexander Best <alexbestms@uni-muenster.de> writes:
 >
 >> i can't really think of a situation where somebody wants to remove all
 >> the 64bit objs but keep the 32bit ones.
 >
 > I was concerned about cleanworld invoked by crossbuild breaking normal
 > build when running concurrently but looks like that's not the case, i.e.
 >
 > =A0$ make cleanworld TARGET=3Di386 # /usr/obj/i386.i386/lib32/usr/src
 >
 > doesn't wipe out lib32 for normal build (/usr/obj/lib32/usr/src).
 > Since crossbuild encloses lib32 in its OBJTREE there is no need for
 > MK_LIB32 check.
 
 cool. now all that is necessary is somebody to commit those changes.
 probably the hardest part of all. ;)
 
 cheers.
 alex
 
 >
 > --- b.diff begins here ---
 > diff --git a/Makefile.inc1 b/Makefile.inc1
 > index 85669d5..2298eca 100644
 > --- a/Makefile.inc1
 > +++ b/Makefile.inc1
 > @@ -1512,7 +1512,7 @@ cleanworld:
 > =A0 =A0 =A0 =A0-chflags -R 0 ${OBJTREE}${.CURDIR}
 > =A0 =A0 =A0 =A0rm -rf ${OBJTREE}${.CURDIR}/*
 > =A0.endif
 > -.if exists(${OBJTREE}/lib32${.CURDIR}) && ${MK_LIB32} !=3D "no"
 > +.if exists(${OBJTREE}/lib32${.CURDIR})
 > =A0 =A0 =A0 =A0-rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 > =A0 =A0 =A0 =A0-chflags -R 0 ${OBJTREE}/lib32${.CURDIR}
 > =A0 =A0 =A0 =A0rm -rf ${OBJTREE}/lib32${.CURDIR}/*
 > --- b.diff ends here ---
 >
 
 
 
 --=20
 Alexander Best

From: Andriy Gapon <avg@freebsd.org>
To: bug-followup@freebsd.org, alexbestms@wwu.de, Anonymous <swell.k@gmail.com>
Cc:  
Subject: Re: amd64/144405: [build] [patch] include /usr/obj/lib32 in cleanworld
 target on amd64 arch
Date: Sun, 05 Dec 2010 16:11:15 +0200

 Hey guys, have you tried discussing this on the mailing lists?
 
 -- 
 Andriy Gapon

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: amd64/144405: [build] [patch] include /usr/obj/lib32 in cleanworld target on amd64 arch
Date: Thu, 3 Mar 2011 00:34:45 +0000

 yes:
 
 http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg70211.html
 
 -- 
 a13x
>Unformatted:
