This repository has been archived by the owner on May 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathMakefile
140 lines (96 loc) · 3.32 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
# Makefile for wormhole project
ifneq ("$(wildcard ./config.mk)","")
config = $(CURDIR)/config.mk
else
config = $(CURDIR)/make/config.mk
endif
# number of threads
# NT=4
# the directory where deps are installed
DEPS_PATH=$(CURDIR)/deps
ROOTDIR = $(CURDIR)
REPOS = $(addprefix repo/, dmlc-core xgboost ps-lite rabit)
.PHONY: clean all test pull
all: xgboost kmeans linear difacto tool
### repos and deps
# dmlc-core
repo/dmlc-core:
git clone /~https://github.com/dmlc/dmlc-core $@
ln -s repo/dmlc-core/tracker .
repo/dmlc-core/libdmlc.a: | repo/dmlc-core glog
+ $(MAKE) -C repo/dmlc-core libdmlc.a config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
core: | repo/dmlc-core glog # always build
+ $(MAKE) -C repo/dmlc-core libdmlc.a config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
# ps-lite
repo/ps-lite:
git clone /~https://github.com/dmlc/ps-lite $@
cd $@; git checkout tags/v1; cd ..
repo/ps-lite/build/libps.a: | repo/ps-lite deps
+ $(MAKE) -C repo/ps-lite ps config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
ps-lite: | repo/ps-lite deps # awlays build
+ $(MAKE) -C repo/ps-lite ps config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
# rabit
repo/rabit:
git clone /~https://github.com/dmlc/rabit $@
repo/rabit/lib/librabit.a: | repo/rabit
+ $(MAKE) -C repo/rabit
rabit: repo/rabit/lib/librabit.a
# deps
include make/deps.mk
deps: gflags glog protobuf zmq lz4 cityhash
### toolkits
# xgboost
repo/xgboost:
git clone /~https://github.com/dmlc/xgboost $@
repo/xgboost/xgboost: repo/dmlc-core/libdmlc.a | repo/xgboost
+ $(MAKE) -C repo/xgboost config=$(config)
bin/xgboost.dmlc: repo/xgboost/xgboost
cp $+ $@
xgboost: bin/xgboost.dmlc
# kmeans
learn/kmeans/kmeans.dmlc: learn/kmeans/kmeans.cc | repo/rabit/lib/librabit.a repo/dmlc-core/libdmlc.a
+ $(MAKE) -C learn/kmeans kmeans.dmlc DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
bin/kmeans.dmlc: learn/kmeans/kmeans.dmlc
cp $+ $@
kmeans: bin/kmeans.dmlc
# lbfgs
learn/lbfgs-linear/lbfgs.dmlc: learn/lbfgs-linear/lbfgs.cc | repo/rabit/lib/librabit.a repo/dmlc-core/libdmlc.a
+ $(MAKE) -C learn/lbfgs-linear lbfgs.dmlc DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
bin/lbfgs.dmlc: learn/lbfgs-linear/lbfgs.dmlc
cp $+ $@
lbfgs: bin/lbfgs.dmlc
# linear
learn/linear/build/linear.dmlc: ps-lite core repo/ps-lite/build/libps.a repo/dmlc-core/libdmlc.a
$(MAKE) -C learn/linear config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
bin/linear.dmlc: learn/linear/build/linear.dmlc
cp $+ $@
linear: bin/linear.dmlc
# FM
learn/difacto/build/difacto.dmlc: ps-lite core repo/ps-lite/build/libps.a repo/dmlc-core/libdmlc.a
$(MAKE) -C learn/difacto config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
bin/difacto.dmlc: learn/difacto/build/difacto.dmlc
cp $+ $@
difacto: bin/difacto.dmlc
# tools
bin/convert.dmlc:
$(MAKE) -C learn/tool convert config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
cp learn/tool/convert $@
tool: bin/convert.dmlc
# test
include learn/test/build.mk
learn/test/%: ps-lite core repo/ps-lite/build/libps.a repo/dmlc-core/libdmlc.a
$(MAKE) -C learn/test $* config=$(config) DEPS_PATH=$(DEPS_PATH) CXX=$(CXX)
test: $(addprefix learn/test/, $(TEST))
pull:
for prefix in $(REPOS); do \
if [ -d $$prefix ]; then \
cd $$prefix; git pull; cd $(ROOTDIR); \
fi \
done
clean:
for prefix in $(REPOS); do \
if [ -d $$prefix ]; then \
$(MAKE) -C $$prefix clean; \
fi \
done
rm -rf bin/*.dmlc