Bug 144405

Summary: [build] [patch] include /usr/obj/lib32 in cleanworld target on amd64 arch
Product: Base System Reporter: Alexander Best <alexbestms>
Component: amd64Assignee: freebsd-amd64 (Nobody) <amd64>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: avos
Priority: Normal    
Version: 9.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Alexander Best 2010-03-02 00:10:07 UTC
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

Fix: Patch attached with submission follows:
How-To-Repeat: `cd /usr/src && make cleanworld`

=> /usr/obj/usr/src gets scrubbed, but /usr/obj/lib32/usr/src doesn't.
Comment 1 swell.k 2010-07-15 23:12:28 UTC
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 ---
Comment 2 alexbestms 2010-07-19 00:36:23 UTC
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
Comment 3 swell.k 2010-07-19 02:33:37 UTC
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 ---
Comment 4 alexbestms 2010-07-21 18:15:22 UTC
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
Comment 5 Andriy Gapon freebsd_committer freebsd_triage 2010-12-05 14:11:15 UTC
Hey guys, have you tried discussing this on the mailing lists?

-- 
Andriy Gapon
Comment 6 Alexander Best freebsd_committer freebsd_triage 2011-03-03 00:34:45 UTC
yes:

http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg70211.html

-- 
a13x
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:24 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 8 Andriy Voskoboinyk freebsd_committer freebsd_triage 2019-03-18 08:55:00 UTC
Seems to be initially fixed in base r271730 (however, now obj tree have a bit different structure...)