linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: Allow building with GNU Make 4.4
@ 2022-12-26 16:49 Michal Sojka
  2023-01-02  8:52 ` Daniel Wagner
  2023-01-04  4:09 ` Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Sojka @ 2022-12-26 16:49 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Daniel Wagner, Jan Engelhardt, Michal Sojka

Make 4.4 introduces several backward incompatibilities and the result
is that building trace-cmd with it never finishes. It seems that make
ends up in some kind of infinite recursion. The symptoms are:

    $ make -d
    GNU Make 4.4
    Built for x86_64-pc-linux-gnu
    Copyright (C) 1988-2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Reading makefiles...
    Reading makefile 'Makefile'...
    Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
    Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
    Makefile:224: not recursively expanding LIBTRACECMD_SHARED_VERSION to export to shell function
    Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
    Makefile:224: not recursively expanding LIBTRACECMD_SHARED_VERSION to export to shell function
    Makefile:225: not recursively expanding LIBTRACECMD_SHARED_SO to export to shell function
    Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
    Makefile:79: not recursively expanding pkgconfig_dir to export to shell function

Build succeeds if recursively expanded variables (defined with '='),
which use $(shell ...) as its value, are replaced with simply expanded
variables (defined with ':=').

Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
---
 Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index bda49dd..d50e625 100644
--- a/Makefile
+++ b/Makefile
@@ -221,8 +221,8 @@ LIBS ?= -ldl
 LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
 LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
 LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so.$(LIBTRACECMD_VERSION)
-LIBTRACECMD_SHARED_VERSION = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
-LIBTRACECMD_SHARED_SO = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
+LIBTRACECMD_SHARED_VERSION := $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
+LIBTRACECMD_SHARED_SO := $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
 
 export LIBTRACECMD_STATIC LIBTRACECMD_SHARED
 export LIBTRACECMD_SHARED_VERSION LIBTRACECMD_SHARED_SO
@@ -230,12 +230,12 @@ export LIBTRACECMD_SHARED_VERSION LIBTRACECMD_SHARED_SO
 LIBTRACEEVENT=libtraceevent
 LIBTRACEFS=libtracefs
 
-TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
-TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) $(LIBTRACEFS) > /dev/null 2>&1 && echo y")
+TEST_LIBTRACEEVENT := $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
+TEST_LIBTRACEFS := $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) $(LIBTRACEFS) > /dev/null 2>&1 && echo y")
 
 ifeq ("$(TEST_LIBTRACEEVENT)", "y")
-LIBTRACEEVENT_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
-LIBTRACEEVENT_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
+LIBTRACEEVENT_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
+LIBTRACEEVENT_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
 else
 .PHONY: warning
 warning:
@@ -253,8 +253,8 @@ endif
 export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS
 
 ifeq ("$(TEST_LIBTRACEFS)", "y")
-LIBTRACEFS_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS)")
-LIBTRACEFS_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEFS)")
+LIBTRACEFS_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS)")
+LIBTRACEFS_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEFS)")
 else
 .PHONY: warning
 warning:
@@ -324,11 +324,11 @@ endif
 export ZLIB_LDLAGS
 
 ifndef NO_LIBZSTD
-TEST_LIBZSTD = $(shell sh -c "$(PKG_CONFIG) --atleast-version 1.4.0 libzstd > /dev/null 2>&1 && echo y")
+TEST_LIBZSTD := $(shell sh -c "$(PKG_CONFIG) --atleast-version 1.4.0 libzstd > /dev/null 2>&1 && echo y")
 
 ifeq ("$(TEST_LIBZSTD)", "y")
-LIBZSTD_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags libzstd")
-LIBZSTD_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs libzstd")
+LIBZSTD_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags libzstd")
+LIBZSTD_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs libzstd")
 CFLAGS += -DHAVE_ZSTD
 ZSTD_INSTALLED=1
 $(info    Have ZSTD compression support)
-- 
2.38.1


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

* Re: [PATCH] trace-cmd: Allow building with GNU Make 4.4
  2022-12-26 16:49 [PATCH] trace-cmd: Allow building with GNU Make 4.4 Michal Sojka
@ 2023-01-02  8:52 ` Daniel Wagner
  2023-01-04  4:09 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Wagner @ 2023-01-02  8:52 UTC (permalink / raw)
  To: Michal Sojka; +Cc: linux-trace-devel, Jan Engelhardt

Hi Michal,

On Mon, Dec 26, 2022 at 05:49:51PM +0100, Michal Sojka wrote:
> Make 4.4 introduces several backward incompatibilities and the result
> is that building trace-cmd with it never finishes. It seems that make
> ends up in some kind of infinite recursion. The symptoms are:
> 
>     $ make -d
>     GNU Make 4.4
>     Built for x86_64-pc-linux-gnu
>     Copyright (C) 1988-2022 Free Software Foundation, Inc.
>     License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
>     This is free software: you are free to change and redistribute it.
>     There is NO WARRANTY, to the extent permitted by law.
>     Reading makefiles...
>     Reading makefile 'Makefile'...
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:224: not recursively expanding LIBTRACECMD_SHARED_VERSION to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:224: not recursively expanding LIBTRACECMD_SHARED_VERSION to export to shell function
>     Makefile:225: not recursively expanding LIBTRACECMD_SHARED_SO to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
> 
> Build succeeds if recursively expanded variables (defined with '='),
> which use $(shell ...) as its value, are replaced with simply expanded
> variables (defined with ':=').
> 
> Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>

This seems to address my make troubles. I am again able to build trace-cmd with make v4.4. Thanks!

Tested-by: Daniel Wagner <dwagner@suse.de>

> ---
>  Makefile | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index bda49dd..d50e625 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -221,8 +221,8 @@ LIBS ?= -ldl
>  LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
>  LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
>  LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so.$(LIBTRACECMD_VERSION)
> -LIBTRACECMD_SHARED_VERSION = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
> -LIBTRACECMD_SHARED_SO = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
> +LIBTRACECMD_SHARED_VERSION := $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
> +LIBTRACECMD_SHARED_SO := $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
>  
>  export LIBTRACECMD_STATIC LIBTRACECMD_SHARED
>  export LIBTRACECMD_SHARED_VERSION LIBTRACECMD_SHARED_SO
> @@ -230,12 +230,12 @@ export LIBTRACECMD_SHARED_VERSION LIBTRACECMD_SHARED_SO
>  LIBTRACEEVENT=libtraceevent
>  LIBTRACEFS=libtracefs
>  
> -TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
> -TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) $(LIBTRACEFS) > /dev/null 2>&1 && echo y")
> +TEST_LIBTRACEEVENT := $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
> +TEST_LIBTRACEFS := $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) $(LIBTRACEFS) > /dev/null 2>&1 && echo y")
>  
>  ifeq ("$(TEST_LIBTRACEEVENT)", "y")
> -LIBTRACEEVENT_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
> -LIBTRACEEVENT_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
> +LIBTRACEEVENT_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
> +LIBTRACEEVENT_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
>  else
>  .PHONY: warning
>  warning:
> @@ -253,8 +253,8 @@ endif
>  export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS
>  
>  ifeq ("$(TEST_LIBTRACEFS)", "y")
> -LIBTRACEFS_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS)")
> -LIBTRACEFS_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEFS)")
> +LIBTRACEFS_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS)")
> +LIBTRACEFS_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEFS)")
>  else
>  .PHONY: warning
>  warning:
> @@ -324,11 +324,11 @@ endif
>  export ZLIB_LDLAGS
>  
>  ifndef NO_LIBZSTD
> -TEST_LIBZSTD = $(shell sh -c "$(PKG_CONFIG) --atleast-version 1.4.0 libzstd > /dev/null 2>&1 && echo y")
> +TEST_LIBZSTD := $(shell sh -c "$(PKG_CONFIG) --atleast-version 1.4.0 libzstd > /dev/null 2>&1 && echo y")
>  
>  ifeq ("$(TEST_LIBZSTD)", "y")
> -LIBZSTD_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags libzstd")
> -LIBZSTD_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs libzstd")
> +LIBZSTD_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags libzstd")
> +LIBZSTD_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs libzstd")
>  CFLAGS += -DHAVE_ZSTD
>  ZSTD_INSTALLED=1
>  $(info    Have ZSTD compression support)
> -- 
> 2.38.1
> 

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

* Re: [PATCH] trace-cmd: Allow building with GNU Make 4.4
  2022-12-26 16:49 [PATCH] trace-cmd: Allow building with GNU Make 4.4 Michal Sojka
  2023-01-02  8:52 ` Daniel Wagner
@ 2023-01-04  4:09 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2023-01-04  4:09 UTC (permalink / raw)
  To: Michal Sojka; +Cc: linux-trace-devel, Daniel Wagner, Jan Engelhardt

On Mon, 26 Dec 2022 17:49:51 +0100
Michal Sojka <michal.sojka@cvut.cz> wrote:

> Make 4.4 introduces several backward incompatibilities and the result
> is that building trace-cmd with it never finishes. It seems that make
> ends up in some kind of infinite recursion. The symptoms are:
> 
>     $ make -d
>     GNU Make 4.4
>     Built for x86_64-pc-linux-gnu
>     Copyright (C) 1988-2022 Free Software Foundation, Inc.
>     License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
>     This is free software: you are free to change and redistribute it.
>     There is NO WARRANTY, to the extent permitted by law.
>     Reading makefiles...
>     Reading makefile 'Makefile'...
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:224: not recursively expanding LIBTRACECMD_SHARED_VERSION to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:224: not recursively expanding LIBTRACECMD_SHARED_VERSION to export to shell function
>     Makefile:225: not recursively expanding LIBTRACECMD_SHARED_SO to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
>     Makefile:79: not recursively expanding pkgconfig_dir to export to shell function
> 
> Build succeeds if recursively expanded variables (defined with '='),
> which use $(shell ...) as its value, are replaced with simply expanded
> variables (defined with ':=').
> 
> Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
> ---

Applied. Thanks Michal!

-- Steve

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

end of thread, other threads:[~2023-01-04  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 16:49 [PATCH] trace-cmd: Allow building with GNU Make 4.4 Michal Sojka
2023-01-02  8:52 ` Daniel Wagner
2023-01-04  4:09 ` Steven Rostedt

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