Use MACHINE_CPUARCH as appropriate

Define __KLD_SHARED to be yes or no depending on if the target uses shared
binaries for klds or not (this also eliminates 4 uses of MACHINE_ARCH).
This commit is contained in:
imp 2010-09-13 07:16:48 +00:00
parent a05e8d3ea8
commit c517eaecea

View File

@ -81,6 +81,13 @@ OBJCOPY?= objcopy
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
# amd64 and mips use direct linking for kmod, all others use shared binaries
.if ${MACHINE_CPUARCH} != amd64 && ${MACHINE_CPUARCH} != mips
__KLD_SHARED=yes
.else
__KLD_SHARED=no
.endif
.if ${CC:T:Micc} == "icc"
CFLAGS:= ${CFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
.else
@ -128,15 +135,15 @@ CFLAGS+= -fno-common
LDFLAGS+= -d -warn-common
CFLAGS+= ${DEBUG_FLAGS}
.if ${MACHINE_ARCH} == amd64
.if ${MACHINE_CPUARCH} == amd64
CFLAGS+= -fno-omit-frame-pointer
.endif
.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
.if ${MACHINE_CPUARCH} == powerpc
CFLAGS+= -mlongcall -fno-omit-frame-pointer
.endif
.if ${MACHINE_ARCH} == "mips"
.if ${MACHINE_CPUARCH} == mips
CFLAGS+= -G0 -fno-pic -mno-abicalls -mlong-calls
.endif
@ -190,7 +197,7 @@ ${PROG}.symbols: ${FULLPROG}
${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET}
.endif
.if ${MACHINE_ARCH} != amd64 && ${MACHINE_ARCH} != mips
.if ${__KLD_SHARED} == yes
${FULLPROG}: ${KMOD}.kld
${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld
.if !defined(DEBUG_FLAGS)
@ -203,7 +210,7 @@ EXPORT_SYMS?= NO
CLEANFILES+= export_syms
.endif
.if ${MACHINE_ARCH} != amd64 && ${MACHINE_ARCH} != mips
.if ${__KLD_SHARED} == yes
${KMOD}.kld: ${OBJS}
.else
${FULLPROG}: ${OBJS}
@ -223,8 +230,7 @@ ${FULLPROG}: ${OBJS}
export_syms | xargs -J% ${OBJCOPY} % ${.TARGET}
.endif
.endif
.if !defined(DEBUG_FLAGS) && \
(${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == mips)
.if !defined(DEBUG_FLAGS) && ${__KLD_SHARED} == no
${OBJCOPY} --strip-debug ${.TARGET}
.endif