forked from cjlin1/libsvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (33 loc) · 1.16 KB
/
Makefile
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
CXX ?= g++
CFLAGS = -Wall -Wconversion -O3 -fPIC -fopenmp
SHVER = 2
OS = $(shell uname)
PREFIX = /usr/local
all: svm-train svm-predict svm-scale lib
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
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)
install: all
test -d $(PREFIX) || mkdir -p $(PREFIX)
test -d $(PREFIX)/include || mkdir -p $(PREFIX)/include
test -d $(PREFIX)/lib || mkdir -p $(PREFIX)/lib
test -d $(PREFIX)/bin || mkdir -p $(PREFIX)/bin
install -m 0644 svm.h $(PREFIX)/include
install -m 0755 libsvm.so.$(SHVER) $(PREFIX)/lib
install -m 0755 svm-train $(PREFIX)/bin
install -m 0755 svm-scale $(PREFIX)/bin
install -m 0755 svm-predict $(PREFIX)/bin