fio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile: use override directive on engine CFLAGS
@ 2021-07-06 17:27 Stefan Hajnoczi
  2021-07-07 13:06 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2021-07-06 17:27 UTC (permalink / raw)
  To: fio; +Cc: Jens Axboe, Stefan Hajnoczi, Eric Sandeen

The GNU Make documentation says the following about the override
keyword:

  Subsequent assignments or appends to this variable which are not
  marked override will be ignored.

  https://www.gnu.org/software/make/manual/html_node/Override-Directive.html

When the override CFLAGS line was moved in commit
f4bd2c3d80bc35f76892205a7e50426711e3def3 it broke the engine template,
which does not use the override directive. Since the engine template is
now evaluated afterwards, the engine CFLAGS are ignored.

Add the override keyword to the engine template so that engine CFLAGS
are honored again.

Note that the CONFIG_DYNAMIC_ENGINES case doesn't need the override
directive. It seems that GNU Make assigns CFLAGS even without the
override directive in this case:

  $$($(1)_OBJS): CFLAGS := -fPIC $$($(1)_CFLAGS) $(CFLAGS)

Fixes: f4bd2c3d80bc35f76892205a7e50426711e3def3 ("fix dynamic engine build")
Cc: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index f57569d5..510e07fc 100644
--- a/Makefile
+++ b/Makefile
@@ -293,7 +293,7 @@ else # !CONFIG_DYNAMIC_ENGINES
 define engine_template =
 SOURCE += $$($(1)_SRCS)
 LIBS += $$($(1)_LIBS)
-CFLAGS += $$($(1)_CFLAGS)
+override CFLAGS += $$($(1)_CFLAGS)
 endef
 endif
 
-- 
2.31.1


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

* Re: [PATCH] Makefile: use override directive on engine CFLAGS
  2021-07-06 17:27 [PATCH] Makefile: use override directive on engine CFLAGS Stefan Hajnoczi
@ 2021-07-07 13:06 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-07-07 13:06 UTC (permalink / raw)
  To: Stefan Hajnoczi, fio; +Cc: Eric Sandeen

On 7/6/21 11:27 AM, Stefan Hajnoczi wrote:
> The GNU Make documentation says the following about the override
> keyword:
> 
>   Subsequent assignments or appends to this variable which are not
>   marked override will be ignored.
> 
>   https://www.gnu.org/software/make/manual/html_node/Override-Directive.html
> 
> When the override CFLAGS line was moved in commit
> f4bd2c3d80bc35f76892205a7e50426711e3def3 it broke the engine template,
> which does not use the override directive. Since the engine template is
> now evaluated afterwards, the engine CFLAGS are ignored.
> 
> Add the override keyword to the engine template so that engine CFLAGS
> are honored again.
> 
> Note that the CONFIG_DYNAMIC_ENGINES case doesn't need the override
> directive. It seems that GNU Make assigns CFLAGS even without the
> override directive in this case:
> 
>   $$($(1)_OBJS): CFLAGS := -fPIC $$($(1)_CFLAGS) $(CFLAGS)

Applied, thanks.

-- 
Jens Axboe



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

end of thread, other threads:[~2021-07-07 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 17:27 [PATCH] Makefile: use override directive on engine CFLAGS Stefan Hajnoczi
2021-07-07 13:06 ` Jens Axboe

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).