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