forked from VowpalWabbit/vowpal_wabbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
126 lines (102 loc) · 3.67 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
CXX = $(shell which g++)
# -- if you want to test 32-bit use this instead,
# it sometimes reveals type portability issues
# CXX = $(shell which g++) -m32
ifneq ($(CXX),)
#$(warning Using clang: "$(CXX)")
ARCH = -D__extern_always_inline=inline
else
CXX = clang++
$(warning Using clang++)
ARCH = $(shell test `g++ -v 2>&1 | tail -1 | cut -d ' ' -f 3 | cut -d '.' -f 1,2` \< 4.3 && echo -march=nocona || echo -march=native)
endif
ifeq ($(CXX),)
$(warning No compiler found)
exit 1
endif
UNAME := $(shell uname)
LIBS = -l boost_program_options -l pthread -l z
BOOST_INCLUDE = -I /usr/include
BOOST_LIBRARY = -L /usr/lib
NPROCS := 1
ifeq ($(UNAME), Linux)
BOOST_LIBRARY += -L /usr/lib/x86_64-linux-gnu
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq ($(UNAME), FreeBSD)
LIBS = -l boost_program_options -l pthread -l z -l compat
BOOST_INCLUDE = -I /usr/local/include
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq "CYGWIN" "$(findstring CYGWIN,$(UNAME))"
LIBS = -l boost_program_options-mt -l pthread -l z
BOOST_INCLUDE = -I /usr/include
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq ($(UNAME), Darwin)
LIBS = -lboost_program_options-mt -lboost_serialization-mt -l pthread -l z
# On Macs, the location isn't always clear
# brew uses /usr/local
# but /opt/local seems to be preferred by some users
# so we try them both
ifneq (,$(wildcard /usr/local/include))
BOOST_INCLUDE += -I /usr/local/include
BOOST_LIBRARY += -L /usr/local/lib
endif
ifneq (,$(wildcard /opt/local/include))
BOOST_INCLUDE += -I /opt/local/include
BOOST_LIBRARY += -L /opt/local/lib
endif
NPROCS:=$(shell sysctl -n hw.ncpu)
endif
#LIBS = -l boost_program_options-gcc34 -l pthread -l z
OPTIM_FLAGS = -O3 -fomit-frame-pointer -fno-strict-aliasing #-ffast-math #uncomment for speed, comment for testability
ifeq ($(UNAME), FreeBSD)
WARN_FLAGS = -Wall
else
WARN_FLAGS = -Wall -pedantic
endif
# for normal fast execution.
FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) $(OPTIM_FLAGS) -D_FILE_OFFSET_BITS=64 -DNDEBUG $(BOOST_INCLUDE) -fPIC #-DVW_LDA_NO_SSE
# for profiling -- note that it needs to be gcc
#FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) -O2 -fno-strict-aliasing -ffast-math -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -pg -fPIC #-DVW_LDA_NO_S
#CXX = g++
# for valgrind / gdb debugging
#FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) $(ARCH) $(WARN_FLAGS) -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -O0 -fPIC
# for valgrind profiling: run 'valgrind --tool=callgrind PROGRAM' then 'callgrind_annotate --tree=both --inclusive=yes'
#FLAGS = -std=c++0x $(CFLAGS) $(LDFLAGS) -Wall $(ARCH) -ffast-math -D_FILE_OFFSET_BITS=64 $(BOOST_INCLUDE) -g -fomit-frame-pointer -ffast-math -fno-strict-aliasing -fPIC
BINARIES = vw active_interactor
MANPAGES = vw.1
all: vw spanning_tree library_example java
%.1: %
help2man --no-info --name="Vowpal Wabbit -- fast online learning tool" ./$< > $@
export
spanning_tree:
cd cluster; $(MAKE)
vw:
cd vowpalwabbit; $(MAKE) -j $(NPROCS) things
active_interactor:
cd vowpalwabbit; $(MAKE)
library_example: vw
cd library; $(MAKE) things
python: vw
cd python; $(MAKE) things
ifneq ($(JAVA_HOME),)
java: vw
cd java; $(MAKE) things
endif
.FORCE:
test: .FORCE vw library_example
@echo "vw running test-suite..."
(cd test && ./RunTests -d -fe -E 0.001 ../vowpalwabbit/vw ../vowpalwabbit/vw)
install: $(BINARIES)
cd vowpalwabbit; cp $(BINARIES) /usr/local/bin; cd ../cluster; $(MAKE) install
clean:
cd vowpalwabbit && $(MAKE) clean
cd cluster && $(MAKE) clean
cd library && $(MAKE) clean
cd python && $(MAKE) clean
ifneq ($(JAVA_HOME),)
cd java && $(MAKE) clean
endif
.PHONY: all clean install