-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
148 lines (111 loc) · 4.97 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
137
138
139
140
141
142
143
144
145
146
147
148
.PHONY=all tests clean obj python
ifndef CXX
CXX=g
endif
ifndef CC
CC=gcc
endif
ifndef STD
STD=c 17
endif
WARNINGS=-Wall -Wextra -Wno-char-subscripts \
-Wpointer-arith -Wwrite-strings -Wdisabled-optimization \
-Wformat -Wcast-align -Wno-unused-function -Wunused-variable -Wno-ignored-qualifiers -Wsuggest-attribute=const \
# -Wconversion -Werror -Wno-float-conversion
DBG:= # -DNDEBUG
OFLAG?=-O3
OPT:= $(OFLAG) -funroll-loops -pipe -fno-strict-aliasing -march=native -fopenmp -DUSE_FASTRANGE \
-funsafe-math-optimizations -ftree-vectorize \
-DBOOST_NO_RTTI
OS:=$(shell uname)
EXTRA=
BLAS_LINKING_FLAGS?=
OPT:=$(OPT) $(FLAGS)
XXFLAGS=-fno-rtti
CBLASFILE?=cblas.h
BLAZEFLAGS= -DBLAZE_BLAS_MODE=1 \
-DBLAZE_USE_BLAS_MATRIX_VECTOR_MULTIPLICATION=1 -DBLAZE_BLAS_INCLUDE_FILE='"$(CBLASFILE)"' \
$(BLAS_LINKING_FLAGS)
CXXFLAGS=$(OPT) $(XXFLAGS) -std=$(STD) $(WARNINGS) -DRADEM_LUT $(EXTRA) $(BLAZEFLAGS)
CCFLAGS=$(OPT) -std=c11 $(WARNINGS)
LIB=-lz -pthread -lfftw3 -lfftw3l -lfftw3f -lstdc fs -lsleef -llapack
LD=-L. -Lfftw-3.3.7/lib -Lvec/sleef/build/lib
OBJS=$(patsubst %.cpp,%.o,$(wildcard lib/*.cpp)) clhash/clhash.o
TEST_OBJS=$(patsubst %.cpp,%.o,$(wildcard test/*.cpp))
EXEC_OBJS=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) $(patsubst %.cpp,%.fo,$(wildcard src/*.cpp))
EX=$(patsubst src/%.fo,%f,$(EXEC_OBJS)) $(patsubst src/%.o,%,$(EXEC_OBJS))
BOOST_DIRS=math config random utility assert static_assert \
integer type_traits mpl core preprocessor exception throw_exception \
range iterator io predef concept_check detail lexical_cast \
numeric_conversion functional array container move thread smart_ptr
SAN=-fsanitize=address -fsanitize=undefined
BOOST_INCS=$(patsubst %,-Iboost/%/include,$(BOOST_DIRS))
# If compiling with c < 17 and your compiler does not provide
# bessel functions with c 14, you must compile against boost.
INCLUDE=-I. -Iinclude -Ivec/blaze -Ithirdparty -Irandom/include/\
-Ifftw-3.3.7/include -I vec/sleef/build/include/ $(BOOST_INCS) \
-I/usr//local/Cellar/zlib/1.2.11/include -Ifastrange -Idistmat -Iaesctr \
-Iinclude/frp -Iclhash/include # asdfnfkjhqefkjhdafs
ifdef BOOST_INCLUDE_PATH
INCLUDE = -I$(BOOST_INCLUDE_PATH)
endif
OBJS:=$(OBJS) vec/sleef/build/include/sleef.h fht.o FFHT/fast_copy.o
all: $(OBJS) $(EX) python
print-% : ; @echo $* = $($*)
obj: $(OBJS) $(EXEC_OBJS)
HEADERS=$(wildcard include/frp/*.h)
fht.o: FFHT/fht.c
cd FFHT && make fht.o && cp fht.o ..
HEADERS=$(wildcard include/frp/*.h)
test/%.o: test/%.cpp $(OBJS)
$(CXX) $(CXXFLAGS) $(INCLUDE) $(LD) $(OBJS) -c $< -o $@ $(LIB)
%.fo: %.cpp $(OBJS)
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=float $(DBG) $(INCLUDE) $(LD) -c $< -o $@ $(LIB)
%.o: %.cpp $(OBJS)
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=double $(DBG) $(INCLUDE) $(LD) -c $< -o $@ $(LIB)
%: src/%.cpp $(OBJS) fftw3.h $(HEADERS)
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=double $(DBG) $(INCLUDE) $(LD) $(OBJS) $< -o $@ $(LIB)
pcatest: src/pcatest.cpp $(OBJS) $(HEADERS)
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=double $(DBG) $(INCLUDE) $(LD) $(OBJS) $< -o $@ $(LIB)
dcitest: src/dcitest.cpp $(OBJS) $(HEADERS)
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=double $(DBG) $(INCLUDE) $(LD) $(OBJS) $< -o $@ -lz -pthread -fopenmp -llapack -DTIME_ADDITIONS #$(SAN)
dcitestf: src/dcitest.cpp $(OBJS) $(HEADERS)
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=float $(DBG) $(INCLUDE) $(LD) $(OBJS) $< -o $@ -lz -pthread -fopenmp -llapack -DTIME_ADDITIONS #$(SAN)
%f: src/%.cpp $(OBJS) fftw3.h
$(CXX) $(CXXFLAGS) -DFLOAT_TYPE=float $(DBG) $(INCLUDE) $(LD) $(OBJS) $< -o $@ $(LIB)
%.o: %.c
$(CC) $(CCFLAGS) -Wno-sign-compare $(DBG) $(INCLUDE) $(LD) -c $< -o $@ $(LIB)
%.o: FFHT/%.c $(OBJS) fftw3.h
cd FFHT && make $@ && cp $@ .. && cd ..
clhash/clhash.o:
cd clhash && make && cd ..
fftw-3.3.7: fftw-3.3.7.tar.gz
tar -zxvf fftw-3.3.7.tar.gz
fftw-3.3.7.exist: fftw-3.3.7.tar.gz
tar -zxvf fftw-3.3.7.tar.gz && touch fftw-3.3.7.exist
PLATFORM_CONF_STR?=--enable-avx2
fftw3.h: fftw-3.3.7/lib/libfftw3l.a fftw-3.3.7/lib/libfftw3.a fftw-3.3.7/lib/libfftw3f.a
cp fftw-3.3.7/api/fftw3.h .
python:
cd py && make
fftw-3.3.7/lib/libfftw3.a: fftw-3.3.7.exist
cd fftw-3.3.7 &&\
./configure $(PLATFORM_CONF_STR) --prefix=$$PWD && make && make install
fftw-3.3.7/lib/libfftw3f.a: fftw-3.3.7.exist fftw-3.3.7/lib/libfftw3.a
cd fftw-3.3.7 &&\
./configure $(PLATFORM_CONF_STR) --prefix=$$PWD --enable-single && make && make install
fftw-3.3.7/lib/libfftw3l.a: fftw-3.3.7.exist fftw-3.3.7/lib/libfftw3f.a
cd fftw-3.3.7 &&\
./configure --prefix=$$PWD --enable-long-double && make && make install && cp api/fftw3.h ..
tests: clean unit
unit: $(OBJS) $(TEST_OBJS)
$(CXX) $(CXXFLAGS) $(INCLUDE) $(TEST_OBJS) $(LD) $(OBJS) -o $@ $(LIB)
vec/sleef/build: vec/sleef
mkdir -p vec/sleef/build
vec/sleef/build/include/sleef.h: vec/sleef/build
cd $< && cmake .. && make && cd ../..
sleef.h:vec/sleef/build/include/sleef.h
cp vec/sleef/build/include/sleef.h sleef.h
clean:
rm -f $(EXEC_OBJS) $(OBJS) $(EX) $(TEST_OBJS) fftw3.h unit lib/*o frp/src/*o && cd FFHT && make clean && cd ..
mostlyclean: clean