Commit 2db1c3fc673c2ddfa1f8dbb41326d9763ea0ae64

Authored by York Sun
Committed by Tom Rini
1 parent 1fd1e2f69f

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 <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 8 changed files with 3 additions and 21 deletions Side-by-side Diff

... ... @@ -154,6 +154,7 @@
154 154 #
155 155 # Use native tools and options
156 156 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
  157 +# Define _GNU_SOURCE to obtain the getline prototype from stdio.h
157 158 #
158 159 HOSTCPPFLAGS = -include $(SRCTREE)/include/libfdt_env.h \
159 160 -idirafter $(SRCTREE)/include \
... ... @@ -163,7 +164,8 @@
163 164 -I $(SRCTREE)/tools \
164 165 -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \
165 166 -DUSE_HOSTCC \
166   - -D__KERNEL_STRICT_NAMES
  167 + -D__KERNEL_STRICT_NAMES \
  168 + -D_GNU_SOURCE
167 169  
168 170  
169 171 all: $(obj).depend $(BINS) $(LOGO-y) subdirs
... ... @@ -5,9 +5,6 @@
5 5 * SPDX-License-Identifier: GPL-2.0+
6 6 */
7 7  
8   -/* Required to obtain the getline prototype from stdio.h */
9   -#define _GNU_SOURCE
10   -
11 8 #include "mkimage.h"
12 9 #include "aisimage.h"
13 10 #include <image.h>
... ... @@ -9,9 +9,6 @@
9 9 * SPDX-License-Identifier: GPL-2.0+
10 10 */
11 11  
12   -/* Required to obtain the getline prototype from stdio.h */
13   -#define _GNU_SOURCE
14   -
15 12 #include "mkimage.h"
16 13 #include <image.h>
17 14 #include "imximage.h"
... ... @@ -6,9 +6,6 @@
6 6 * SPDX-License-Identifier: GPL-2.0+
7 7 */
8 8  
9   -/* Required to obtain the getline prototype from stdio.h */
10   -#define _GNU_SOURCE
11   -
12 9 #include "mkimage.h"
13 10 #include <image.h>
14 11 #include "kwbimage.h"
... ... @@ -9,9 +9,6 @@
9 9 * SPDX-License-Identifier: GPL-2.0+
10 10 */
11 11  
12   -/* We want the GNU version of basename() */
13   -#define _GNU_SOURCE
14   -
15 12 #include <errno.h>
16 13 #include <fcntl.h>
17 14 #include <stdio.h>
... ... @@ -14,9 +14,6 @@
14 14 * SPDX-License-Identifier: GPL-2.0+
15 15 */
16 16  
17   -/* Required to obtain the getline prototype from stdio.h */
18   -#define _GNU_SOURCE
19   -
20 17 #include "mkimage.h"
21 18 #include <image.h>
22 19 #include "omapimage.h"
... ... @@ -3,8 +3,6 @@
3 3 *
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
6   -#define _GNU_SOURCE
7   -
8 6 #include "mkimage.h"
9 7 #include <image.h>
10 8 #include "pblimage.h"
... ... @@ -13,9 +13,6 @@
13 13 * SPDX-License-Identifier: GPL-2.0+
14 14 */
15 15  
16   -/* Required to obtain the getline prototype from stdio.h */
17   -#define _GNU_SOURCE
18   -
19 16 #include "mkimage.h"
20 17 #include <image.h>
21 18 #include "ublimage.h"