forked from arangodb/arangodb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
259 lines (203 loc) · 7.8 KB
/
GNUmakefile
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# -*- mode: Makefile; -*-
## -----------------------------------------------------------------------------
## --SECTION-- COMMON VARIABLES
## -----------------------------------------------------------------------------
SRC=$(shell pwd |sed "s;.*/;;")
.PHONY: warning help
warning:
@echo "ArangoDB has switched to CMAKE. In order to compile, use:"
@echo ""
@echo " mkdir -p build"
@echo " cd build"
@echo " cmake .. -DCMAKE_BUILD_TYPE=Release"
@echo " make"
@echo ""
@echo "MacOS users:"
@echo " Please use OPENSSL from homebrew and use"
@echo ""
@echo " cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_BUILD_TYPE=Release"
@echo ""
@echo " Note that some versions of Apple's clang have severe performance"
@echo " issues. Use GCC5 from homebrew in this case."
@echo ""
@echo "Use 'make help' to see more options."
help:
@echo "The most common -D<options> are"
@echo ""
@echo " -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-5"
@echo " sets the C++ compiler"
@echo " -DCMAKE_C_COMPILER=/usr/local/bin/gcc-5"
@echo " sets the C compiler"
@echo ""
@echo "ArangoDB supports:"
@echo ""
@echo " -DUSE_BACKTRACE=off"
@echo " if ON, enables backtraces in fatal errors"
@echo " -DUSE_FAILURE_TESTS=off"
@echo " if ON, add failure functions for testing"
@echo " -DUSE_MAINTAINER_MODE=off"
@echo " if ON, enable maintainer features"
@echo ""
@echo "BOOST supports:"
@echo ""
@echo " -DUSE_BOOST_SYSTEM_LIBS=off"
@echo " if ON, use the operating system Boost installation"
@echo " -DUSE_BOOST_UNITTESTS=on"
@echo " if ON, use Boost unittest framework if this available"
@echo ""
@echo "OPENSSL supports:"
@echo " -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
@echo " sets the location of the openssl includes and libraries"
@echo ""
@echo "JEMALLOC supports:"
@echo " -DUSE_JEMALLOC=on"
@echo " if ON, link against JEMALLOC"
@echo ""
@echo "TCMALLOC supports:"
@echo " -DUSE_TCMALLOC=on"
@echo " if ON, link against TCMALLOC"
@echo ""
@echo "V8 supports:"
@echo " -DUSE_PRECOMPILED_V8=off"
@echo " if ON, use precompiled V8 libraries"
@echo ""
@echo "ZLIB supports:"
@echo " -DASM686=on"
@echo " if ON, enables building i686 assembly implementation"
@echo " -DAMD64=on"
@echo " if ON, enables building amd64 assembly implementation"
## -----------------------------------------------------------------------------
## --SECTION-- CMAKE & CPACK
## -----------------------------------------------------------------------------
################################################################################
### @brief MacOSX bundle
################################################################################
.PHONY: pack-dmg pack-dmg-cmake
DMG_NAME := ArangoDB-CLI.app
pack-dmg:
rm -rf Build && mkdir Build
${MAKE} pack-dmg-cmake
pack-dmg-cmake:
cd Build && cmake \
-D "USE_OPTIMIZE_FOR_ARCHITECTURE=Off" \
-D "CMAKE_BUILD_TYPE=RelWithDebInfo" \
-D "CMAKE_OSX_DEPLOYMENT_TARGET=10.10" \
-D "CMAKE_INSTALL_PREFIX=/opt/arangodb" \
-D "OPENSSL_ROOT_DIR=`brew --prefix`/opt/openssl" \
..
cd Build && ${MAKE}
cd Build && cpack \
-G Bundle \
-D "CPACK_INSTALL_PREFIX=${DMG_NAME}/Contents/MacOS/opt/arangodb"
################################################################################
### @brief MacOSXcode
################################################################################
.PHONY: pack-macosxcode pack-macosxcode-cmake
PACK_DESTDIR ?= .
pack-macosxcode:
rm -rf Build && mkdir Build
${MAKE} -f GNUMakefile pack-macosxcode-cmake MOREOPTS='$(MOREOPTS)'
pack-macosxcode-cmake:
cd Build && cmake \
-D "USE_OPTIMIZE_FOR_ARCHITECTURE=Off" \
-D "CMAKE_BUILD_TYPE=RelWithDebInfo" \
-D "CMAKE_OSX_DEPLOYMENT_TARGET=10.10" \
-D "CMAKE_INSTALL_PREFIX=/opt/arangodb" \
-D "OPENSSL_ROOT_DIR=`brew --prefix`/opt/openssl" \
-G Xcode \
$(MOREOPTS) \
..
################################################################################
### @brief MacOSX
################################################################################
.PHONY: pack-macosx pack-macosx-cmake
PACK_DESTDIR ?= .
pack-macosx:
rm -rf Build && mkdir Build
${MAKE} pack-macosx-cmake MOREOPTS='$(MOREOPTS)'
pack-macosx-cmake:
cd Build && cmake \
-D "BUILD_PACKAGE=dmg-cli" \
-D "CMAKE_INSTALL_PREFIX=${prefix}" \
-D "OPENSSL_INCLUDE=`brew --prefix`/opt/openssl/include" \
-D "OPENSSL_LIB_PATH=`brew --prefix`/opt/openssl/lib" \
-D "OPENSSL_LIBS=`brew --prefix`/opt/openssl/lib/libssl.a;`brew --prefix`/opt/openssl/lib/libcrypto.a" \
$(MOREOPTS) \
..
${MAKE} ${BUILT_SOURCES}
test -d bin || mkdir bin
cd Build && ${MAKE} install DESTDIR=${PACK_DESTDIR}
################################################################################
### @brief debian arm package
################################################################################
.PHONY: pack-arm pack-arm-cmake
pack-arm:
rm -rf Build && mkdir Build
${MAKE} pack-arm-cmake
pack-arm-cmake:
cd Build && cmake \
-D "BUILD_PACKAGE=raspbian" \
-D "CMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -DNDEBUG" \
-D "CMAKE_C_FLAGS_RELEASE:STRING=-O2 -DNDEBUG" \
-D "CMAKE_INSTALL_PREFIX=${prefix}" \
-D "ETCDIR=${sysconfdir}" \
-D "VARDIR=${localstatedir}" \
$(MOREOPTS) \
..
${MAKE} ${BUILT_SOURCES}
cd Build && cpack -G DEB
pack-deb-cmake:
mkdir Build
cd Build && cmake \
-D "CMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -DNDEBUG" \
-D "CMAKE_C_FLAGS_RELEASE:STRING=-O2 -DNDEBUG" \
-D "CMAKE_INSTALL_PREFIX=${prefix}" \
-D "ETCDIR=${sysconfdir}" \
-D "VARDIR=${localstatedir}" \
$(MOREOPTS) \
..
${MAKE} ${BUILT_SOURCES}
cd Build && ${MAKE}
cd Build && cpack -G DEB
################################################################################
### @brief Windows 64-bit bundle
################################################################################
.PHONY: pack-win32 pack-winXX winXX-cmake win64-relative win64-relative-debug
pack-win32:
$(MAKE) pack-winXX BITS=32 TARGET="Visual Studio 14" MOREOPTS='-D "V8_TARGET_ARCHS=Release"'
pack-win64:
$(MAKE) pack-winXX BITS=64 TARGET="Visual Studio 14 Win64" MOREOPTS='-D "V8_TARGET_ARCHS=Release"'
pack-win32-relative:
$(MAKE) pack-winXX BITS=32 TARGET="Visual Studio 14" MOREOPTS='-D "USE_MAINTAINER_MODE=ON" -D "USE_BACKTRACE=ON" -D "V8_TARGET_ARCHS=Debug"'
pack-win64-relative:
$(MAKE) pack-winXX BITS=64 TARGET="Visual Studio 14 Win64" MOREOPTS='-D "USE_MAINTAINER_MODE=ON" -D "USE_BACKTRACE=ON" -D "V8_TARGET_ARCHS=Debug"'
win64-relative:
$(MAKE) winXX-cmake BITS=64 TARGET="Visual Studio 14 Win64" MOREOPTS='-D "V8_TARGET_ARCHS=Debug"'
$(MAKE) winXX-build BITS=64 BUILD_TARGET=RelWithDebInfo
win64-relative-debug:
$(MAKE) winXX-cmake BITS=64 TARGET="Visual Studio 14 Win64" MOREOPTS=' -D "USE_MAINTAINER_MODE=ON" -D "USE_BACKTRACE=ON" -D "V8_TARGET_ARCHS=Debug"'
$(MAKE) winXX-build BITS=64 BUILD_TARGET=Debug
pack-winXX:
rm -rf ../b && mkdir ../b
${MAKE} winXX-cmake BITS="$(BITS)" TARGET="$(TARGET)" BUILD_TARGET=RelWithDebInfo
${MAKE} winXX-build BITS="$(BITS)" TARGET="$(TARGET)" BUILD_TARGET=RelWithDebInfo
${MAKE} packXX BITS="$(BITS)" BUILD_TARGET=RelWithDebInfo
pack-winXX-MOREOPTS:
rm -rf ../b && mkdir ../b
${MAKE} winXX-cmake BITS="$(BITS)" TARGET="$(TARGET)" MOREOPTS=$(MOREOPTS)
${MAKE} winXX-build BITS="$(BITS)" TARGET="$(TARGET)" BUILD_TARGET=Debug
${MAKE} packXX BITS="$(BITS)" TARGET="$(TARGET)" BUILD_TARGET=Debug
winXX-cmake:
cd ../b && cmake \
-G "$(TARGET)" \
-D "CMAKE_BUILD_TYPE=RelWithDebInfo" \
-D "BUILD_TYPE=RelWithDebInfo" \
-D "BUILD_ID=${BUILD_ID}" \
$(MOREOPTS) \
../$(SRC)/
winXX-build:
cp Installation/Windows/Icons/arangodb.ico ../b
cd ../b && cmake --build . --config $(BUILD_TARGET)
packXX:
cd ../b && cpack -G NSIS64 -C $(BUILD_TARGET)
cd ../b && cpack -G ZIP -C $(BUILD_TARGET)