diff --git a/share/mk/bsd.endian.mk b/share/mk/bsd.endian.mk --- a/share/mk/bsd.endian.mk +++ b/share/mk/bsd.endian.mk @@ -1,21 +1,36 @@ -.if ${MACHINE_CPUARCH} == "aarch64" || \ - ${MACHINE_CPUARCH} == "arm" || \ - ${MACHINE_ARCH} == "amd64" || \ - ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "powerpc64le" || \ - ${MACHINE_CPUARCH} == "riscv" +MACHINE_ARCH_LIST.little = \ + aarch64 \ + amd64 \ + armv[67]* \ + i386 \ + powerpc64le \ + riscv* + +MACHINE_ARCH_LIST.big = \ + powerpc \ + powerpc64 \ + powerpcspe + +.for e in big little +N_$e= ${MACHINE_ARCH_LIST.$e:@m@N$m@:ts:} +.endfor + +# For the host, we need to look at the host architecture +.if ${MACHINE:Nhost*} == "" +_ENDIAN_ARCH=${_HOST_ARCH} +.else +_ENDIAN_ARCH=${MACHINE_ARCH} +.endif + +.if ${_ENDIAN_ARCH:${N_little}} == "" TARGET_ENDIANNESS= 1234 CAP_MKDB_ENDIAN= -l LOCALEDEF_ENDIAN= -l -.elif ${MACHINE_ARCH} == "powerpc" || \ - ${MACHINE_ARCH} == "powerpc64" || \ - ${MACHINE_ARCH} == "powerpcspe" +.elif ${_ENDIAN_ARCH:${N_big}} == "" TARGET_ENDIANNESS= 4321 CAP_MKDB_ENDIAN= -b LOCALEDEF_ENDIAN= -b -.elif ${.MAKE.OS} == "FreeBSD" -.error Don't know the endian of this architecture .else # # During bootstrapping on !FreeBSD OSes, we need to define some value. Short of @@ -27,3 +42,7 @@ CAP_MKDB_ENDIAN= -B # Poisoned value, invalid flags for both cap_mkdb LOCALEDEF_ENDIAN= -B # and localedef. .endif + +.if empty(TARGET_ENDIANNESS) && ${.MAKE.OS} == "FreeBSD" +.error Don't know the endian of this architecture +.endif