diff --git a/Makefile b/Makefile index 8e7f106..d16577b 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,16 @@ CC = gcc CFLAGS = -g -O0 -Wall -Wextra -CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L +CFLAGS += -std=c99 $(DEFINES) CFLAGS += -Iinclude/ +DEFINES = -D_POSIX_C_SOURCE=200112L +# Define _BSD_SOURCE, necessary to expose all endian conversions properly. +# See http://linux.die.net/man/3/endian +DEFINES += -D_BSD_SOURCE +# glibc 2.20+ also requires _DEFAULT_SOURCE +DEFINES += -D_DEFAULT_SOURCE + # Tools useful on host and target TOOLS = sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part diff --git a/fel.c b/fel.c index 4932d71..c102345 100644 --- a/fel.c +++ b/fel.c @@ -15,12 +15,6 @@ * along with this program. If not, see . */ -/* Needs _BSD_SOURCE for htole and letoh */ -/* glibc 2.20+ also requires _DEFAULT_SOURCE */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE -#define _NETBSD_SOURCE - #include #include #include diff --git a/phoenix_info.c b/phoenix_info.c index 0529391..07a217e 100644 --- a/phoenix_info.c +++ b/phoenix_info.c @@ -15,11 +15,6 @@ * along with this program. If not, see . */ -/* Needs _BSD_SOURCE for htole and letoh */ -/* glibc 2.20+ also requires _DEFAULT_SOURCE */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include #include #include diff --git a/pio.c b/pio.c index a34c6c5..f545cc4 100644 --- a/pio.c +++ b/pio.c @@ -17,11 +17,6 @@ * MA 02111-1307 USA */ -/* needs _BSD_SOURCE for htole and letoh */ -/* glibc 2.20+ also requires _DEFAULT_SOURCE */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - #include #include #include