aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-10-09 22:12:32 +0000
committerWarner Losh <imp@FreeBSD.org>2017-10-09 22:12:32 +0000
commiteca8b9c449d522adf5c683b7fd09e562daa53161 (patch)
tree469b3ddd4451f575f1ab72fb7781cd5c3d50826c
parent6a971c173266ad15410557184195ea1bd681ab20 (diff)
Define SASRC and use it
Define SASRC to point to the current libstand sources. Include ../Makefile.inc early enough in a few places so we can .include "${SASRC}/Makefile" and have it work. Create a new pass-up Makefile.inc in sys/boot/userboot to allow this pattern to work. Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=324450
-rw-r--r--sys/boot/Makefile.inc7
-rw-r--r--sys/boot/arm/uboot/Makefile2
-rw-r--r--sys/boot/common/Makefile.inc2
-rw-r--r--sys/boot/efi/fdt/Makefile2
-rw-r--r--sys/boot/efi/libefi/Makefile2
-rw-r--r--sys/boot/efi/loader/Makefile2
-rw-r--r--sys/boot/i386/libfirewire/Makefile2
-rw-r--r--sys/boot/i386/libi386/Makefile2
-rw-r--r--sys/boot/i386/loader/Makefile2
-rw-r--r--sys/boot/libstand32/Makefile10
-rw-r--r--sys/boot/mips/beri/boot2/Makefile2
-rw-r--r--sys/boot/mips/beri/loader/Makefile2
-rw-r--r--sys/boot/mips/uboot/Makefile2
-rw-r--r--sys/boot/ofw/libofw/Makefile2
-rw-r--r--sys/boot/powerpc/kboot/Makefile2
-rw-r--r--sys/boot/powerpc/ofw/Makefile2
-rw-r--r--sys/boot/powerpc/ps3/Makefile2
-rw-r--r--sys/boot/powerpc/uboot/Makefile2
-rw-r--r--sys/boot/sparc64/loader/Makefile2
-rw-r--r--sys/boot/uboot/fdt/Makefile2
-rw-r--r--sys/boot/uboot/lib/Makefile2
-rw-r--r--sys/boot/userboot/Makefile.inc3
-rw-r--r--sys/boot/userboot/libstand/Makefile3
-rw-r--r--sys/boot/userboot/userboot/Makefile2
-rw-r--r--sys/boot/userboot/zfs/Makefile2
-rw-r--r--sys/boot/zfs/Makefile2
26 files changed, 39 insertions, 28 deletions
diff --git a/sys/boot/Makefile.inc b/sys/boot/Makefile.inc
index f83d266c92e9..727f2ec7a6f8 100644
--- a/sys/boot/Makefile.inc
+++ b/sys/boot/Makefile.inc
@@ -2,6 +2,11 @@
.include <src.opts.mk>
+.if !defined(__BOOT_MAKEFILE_INC__)
+__BOOT_MAKEFILE_INC__=${MFILE}
+
+SASRC=${SRCTOP}/lib/libstand
+
SSP_CFLAGS=
.if ${MACHINE_CPUARCH} == "arm"
@@ -24,9 +29,9 @@ DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true
DD=dd ${DD_NOSTATUS}
.if ${MK_LOADER_FORCE_LE} != "no"
-
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -mlittle-endian
.endif
+.endif
.endif
diff --git a/sys/boot/arm/uboot/Makefile b/sys/boot/arm/uboot/Makefile
index 4d5ea3aa1f7f..f242adb3e2e7 100644
--- a/sys/boot/arm/uboot/Makefile
+++ b/sys/boot/arm/uboot/Makefile
@@ -113,7 +113,7 @@ CFLAGS+= -I${.CURDIR}/../../uboot/lib
CFLAGS+= -I${.OBJDIR}/../../uboot/lib
# where to get libstand from
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
CFLAGS+= -fPIC
diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc
index 7b0e81c85570..7da374836d62 100644
--- a/sys/boot/common/Makefile.inc
+++ b/sys/boot/common/Makefile.inc
@@ -70,7 +70,7 @@ CFLAGS+= -DBOOT_PROMPT_123
.if defined(LOADER_INSTALL_SUPPORT)
SRCS+= install.c
-CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=-I${SASRC}
.endif
CLEANFILES+= vers.c
diff --git a/sys/boot/efi/fdt/Makefile b/sys/boot/efi/fdt/Makefile
index 56fc2997a136..ec201abbf23c 100644
--- a/sys/boot/efi/fdt/Makefile
+++ b/sys/boot/efi/fdt/Makefile
@@ -17,7 +17,7 @@ CFLAGS+= -mgeneral-regs-only
CFLAGS+= -msoft-float
.endif
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
# EFI library headers
CFLAGS+= -I${.CURDIR}/../include
diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile
index 8fcf25956b47..166e0cf19b28 100644
--- a/sys/boot/efi/libefi/Makefile
+++ b/sys/boot/efi/libefi/Makefile
@@ -37,7 +37,7 @@ CFLAGS+= -fPIC -mno-red-zone
.endif
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
.if ${MK_ZFS} != "no"
CFLAGS+= -I${.CURDIR}/../../zfs
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs
diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile
index 8e65c02e8e95..5f4c3e30baa7 100644
--- a/sys/boot/efi/loader/Makefile
+++ b/sys/boot/efi/loader/Makefile
@@ -37,7 +37,7 @@ CWARNFLAGS.zfs.c+= -Wno-missing-prototypes
.endif
.if defined(LOADER_NET_SUPPORT)
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
.endif
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
diff --git a/sys/boot/i386/libfirewire/Makefile b/sys/boot/i386/libfirewire/Makefile
index 904f4abccae9..71821ea90481 100644
--- a/sys/boot/i386/libfirewire/Makefile
+++ b/sys/boot/i386/libfirewire/Makefile
@@ -10,7 +10,7 @@ SRCS+= dcons.c fwcrom.c
CFLAGS+= -D_BOOT
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
CFLAGS+= -I${.CURDIR}/../btx/lib
CFLAGS+= -I${.CURDIR}/../libi386
diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
index dc57030b4609..fcba9ea03836 100644
--- a/sys/boot/i386/libi386/Makefile
+++ b/sys/boot/i386/libi386/Makefile
@@ -60,7 +60,7 @@ CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 \
-I${.CURDIR}/../../../contrib/dev/acpica/include \
-I${.CURDIR}/../../.. -I.
# the location of libstand
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
# Handle FreeBSD specific %b and %D printf format specifiers
CFLAGS+= ${FORMAT_EXTENSIONS}
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index 434ccc914946..9372a548353b 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -29,7 +29,7 @@ LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a
.endif
.if defined(LOADER_NET_SUPPORT)
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
.endif
.if defined(LOADER_TFTP_SUPPORT)
diff --git a/sys/boot/libstand32/Makefile b/sys/boot/libstand32/Makefile
index 6dbf1f420910..ace4189ee29b 100644
--- a/sys/boot/libstand32/Makefile
+++ b/sys/boot/libstand32/Makefile
@@ -2,23 +2,25 @@
.include <src.opts.mk>
-LIBSTAND_SRC= ${.CURDIR}/../../../lib/libstand
+.include "../Makefile.inc"
+
.if ${MACHINE_CPUARCH} == "amd64"
LIBSTAND_CPUARCH=i386
.else
LIBSTAND_CPUARCH=${MACHINE_CPUARCH}
.endif
-LIBC_SRC= ${LIBSTAND_SRC}/../libc
+LIBSTAND_SRC= ${SASRC}
+LIBC_SRC= ${SRCTOP}/lib/libc
INTERNALLIB=
INCS=
MAN=
-.PATH: ${LIBSTAND_SRC}
+.PATH: ${SASRC}
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -I.
.endif
-.include "${LIBSTAND_SRC}/Makefile"
+.include "${SASRC}/Makefile"
.if ${MACHINE_CPUARCH} == "amd64"
CLEANFILES+= machine
diff --git a/sys/boot/mips/beri/boot2/Makefile b/sys/boot/mips/beri/boot2/Makefile
index a12db1b6e6b8..093fe1353655 100644
--- a/sys/boot/mips/beri/boot2/Makefile
+++ b/sys/boot/mips/beri/boot2/Makefile
@@ -58,7 +58,7 @@ CFLAGS= -ffreestanding \
-g
# where to get libstand from
-CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a
LDFLAGS= -nostdlib \
diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile
index 77262f360b08..5b0a78aa9c19 100644
--- a/sys/boot/mips/beri/loader/Makefile
+++ b/sys/boot/mips/beri/loader/Makefile
@@ -108,7 +108,7 @@ LDFLAGS= -nostdlib \
-e __start
# where to get libstand from
-CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a
DPADD= ${LIBFICL} ${LIBSTAND}
diff --git a/sys/boot/mips/uboot/Makefile b/sys/boot/mips/uboot/Makefile
index 2a339a51377f..fba4f69cb4cf 100644
--- a/sys/boot/mips/uboot/Makefile
+++ b/sys/boot/mips/uboot/Makefile
@@ -116,7 +116,7 @@ CFLAGS+= -I${.CURDIR}/../../uboot/lib
CFLAGS+= -I${.OBJDIR}/../../uboot/lib
# where to get libstand from
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
# clang doesn't understand %D as a specifier to printf
diff --git a/sys/boot/ofw/libofw/Makefile b/sys/boot/ofw/libofw/Makefile
index 3b91ea28d37a..056019eecf5c 100644
--- a/sys/boot/ofw/libofw/Makefile
+++ b/sys/boot/ofw/libofw/Makefile
@@ -9,7 +9,7 @@ SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \
.PATH: ${.CURDIR}/../../zfs
SRCS+= devicename_stubs.c
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
diff --git a/sys/boot/powerpc/kboot/Makefile b/sys/boot/powerpc/kboot/Makefile
index 6a1741b1db7c..daf8e78b3e0f 100644
--- a/sys/boot/powerpc/kboot/Makefile
+++ b/sys/boot/powerpc/kboot/Makefile
@@ -95,7 +95,7 @@ CFLAGS+= -Wa,-mppc64bridge
# where to get libstand from
LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile
index 1d135f0a217b..79892ab95e06 100644
--- a/sys/boot/powerpc/ofw/Makefile
+++ b/sys/boot/powerpc/ofw/Makefile
@@ -93,7 +93,7 @@ CFLAGS+= -I${.CURDIR}/../../ofw/libofw
# where to get libstand from
LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
diff --git a/sys/boot/powerpc/ps3/Makefile b/sys/boot/powerpc/ps3/Makefile
index b54cebe2bd06..57dda8d0fb0e 100644
--- a/sys/boot/powerpc/ps3/Makefile
+++ b/sys/boot/powerpc/ps3/Makefile
@@ -92,7 +92,7 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
# where to get libstand from
LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
DPADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND}
diff --git a/sys/boot/powerpc/uboot/Makefile b/sys/boot/powerpc/uboot/Makefile
index b18d8ebd6d68..723a3258c81a 100644
--- a/sys/boot/powerpc/uboot/Makefile
+++ b/sys/boot/powerpc/uboot/Makefile
@@ -98,7 +98,7 @@ CFLAGS+= -I${.OBJDIR}/../../uboot/lib
# where to get libstand from
LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile
index 243ec11e8e0d..0b0216ab9696 100644
--- a/sys/boot/sparc64/loader/Makefile
+++ b/sys/boot/sparc64/loader/Makefile
@@ -80,7 +80,7 @@ LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a
CFLAGS+= -I${.CURDIR}/../../ofw/libofw/
# where to get libstand from
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
# Need sys/ for crypto/intake.h
CFLAGS+= -I${SRCTOP}/sys
diff --git a/sys/boot/uboot/fdt/Makefile b/sys/boot/uboot/fdt/Makefile
index 95c0800789a2..4b27d6e3d235 100644
--- a/sys/boot/uboot/fdt/Makefile
+++ b/sys/boot/uboot/fdt/Makefile
@@ -12,7 +12,7 @@ SRCS= uboot_fdt.c
CFLAGS+= -ffreestanding -msoft-float
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
# U-Boot library headers
CFLAGS+= -I${.CURDIR}/../lib
diff --git a/sys/boot/uboot/lib/Makefile b/sys/boot/uboot/lib/Makefile
index 982da713c66b..59db7d0cfc5f 100644
--- a/sys/boot/uboot/lib/Makefile
+++ b/sys/boot/uboot/lib/Makefile
@@ -13,7 +13,7 @@ SRCS+= module.c net.c reboot.c time.c
CFLAGS+= -ffreestanding -msoft-float
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+= -I${SASRC}
.if !defined(LOADER_NO_DISK_SUPPORT)
SRCS+= disk.c
diff --git a/sys/boot/userboot/Makefile.inc b/sys/boot/userboot/Makefile.inc
new file mode 100644
index 000000000000..265f86d1ed55
--- /dev/null
+++ b/sys/boot/userboot/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"
diff --git a/sys/boot/userboot/libstand/Makefile b/sys/boot/userboot/libstand/Makefile
index d8a1100f8452..74ae890bbc81 100644
--- a/sys/boot/userboot/libstand/Makefile
+++ b/sys/boot/userboot/libstand/Makefile
@@ -1,8 +1,9 @@
# $FreeBSD$
.include <src.opts.mk>
+.include "../Makefile.inc"
-LIBSTAND_SRC= ${.CURDIR}/../../../../lib/libstand
+LIBSTAND_SRC= ${SASRC}
INTERNALLIB=
INCS=
diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile
index 44376b8bad3b..8b2df16016ef 100644
--- a/sys/boot/userboot/userboot/Makefile
+++ b/sys/boot/userboot/userboot/Makefile
@@ -32,7 +32,7 @@ CFLAGS+= -Wall
CFLAGS+= -I${.CURDIR}/..
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../..
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
CFLAGS+= -ffreestanding -I.
CWARNFLAGS.main.c += -Wno-implicit-function-declaration
diff --git a/sys/boot/userboot/zfs/Makefile b/sys/boot/userboot/zfs/Makefile
index 3180b94788b7..c34d15993494 100644
--- a/sys/boot/userboot/zfs/Makefile
+++ b/sys/boot/userboot/zfs/Makefile
@@ -12,7 +12,7 @@ SRCS+= zfs.c skein.c skein_block.c
CFLAGS+= -DSKEIN_LOOP=111
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs
CFLAGS+= -I${.CURDIR}/../../../crypto/skein
diff --git a/sys/boot/zfs/Makefile b/sys/boot/zfs/Makefile
index 9180049becb1..0e7bdcdbac54 100644
--- a/sys/boot/zfs/Makefile
+++ b/sys/boot/zfs/Makefile
@@ -12,7 +12,7 @@ CFLAGS+= -DSKEIN_LOOP=111
CFLAGS+= -DBOOTPROG=\"zfsloader\"
CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../.. -I.
-CFLAGS+= -I${.CURDIR}/../../../lib/libstand
+CFLAGS+= -I${SASRC}
CFLAGS+= -I${.CURDIR}/../../cddl/boot/zfs
CFLAGS+= -I${.CURDIR}/../../crypto/skein