Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add install target to Makefile #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libsvm.a
svm-predict
svm-scale
svm-train
svm.o
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@ CFLAGS = -Wall -Wconversion -O3 -fPIC
SHVER = 2
OS = $(shell uname)

LIB = /usr/local/lib
CP = cp
LN = ln -sf

all: svm-train svm-predict svm-scale

install: lib
if [ ! -w $(LIB) ]; then \
CP='sudo cp'; \
LN='sudo ln -sf'; \
fi; \
$(CP) libsvm.so.2 $(LIB)
$(LN) $(LIB)/libsvm.so.$(SHVER) $(LIB)/libsvm.so

lib: svm.o
if [ "$(OS)" = "Darwin" ]; then \
SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)"; \
Expand All @@ -13,6 +25,10 @@ lib: svm.o
fi; \
$(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER)

slib: svm.o
ar rcs libsvm.a svm.o


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
Expand Down