[OE-core] [PATCH] autotools: Attempt to clean build directory when rerunning configure

Richard Purdie richard.purdie at linuxfoundation.org
Tue Oct 30 08:10:42 UTC 2012


On Mon, 2012-10-29 at 18:14 +0000, Phil Blundell wrote:
> Existing logic in autotools_preconfigure() will clean the build directory
> before rerunning configure in the case where ${S} != ${B}.  It is, however,
> desirable to make at least some attempt to clean the build artifacts for
> in-tree builds since many packages lack the appropriate dependency rules
> to force a recompile if (for example) CFLAGS has changed.  Making distclean
> would be better but is not practical because many packages don't support it
> properly.  Even "make clean" is not universally available, so we ignore any
> failure from that command and just carry on regardless.
> 
> Signed-off-by: Phil Blundell <philb at gnu.org>
> ---
>  meta/classes/autotools.bbclass |   13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)

How extensively has this been tested? I have a suspicion that we might
run into a number of issues doing this throughout the tree :(

I'm wondering how many recipes will suffer from issues with "make clean"
verses how many recipes would struggle if we defaulted ${B} != ${S}?

Cheers,

Richard


> diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
> index b97d74b..6539df9 100644
> --- a/meta/classes/autotools.bbclass
> +++ b/meta/classes/autotools.bbclass
> @@ -93,10 +93,15 @@ CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
>  
>  autotools_preconfigure() {
>  	if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
> -		if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${S}" != "${B}" ]; then
> -			echo "Previously configured separate build directory detected, cleaning ${B}"
> -			rm -rf ${B}
> -			mkdir ${B}
> +		if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
> +			if [ "${S}" != "${B}" ]; then
> +				echo "Previously configured separate build directory detected, cleaning ${B}"
> +				rm -rf ${B}
> +				mkdir ${B}
> +			else
> +				echo "Previously configured source directory detected, cleaning ${S}"
> +				( oe_runmake clean ) || true
> +			fi
>  		fi
>  	fi
>  }






More information about the Openembedded-core mailing list