liblinear/liblinear-1.96.makefile.patch

54 lines
1.8 KiB
Diff
Raw Normal View History

--- liblinear-1.96/Makefile 2015-03-22 00:49:07.000000000 +0100
+++ liblinear-1.96/Makefile.linux 2015-03-22 09:29:55.001697676 +0100
@@ -1,37 +1,26 @@
CXX ?= g++
-CC ?= gcc
-CFLAGS = -Wall -Wconversion -O3 -fPIC
-LIBS = blas/blas.a
+CFLAGS_ADD = -Wall -Wconversion -O3 -fPIC
+LIBS = -lblas
SHVER = 2
-OS = $(shell uname)
-#LIBS = -lblas
+SHARED_LIB_FLAGS= -shared -Wl,-soname,liblinear.so.$(SHVER)
all: train predict
-lib: linear.o tron.o blas/blas.a
- if [ "$(OS)" = "Darwin" ]; then \
- SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,liblinear.so.$(SHVER)"; \
- else \
- SHARED_LIB_FLAG="-shared -Wl,-soname,liblinear.so.$(SHVER)"; \
- fi; \
- $(CXX) $${SHARED_LIB_FLAG} linear.o tron.o blas/blas.a -o liblinear.so.$(SHVER)
+lib: linear.o tron.o
+ $(CXX) $(SHARED_LIB_FLAGS) $(LDFLAGS) $(LIBS) linear.o tron.o -o liblinear.so.$(SHVER)
+ ln -fs liblinear.so.$(SHVER) liblinear.so
-train: tron.o linear.o train.c blas/blas.a
- $(CXX) $(CFLAGS) -o train train.c tron.o linear.o $(LIBS)
+train: lib train.c
+ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -o train train.c -L. -llinear
-predict: tron.o linear.o predict.c blas/blas.a
- $(CXX) $(CFLAGS) -o predict predict.c tron.o linear.o $(LIBS)
+predict: lib predict.c
+ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -o predict predict.c -L. -llinear
tron.o: tron.cpp tron.h
- $(CXX) $(CFLAGS) -c -o tron.o tron.cpp
+ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o tron.o tron.cpp
linear.o: linear.cpp linear.h
- $(CXX) $(CFLAGS) -c -o linear.o linear.cpp
-
-blas/blas.a: blas/*.c blas/*.h
- make -C blas OPTFLAGS='$(CFLAGS)' CC='$(CC)';
+ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o linear.o linear.cpp
clean:
- make -C blas clean
- make -C matlab clean
- rm -f *~ tron.o linear.o train predict liblinear.so.$(SHVER)
+ rm -f *~ tron.o linear.o train predict liblinear.so*