linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc-utils: support overriding CFLAGS without setting -DVERSION
@ 2023-05-26  8:11 Ahmad Fatoum
  2023-05-26 13:07 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-05-26  8:11 UTC (permalink / raw)
  To: Avri Altman, Ulf Hansson; +Cc: kernel, linux-mmc, Ahmad Fatoum

Build tools like OpenEmbedded set the CFLAGS environment variable to be
in line with distro-wide decisions. Updating OpenEmbedded-core to point
at the new mmc-utils breaks, because VERSION would then be undefined.

Instead of having users workaround this by feeding in -DVERSION from
the outside, let's just move it out of environment-overridable CFLAGS
and into AM_CFLAGS instead.

This will inconvenience users that set their own VERSION a bit: The
Makefile sets -Werror and specifying -DVERSION twice will trigger it
because of the duplicate definition. This can be resolved by specifying
-UVERSION first. Given that the VERSION macro has only been there for a
month, this is deemed acceptable.

Fixes: 145c74ab6f2e ("mmc-utils: Change version string to git hash")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d8d59a4047fd..10b78ab5d7dd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
 CC ?= gcc
 GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
-AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
-CFLAGS ?= -g -O2 -DVERSION=\"$(GIT_VERSION)\"
+AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 \
+	    -DVERSION=\"$(GIT_VERSION)\"
+CFLAGS ?= -g -O2
 objects = \
 	mmc.o \
 	mmc_cmds.o \
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc-utils: support overriding CFLAGS without setting -DVERSION
  2023-05-26  8:11 [PATCH] mmc-utils: support overriding CFLAGS without setting -DVERSION Ahmad Fatoum
@ 2023-05-26 13:07 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2023-05-26 13:07 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Avri Altman, kernel, linux-mmc

On Fri, 26 May 2023 at 10:11, Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> Build tools like OpenEmbedded set the CFLAGS environment variable to be
> in line with distro-wide decisions. Updating OpenEmbedded-core to point
> at the new mmc-utils breaks, because VERSION would then be undefined.
>
> Instead of having users workaround this by feeding in -DVERSION from
> the outside, let's just move it out of environment-overridable CFLAGS
> and into AM_CFLAGS instead.
>
> This will inconvenience users that set their own VERSION a bit: The
> Makefile sets -Werror and specifying -DVERSION twice will trigger it
> because of the duplicate definition. This can be resolved by specifying
> -UVERSION first. Given that the VERSION macro has only been there for a
> month, this is deemed acceptable.
>
> Fixes: 145c74ab6f2e ("mmc-utils: Change version string to git hash")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Applied to git.kernel.org/pub/scm/utils/mmc/mmc-utils.git master, thanks!

Kind regards
Uffe

> ---
>  Makefile | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d8d59a4047fd..10b78ab5d7dd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,7 +1,8 @@
>  CC ?= gcc
>  GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
> -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
> -CFLAGS ?= -g -O2 -DVERSION=\"$(GIT_VERSION)\"
> +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 \
> +           -DVERSION=\"$(GIT_VERSION)\"
> +CFLAGS ?= -g -O2
>  objects = \
>         mmc.o \
>         mmc_cmds.o \
> --
> 2.39.2
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-26 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  8:11 [PATCH] mmc-utils: support overriding CFLAGS without setting -DVERSION Ahmad Fatoum
2023-05-26 13:07 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).