diff options
-rw-r--r-- | adk/include/endian.h | 40 | ||||
-rw-r--r-- | mk/kernel-vars.mk | 2 |
2 files changed, 41 insertions, 1 deletions
diff --git a/adk/include/endian.h b/adk/include/endian.h new file mode 100644 index 000000000..bba70abd8 --- /dev/null +++ b/adk/include/endian.h @@ -0,0 +1,40 @@ +#ifndef __endian_compat_h +#define __endian_compat_h + +#if defined(__linux__) || defined(__CYGWIN__) +#include <byteswap.h> +#include_next <endian.h> +#elif defined(__APPLE__) +#include <machine/endian.h> +#include <machine/byte_order.h> +#define bswap_16(x) NXSwapShort(x) +#define bswap_32(x) NXSwapInt(x) +#define bswap_64(x) NXSwapLongLong(x) +#elif defined(__FreeBSD__) +#include <sys/endian.h> +#define bswap_16(x) bswap16(x) +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) +#elif defined(__OpenBSD__) +#include <sys/types.h> +#define bswap_16(x) __swap16(x) +#define bswap_32(x) __swap32(x) +#define bswap_64(x) __swap64(x) +#else +#include <machine/endian.h> +#define bswap_16(x) swap16(x) +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) +#endif + +#ifndef __BYTE_ORDER +#define __BYTE_ORDER BYTE_ORDER +#endif +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN BIG_ENDIAN +#endif +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#endif + +#endif diff --git a/mk/kernel-vars.mk b/mk/kernel-vars.mk index addd7ab4b..17227afed 100644 --- a/mk/kernel-vars.mk +++ b/mk/kernel-vars.mk @@ -18,7 +18,7 @@ endif # non-Linux platforms need elf.h ifneq ($(OS_FOR_BUILD),Linux) KERNEL_MAKE_OPTS+= HOSTCFLAGS='$(HOST_CPPFLAGS) ${HOST_CFLAGS}' -KERNEL_MAKE_OPTS+= HOST_EXTRACFLAGS='-I${ADK_TOPDIR}/adk/include -DKBUILD_NO_NLS' +KERNEL_MAKE_OPTS+= HOST_EXTRACFLAGS='-I${LINUX_DIR}/tools/include -I${ADK_TOPDIR}/adk/include -DKBUILD_NO_NLS' else KERNEL_MAKE_OPTS+= HOSTCFLAGS='${HOST_CFLAGS}' endif |