summaryrefslogtreecommitdiffstats
path: root/lib/libkvm
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-01-13 19:01:14 +0000
committermarcel <marcel@FreeBSD.org>2014-01-13 19:01:14 +0000
commit29c2e7b72abd02d7f55b845f14d967b0e1a44f36 (patch)
treeb53cfb08a448579a08f567cfec1ed6af4d71bf16 /lib/libkvm
parent82e11f8c24339a03167e01c1bbdcf995d3b91f31 (diff)
downloadFreeBSD-src-29c2e7b72abd02d7f55b845f14d967b0e1a44f36.zip
FreeBSD-src-29c2e7b72abd02d7f55b845f14d967b0e1a44f36.tar.gz
Re-apply the part of r260022 that was reverted by r260030 with
one significant difference: for LIB32 builds both TARGET_ARCH and MACHINE_ARCH are defined. TARGET_ARCH confusingly holds the architecture of the host (e.g. amd64), while MACHINE_ARCH holds the architecture were trying to build (e.g. i386). With both set and different, r260022 changed the behaviour to interpret the condition as building a cross-amd64 libkvm on i386, when obviously we're trying to build an i386 version on amd64. When COMPAT_32BIT is defined, we're building LIB32 and ignore the value of TARGET_ARCH as we did before.
Diffstat (limited to 'lib/libkvm')
-rw-r--r--lib/libkvm/Makefile23
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/libkvm/Makefile b/lib/libkvm/Makefile
index f21a1bf..a50f948 100644
--- a/lib/libkvm/Makefile
+++ b/lib/libkvm/Makefile
@@ -1,23 +1,36 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD$
+.if defined(TARGET_ARCH) && !defined(COMPAT_32BIT)
+KVM_XARCH=${TARGET_ARCH}
+KVM_XCPUARCH=${KVM_XARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
+.else
+KVM_XARCH=${MACHINE_ARCH}
+KVM_XCPUARCH=${MACHINE_CPUARCH}
+.endif
+
+.if ${KVM_XARCH} != ${MACHINE_ARCH}
+LIB= kvm-${KVM_XARCH}
+CFLAGS+=-DCROSS_LIBKVM
+.else
LIB= kvm
+.endif
+
SHLIBDIR?= /lib
SHLIB_MAJOR= 6
CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
-.if exists(${.CURDIR}/kvm_${MACHINE_ARCH}.c)
-KVM_ARCH=${MACHINE_ARCH}
+.if exists(${.CURDIR}/kvm_${KVM_XARCH}.c)
+KVM_ARCH=${KVM_XARCH}
.else
-KVM_ARCH=${MACHINE_CPUARCH}
+KVM_ARCH=${KVM_XCPUARCH}
.endif
WARNS?= 3
SRCS= kvm.c kvm_${KVM_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \
kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
- ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
+.if exists(${.CURDIR}/kvm_minidump_${KVM_ARCH}.c)
SRCS+= kvm_minidump_${KVM_ARCH}.c
.endif
INCS= kvm.h
OpenPOWER on IntegriCloud