mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
2c8ac8b55b
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
93 lines
2.6 KiB
Diff
93 lines
2.6 KiB
Diff
--- ./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 = 3
|
|
+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
|