From: York Sun Date: Tue, 30 Jul 2013 22:26:11 +0000 (-0700) Subject: tools/Makefile: Move _GNU_SOURCE to Makefile X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=2db1c3fc673c2ddfa1f8dbb41326d9763ea0ae64;p=u-boot.git tools/Makefile: Move _GNU_SOURCE to Makefile Commit 669dfc2e adds libfdt_env.h to HOSTCPPFLAGS. It causes stdio.h to be included before _GNU_SOURCE is defined in C files. On some old hosts some prototypes are protected by #ifdef __USE_GNU, which is set when _GNU_SOURCE is defined. Signed-off-by: York Sun Acked-by: Simon Glass --- diff --git a/tools/Makefile b/tools/Makefile index 33fad6badb..6d456564a1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -154,6 +154,7 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y)) # # Use native tools and options # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps +# Define _GNU_SOURCE to obtain the getline prototype from stdio.h # HOSTCPPFLAGS = -include $(SRCTREE)/include/libfdt_env.h \ -idirafter $(SRCTREE)/include \ @@ -163,7 +164,8 @@ HOSTCPPFLAGS = -include $(SRCTREE)/include/libfdt_env.h \ -I $(SRCTREE)/tools \ -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \ -DUSE_HOSTCC \ - -D__KERNEL_STRICT_NAMES + -D__KERNEL_STRICT_NAMES \ + -D_GNU_SOURCE all: $(obj).depend $(BINS) $(LOGO-y) subdirs diff --git a/tools/aisimage.c b/tools/aisimage.c index cd89145867..980bf2e1a7 100644 --- a/tools/aisimage.c +++ b/tools/aisimage.c @@ -5,9 +5,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/* Required to obtain the getline prototype from stdio.h */ -#define _GNU_SOURCE - #include "mkimage.h" #include "aisimage.h" #include diff --git a/tools/imximage.c b/tools/imximage.c index c8a9ad578b..cab208b5ac 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -9,9 +9,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/* Required to obtain the getline prototype from stdio.h */ -#define _GNU_SOURCE - #include "mkimage.h" #include #include "imximage.h" diff --git a/tools/kwbimage.c b/tools/kwbimage.c index d08e49892d..1df6b2051e 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -6,9 +6,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/* Required to obtain the getline prototype from stdio.h */ -#define _GNU_SOURCE - #include "mkimage.h" #include #include "kwbimage.h" diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index f685ff2e30..bbd3041e36 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -9,9 +9,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/* We want the GNU version of basename() */ -#define _GNU_SOURCE - #include #include #include diff --git a/tools/omapimage.c b/tools/omapimage.c index d4d77d8858..00853dd741 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -14,9 +14,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/* Required to obtain the getline prototype from stdio.h */ -#define _GNU_SOURCE - #include "mkimage.h" #include #include "omapimage.h" diff --git a/tools/pblimage.c b/tools/pblimage.c index 4542a9c10f..bac5faff98 100644 --- a/tools/pblimage.c +++ b/tools/pblimage.c @@ -3,8 +3,6 @@ * * SPDX-License-Identifier: GPL-2.0+ */ -#define _GNU_SOURCE - #include "mkimage.h" #include #include "pblimage.h" diff --git a/tools/ublimage.c b/tools/ublimage.c index 6495db6d6a..b4ef7f080e 100644 --- a/tools/ublimage.c +++ b/tools/ublimage.c @@ -13,9 +13,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/* Required to obtain the getline prototype from stdio.h */ -#define _GNU_SOURCE - #include "mkimage.h" #include #include "ublimage.h"