Skip to content

Commit 978f626

Browse files
committed
perf tools: Don't try to build python bindings if Python.h not available
Just leverage the test done for python support in 'python script', emitting a warning about losing those features if python-dev[el] is not installed. Reported-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 0015e2e commit 978f626

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎tools/perf/Makefile‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,14 @@ PROGRAMS += $(EXTRA_PROGRAMS)
348348
#
349349
PROGRAMS += $(OUTPUT)perf
350350

351-
LANG_BINDINGS = $(OUTPUT)python/perf.so
351+
LANG_BINDINGS =
352352

353353
# List built-in command $C whose implementation cmd_$C() is not in
354354
# builtin-$C.o but is linked in as part of some other command.
355355
#
356356

357357
# what 'all' will build and 'install' will install, in perfexecdir
358-
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) $(LANG_BINDINGS)
358+
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
359359

360360
# what 'all' will build but not install in perfexecdir
361361
OTHER_PROGRAMS = $(OUTPUT)perf$X
@@ -664,12 +664,14 @@ else
664664
PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null`
665665
FLAGS_PYTHON_EMBED=$(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
666666
ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y)
667+
msg := $(warning No Python.h found, install python-dev[el] to have python support in 'perf script' and to build the python bindings)
667668
BASIC_CFLAGS += -DNO_LIBPYTHON
668669
else
669670
ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
670671
EXTLIBS += $(PYTHON_EMBED_LIBADD)
671672
LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
672673
LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
674+
LANG_BINDINGS += $(OUTPUT)python/perf.so
673675
endif
674676
endif
675677

@@ -956,7 +958,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
956958

957959
SHELL = $(SHELL_PATH)
958960

959-
all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) $(OUTPUT)PERF-BUILD-OPTIONS
961+
all:: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(BUILT_INS) $(OTHER_PROGRAMS) $(OUTPUT)PERF-BUILD-OPTIONS
960962
ifneq (,$X)
961963
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
962964
endif

0 commit comments

Comments
 (0)