mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: ejo@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 1/2] scripts: define _GNU_SOURCE for every user tool build
Date: Thu, 20 Feb 2025 07:46:11 +0100	[thread overview]
Message-ID: <20250220064612.865757-1-a.fatoum@pengutronix.de> (raw)

Defining _GNU_SOURCE via userccflags (for target tools) and KBUILD_HOSTCFLAGS
(for host tools) works, but needs to be repeated in subdirectories like i.MX
as well. As we make ample use of the asprintf GNU extension anyway, let's just
define it in the top-level makefile for build of all user code.

Fixes: 02a61edc1842 ("scripts: define _GNU_SOURCE for all source files")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Makefile         | 3 ++-
 scripts/Makefile | 4 ----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 5488f9d97251..4e6ac5a10a97 100644
--- a/Makefile
+++ b/Makefile
@@ -399,7 +399,8 @@ HOSTCXX	= g++
 endif
 
 KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
-			      -O2 -fomit-frame-pointer -std=gnu11
+			      -O2 -fomit-frame-pointer -std=gnu11 \
+			      -D_GNU_SOURCE=""
 KBUILD_USERCFLAGS  := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
 KBUILD_USERLDFLAGS := $(USERLDFLAGS)
 
diff --git a/scripts/Makefile b/scripts/Makefile
index bb4e85b0a639..6d89af7d4f35 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -60,10 +60,6 @@ rk-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
 
 userccflags += -I $(srctree)/$(src)/include -isystem $(srctree)/scripts/include
 
-# We need to explicitly set the macro to empty, otherwise it's defined to =1
-userccflags += -D_GNU_SOURCE=""
-KBUILD_HOSTCFLAGS += -D_GNU_SOURCE=""
-
 subdir-y			+= mod
 subdir-y			+= imx
 subdir-$(CONFIG_ARCH_TEGRA)	+= tegra
-- 
2.39.5




             reply	other threads:[~2025-02-20  6:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20  6:46 Ahmad Fatoum [this message]
2025-02-20  6:46 ` [PATCH master 2/2] scripts: common.h: define loff_t on musl Ahmad Fatoum
2025-02-21 10:22 ` [PATCH master 1/2] scripts: define _GNU_SOURCE for every user tool build Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250220064612.865757-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ejo@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox