Move machine and other link creation to defs.mk
Steal the code from kmod.mk and use it to automatically create links. Modify it a little for the needs of the loader (no need to guess the OBJS dependency, and we have 32-on-64 cases to contend with). Remove 15 redundant implementations (which were mostly different, but kinda the same). A future commit should factor out this code and that of kmod.mk so we have only one copy of it in the tree. Sposnored by: Netflix
This commit is contained in:
parent
a766a5008a
commit
25f44449ad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325482
@ -96,4 +96,43 @@ CFLAGS+= -DLOADER_GELI_SUPPORT
|
|||||||
CFLAGS+= -m32 -mcpu=powerpc
|
CFLAGS+= -m32 -mcpu=powerpc
|
||||||
.endif
|
.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__
|
.endif # __BOOT_DEFS_MK__
|
||||||
|
@ -129,18 +129,3 @@ boot1.efifat: boot1.efi
|
|||||||
CLEANFILES= boot1.efi boot1.efifat
|
CLEANFILES= boot1.efi boot1.efifat
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.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
|
|
||||||
|
@ -27,11 +27,4 @@ CFLAGS+= -I${FDTSRC}
|
|||||||
# Pick up the bootstrap header for some interface items
|
# Pick up the bootstrap header for some interface items
|
||||||
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
|
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
|
||||||
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/${MACHINE}/include machine
|
|
||||||
|
|
||||||
CLEANFILES+= machine
|
|
||||||
|
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
|
@ -133,18 +133,3 @@ DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \
|
|||||||
LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA}
|
LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA}
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.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
|
|
||||||
|
@ -29,16 +29,3 @@ CFLAGS+= -m32 -mcpu=powerpc -I.
|
|||||||
CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC}
|
CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC}
|
||||||
CFLAGS+= -DBOOT_FORTH
|
CFLAGS+= -DBOOT_FORTH
|
||||||
CFLAGS+= -DBF_DICTSIZE=15000
|
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
|
|
||||||
|
@ -30,6 +30,7 @@ ACFLAGS+= -m32
|
|||||||
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
|
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
|
||||||
LD_FLAGS+= -m elf_i386_fbsd
|
LD_FLAGS+= -m elf_i386_fbsd
|
||||||
AFLAGS+= --32
|
AFLAGS+= --32
|
||||||
|
DO32=1
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.include "../Makefile.inc"
|
.include "../Makefile.inc"
|
||||||
|
@ -93,13 +93,6 @@ boot2.h: boot1.out
|
|||||||
ORG1=`printf "%d" ${ORG1}` \
|
ORG1=`printf "%d" ${ORG1}` \
|
||||||
REL1=`printf "%d" ${REL1}` > ${.TARGET}
|
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>
|
.include <bsd.prog.mk>
|
||||||
|
|
||||||
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
||||||
|
@ -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
|
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>
|
.include <bsd.prog.mk>
|
||||||
|
|
||||||
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
||||||
|
@ -88,13 +88,6 @@ gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \
|
|||||||
|
|
||||||
zfsboot.o: ${ZFSSRC}/zfsimpl.c
|
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>
|
.include <bsd.prog.mk>
|
||||||
|
|
||||||
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
||||||
|
@ -17,15 +17,4 @@ CFLAGS+= -I${BOOTSRC}/i386/libi386
|
|||||||
|
|
||||||
CFLAGS+= -Wformat -Wall
|
CFLAGS+= -Wformat -Wall
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64"
|
|
||||||
CLEANFILES+= machine
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/i386/include machine
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64"
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
.endif
|
|
||||||
|
|
||||||
|
@ -58,18 +58,8 @@ CFLAGS+= -I${BOOTSRC}/ficl -I${BOOTSRC}/ficl/i386 \
|
|||||||
# Handle FreeBSD specific %b and %D printf format specifiers
|
# Handle FreeBSD specific %b and %D printf format specifiers
|
||||||
CFLAGS+= ${FORMAT_EXTENSIONS}
|
CFLAGS+= ${FORMAT_EXTENSIONS}
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64"
|
|
||||||
CLEANFILES+= machine
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/i386/include machine
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
||||||
CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS}
|
CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS}
|
||||||
CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS}
|
CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS}
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64"
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
.endif
|
|
||||||
|
@ -104,12 +104,8 @@ OBJS= ${BTXCRT}
|
|||||||
DPADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
|
DPADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
|
||||||
LDADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
|
LDADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64"
|
.if ${MACHINE_CPUARCH} == "amd64"
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
CLEANFILES+= machine
|
|
||||||
CFLAGS+= -DLOADER_PREFER_AMD64
|
CFLAGS+= -DLOADER_PREFER_AMD64
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/i386/include machine
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.include <bsd.prog.mk>
|
||||||
|
@ -87,13 +87,6 @@ zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
|
|||||||
|
|
||||||
SRCS= zfsboot.c
|
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>
|
.include <bsd.prog.mk>
|
||||||
|
|
||||||
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
||||||
|
@ -17,10 +17,3 @@ CFLAGS+= -m32 -I.
|
|||||||
|
|
||||||
.PATH: ${SASRC}
|
.PATH: ${SASRC}
|
||||||
.include "${SASRC}/Makefile"
|
.include "${SASRC}/Makefile"
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64"
|
|
||||||
CLEANFILES+= machine
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -fs ${SYSDIR}/i386/include machine
|
|
||||||
.endif
|
|
||||||
|
@ -25,11 +25,4 @@ SRCS+= ppc64_elf_freebsd.c
|
|||||||
CFLAGS+= -DDISK_DEBUG
|
CFLAGS+= -DDISK_DEBUG
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/${MACHINE_CPUARCH}/include machine
|
|
||||||
|
|
||||||
CLEANFILES+= machine
|
|
||||||
|
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
|
@ -21,12 +21,5 @@ CFLAGS+= -I${FDTSRC}
|
|||||||
# Pick up the bootstrap header for some interface items
|
# Pick up the bootstrap header for some interface items
|
||||||
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
|
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
|
||||||
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/${MACHINE_CPUARCH}/include machine
|
|
||||||
|
|
||||||
CLEANFILES+= machine
|
|
||||||
|
|
||||||
.include <bsd.stand.mk>
|
.include <bsd.stand.mk>
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
|
@ -38,12 +38,5 @@ CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
|
|||||||
CFLAGS+= -DDISK_DEBUG
|
CFLAGS+= -DDISK_DEBUG
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
machine: .NOMETA
|
|
||||||
ln -sf ${SYSDIR}/${MACHINE_CPUARCH}/include machine
|
|
||||||
|
|
||||||
CLEANFILES+= machine
|
|
||||||
|
|
||||||
.include <bsd.stand.mk>
|
.include <bsd.stand.mk>
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
|
@ -26,17 +26,5 @@ CFLAGS+= -m32
|
|||||||
|
|
||||||
CFLAGS+= -Wformat -Wall
|
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.stand.mk>
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
.if ${MACHINE_CPUARCH} == "amd64" && defined(DO32)
|
|
||||||
.if !exists(machine)
|
|
||||||
beforedepend ${OBJS}: machine
|
|
||||||
.endif
|
|
||||||
.endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user