Commit 47f9bccc authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

libperf: Add build version support

Add a shared library version, generating the following files:

  $ ll tools/perf/lib/libperf.so*
  libperf.so -> libperf.so.0.0.1
  libperf.so.0 -> libperf.so.0.0.1
  libperf.so.0.0.1

Committer testing:

One has to build just libbperf to get this, building perf so far doesn't
trigger this, i.e. I tried:

  $ make O=/tmp/build/perf -C tools/perf

And the files above were not created, so one has to do:

  $ make O=/tmp/build/perf -C tools/perf/lib/
  make: Entering directory '/home/acme/git/perf/tools/perf/lib'
    LINK     /tmp/build/perf/libperf.so.0.0.1
  make: Leaving directory '/home/acme/git/perf/tools/perf/lib'
  $ ls -la /tmp/build/perf/*.so.*
  lrwxrwxrwx. 1 acme acme    16 Jul 22 15:37 /tmp/build/perf/libperf.so.0 -> libperf.so.0.0.1
  -rwxrwxr-x. 1 acme acme 16368 Jul 22 15:37 /tmp/build/perf/libperf.so.0.0.1
  $
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-25-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 31435049
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
# Most of this file is copied from tools/lib/bpf/Makefile # Most of this file is copied from tools/lib/bpf/Makefile
LIBPERF_VERSION = 0
LIBPERF_PATCHLEVEL = 0
LIBPERF_EXTRAVERSION = 1
MAKEFLAGS += --no-print-directory MAKEFLAGS += --no-print-directory
ifeq ($(srctree),) ifeq ($(srctree),)
...@@ -47,7 +51,13 @@ all: ...@@ -47,7 +51,13 @@ all:
export srctree OUTPUT CC LD CFLAGS V export srctree OUTPUT CC LD CFLAGS V
include $(srctree)/tools/build/Makefile.include include $(srctree)/tools/build/Makefile.include
LIBPERF_SO := $(OUTPUT)libperf.so VERSION_SCRIPT := libperf.map
PATCHLEVEL = $(LIBPERF_PATCHLEVEL)
EXTRAVERSION = $(LIBPERF_EXTRAVERSION)
VERSION = $(LIBPERF_VERSION).$(LIBPERF_PATCHLEVEL).$(LIBPERF_EXTRAVERSION)
LIBPERF_SO := $(OUTPUT)libperf.so.$(VERSION)
LIBPERF_A := $(OUTPUT)libperf.a LIBPERF_A := $(OUTPUT)libperf.a
LIBPERF_IN := $(OUTPUT)libperf-in.o LIBPERF_IN := $(OUTPUT)libperf-in.o
...@@ -58,7 +68,11 @@ $(LIBPERF_A): $(LIBPERF_IN) ...@@ -58,7 +68,11 @@ $(LIBPERF_A): $(LIBPERF_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN)
$(LIBPERF_SO): $(LIBPERF_IN) $(LIBPERF_SO): $(LIBPERF_IN)
$(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so $^ -o $@ $(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so \
-Wl,--version-script=$(VERSION_SCRIPT) $^ -o $@
@ln -sf $(@F) $(OUTPUT)libperf.so
@ln -sf $(@F) $(OUTPUT)libperf.so.$(LIBPERF_VERSION)
libs: $(LIBPERF_A) $(LIBPERF_SO) libs: $(LIBPERF_A) $(LIBPERF_SO)
...@@ -67,7 +81,7 @@ all: fixdep ...@@ -67,7 +81,7 @@ all: fixdep
clean: clean:
$(call QUIET_CLEAN, libperf) $(RM) $(LIBPERF_A) \ $(call QUIET_CLEAN, libperf) $(RM) $(LIBPERF_A) \
*.o *~ *.a *.so .*.d .*.cmd LIBPERF-CFLAGS *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBPERF_VERSION) .*.d .*.cmd LIBPERF-CFLAGS
FORCE: FORCE:
......
LIBPERF_0.0.1 {
local:
*;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment