56 lines
1.6 KiB
Plaintext
56 lines
1.6 KiB
Plaintext
$NetBSD: patch-Makefile,v 1.2 2016/01/28 11:34:48 jperkin Exp $
|
|
|
|
Use LIBTOOL.
|
|
|
|
--- Makefile.orig 2015-09-26 22:03:26.000000000 +0000
|
|
+++ Makefile
|
|
@@ -1,34 +1,27 @@
|
|
CXX ?= g++
|
|
CC ?= gcc
|
|
-CFLAGS = -Wall -Wconversion -O3 -fPIC
|
|
-LIBS = blas/blas.a
|
|
+LIBS = blas/libblas.la
|
|
SHVER = 3
|
|
-OS = $(shell uname)
|
|
#LIBS = -lblas
|
|
|
|
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)
|
|
-
|
|
-train: tron.o linear.o train.c blas/blas.a
|
|
- $(CXX) $(CFLAGS) -o train train.c tron.o linear.o $(LIBS)
|
|
-
|
|
-predict: tron.o linear.o predict.c blas/blas.a
|
|
- $(CXX) $(CFLAGS) -o predict predict.c tron.o linear.o $(LIBS)
|
|
+lib: linear.lo tron.lo $(LIBS)
|
|
+ ${LIBTOOL} --mode=link $(CXX) -o liblinear.la $> -rpath ${PREFIX}/lib -version-info ${SHVER}:0
|
|
|
|
-tron.o: tron.cpp tron.h
|
|
- $(CXX) $(CFLAGS) -c -o tron.o tron.cpp
|
|
+train: tron.lo linear.lo train.c $(LIBS)
|
|
+ ${LIBTOOL} --mode=link $(CXX) $(CFLAGS) -o train $>
|
|
|
|
-linear.o: linear.cpp linear.h
|
|
- $(CXX) $(CFLAGS) -c -o linear.o linear.cpp
|
|
+predict: tron.lo linear.lo predict.c $(LIBS)
|
|
+ ${LIBTOOL} --mode=link $(CXX) $(CFLAGS) -o predict $>
|
|
|
|
-blas/blas.a: blas/*.c blas/*.h
|
|
+tron.lo: tron.cpp tron.h
|
|
+ ${LIBTOOL} --mode=compile $(CXX) $(CFLAGS) -c -o tron.o tron.cpp
|
|
+
|
|
+linear.lo: linear.cpp linear.h
|
|
+ ${LIBTOOL} --mode=compile $(CXX) $(CFLAGS) -c -o linear.o linear.cpp
|
|
+
|
|
+$(LIBS): blas/*.c blas/*.h
|
|
make -C blas OPTFLAGS='$(CFLAGS)' CC='$(CC)';
|
|
|
|
clean:
|