perf python: Make sure the python binding output directory is in place
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 3 Jan 2019 19:03:46 +0000 (16:03 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 4 Jan 2019 15:55:24 +0000 (12:55 -0300)
Instead of doing an unconditional mkdir, use a dummy Makefile variable
to check if the directory is there and if not, create it.

This is better than what we had and will help with other python bindings
that are in development, like one involved with python backtraces.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-iis6us2nocw3y4uuoon9osd7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.perf

index ff29c33..2921f82 100644 (file)
@@ -524,12 +524,14 @@ $(arch_errno_name_array): $(arch_errno_tbl)
 
 all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 
+# Create python binding output directory if not already present
+_dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
+
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
        $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
          $(PYTHON_WORD) util/setup.py \
          --quiet build_ext; \
-       mkdir -p $(OUTPUT)python && \
        cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
 
 please_set_SHELL_PATH_to_a_more_modern_shell: