git: 27e64c99e4d6 - main - stand/uboot: Fix building of ubldr.bin

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 07 Feb 2022 20:20:02 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=27e64c99e4d61fc16e11fc9416553a54c1628a84

commit 27e64c99e4d61fc16e11fc9416553a54c1628a84
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-02-07 20:14:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-07 20:14:48 +0000

    stand/uboot: Fix building of ubldr.bin
    
    Sponsored by:           Netflix
    Reviewed by:            kevans
    Differential Revision:  https://reviews.freebsd.org/D34189
---
 stand/uboot/Makefile                  | 9 +++++++--
 stand/uboot/arch/powerpc/Makefile.inc | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/stand/uboot/Makefile b/stand/uboot/Makefile
index aed2121bd507..052c9615bfc2 100644
--- a/stand/uboot/Makefile
+++ b/stand/uboot/Makefile
@@ -15,9 +15,9 @@ LOADER_DISK_SUPPORT?=	yes
 
 .include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc"
 
-.if ${MK_PIE} == "yes"
+LOADER_UBLDR_BIN?=	yes
+.if ${LOADER_UBLDR_BIN} != "no"
 FILES+=		ubldr ubldr.bin
-OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 .else
 PROG=		ubldr
 .endif
@@ -75,6 +75,11 @@ CFLAGS+=	-I${FDTSRC}
 CFLAGS+= -DDISK_DEBUG
 .endif
 
+.if ${LOADER_UBLDR_BIN} != "no"
+OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
+ubldr ubldr.bin ubldr.pie: ${OBJS}
+.endif
+
 DPADD=		${LDR_INTERP} ${LIBFDT} ${LIBSA}
 LDADD=		${LDR_INTERP} ${LIBFDT} ${LIBSA}
 
diff --git a/stand/uboot/arch/powerpc/Makefile.inc b/stand/uboot/arch/powerpc/Makefile.inc
index 01c7a0c6ac8c..226cfc2f7369 100644
--- a/stand/uboot/arch/powerpc/Makefile.inc
+++ b/stand/uboot/arch/powerpc/Makefile.inc
@@ -3,4 +3,4 @@ SRCS+=		start.S conf.c ppc64_elf_freebsd.c
 .PATH:		${SYSDIR}/libkern
 SRCS+=		ucmpdi2.c
 
-MK_PIE=		no
+LOADER_UBLDR_BIN=	no