summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-11-06 15:22:04 +0000
committerWarner Losh <imp@FreeBSD.org>2017-11-06 15:22:04 +0000
commit25f44449ad71bc15dec3be3c395bffa4506805a6 (patch)
tree27b5046b11ee59ba4e2191e89c81538ca4c75e78
parenta766a5008a7e7a9b5f3b46608965ad336a77b634 (diff)
Notes
-rw-r--r--sys/boot/defs.mk39
-rw-r--r--sys/boot/efi/boot1/Makefile15
-rw-r--r--sys/boot/efi/fdt/Makefile7
-rw-r--r--sys/boot/efi/loader/Makefile15
-rw-r--r--sys/boot/ficl.mk13
-rw-r--r--sys/boot/i386/Makefile.inc1
-rw-r--r--sys/boot/i386/boot2/Makefile7
-rw-r--r--sys/boot/i386/gptboot/Makefile7
-rw-r--r--sys/boot/i386/gptzfsboot/Makefile7
-rw-r--r--sys/boot/i386/libfirewire/Makefile11
-rw-r--r--sys/boot/i386/libi386/Makefile10
-rw-r--r--sys/boot/i386/loader/Makefile8
-rw-r--r--sys/boot/i386/zfsboot/Makefile7
-rw-r--r--sys/boot/libsa32/Makefile7
-rw-r--r--sys/boot/ofw/libofw/Makefile7
-rw-r--r--sys/boot/uboot/fdt/Makefile7
-rw-r--r--sys/boot/uboot/lib/Makefile7
-rw-r--r--sys/boot/zfs/Makefile12
18 files changed, 42 insertions, 145 deletions
diff --git a/sys/boot/defs.mk b/sys/boot/defs.mk
index 08daae9c2f801..4fbc83966dc60 100644
--- a/sys/boot/defs.mk
+++ b/sys/boot/defs.mk
@@ -96,4 +96,43 @@ CFLAGS+= -DLOADER_GELI_SUPPORT
CFLAGS+= -m32 -mcpu=powerpc
.endif
+_ILINKS=machine
+.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
+_ILINKS+=${MACHINE_CPUARCH}
+.endif
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+_ILINKS+=x86
+.endif
+CLEANFILES+=${_ILINKS}
+
+all: ${PROG}
+
+beforedepend: ${_ILINKS}
+beforebuild: ${_ILINKS}
+
+# Ensure that the links exist without depending on it when it exists which
+# causes all the modules to be rebuilt when the directory pointed to changes.
+.for _link in ${_ILINKS}
+.if !exists(${.OBJDIR}/${_link})
+${OBJS}: ${_link}
+.endif
+.endfor
+
+.NOPATH: ${_ILINKS}
+
+${_ILINKS}:
+ @case ${.TARGET} in \
+ machine) \
+ if [ ${DO32:U0} -eq 0 ]; then \
+ path=${SYSDIR}/${MACHINE}/include ; \
+ else \
+ path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \
+ fi ;; \
+ *) \
+ path=${SYSDIR}/${.TARGET:T}/include ;; \
+ esac ; \
+ path=`(cd $$path && /bin/pwd)` ; \
+ ${ECHO} ${.TARGET:T} "->" $$path ; \
+ ln -fhs $$path ${.TARGET:T}
+
.endif # __BOOT_DEFS_MK__
diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile
index c6b27d8ade032..8f5aed50dce49 100644
--- a/sys/boot/efi/boot1/Makefile
+++ b/sys/boot/efi/boot1/Makefile
@@ -129,18 +129,3 @@ boot1.efifat: boot1.efi
CLEANFILES= boot1.efi boot1.efifat
.include <bsd.prog.mk>
-
-beforedepend ${OBJS}: machine
-
-CLEANFILES+= machine
-
-machine: .NOMETA
- ln -sf ${SYSDIR}/${MACHINE}/include machine
-
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
-beforedepend ${OBJS}: x86
-CLEANFILES+= x86
-
-x86: .NOMETA
- ln -sf ${SYSDIR}/x86/include x86
-.endif
diff --git a/sys/boot/efi/fdt/Makefile b/sys/boot/efi/fdt/Makefile
index 4a5f164a458f6..01dbeed05eaf4 100644
--- a/sys/boot/efi/fdt/Makefile
+++ b/sys/boot/efi/fdt/Makefile
@@ -27,11 +27,4 @@ CFLAGS+= -I${FDTSRC}
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
-machine: .NOMETA
- ln -sf ${SYSDIR}/${MACHINE}/include machine
-
-CLEANFILES+= machine
-
.include <bsd.lib.mk>
-
-beforedepend ${OBJS}: machine
diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile
index d4eb8d8d55e2b..0c560d554ecbb 100644
--- a/sys/boot/efi/loader/Makefile
+++ b/sys/boot/efi/loader/Makefile
@@ -133,18 +133,3 @@ DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \
LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA}
.include <bsd.prog.mk>
-
-beforedepend ${OBJS}: machine
-
-CLEANFILES+= machine
-
-machine: .NOMETA
- ln -sf ${SYSDIR}/${MACHINE}/include machine
-
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
-beforedepend ${OBJS}: x86
-CLEANFILES+= x86
-
-x86: .NOMETA
- ln -sf ${SYSDIR}/x86/include x86
-.endif
diff --git a/sys/boot/ficl.mk b/sys/boot/ficl.mk
index 3c74e34959797..b6ac8d9096b04 100644
--- a/sys/boot/ficl.mk
+++ b/sys/boot/ficl.mk
@@ -29,16 +29,3 @@ CFLAGS+= -m32 -mcpu=powerpc -I.
CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC}
CFLAGS+= -DBOOT_FORTH
CFLAGS+= -DBF_DICTSIZE=15000
-
-.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1
-.if !exists(machine)
-${SRCS:M*.c:R:S/$/.o/g}: machine
-
-beforedepend ${OBJS}: machine
-.endif
-
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-
-CLEANFILES+= machine
-.endif
diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
index da9489ac9707f..941a8c49ab9b2 100644
--- a/sys/boot/i386/Makefile.inc
+++ b/sys/boot/i386/Makefile.inc
@@ -30,6 +30,7 @@ ACFLAGS+= -m32
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
LD_FLAGS+= -m elf_i386_fbsd
AFLAGS+= --32
+DO32=1
.endif
.include "../Makefile.inc"
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index 506ea37664e40..9f9e5191e133b 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -93,13 +93,6 @@ boot2.h: boot1.out
ORG1=`printf "%d" ${ORG1}` \
REL1=`printf "%d" ${REL1}` > ${.TARGET}
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend boot2.s: machine
-CLEANFILES+= machine
-machine: ${SYSDIR}/i386/include .NOMETA
- ln -sf ${.ALLSRC} ${.TARGET}
-.endif
-
.include <bsd.prog.mk>
# XXX: clang integrated-as doesn't grok .codeNN directives yet
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
index 2b2d2650d43be..9d3048a89c568 100644
--- a/sys/boot/i386/gptboot/Makefile
+++ b/sys/boot/i386/gptboot/Makefile
@@ -76,13 +76,6 @@ gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_
gptboot.o: ${SASRC}/ufsread.c
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend gptboot.o: machine
-CLEANFILES+= machine
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-.endif
-
.include <bsd.prog.mk>
# XXX: clang integrated-as doesn't grok .codeNN directives yet
diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile
index c2da080e39f6b..b9df313dd2912 100644
--- a/sys/boot/i386/gptzfsboot/Makefile
+++ b/sys/boot/i386/gptzfsboot/Makefile
@@ -88,13 +88,6 @@ gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \
zfsboot.o: ${ZFSSRC}/zfsimpl.c
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend zfsboot.o: machine
-CLEANFILES+= machine
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-.endif
-
.include <bsd.prog.mk>
# XXX: clang integrated-as doesn't grok .codeNN directives yet
diff --git a/sys/boot/i386/libfirewire/Makefile b/sys/boot/i386/libfirewire/Makefile
index 758b850a146b2..be906ff946360 100644
--- a/sys/boot/i386/libfirewire/Makefile
+++ b/sys/boot/i386/libfirewire/Makefile
@@ -17,15 +17,4 @@ CFLAGS+= -I${BOOTSRC}/i386/libi386
CFLAGS+= -Wformat -Wall
-.if ${MACHINE_CPUARCH} == "amd64"
-CLEANFILES+= machine
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-.endif
-
.include <bsd.lib.mk>
-
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend ${OBJS}: machine
-.endif
-
diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
index e998d6d6b0b13..20ce255fd50bd 100644
--- a/sys/boot/i386/libi386/Makefile
+++ b/sys/boot/i386/libi386/Makefile
@@ -58,18 +58,8 @@ CFLAGS+= -I${BOOTSRC}/ficl -I${BOOTSRC}/ficl/i386 \
# Handle FreeBSD specific %b and %D printf format specifiers
CFLAGS+= ${FORMAT_EXTENSIONS}
-.if ${MACHINE_CPUARCH} == "amd64"
-CLEANFILES+= machine
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-.endif
-
.include <bsd.lib.mk>
# XXX: clang integrated-as doesn't grok .codeNN directives yet
CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS}
CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS}
-
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend ${OBJS}: machine
-.endif
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index 846de0f085fcc..e588d7996ba64 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -104,12 +104,8 @@ OBJS= ${BTXCRT}
DPADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
LDADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
-.include <bsd.prog.mk>
-
.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend ${OBJS}: machine
-CLEANFILES+= machine
CFLAGS+= -DLOADER_PREFER_AMD64
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
.endif
+
+.include <bsd.prog.mk>
diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
index 2a9804a6f854b..a83bfa960590d 100644
--- a/sys/boot/i386/zfsboot/Makefile
+++ b/sys/boot/i386/zfsboot/Makefile
@@ -87,13 +87,6 @@ zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
SRCS= zfsboot.c
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend zfsboot.o: machine
-CLEANFILES+= machine
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-.endif
-
.include <bsd.prog.mk>
# XXX: clang integrated-as doesn't grok .codeNN directives yet
diff --git a/sys/boot/libsa32/Makefile b/sys/boot/libsa32/Makefile
index d4552fbf50b4d..862f8868beab0 100644
--- a/sys/boot/libsa32/Makefile
+++ b/sys/boot/libsa32/Makefile
@@ -17,10 +17,3 @@ CFLAGS+= -m32 -I.
.PATH: ${SASRC}
.include "${SASRC}/Makefile"
-
-.if ${MACHINE_CPUARCH} == "amd64"
-CLEANFILES+= machine
-beforedepend ${OBJS}: machine
-machine: .NOMETA
- ln -fs ${SYSDIR}/i386/include machine
-.endif
diff --git a/sys/boot/ofw/libofw/Makefile b/sys/boot/ofw/libofw/Makefile
index 0af80aafa54f3..836e2a821d1ab 100644
--- a/sys/boot/ofw/libofw/Makefile
+++ b/sys/boot/ofw/libofw/Makefile
@@ -25,11 +25,4 @@ SRCS+= ppc64_elf_freebsd.c
CFLAGS+= -DDISK_DEBUG
.endif
-machine: .NOMETA
- ln -sf ${SYSDIR}/${MACHINE_CPUARCH}/include machine
-
-CLEANFILES+= machine
-
.include <bsd.lib.mk>
-
-beforedepend ${OBJS}: machine
diff --git a/sys/boot/uboot/fdt/Makefile b/sys/boot/uboot/fdt/Makefile
index 1409e3e4696eb..87bebca5c0d84 100644
--- a/sys/boot/uboot/fdt/Makefile
+++ b/sys/boot/uboot/fdt/Makefile
@@ -21,12 +21,5 @@ CFLAGS+= -I${FDTSRC}
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
-machine: .NOMETA
- ln -sf ${SYSDIR}/${MACHINE_CPUARCH}/include machine
-
-CLEANFILES+= machine
-
.include <bsd.stand.mk>
.include <bsd.lib.mk>
-
-beforedepend ${OBJS}: machine
diff --git a/sys/boot/uboot/lib/Makefile b/sys/boot/uboot/lib/Makefile
index 8fce769c77c81..6b25a415e6cd4 100644
--- a/sys/boot/uboot/lib/Makefile
+++ b/sys/boot/uboot/lib/Makefile
@@ -38,12 +38,5 @@ CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
CFLAGS+= -DDISK_DEBUG
.endif
-machine: .NOMETA
- ln -sf ${SYSDIR}/${MACHINE_CPUARCH}/include machine
-
-CLEANFILES+= machine
-
.include <bsd.stand.mk>
.include <bsd.lib.mk>
-
-beforedepend ${OBJS}: machine
diff --git a/sys/boot/zfs/Makefile b/sys/boot/zfs/Makefile
index d06464354fca6..478e168ef3689 100644
--- a/sys/boot/zfs/Makefile
+++ b/sys/boot/zfs/Makefile
@@ -26,17 +26,5 @@ CFLAGS+= -m32
CFLAGS+= -Wformat -Wall
-.if ${MACHINE_CPUARCH} == "amd64" && defined(DO32)
-CLEANFILES+= machine
-machine: .NOMETA
- ln -sf ${SYSDIR}/i386/include machine
-.endif
-
.include <bsd.stand.mk>
.include <bsd.lib.mk>
-
-.if ${MACHINE_CPUARCH} == "amd64" && defined(DO32)
-.if !exists(machine)
-beforedepend ${OBJS}: machine
-.endif
-.endif