xref: /netbsd-src/share/mk/bsd.endian.mk (revision d710132b4b8ce7f7cccaaf660cb16aa16b4077a0)
1#	$NetBSD: bsd.endian.mk,v 1.4 2003/05/18 08:19:03 lukem Exp $
2
3.ifndef TARGET_ENDIANNESS
4
5.include <bsd.init.mk>
6
7# find out endianness of target and set proper flag for pwd_mkdb and such,
8# so that it creates database in same endianness.
9.if exists(${DESTDIR}/usr/include/sys/endian.h)
10TARGET_ENDIANNESS!= \
11	printf '\#include <sys/endian.h>\n_BYTE_ORDER\n' | \
12	${CC} -nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -E - | \
13	tail -1 | awk '{print $$1}'
14.else
15TARGET_ENDIANNESS=
16.endif
17
18#.if ${TARGET_ENDIANNESS} == "1234"
19#TARGET_ENDIANNESS=	little
20#.elif ${TARGET_ENDIANNESS} == "4321"
21#TARGET_ENDIANNESS=	big
22#.else
23#TARGET_ENDIANNESS=	unknown
24#.endif
25
26.endif	# TARGET_ENDIANNESS
27