Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Nov 2017 03:01:11 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325376 - head/sys/boot
Message-ID:  <201711040301.vA431BRA001950@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Nov  4 03:01:11 2017
New Revision: 325376
URL: https://svnweb.freebsd.org/changeset/base/325376

Log:
  WIP: centralize machine links

Modified:
  head/sys/boot/defs.mk

Modified: head/sys/boot/defs.mk
==============================================================================
--- head/sys/boot/defs.mk	Sat Nov  4 00:47:21 2017	(r325375)
+++ head/sys/boot/defs.mk	Sat Nov  4 03:01:11 2017	(r325376)
@@ -84,6 +84,40 @@ CFLAGS+= -DLOADER_MBR_SUPPORT
 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes"
 CFLAGS+= -DLOADER_GELI_SUPPORT
 .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) \
+		path=${SYSDIR}/${MACHINE}/include ;; \
+	*) \
+		path=${SYSDIR}/${.TARGET:T}/include ;; \
+	esac ; \
+	path=`(cd $$path && /bin/pwd)` ; \
+	${ECHO} ${.TARGET:T} "->" $$path ; \
+	ln -fhs $$path ${.TARGET:T}
 
 .endif # __BOOT_DEFS_MK__



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711040301.vA431BRA001950>