This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 531
/
makefile_py
113 lines (75 loc) · 3.56 KB
/
makefile_py
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
CXX = g++
CXXFLAGS = -pthread -std=gnu++11
BOOST_DIR = /usr/local/bin/boost_1_63_0/
GTEST_DIR = /usr/local/bin/googletest
OBJS = normalize.o dict.o args.o proj.o parser.o data.o model.o starspace.o doc_parser.o doc_data.o utils.o
TESTS = matrix_test proj_test
INCLUDES = -I$(BOOST_DIR)
opt: CXXFLAGS += -O3 -fPIC -funroll-loops
opt: libstarspace.a
debug: CXXFLAGS += -g -O0 -fPIC -fno-inline
debug: libstarspace.a
TEST_INCLUDES = -I$(GTEST_DIR)/include
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
$(GTEST_DIR)/include/gtest/internal/*.h
CPPFLAGS += -isystem $(GTEST_DIR)/include
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
# For simplicity and to avoid depending on Google Test's
# implementation details, the dependencies specified below are
# conservative and not optimized. This is fine as Google Test
# compiles fast and for ordinary users its source rarely changes.
gtest-all.o : $(GTEST_SRCS_)
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest-all.cc
gtest_main.o : $(GTEST_SRCS_)
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest_main.cc
gtest.a : gtest-all.o
$(AR) $(ARFLAGS) $@ $^
gtest_main.a : gtest-all.o gtest_main.o
$(AR) $(ARFLAGS) $@ $^
normalize.o: src/utils/normalize.cpp src/utils/normalize.h
$(CXX) $(CXXFLAGS) -g -c src/utils/normalize.cpp
dict.o: src/dict.cpp src/dict.h src/utils/args.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/dict.cpp
args.o: src/utils/args.cpp src/utils/args.h
$(CXX) $(CXXFLAGS) -g -c src/utils/args.cpp
matrix_test.o: src/test/matrix_test.cpp src/matrix.h $(GTEST_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(TEST_INCLUDES) -g -c src/test/matrix_test.cpp
model.o: data.o src/model.cpp src/model.h src/utils/args.h src/proj.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/model.cpp
matrix_test: matrix_test.o gtest_main.a
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@
proj.o: src/proj.cpp src/proj.h src/matrix.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/proj.cpp
proj_test.o: src/test/proj_test.cpp src/proj.h $(GTEST_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(TEST_INCLUDES) -g -c src/test/proj_test.cpp
proj_test: proj.o proj_test.o gtest_main.a
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@
data.o: parser.o src/data.cpp src/data.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/data.cpp -o data.o
utils.o: src/utils/utils.cpp src/utils/utils.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/utils/utils.cpp -o utils.o
doc_data.o: doc_parser.o data.o src/doc_data.cpp src/doc_data.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/doc_data.cpp -o doc_data.o
parser.o: dict.o src/parser.cpp src/parser.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/parser.cpp -o parser.o
doc_parser.o: dict.o src/doc_parser.cpp src/doc_parser.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/doc_parser.cpp -o doc_parser.o
starspace.o: src/starspace.cpp src/starspace.h
$(CXX) $(CXXFLAGS) $(INCLUDES) -g -c src/starspace.cpp
libstarspace.a: $(OBJS)
ar rcs libstarspace.a $(OBJS)
starspace:
$(CXX) $(CXXFLAGS) $(OBJS) $(INCLUDES) -g src/main.cpp -o starspace
query_nn: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(INCLUDES) -g src/apps/query_nn.cpp -o query_nn
query_predict: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(INCLUDES) -g src/apps/query_predict.cpp -o query_predict
print_ngrams: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(INCLUDES) -g src/apps/print_ngrams.cpp -o print_ngrams
embed_doc: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(INCLUDES) -g src/apps/embed_doc.cpp -o embed_doc
test: $(TESTS)
clean:
rm -rf *.o starspace gtest.a gtest_main.a *_test query_nn print_ngrams