forked from primme/primme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
136 lines (112 loc) · 4.6 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#-----------------------------------------------------------------
# make
# lib makes the libprimme.a library
# solib makes the libprimme.so library
# matlab make libprimme.a compatible with MATLAB and the
# module for MATLAB
# octave make libprimme.a and the Octave module
# python make libprimme.a and the python module
# R_install install PRIMME's R interface
# deps update header dependencies
# clean removes all *.o files
# clean_lib remove all files in lib
# test build and execute simple examples
#-----------------------------------------------------------------
include Make_flags
.PHONY: lib clean test all_tests check_style matlab octave \
python python_install R_install tags deps install \
uninstall
#------------------------ Libraries ------------------------------
# Making the PRIMME library
# Includes float, double and complex counterparts
lib:
@$(MAKE) -C src ../lib/$(LIBRARY)
solib:
@$(MAKE) -C src ../lib/$(SONAMELIBRARY)
ifneq ($(SOLIBRARY),$(SONAMELIBRARY))
@cd lib; ln -fs $(SONAMELIBRARY) $(SOLIBRARY)
endif
ifneq ($(SONAMELIBRARYMAJOR),$(SONAMELIBRARY))
@cd lib; ln -fs $(SONAMELIBRARY) $(SONAMELIBRARYMAJOR)
endif
clean:
@$(MAKE) -C src clean
clean_lib:
@rm -f lib/*
test:
@echo "------------------------------------------------";
@echo " Test C examples ";
@echo "------------------------------------------------";
@$(MAKE) -C examples veryclean test_examples_C USE_PETSC=no
all_tests:
@$(MAKE) -C examples veryclean test_examples;
@$(MAKE) -C tests veryclean all_tests
matlab: clean clean_lib
@$(MAKE) lib CFLAGS="${CFLAGS} -DPRIMME_BLASINT_SIZE=64" PRIMME_WITH_MAGMA=no
@$(MAKE) -C Matlab matlab
matlab-cuda: clean clean_lib
@$(MAKE) lib CFLAGS="${CFLAGS} -DPRIMME_BLASINT_SIZE=64" PRIMME_WITH_MAGMA=yes
@$(MAKE) -C Matlab matlab-cuda
octave: clean clean_lib
@$(MAKE) lib PRIMME_WITH_MAGMA=no
@$(MAKE) -C Matlab octave
python: clean clean_lib lib
@$(MAKE) -C Python clean all
python_install: python
@$(MAKE) -C Python install
R_install:
@$(MAKE) -C R install
install: solib
install -d $(includedir)
cd include && install -m 644 primme_eigs_f77.h primme_eigs_f90.inc primme_eigs.h \
primme_f77.h primme_f90.inc primme.h primme_svds_f77.h \
primme_svds_f90.inc primme_svds.h \
$(includedir)
install -d $(libdir)
install -m 644 lib/$(SONAMELIBRARY) $(libdir)
ifeq ($(UNAME), Darwin)
$(INSTALL_NAME_TOOL) -id $(libdir)/$(SONAMELIBRARY) $(libdir)/$(SONAMELIBRARY) || echo Failed install_name_tool
endif
ifneq ($(SOLIBRARY),$(SONAMELIBRARY))
@cd $(libdir); ln -fs $(SONAMELIBRARY) $(SOLIBRARY)
endif
ifneq ($(SONAMELIBRARYMAJOR),$(SONAMELIBRARY))
@cd $(libdir); ln -fs $(SONAMELIBRARY) $(SONAMELIBRARYMAJOR)
endif
uninstall:
rm -f $(libdir)/$(SONAMELIBRARY) $(libdir)/$(SOLIBRARY) $(libdir)/$(SONAMELIBRARYMAJOR)
rm -f $(includedir)/primme_eigs_f77.h $(includedir)/primme_eigs_f90.inc \
$(includedir)/primme_eigs.h $(includedir)/primme_f77.h \
$(includedir)/primme_f90.inc $(includedir)/primme.h \
$(includedir)/primme_svds_f77.h $(includedir)/primme_svds_f90.inc \
$(includedir)/primme_svds.h
deps:
@touch src/*/*.c
@rm -f src/deps
@$(MAKE) -C src auto_headers
check_style:
@( grep ' ' -R . --include='*.[chfmF]' && echo "Please don't use tabs!" ) || true
tags:
rm -f tags
@$(MAKE) -C src ../tags
#
# Convenient actions to build half precision (optional)
#
lib-debug-sanitize all_tests-debug-sanitize: export CFLAGS += -g -O0 -fsanitize=undefined,address
lib-debug-sanitize all_tests-debug-sanitize: export LDFLAGS += -g -O0 -fsanitize=undefined,address
lib-debug-sanitize: lib
all_tests-debug-sanitize: all_tests
lib-clang-half matlab-clang-half lib-clang-half-debug matlab-clang-half-debug: export PRIMME_WITH_HALF := yes
lib-clang-half matlab-clang-half lib-clang-half-debug matlab-clang-half-debug: export CC := clang
lib-clang-half matlab-clang-half: export CFLAGS += -march=native -Ofast
lib-clang-half-debug matlab-clang-half-debug: export CFLAGS := -O0 -g -fPIC
lib-clang-half lib-clang-half-debug: lib
all_tests-clang-half-debug: export CC := clang
all_tests-clang-half-debug: export CXX := clang++
all_tests-clang-half-debug: export LDFLAGS := -rtlib=compiler-rt -fPIC -lgcc_s
all_tests-clang-half-debug: all_tests
matlab-clang-half-debug: export MEXFLAGS := CXX=clang LDFLAGS='-rtlib=compiler-rt -fPIC' -g CXXFLAGS='-fPIC -O0 -g'
matlab-clang-half matlab-clang-half-debug: matlab
python-clang-half-debug: clean clean_lib lib-clang-half-debug
@$(MAKE) -C Python clean all CC='clang -fPIC' LDSHARED='clang -shared -rtlib=compiler-rt -lm'
.NOTPARALLEL: