All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] trace-cruncher: Build trace-obj-debug.c as library
@ 2022-04-29 13:18 Yordan Karadzhov (VMware)
  0 siblings, 0 replies; only message in thread
From: Yordan Karadzhov (VMware) @ 2022-04-29 13:18 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: tz.stoyanov, Yordan Karadzhov (VMware)

The code for resolving virtual address to function name gets build
as shared library. The library is installed as package data. Later
this library can be used by the different sub-modules of tracecruncher.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---

This patch applies on top of the patch:
https://lore.kernel.org/all/20220420080206.252356-2-tz.stoyanov@gmail.com/

 Makefile | 24 +++++++++++++++++++++---
 setup.py |  3 ++-
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 52428c0..9b62c4a 100644
--- a/Makefile
+++ b/Makefile
@@ -13,13 +13,31 @@ NC	:= '\e[0m'
 
 DOCDIR = ./docs
 
-all:
+CC = gcc
+CFLAGS = -fPIC -Wall -Wextra -O2 -g
+LDFLAGS = -shared
+RM = rm -rf
+
+DBG_LIB = tracecruncher/libobjdebug.so
+PY_SETUP = setup
+
+DBG_SRCS = src/trace-obj-debug.c
+DBG_OBJS = src/trace-obj-debug.o
+
+all: $(DBG_LIB) $(PY_SETUP)
 	@ echo ${CYAN}Buildinging trace-cruncher:${NC};
+
+$(PY_SETUP):
 	python3 setup.py build
 
+$(DBG_LIB): $(DBG_OBJS)
+	$(CC) ${LDFLAGS} -o $@ $^ -L./tracecruncher -lbfd
+
 clean:
-	rm -f src/npdatawrapper.c
-	rm -rf build
+	${RM} src/npdatawrapper.c
+	${RM} $(DBG_LIB)
+	${RM} src/*.o
+	${RM} build
 
 install:
 	@ echo ${CYAN}Installing trace-cruncher:${NC};
diff --git a/setup.py b/setup.py
index 58561cf..3c3d40b 100644
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ def add_library(lib, min_version,
         libs_found.extend([(lib, lib_version)])
 
 def third_party_paths():
-    library_dirs = []
+    library_dirs = ['tracecruncher']
     include_dirs = [np.get_include()]
     libs_required = [('libtraceevent', '1.5.0'),
                      ('libtracefs',    '1.3.0'),
@@ -91,6 +91,7 @@ def main():
           url='https://github.com/vmware/trace-cruncher',
           license='LGPL-2.1',
           packages=find_packages(),
+          package_data={'tracecruncher': ['libobjdebug.so']},
           ext_modules=[module_ft, module_data, module_ks],
           classifiers=[
               'Development Status :: 4 - Beta',
-- 
2.32.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-29 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 13:18 [RFC PATCH] trace-cruncher: Build trace-obj-debug.c as library Yordan Karadzhov (VMware)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.