Skip to contentSkip to conversation

base.bbclass: Enable using 'make clean' for rebuilds

PATCH New Richard Purdie 1 participant 1 message Oct 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base.bbclass: Enable using 'make clean' for rebuilds

When something rebuilds say due to ${baselib} changing or some other key variable, software is often not rebuilt due to the fact that make detects no dependency change.

By running "make clean" when these changes occur, we can at least try and ensure the correct rebuilds happen. We use the same checksum check as autotools to decide if things have changed or not.

meta/classes/base.bbclass +14 -1
index d6a2292..52b835e 100644
@@ -230,11 +230,24 @@ gdkpixbuf_complete() {
 	GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_BINDIR_NATIVE}/gdk-pixbuf-query-loaders --update-cache || exit 1
 }
 
+CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
+
 addtask configure after do_patch
 do_configure[dirs] = "${S} ${B}"
 do_configure[deptask] = "do_populate_sysroot"
 base_do_configure() {
-	:
+	if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
+		if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
+			cd ${B}
+			if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
+				${MAKE} clean
+			fi
+			find ${B} -name \*.la -delete
+		fi
+	fi
+	if [ -n "${CONFIGURESTAMPFILE}" ]; then
+		echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
+	fi
 }
 
 addtask compile after do_configure