Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Raul Rangel: Looks good to me, approved
libpayload/lpgcc: Turn references to build dir into a variable

Introduce a `$_OBJ` variable, that points to the build directory for
in-tree usage of `lpgcc`. If unset, the default `../build` relative
to the location of `lpgcc` is used.

Change-Id: I35112d7533d69aa51252dd2bceec010a62522403
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47629
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M payloads/libpayload/bin/lp.functions
M payloads/libpayload/bin/lpgcc
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/payloads/libpayload/bin/lp.functions b/payloads/libpayload/bin/lp.functions
index 3911c42..8d784eb 100644
--- a/payloads/libpayload/bin/lp.functions
+++ b/payloads/libpayload/bin/lp.functions
@@ -35,6 +35,10 @@
echo "Warning: $1"
}

+# For in-tree builds, allow to override the libpayload build dir.
+
+_OBJ=${_OBJ:-$BASE/../build}
+
# If the user didn't specify LIBPAYLOAD_PREFIX, then preload it
# with the default prefix value

@@ -48,8 +52,8 @@

if [ -f $BASE/../lib/libpayload.a ]; then
_LIBDIR=$BASE/../lib
-elif [ -f $BASE/../build/libpayload.a ]; then
- _LIBDIR=$BASE/../build
+elif [ -f $_OBJ/libpayload.a ]; then
+ _LIBDIR=$_OBJ
else
_LIBDIR=$LIBPAYLOAD_PREFIX/lib
fi
diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc
index aa09c1d..1e63d05 100755
--- a/payloads/libpayload/bin/lpgcc
+++ b/payloads/libpayload/bin/lpgcc
@@ -137,7 +137,7 @@
shift
done

-_CFLAGS="$_ARCHEXTRA -nostdinc -nostdlib -I$BASE/../build -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1"
+_CFLAGS="$_ARCHEXTRA -nostdinc -nostdlib -I$_OBJ -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1"

if [ "$CONFIG_LP_PDCURSES" = y ]; then
_CFLAGS="$_CFLAGS -I$BASE/../curses/PDCurses"
@@ -167,8 +167,8 @@
_LIBGCC=`$DEFAULT_CC $_ARCHEXTRA -print-libgcc-file-name`
if [ -f $_ARCHLIBDIR/head.o ]; then
HEAD_O=$_ARCHLIBDIR/head.o
- elif [ -f $BASE/../build/head.o ]; then
- HEAD_O=$BASE/../build/head.o
+ elif [ -f $_OBJ/head.o ]; then
+ HEAD_O=$_OBJ/head.o
else
echo "Could not find head.o"
exit 1

To view, visit change 47629. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I35112d7533d69aa51252dd2bceec010a62522403
Gerrit-Change-Number: 47629
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Raul Rangel <rrangel@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged