trace-cmd: Only add udis86 CFLAGS and LDFLAGS if it is found
[ Patrick, I don't have udis86 on my machines, can you test to see if
this will include it if you do not set NO_UDIS86? ]
As we need to update both LDFLAGS and CFLAGS, move the test to see if udisc86 is installed to a variable, and then set NO_UDIS86 if it is not found. This way we do not need to test if it exists twice, nor have LDFLAGS set unconditionally.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277
---
Makefile +6 -1
@@ -136,9 +136,14 @@ export NO_PYTHON test-build = $(if $(shell sh -c 'echo "$(1)" | \ $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2) +UDIS86_AVAILABLE := $(call test-build,\#include <udis86.h>, y) +ifneq ($(UDIS86_AVAILABLE), y) +NO_UDIS86 := 1 +endif + ifndef NO_UDIS86 # have udis86 disassembler library? -udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86) +udis86-flags := -DHAVE_UDIS86 -ludis86 udis86-ldflags := -ludis86 endif # NO_UDIS86
Quoted 18 lines · On Wed, 24 Jul 2019 15:13:49 -0400 Steven Rostedt <[email protected]> wrote:
[ Patrick, I don't have udis86 on my machines, can you test to see if
this will include it if you do not setNO_UDIS86? ]As we need to update both LDFLAGS and CFLAGS, move the test to see if udisc86 is installed to a variable, and then set
NO_UDIS86if it is not found. This way we do not need to test if it exists twice, nor have LDFLAGS set unconditionally.Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204277
Reported-by [email protected]Signed-off-by Steven Rostedt (VMware) <[email protected]>---
Makefile +0
-0
Makefile export NO_PYTHON · line 140
Quoted 5 lines
Makefile +2
-0@@ -136,9 +136,14 @@ export NO_PYTHON test-build = $(if $(shell sh -c 'echo "$(1)" | \ $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2) +UDIS86_AVAILABLE := $(call test-build,\#include <udis86.h>, y) +ifneq ($(UDIS86_AVAILABLE), y)
The value of UDIS86_AVAILABLE ends up having whitespace, so this line always fails. If you change it to the line below, it works. ifneq ($(strip $(UDIS86_AVAILABLE)), y)
Quoted 10 lines
Makefile +3
-2+NO_UDIS86 := 1 +endif + ifndef NO_UDIS86 # have udis86 disassembler library? -udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86) +udis86-flags := -DHAVE_UDIS86 -ludis86 udis86-ldflags := -ludis86 endif # NO_UDIS86