-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.in
153 lines (118 loc) · 4.62 KB
/
Makefile.in
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
149
150
151
152
153
IS_MACOS:=$(shell test -d /Library && echo macos)
ifneq ($(IS_MACOS),) # Mac compile
CPPFLAGS=-DHAVE_SHA1
LIBS=-lz -lpthread -lcrypto
RUBY_LDFLAGS?=-shared
RUBY_LIB?=-lruby
SO_PYTHON=so
SO_RUBY=bundle
endif
ifeq ($(IS_MACOS),) # Linux compile
CPPFLAGS=-DHAVE_SHA1
LIBS=-lz -lpthread -lcrypto -lrt
RUBY_LDFLAGS?=-shared
RUBY_LIB?=-lruby18
SO_PYTHON=so
SO_RUBY=rb.so
endif
PYTHON_INSTALLDIR?=@PYTHON_INSTALL_PATH@
PYTHON_INCLUDE?=@PYTHON_INCLUDES@
PYTHON_LIB?=@PYTHON_LIB@
RUBY_INCLUDE?=-I@RUBY_EXT_INC@
RUBY_INSTALLDIR?=@RUBY_EXT_INC@
A=a
O=o
CC=gcc $(CPPFLAGS) $(CFLAGS) -pg -g -fPIC -Wimplicit
CXX=g++ $(CPPFLAGS) $(CXXFLAGS) -pg -g -fPIC -Wimplicit
INSTALL=/usr/bin/install -c
DEP=cpp -
MODELS= src/ml/model_cv_dtree.cpp \
src/ml/model_cv_ann.cpp \
src/ml/model_cv_svm.cpp \
src/ml/model_cv_linear.cpp \
src/ml/model_perceptron.c \
src/ml/model_knearest.c
VAR_SELECTORS=\
src/ml/varselect_cv_dtree.cpp
ML_SOURCES=src/ml/cvtools.cpp \
src/ml/dataset.c \
src/ml/model.c \
src/ml/model_select.c \
src/ml/text.c \
src/ml/transform.c \
src/ml/var_selection.c
CODE_GENERATORS=\
src/vm/codegen_python.c \
src/vm/codegen_ruby.c \
src/vm/codegen_js.c \
src/vm/codegen_c.c
VM_SOURCES=\
src/vm/ast.c \
src/vm/ast_transforms.c \
src/vm/codegen.c \
src/vm/environment.c
JOB_ENGINE=src/jobs/datacache.c \
src/jobs/job.c \
src/jobs/net/distribute.c \
src/jobs/net/protocol.c \
src/jobs/net/server.c
MRSCAKE_SOURCES=$(MODELS) $(VAR_SELECTORS) $(CODE_GENERATORS) \
$(ML_SOURCES) $(VM_SOURCES) $(JOB_ENGINE) \
src/constant.c \
src/dict.c \
src/io.c \
src/list.c \
src/util.c \
src/serialize.c \
src/settings.c \
src/stringpool.c \
src/mrscake.c
CV_SOURCES=\
src/ml/opencv/alloc.cpp src/ml/opencv/ann_mlp.cpp src/ml/opencv/arithm.cpp src/ml/opencv/array.cpp src/ml/opencv/boost.cpp src/ml/opencv/cnn.cpp src/ml/opencv/convert.cpp src/ml/opencv/copy.cpp src/ml/opencv/data.cpp \
src/ml/opencv/datastructs.cpp src/ml/opencv/ertrees.cpp src/ml/opencv/estimate.cpp src/ml/opencv/gbt.cpp src/ml/opencv/inner_functions.cpp src/ml/opencv/knearest.cpp src/ml/opencv/mathfuncs.cpp src/ml/opencv/matmul.cpp \
src/ml/opencv/matrix.cpp src/ml/opencv/missing.cpp src/ml/opencv/persistence.cpp src/ml/opencv/precomp.cpp src/ml/opencv/rand.cpp src/ml/opencv/rtrees.cpp src/ml/opencv/stat.cpp src/ml/opencv/svm.cpp src/ml/opencv/system.cpp src/ml/opencv/tables.cpp \
src/ml/opencv/testset.cpp src/ml/opencv/tree.cpp
SOURCES=$(MRSCAKE_SOURCES) $(CV_SOURCES)
OBJECTS=$(addsuffix .o,$(basename $(SOURCES)))
DEPS=$(addsuffix .dep,$(basename $(SOURCES)))
%.dep: %.c
cpp -I. -MF$@ -MT$< -MM $<
%.dep: %.cpp
cpp -I. -MF$@ -MT$< -MM $<
.deps: $(DEPS)
cat $(DEPS) > .deps
rm -f *.dep net/*.dep lib/*.dep
all: bin/mrscake-job-server mrscake.$(A) python/mrscake.$(SO_PYTHON) ruby/mrscake.$(SO_RUBY)
OPENCV_LIB=src/ml/opencv/libml.a
$(OPENCV_LIB): src/ml/opencv/*.cpp src/ml/opencv/*.hpp src/ml/opencv/*.h
cd src/ml/opencv/;make libml.a
bin/mrscake-job-server: src/jobs/server.$(O) $(OBJECTS) $(OPENCV_LIB)
$(CXX) src/jobs/server.$(O) $(OBJECTS) $(OPENCV_LIB) -o $@ $(LIBS)
%.$(O): %.c
$(CC) -c -I. -Isrc -Isrc/ml -Isrc/vm -Isrc/jobs -Isrc/jobs/net $< -o $@
%.$(O): %.cpp
$(CXX) -c -I. -Isrc -Isrc/ml -Isrc/vm -Isrc/jobs -Isrc/jobs/net -Isrc/vm/opencv $< -o $@
# ------------ static library ----------------
mrscake.$(A): $(OBJECTS)
$(AR) cru $@ $(OBJECTS)
# ------------ python interface --------------
python/mrscake.$(SO_PYTHON): python/mrscake.py.c src/mrscake.h src/list.h $(OBJECTS) $(OPENCV_LIB)
$(CC) $(PYTHON_INCLUDE) -shared -Isrc python/mrscake.py.c $(OBJECTS) $(OPENCV_LIB) -o $@ $(LIBS) $(PYTHON_LIB) -lstdc++
python/python_interpreter: python/python_interpreter.c
$(CC) $(PYTHON_INCLUDE) python/python_interpreter.c -o $@ $(PYTHON_LIB)
# ------------ ruby interface ----------------
ruby/mrscake.$(SO_RUBY): ruby/mrscake.rb.c src/mrscake.h $(OBJECTS) $(OPENCV_LIB)
$(CC) $(RUBY_LDFLAGS) $(RUBY_CPPFLAGS) $(RUBY_INCLUDE) -Isrc ruby/mrscake.rb.c $(OBJECTS) $(OPENCV_LIB) -o $@ $(LIBS) $(RUBY_LIB) -lstdc++
# ------------ installation ------------------
install:
$(INSTALL) ruby/mrscake.$(SO_RUBY) $(RUBY_INSTALLDIR)/mrscake.$(SO_RUBY)
$(INSTALL) python/mrscake.$(SO_PYTHON) $(PYTHON_INSTALLDIR)/mrscake.$(SO_PYTHON)
# ------------ old test code -----------------
test: mrscake.so
python python/test_python_module.py
local-clean:
rm -f *.dep net/*.dep net/*.o lib/*.dep *.o *.obj *.$(O) mrscake.$(SO) predict.$(SO) prediction.$(SO)
clean: local-clean
rm -f lib/*.$(O) lib/*.o lib/*.obj lib/*.a lib/*.gch lib/*.dep
rm -rf *.dSYM
.PHONY: clean all test local-clean