summaryrefslogtreecommitdiff
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2006-09-07 16:41:30 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2006-09-07 16:41:30 +0000
commite6cb78fbd46311ee603dc5373ff66e9778e7c4f1 (patch)
treeba21535abbc51c5d06c38fb93a33ca77fbfdd9a2 /Makefile.inc1
parentf6c48c1932ee2e9fac92fab351cd390f81d12cfe (diff)
downloadsrc-test2-e6cb78fbd46311ee603dc5373ff66e9778e7c4f1.tar.gz
src-test2-e6cb78fbd46311ee603dc5373ff66e9778e7c4f1.zip
- Rewrite logic to guess TARGET_ARCH/TARGET to be more readable,
but without changes in behavior. - Add sanity checking for TARGET_ARCH/TARGET.
Notes
Notes: svn path=/head/; revision=162113
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc131
1 files changed, 25 insertions, 6 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 84d2f9db24aa..d9d8010d3039 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -11,7 +11,7 @@
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
-# TARGET="arch" to crossbuild world to a different arch
+# TARGET="machine" to crossbuild world for a different machine type
#
# The intended user-driven targets are:
@@ -95,17 +95,36 @@ OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
OSRELDATE= 0
.endif
.endif
-.if defined(TARGET) && !defined(TARGET_ARCH)
-TARGET_ARCH=${TARGET:S/pc98/i386/}
+
+# Guess machine architecture from machine type, and vice versa.
+.if !defined(TARGET_ARCH) && defined(TARGET)
+TARGET_ARCH= ${TARGET:S/pc98/i386/}
+.elif !defined(TARGET) && defined(TARGET_ARCH) && \
+ ${TARGET_ARCH} != ${MACHINE_ARCH}
+TARGET= ${TARGET_ARCH}
.endif
-TARGET_ARCH?= ${MACHINE_ARCH}
-.if ${TARGET_ARCH} == ${MACHINE_ARCH}
+# Otherwise, default to current machine type and architecture.
TARGET?= ${MACHINE}
+TARGET_ARCH?= ${MACHINE_ARCH}
+
+KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 powerpc sparc64
+.if ${TARGET} == ${TARGET_ARCH}
+_t= ${TARGET}
+.else
+_t= ${TARGET_ARCH}/${TARGET}
+.endif
+.for _t in ${_t}
+.if empty(KNOWN_ARCHES:M${_t})
+.error Unknown target ${TARGET_ARCH}:${TARGET}.
+.endif
+.endfor
+
+.if ${TARGET} == ${MACHINE}
TARGET_CPUTYPE?=${CPUTYPE}
.else
-TARGET?= ${TARGET_ARCH}
TARGET_CPUTYPE?=
.endif
+
.if !empty(TARGET_CPUTYPE)
_TARGET_CPUTYPE=${TARGET_CPUTYPE}
.else