Changeset View
Changeset View
Standalone View
Standalone View
share/mk/bsd.endian.mk
| .if ${MACHINE_CPUARCH} == "aarch64" || \ | MACHINE_ARCH_LIST.little = \ | ||||
| ${MACHINE_CPUARCH} == "arm" || \ | aarch64 \ | ||||
| ${MACHINE_ARCH} == "amd64" || \ | amd64 \ | ||||
| ${MACHINE_ARCH} == "i386" || \ | armv7 \ | ||||
| ${MACHINE_ARCH} == "powerpc64le" || \ | i386 \ | ||||
| ${MACHINE_CPUARCH} == "riscv" | powerpc64le \ | ||||
| riscv* | |||||
| MACHINE_ARCH_LIST.big = \ | |||||
| powerpc \ | |||||
| powerpc64 | |||||
| .for e in big little | |||||
| N_$e:= ${MACHINE_ARCH_LIST.$e:${M_ListToSkip}} | |||||
| .endfor | |||||
sjg: I thnk you could simplify this with M_ListToSkip:
`N_$e = ${MACHINE_ARCH_LIST.$e… | |||||
| # 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 | TARGET_ENDIANNESS= 1234 | ||||
Not Done Inline ActionsFWIW I find this sort of construct scales (mentally) far better than a or'd list of conditionals. Here is is quite clear that we are after arches which are little endian. Granted some folk find :M a more natural test than :N but the later as the huge advantage of being cumulative. Testing multiple values using :M is more complicated (see M_ListToMatch in share/mk/local.sys.env.mk) sjg: FWIW I find this sort of construct scales (mentally) far better than a or'd list of… | |||||
| CAP_MKDB_ENDIAN= -l | CAP_MKDB_ENDIAN= -l | ||||
| LOCALEDEF_ENDIAN= -l | LOCALEDEF_ENDIAN= -l | ||||
| .elif ${MACHINE_ARCH} == "powerpc" || \ | .elif ${_ENDIAN_ARCH:${N_big}} == "" | ||||
| ${MACHINE_ARCH} == "powerpc64" | |||||
| TARGET_ENDIANNESS= 4321 | TARGET_ENDIANNESS= 4321 | ||||
| CAP_MKDB_ENDIAN= -b | CAP_MKDB_ENDIAN= -b | ||||
| LOCALEDEF_ENDIAN= -b | LOCALEDEF_ENDIAN= -b | ||||
| .elif ${.MAKE.OS} == "FreeBSD" | |||||
| .error Don't know the endian of this architecture | |||||
| .else | .else | ||||
| # | # | ||||
| # During bootstrapping on !FreeBSD OSes, we need to define some value. Short of | # During bootstrapping on !FreeBSD OSes, we need to define some value. Short of | ||||
| # having an exhaustive list for all variants of Linux and MacOS we simply do not | # having an exhaustive list for all variants of Linux and MacOS we simply do not | ||||
| # set TARGET_ENDIANNESS (on Linux) and poison the other variables. They should | # set TARGET_ENDIANNESS (on Linux) and poison the other variables. They should | ||||
| # be unused during the bootstrap phases (apart from one place that's adequately | # be unused during the bootstrap phases (apart from one place that's adequately | ||||
| # protected in bsd.compiler.mk) where we're building the bootstrap tools. | # protected in bsd.compiler.mk) where we're building the bootstrap tools. | ||||
| # | # | ||||
| .if ${.MAKE.OS} == "Darwin" | .if ${.MAKE.OS} == "Darwin" | ||||
| # We do assume the endianness on macOS because Apple's modern hardware is all | # We do assume the endianness on macOS because Apple's modern hardware is all | ||||
| # little-endian. This might need revisited in the far future, but for the time | # little-endian. This might need revisited in the far future, but for the time | ||||
| # being Apple Silicon's reign of terror continues. We only set this one up | # being Apple Silicon's reign of terror continues. We only set this one up | ||||
| # because libcrypto is now built in bootstrap. | # because libcrypto is now built in bootstrap. | ||||
| TARGET_ENDIANNESS= 1234 | TARGET_ENDIANNESS= 1234 | ||||
| .endif | .endif | ||||
| CAP_MKDB_ENDIAN= -B # Poisoned value, invalid flags for both cap_mkdb | CAP_MKDB_ENDIAN= -B # Poisoned value, invalid flags for both cap_mkdb | ||||
| LOCALEDEF_ENDIAN= -B # and localedef. | LOCALEDEF_ENDIAN= -B # and localedef. | ||||
| .endif | |||||
| .if empty(TARGET_ENDIANNESS) && ${.MAKE.OS} == "FreeBSD" | |||||
| .error Don't know the endianness of this architecture | |||||
Not Done Inline Actionsedianness? or however that would be spelt sjg: edianness? or however that would be spelt | |||||
| .endif | .endif | ||||
I thnk you could simplify this with M_ListToSkip:
N_$e = ${MACHINE_ARCH_LIST.$e:${M_ListToSkip}}
possibly use := too