-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (51 loc) · 1.52 KB
/
Copy pathMakefile
File metadata and controls
66 lines (51 loc) · 1.52 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
CC ?= gcc
CXX ?= g++
headers = $(wildcard inc/*.h)
src = $(wildcard src/*.c)
objs = matrix.o vector.o
blas_library = -lopenblas
CFLAGS ?= -Wall -fPIC -O2 -march=native
CXXFLAGS ?= -Wall -O2 -march=native -std=c++11
ifdef WIN32
INSTALL_DIR ?= C:/MatriceInstall
else
INSTALL_DIR ?= /usr/local
endif
main:
$(CC) $(CFLAGS) -c $(src)
$(CC) -shared -o libmatrice.so $(objs)
test:
@make main
$(CC) $(objs) -O tests/test_allocations.c -o test_allocations
$(CC) $(objs) -O tests/test_basics.c -o test_basics
$(CC) $(objs) -O tests/test_ops.c -o test_ops
$(CC) tests/test_shared.c -o test_shared libmatrice.so
test-cpp:
@make main
$(CXX) $(CXXFLAGS) tests-cpp/test_bindings_cpp.cxx -o test_bindings_cpp libmatrice.so
bench:
$(CC) $(CFLAGS) -c src/matrix.c -o matrix.o
$(CC) matrix.o $(blas_library) -O benchmarks/bench-float.c -o bench-float
$(CC) matrix.o $(blas_library) -O benchmarks/bench-double.c -o bench-double
install:
@echo Installing libmatrice.so into $(INSTALL_DIR)
mkdir -p $(INSTALL_DIR)/lib
cp libmatrice.so $(INSTALL_DIR)/lib
@echo Installing header files
mkdir -p $(INSTALL_DIR)/include/matrice
cp inc/*.h $(INSTALL_DIR)/include/matrice
@echo Installing config files
mkdir -p $(INSTALL_DIR)/lib/pkgconfig
cp matrice.pc $(INSTALL_DIR)/lib/pkgconfig
install-cpp:
@echo Installing C++ bindings
mkdir -p $(INSTALL_DIR)/include/matrice
cp bindings/cpp/matrice.hxx $(INSTALL_DIR)/include/matrice
clean:
rm -f *.o
rm -f *.so
rm -f inc/*.pch
rm -f test_*
clean-bench:
rm -f bench-float
rm -f bench-double