[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Any idea how to create shared lobrary for libatomicqueue



Hi Andreas,

On Sat, 24 Oct 2020 at 02:17, Andreas Tille <andreas@an3as.eu> wrote:
Hi,

I checked libatomicqueue[1] and realised that only a static library is
built.  Any idea how to create a shared library in addition.

I tried something and was successful in making a shared library, however  I noticed that the debian/tmp directory does _not_ take in any of the installed files - neither includes, not the static nor the .so lib. Hence I'm not sure of using d-shlibs for the same.
I'm anyway, attaching my patche here - you'd probably know a way to setup d-shlibs with this.

Kind Regards,
Nilesh
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@
 
 TOOLSET := gcc
 build_dir := ${CURDIR}/build/${BUILD}/${TOOLSET}
+build_dir_shared := ${CURDIR}/build_shared/${BUILD}/${TOOLSET}
 
 cxx.gcc := g++
 cc.gcc := gcc
@@ -66,13 +67,17 @@
 
 all : ${exes}
 
-${exes} : % : ${build_dir}/%
+${exes} : % : ${build_dir}/% ${build_dir_shared}/libatomic_queue.so
 	ln -sf ${<:${CURDIR}/%=%}
 
 ${build_dir}/libatomic_queue.a : $(addprefix ${build_dir}/,cpu_base_frequency.o huge_pages.o)
 -include ${build_dir}/cpu_base_frequency.d
 -include ${build_dir}/huge_pages.d
 
+${build_dir_shared}/libatomic_queue.so : $(addprefix ${build_dir_shared}/,cpu_base_frequency.o huge_pages.o)
+-include ${build_dir_shared}/cpu_base_frequency.d
+-include ${build_dir_shared}/huge_pages.d
+
 ${build_dir}/benchmarks : cppflags += ${cppflags.tbb} ${cppflags.moodycamel} ${cppflags.xenium}
 ${build_dir}/benchmarks : ldlibs += ${ldlibs.tbb} ${ldlibs.moodycamel} ${ldlibs.xenium} -ldl
 ${build_dir}/benchmarks : ${build_dir}/benchmarks.o ${build_dir}/libatomic_queue.a Makefile | ${build_dir}
@@ -85,8 +90,8 @@
 	$(strip ${LINK.EXE})
 -include ${build_dir}/tests.d
 
-${build_dir}/%.so : cxxflags += -fPIC
-${build_dir}/%.so : Makefile | ${build_dir}
+${build_dir_shared}/%.so : cxxflags += -fPIC
+${build_dir_shared}/%.so : Makefile | ${build_dir}
 	$(strip ${LINK.SO})
 
 ${build_dir}/%.a : Makefile | ${build_dir}
@@ -108,6 +113,13 @@
 ${build_dir}/%.o : src/%.c Makefile | ${build_dir}
 	$(strip ${COMPILE.C})
 
+${build_dir_shared}/%.o : src/%.cc Makefile | ${build_dir_shared}
+	$(strip ${COMPILE.CXX})
+
+${build_dir_shared}/%.o : src/%.c Makefile | ${build_dir_shared}
+	$(strip ${COMPILE.C})
+
+
 %.S : cppflags += ${cppflags.tbb} ${cppflags.moodycamel} ${cppflags.xenium}
 %.S : src/%.cc Makefile | ${build_dir}
 	$(strip ${COMPILE.S})
@@ -118,6 +130,9 @@
 ${build_dir} :
 	mkdir -p $@
 
+${build_dir_shared} :
+	mkdir -p $@
+
 rtags : clean
 	${MAKE} -nk | rc -c -; true
 

Reply to: