blob: 64aa0df4e1a0e7d4d8d9db5a670556af24765c7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
--- ./Makefile 2023-07-08 16:08:14.000000000 +0200
+++ ./Makefile.fix 2024-03-10 09:21:50.249371988 +0100
@@ -1,7 +1,13 @@
CXX ?= g++
CFLAGS = -Wall -Wconversion -O3 -fPIC
SHVER = 4
+export SHVER
OS = $(shell uname)
+DOT_LIBS = .
+LIBS = -L${DOT_LIBS} -lsvm
+export LIBSVM_VER
+PREFIXDIR ?= /usr
+export PREFIXDIR
ifeq ($(OS),Darwin)
SHARED_LIB_FLAG = -dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)
else
@@ -9,20 +16,69 @@
endif
# Uncomment the following lines to enable parallelization with OpenMP
-# CFLAGS += -fopenmp
-# SHARED_LIB_FLAG += -fopenmp
+CFLAGS += -fopenmp
+SHARED_LIB_FLAG += -fopenmp
-all: svm-train svm-predict svm-scale
+LIBDIR ?= ${PREFIXDIR}/lib
+export LIBDIR
-lib: svm.o
+DATADIR?=${PREFIXDIR}/share
+export DATADIR
+
+BINDIR?=${PREFIXDIR}/bin
+export BINDIR
+
+INCLUDEDIR_INSTALL:=${DESTDIR}/${PREFIXDIR}/include
+export INCLUDEDIR_INSTALL
+
+LIBDIR_INSTALL:=${DESTDIR}/${LIBDIR}
+export LIBDIR_INSTALL
+
+DATADIR_INSTALL:=${DESTDIR}/${DATADIR}
+export DATA_INSTALL
+
+BINDIR_INSTALL:=${DESTDIR}/${BINDIR}
+export BINDIR_INSTALL
+
+all: lib svm-train svm-predict svm-scale svm-python svm-toy-qt
+
+lib: libsvm.so.$(SHVER) libsvm.so
+
+libsvm.so: libsvm.so.$(SHVER)
+ ln -sf libsvm.so.$(SHVER) libsvm.so
+
+libsvm.so.$(SHVER): svm.o
$(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
+ $(CXX) $(CFLAGS) svm-predict.c $(LIBS) -o svm-predict -lm
svm-train: svm-train.c svm.o
- $(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm
+ $(CXX) $(CFLAGS) svm-train.c $(LIBS) -o svm-train -lm
svm-scale: svm-scale.c
$(CXX) $(CFLAGS) svm-scale.c -o svm-scale
svm.o: svm.cpp svm.h
$(CXX) $(CFLAGS) -c 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 svm-toy/qt/svm-toy-qt
+ ${MAKE} -C python clean
+ ${MAKE} -C java clean
+svm-python:
+ ${MAKE} -C python
+
+svm-toy-qt:
+ ${MAKE} -C svm-toy/qt
+
+install: all
+ mkdir -p ${BINDIR_INSTALL}
+ install -m 755 svm-train ${BINDIR_INSTALL}
+ install -m 755 svm-predict ${BINDIR_INSTALL}
+ install -m 755 svm-scale ${BINDIR_INSTALL}
+ mkdir -p ${LIBDIR_INSTALL}
+ install -m 755 libsvm.so.$(SHVER) ${LIBDIR_INSTALL}
+# install package libsvm-devel
+ mkdir -p ${INCLUDEDIR_INSTALL}/libsvm
+ install -m 644 svm.h ${INCLUDEDIR_INSTALL}/libsvm
+# install package svm-toy
+ install -m 755 svm-toy/qt/svm-toy-qt ${BINDIR_INSTALL}
+# install examples
+ mkdir -p ${DATADIR_INSTALL}/libsvm/examples
+ install -m 644 heart_scale ${DATADIR_INSTALL}/libsvm/examples
|