libsvm/libsvm-3.20-Makefile.patch

48 lines
1.5 KiB
Diff
Raw Permalink Normal View History

--- libsvm-3.20/Makefile 2015-03-22 12:55:35.000000000 +0100
+++ libsvm-3.20/Makefile.linux 2015-03-22 14:00:24.234436503 +0100
@@ -1,25 +1,28 @@
CXX ?= g++
-CFLAGS = -Wall -Wconversion -O3 -fPIC
+MAKE = make
+CFLAGS_ADD = -Wall -Wconversion -O3 -fPIC
SHVER = 2
-OS = $(shell uname)
+SHARED_LIB_FLAGS= -shared -Wl,-soname,liblinear.so.$(SHVER)
+LIBS= -L. -lsvm
all: svm-train svm-predict svm-scale
lib: svm.o
- if [ "$(OS)" = "Darwin" ]; then \
- SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)"; \
- else \
- SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \
- fi; \
- $(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER)
-
-svm-predict: svm-predict.c svm.o
- $(CXX) $(CFLAGS) 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) $(SHARED_LIB_FLAGS) $(LDFLAGS) svm.o -o libsvm.so.$(SHVER)
+ ln -fs libsvm.so.$(SHVER) libsvm.so
+
+svm-predict: lib svm-predict.c
+ $(CXX) $(CFLAGS_ADD) svm-predict.c $(LIBS) -o svm-predict -lm
+
+svm-train: lib svm-train.c
+ $(CXX) $(CFLAGS_ADD) svm-train.c $(LIBS) -o svm-train -lm
+
svm-scale: svm-scale.c
- $(CXX) $(CFLAGS) svm-scale.c -o svm-scale
+ $(CXX) $(CFLAGS_ADD) svm-scale.c -o svm-scale
+
svm.o: svm.cpp svm.h
- $(CXX) $(CFLAGS) -c svm.cpp
+ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o svm.o svm.cpp
+
clean:
- rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER)
+ rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so*
+ ${MAKE} -C python clean