mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 18:58:08 -07:00
We need to pass -fPIC when compiling too, otherwise w/o LTO, we fail to link. Closes: https://bugs.gentoo.org/972427 Signed-off-by: Sam James <sam@gentoo.org>
48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
diff --git a/Makefile b/Makefile
|
|
index 1bc5d4e..4d55228 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -1,28 +1,33 @@
|
|
CXX ?= g++
|
|
-CFLAGS = -Wall -Wconversion -O3 -fPIC
|
|
+CFLAGS ?= -Wall -Wconversion
|
|
+CXXFLAGS ?= $(CFLAGS)
|
|
+CFLAGS += -fPIC
|
|
+CXXFLAGS += -fPIC
|
|
+
|
|
SHVER = 4
|
|
OS = $(shell uname)
|
|
ifeq ($(OS),Darwin)
|
|
- SHARED_LIB_FLAG = -dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)
|
|
+ SHARED_LIB_FLAG = -dynamiclib -Wl,-install_name,libsvm.so.$(SHVER) -fPIC
|
|
else
|
|
- SHARED_LIB_FLAG = -shared -Wl,-soname,libsvm.so.$(SHVER)
|
|
+ SHARED_LIB_FLAG = -shared -Wl,-soname,libsvm.so.$(SHVER) -fPIC
|
|
endif
|
|
|
|
# Uncomment the following lines to enable parallelization with OpenMP
|
|
# CFLAGS += -fopenmp
|
|
# SHARED_LIB_FLAG += -fopenmp
|
|
|
|
-all: svm-train svm-predict svm-scale
|
|
+all: svm-train svm-predict svm-scale lib
|
|
|
|
lib: svm.o
|
|
- $(CXX) $(SHARED_LIB_FLAG) svm.o -o libsvm.so.$(SHVER)
|
|
+ $(CXX) $(LDFLAGS) $(SHARED_LIB_FLAG) svm.o -o libsvm.so.$(SHVER)
|
|
+ ln -s libsvm.so.$(SHVER) libsvm.so
|
|
svm-predict: svm-predict.c svm.o
|
|
- $(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm
|
|
+ $(CXX) $(CFLAGS) $(LDFLAGS) svm-predict.c svm.o -o svm-predict -lm
|
|
svm-train: svm-train.c svm.o
|
|
- $(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm
|
|
+ $(CXX) $(CFLAGS) $(LDFLAGS) svm-train.c svm.o -o svm-train -lm
|
|
svm-scale: svm-scale.c
|
|
- $(CXX) $(CFLAGS) svm-scale.c -o svm-scale
|
|
+ $(CXX) $(CFLAGS) $(LDFLAGS) svm-scale.c -o svm-scale
|
|
svm.o: svm.cpp svm.h
|
|
- $(CXX) $(CFLAGS) -c svm.cpp
|
|
+ $(CXX) $(CXXFLAGS) -c svm.cpp
|
|
clean:
|
|
rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER)
|