File 0002-Fix-shared-library-build.patch of Package libSNL
From e4ae44ab6e151f50696946fd0d88e18400cc7263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Sun, 17 Nov 2024 07:53:17 +0100 Subject: [PATCH 2/5] Fix shared library build --- trunk/src/makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/trunk/src/makefile b/trunk/src/makefile index 12161e6..b31ec92 100644 --- a/trunk/src/makefile +++ b/trunk/src/makefile @@ -15,19 +15,19 @@ objFiles := snlCircularOffsetCurve.o \ libName = libSNL.so.0.2 -export cflags = -Wall -fPIC -g -export cname = g++ +# rule for compiling c files for use with the dynamic library +%.o: %.cpp + $(PURIFY) $(CXX) -c $(CFLAGS) $< -fPIC -DPIC -o $@ -CXXFLAGS := $(cflags) -CFLAGS := $(cflags) -libSNL: $(objFiles) +$(libName): $(objFiles) @ echo @ echo "*** Building Shared Library ***" @ echo - $(cname) $(cflags) -shared -o $(libName) $(objFiles) + g++ -shared $? -Wl,-soname,libSNL.so.0.2 -o libSNL.so.0.2 -lm + ln -s libSNL.so.0.2 libSNL.so -include make.dep +-include make.dep PHONY : dep dep: make.dep @@ -36,7 +36,7 @@ make.dep : $(objFiles:.o=.h) $(extraIncl) @ echo @ echo "*** Building Dependencies ***" @ echo - $(cname) -MM $(objFiles:.o=.cpp) > make.dep + $(CXX) -MM $(objFiles:.o=.cpp) > make.dep @ echo @ echo "*** Dependencies Built Okay ***" @ echo @@ -46,5 +46,5 @@ clean: rm $(objFiles) make.dep $(libName) snlTest test: snlTest.cpp - $(cname) $(cflags) snlTest.cpp -o snlTest $(objFiles) + $(PURIFY) $(CXX) snlTest.cpp -o snlTest $(objFiles) -- 2.47.0