damiano@1960
|
1 |
# Copyright 2017, pEp Foundation
|
damiano@1953
|
2 |
# This file is part of pEpEngine
|
damiano@1953
|
3 |
# This file may be used under the terms of the GNU General Public License version 3
|
damiano@1953
|
4 |
# see LICENSE.txt
|
damiano@1953
|
5 |
|
damiano@2569
|
6 |
# See `doc/build-<your platform>.md` for documentation on how to build, and customize your build.
|
damiano@1968
|
7 |
|
damiano@3201
|
8 |
# This file sets all the make variables that allow you to customize a build.
|
damiano@3201
|
9 |
# There are 3 ways in which you can customize your build:
|
damiano@3201
|
10 |
# 1) Edit the variable assignments in this file (this is a tracked file, so your repository will be dirty)
|
damiano@3201
|
11 |
# 2) Create `local.conf` and fill it with variable assignments.
|
damiano@3201
|
12 |
# 3) Set the environment variable `BUILD_CONFIG` to an absolute path.
|
damiano@3201
|
13 |
# The variable assignments found in the make file at the path indicated by `BUILD_CONFIG` will be evaluated.
|
damiano@3201
|
14 |
# Customization options are applied in the order given above. Later variable assignments take precedence over earlier ones.
|
damiano@3201
|
15 |
# It is possible to use multiple variants simultaniously.
|
damiano@3201
|
16 |
# If nothing is changed according to these 3 methods, a default configuration for your platform (specified below) will be used for the build.
|
damiano@3201
|
17 |
|
damiano@3201
|
18 |
|
damiano@3201
|
19 |
######### Header #########
|
damiano@3201
|
20 |
HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
|
damiano@3201
|
21 |
|
damiano@3201
|
22 |
|
damiano@2081
|
23 |
######### General #########
|
damiano@2081
|
24 |
# To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
|
damiano@2081
|
25 |
# All the *_INC and *_LIB variables are command line flags, not paths.
|
damiano@2081
|
26 |
# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
|
damiano@1953
|
27 |
|
damiano@3201
|
28 |
BUILD_ON:=$(shell uname)
|
vb@1517
|
29 |
|
damiano@2081
|
30 |
# This variable specifies the platform that the engine should be cross-compiled for.
|
damiano@3201
|
31 |
BUILD_FOR=$(BUILD_ON)
|
damiano@3201
|
32 |
|
damiano@3201
|
33 |
# Cross-compiling is currently not supported.
|
damiano@3201
|
34 |
# Maybe you can hack something with `local.conf`.
|
damiano@3201
|
35 |
ifneq ($(BUILD_ON),$(BUILD_FOR))
|
damiano@3201
|
36 |
$(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
|
damiano@3201
|
37 |
endif
|
damiano@2081
|
38 |
|
damiano@2081
|
39 |
# Installation path prefix for libraries and binaries, except for system.db
|
damiano@3201
|
40 |
PREFIX=$(HOME)
|
damiano@2081
|
41 |
|
vb@4003
|
42 |
# pEp files and directories
|
vb@4003
|
43 |
#
|
vb@4003
|
44 |
# the PER_USER_DIRECTORY will be in $(HOME), respectively
|
vb@4003
|
45 |
# in debug builds the PER_USER_DIRECTORY will be in $(PEP_HOME) instead if set
|
vb@4003
|
46 |
#
|
vb@4003
|
47 |
# PER_MACHINE_DIRECTORY is calculated depending on platform; overwrite if
|
vb@4003
|
48 |
# necessary
|
vb@4003
|
49 |
|
vb@4003
|
50 |
#PER_USER_DIRECTORY=.pEp
|
vb@4003
|
51 |
#PER_MACHINE_DIRECTORY=/usr/local/share/pEp
|
damiano@2081
|
52 |
|
damiano@2081
|
53 |
# Filename of the pEpEngine library
|
damiano@3201
|
54 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
55 |
TARGET=libpEpEngine.so
|
damiano@3201
|
56 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
57 |
TARGET=libpEpEngine.dylib
|
damiano@3201
|
58 |
endif
|
damiano@3201
|
59 |
|
damiano@3201
|
60 |
# If empty, create a release build.
|
damiano@3201
|
61 |
# Otherwise, create a debug build.
|
damiano@3202
|
62 |
# This variable is ineffective when set anywhere else but here.
|
damiano@3201
|
63 |
DEBUG=placeholder
|
damiano@3201
|
64 |
|
damiano@3201
|
65 |
# If empty, suppress compiler warnings.
|
damiano@3201
|
66 |
# Otherwise, print warnings.
|
damiano@3202
|
67 |
# This variable is ineffective when set anywhere else but here.
|
damiano@3201
|
68 |
WARN=placeholder
|
damiano@2081
|
69 |
|
damiano@2081
|
70 |
|
damiano@2081
|
71 |
######### C and C++ #########
|
damiano@3201
|
72 |
TARGET_ARCH=
|
damiano@2211
|
73 |
|
damiano@2081
|
74 |
# The following two variables will be appended to.
|
damiano@3202
|
75 |
# You can thus not set them to a final, fixed value here.
|
damiano@3201
|
76 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
77 |
LDFLAGS=
|
damiano@3201
|
78 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
79 |
# "-bind_at_load" helps find symbol resolution errors faster
|
damiano@3201
|
80 |
LDFLAGS=-bind_at_load
|
damiano@3201
|
81 |
endif
|
damiano@2081
|
82 |
|
damiano@3201
|
83 |
LDLIBS=
|
damiano@2081
|
84 |
|
damiano@2081
|
85 |
|
damiano@2081
|
86 |
######### C #########
|
damiano@3201
|
87 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
88 |
CC=gcc -std=c99 -pthread
|
damiano@3201
|
89 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
90 |
# clang issues a warning when "-pthread" is used for linking.
|
damiano@3201
|
91 |
# So, include it in CFLAGS, and not in CC
|
damiano@3201
|
92 |
CC=clang -std=c99
|
damiano@3201
|
93 |
endif
|
damiano@2081
|
94 |
|
damiano@3201
|
95 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
96 |
CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
|
damiano@3201
|
97 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
98 |
CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
|
damiano@3201
|
99 |
endif
|
damiano@2081
|
100 |
|
damiano@3201
|
101 |
# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
|
damiano@3201
|
102 |
# The tests do not work properly, if compiled with -DNDEBUG
|
damiano@3201
|
103 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
104 |
ifdef WARN
|
damiano@3201
|
105 |
CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
|
damiano@3201
|
106 |
else
|
damiano@3201
|
107 |
CFLAGS+= -w
|
damiano@3201
|
108 |
endif
|
damiano@3201
|
109 |
ifdef DEBUG
|
damiano@3201
|
110 |
CFLAGS+= -g -ggdb -DDEBUG_ERRORSTACK
|
damiano@3201
|
111 |
else
|
damiano@3201
|
112 |
CFLAGS+= -O3 -DNDEBUG
|
damiano@3201
|
113 |
endif
|
damiano@3201
|
114 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
115 |
ifdef WARN
|
damiano@3201
|
116 |
# FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
|
damiano@3201
|
117 |
CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
|
damiano@3201
|
118 |
else
|
damiano@3201
|
119 |
CFLAGS+= -w
|
damiano@3201
|
120 |
endif
|
damiano@3201
|
121 |
ifdef DEBUG
|
damiano@3201
|
122 |
CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
|
damiano@3201
|
123 |
else
|
damiano@3201
|
124 |
CFLAGS+= -O3 -DNDEBUG
|
damiano@3201
|
125 |
endif
|
damiano@3201
|
126 |
endif
|
damiano@2081
|
127 |
|
damiano@2081
|
128 |
# Additional CFLAGS used for compiling ASN1C-generated code
|
damiano@3201
|
129 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
130 |
# The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning
|
damiano@3201
|
131 |
# _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
|
damiano@3201
|
132 |
# otherwise printed during the compilation of every asn1c-generated C file.
|
damiano@3201
|
133 |
# It's a glibc specific warning, only present in few versions around ~2.19.
|
damiano@3201
|
134 |
# See https://lwn.net/Articles/590381/ for a discussion.
|
damiano@3201
|
135 |
CFLAGS_GENERATED=-D_DEFAULT_SOURCE
|
damiano@3201
|
136 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
137 |
CFLAGS_GENERATED=
|
damiano@3201
|
138 |
endif
|
damiano@2081
|
139 |
|
damiano@2081
|
140 |
|
damiano@2081
|
141 |
######### C++ #########
|
damiano@3201
|
142 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
143 |
CXX=g++ -std=gnu++11 -pthread
|
damiano@3201
|
144 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
145 |
# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
|
damiano@3201
|
146 |
CXX=clang -std=c++11
|
damiano@3201
|
147 |
endif
|
damiano@2081
|
148 |
|
damiano@3201
|
149 |
# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
|
damiano@3201
|
150 |
# The tests do not work properly, if compiled with -DNDEBUG
|
damiano@3201
|
151 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3201
|
152 |
CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
|
damiano@3201
|
153 |
ifdef WARN
|
damiano@3201
|
154 |
CXXFLAGS+=
|
damiano@3201
|
155 |
else
|
damiano@3201
|
156 |
CXXFLAGS+= -w
|
damiano@3201
|
157 |
endif
|
damiano@3201
|
158 |
ifdef DEBUG
|
damiano@3201
|
159 |
CXXFLAGS+= -g -ggdb
|
damiano@3201
|
160 |
else
|
damiano@3201
|
161 |
CXXFLAGS+= -O3 -DNDEBUG
|
damiano@3201
|
162 |
endif
|
damiano@3201
|
163 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3201
|
164 |
CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
|
damiano@3201
|
165 |
ifdef WARN
|
damiano@3201
|
166 |
CXXFLAGS+=
|
damiano@3201
|
167 |
else
|
damiano@3201
|
168 |
CXXFLAGS+= -w
|
damiano@3201
|
169 |
endif
|
damiano@3201
|
170 |
ifdef DEBUG
|
damiano@3201
|
171 |
CXXFLAGS+= -O0 -g
|
damiano@3201
|
172 |
else
|
damiano@3201
|
173 |
CXXFLAGS+= -O3 -DNDEBUG
|
damiano@3201
|
174 |
endif
|
damiano@3201
|
175 |
endif
|
damiano@3201
|
176 |
|
damiano@3201
|
177 |
|
damiano@3201
|
178 |
######### C and C++ #########
|
krista@4028
|
179 |
ifeq ($(BUILD_FOR),Darwin)
|
krista@4028
|
180 |
CPPFLAGS=-D_DARWIN_C_SOURCE
|
krista@4028
|
181 |
else
|
krista@4028
|
182 |
CPPFLAGS=
|
krista@4028
|
183 |
endif
|
krista@4028
|
184 |
|
damiano@2081
|
185 |
|
damiano@2081
|
186 |
|
damiano@2081
|
187 |
######### YML2 #########
|
damiano@3201
|
188 |
YML2_PATH=$(HOME)/yml2
|
damiano@2081
|
189 |
|
damiano@3202
|
190 |
YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS)
|
damiano@2081
|
191 |
|
damiano@3201
|
192 |
YML2_OPTS=--encoding=utf8
|
damiano@2211
|
193 |
|
damiano@2081
|
194 |
|
damiano@2081
|
195 |
######### asn1c #########
|
damiano@2081
|
196 |
# asn1c binary
|
damiano@3201
|
197 |
ASN1C=asn1c
|
damiano@2081
|
198 |
|
damiano@2081
|
199 |
# asn1c include search flag
|
damiano@3201
|
200 |
ASN1C_INC=
|
damiano@3202
|
201 |
#ASN1C_INC=-I$(HOME)/include
|
damiano@2081
|
202 |
|
damiano@2081
|
203 |
|
damiano@2081
|
204 |
######### libetpan #########
|
damiano@2081
|
205 |
# libetpan library search flag
|
damiano@3201
|
206 |
ETPAN_LIB=
|
damiano@3202
|
207 |
#ETPAN_LIB=-L$(HOME)/lib
|
damiano@2081
|
208 |
|
damiano@2081
|
209 |
# libetpan include search flag
|
damiano@3201
|
210 |
ETPAN_INC=
|
damiano@3202
|
211 |
#ETPAN_INC=-I$(HOME)/include
|
damiano@2081
|
212 |
|
damiano@2081
|
213 |
|
vb@3443
|
214 |
######### pEp MIME #########
|
vb@3443
|
215 |
# set this to skip libetpan and use PEP_MIME instead
|
vb@3443
|
216 |
# PEP_MIME=1
|
vb@3443
|
217 |
#
|
vb@3443
|
218 |
# pEp MIME library search flag
|
vb@3443
|
219 |
PEP_MIME_LIB=
|
vb@3443
|
220 |
# pEp MIME include search flag
|
vb@3443
|
221 |
PEP_MIME_INC=
|
vb@3443
|
222 |
|
vb@3443
|
223 |
|
damiano@2081
|
224 |
######### sqlite3 #########
|
damiano@2081
|
225 |
# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
|
damiano@2081
|
226 |
# Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
|
damiano@3201
|
227 |
SQLITE3_FROM_OS=placeholder
|
damiano@2081
|
228 |
|
damiano@2081
|
229 |
|
damiano@2081
|
230 |
######### OpenPGP #########
|
damiano@2081
|
231 |
# Path of GPG binary
|
damiano@2163
|
232 |
# gpgconf is not available for old version of GPG, for example GPG 2.0.30. Override this variable, if you compile the engine for such an old version.
|
damiano@3201
|
233 |
GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
|
damiano@2081
|
234 |
|
damiano@3237
|
235 |
# Selects OpenPGP implementation. must be either `SEQUOIA`, `GPG` or `NETPGP`
|
damiano@3201
|
236 |
OPENPGP=GPG
|
damiano@2081
|
237 |
|
damiano@3236
|
238 |
# Sequoia-specific variables
|
krista@3428
|
239 |
SEQUOIA_CFLAGS=
|
krista@3428
|
240 |
SEQUOIA_LDFLAGS=
|
krista@3428
|
241 |
SEQUOIA_LIB=
|
krista@3428
|
242 |
SEQUOIA_INC=
|
damiano@3236
|
243 |
|
damiano@3201
|
244 |
# libGPGME filename
|
damiano@3284
|
245 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3284
|
246 |
LIBGPGME=libgpgme.so.11
|
damiano@3284
|
247 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@3284
|
248 |
LIBGPGME=libgpgme.11.dylib
|
damiano@3201
|
249 |
endif
|
damiano@2081
|
250 |
|
damiano@2081
|
251 |
# libGPGME library search flag
|
damiano@3201
|
252 |
GPGME_LIB=
|
damiano@3201
|
253 |
#GPGME_LIB=-L$(HOME)/lib
|
damiano@2081
|
254 |
|
damiano@2081
|
255 |
# libGPGME include search flag
|
damiano@3201
|
256 |
GPGME_INC=
|
damiano@3201
|
257 |
#GPGME_INC=-I$(HOME)/include
|
damiano@2081
|
258 |
|
damiano@2081
|
259 |
# NETPGP library search flag
|
damiano@3201
|
260 |
NETPGP_LIB=
|
damiano@3202
|
261 |
#NETPGP_LIB=-L$(HOME)/lib
|
damiano@2081
|
262 |
|
damiano@2081
|
263 |
# libGPGME include search flag
|
damiano@3201
|
264 |
NETPGP_INC=
|
damiano@3202
|
265 |
#NETPGP_INC=-I$(HOME)/include
|
damiano@2081
|
266 |
|
damiano@2081
|
267 |
|
krista@3428
|
268 |
|
damiano@3201
|
269 |
######### CppUnit #########
|
damiano@3201
|
270 |
# CppUnit library search flag
|
damiano@3201
|
271 |
CPPUNIT_LIB=
|
damiano@3201
|
272 |
#CPPUNIT_LIB=-L$(HOME)/local/lib
|
damiano@3201
|
273 |
|
damiano@3201
|
274 |
# CppUnit include search flag
|
damiano@3201
|
275 |
CPPUNIT_INC=
|
damiano@3201
|
276 |
#CPPUNIT_INC=-I$(HOME)/local/inc
|
damiano@3201
|
277 |
|
damiano@3201
|
278 |
|
damiano@2081
|
279 |
######### Engine internals #########
|
damiano@2081
|
280 |
# C macros (not environment variables) that can be overridden:
|
damiano@2081
|
281 |
# DEFAULT_KEYSERVER - string with default keyserver
|
damiano@2081
|
282 |
# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
|
damiano@2081
|
283 |
# Example:
|
damiano@2081
|
284 |
# EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
|
damiano@3201
|
285 |
EXTRA_MACROS=
|
damiano@3201
|
286 |
|
damiano@3201
|
287 |
|
damiano@3201
|
288 |
######### Misc #########
|
damiano@3580
|
289 |
# FIXME Maybe include these variables here.
|
damiano@3580
|
290 |
# Check how they are used throughout the project before setting them here
|
damiano@3580
|
291 |
#LLDB_BIN
|
damiano@3580
|
292 |
|
damiano@3202
|
293 |
# Add this for running tests in debugger
|
damiano@3202
|
294 |
#TEST_DEBUGGER=lldb --batch -o r
|
vb@2750
|
295 |
|
damiano@3202
|
296 |
# comma-separated list of tests to exclude from gensuite (relevant for running tests only)
|
damiano@3202
|
297 |
EXCLUDE=
|
damiano@3201
|
298 |
|
damiano@3201
|
299 |
|
damiano@3201
|
300 |
######### Footer #########
|
damiano@3201
|
301 |
-include $(HERE)/local.conf
|
damiano@3201
|
302 |
|
damiano@3201
|
303 |
ifdef BUILD_CONFIG
|
damiano@3201
|
304 |
include $(BUILD_CONFIG)
|
damiano@3201
|
305 |
endif
|
damiano@3201
|
306 |
|
krista@3428
|
307 |
######### Post processing assignments ########
|
krista@3435
|
308 |
# These variables are ineffective when set anywhere else but here.
|
krista@3428
|
309 |
ifeq ($(OPENPGP),SEQUOIA)
|
krista@3428
|
310 |
SEQUOIA_CFLAGS=$(shell pkg-config --cflags-only-other sequoia-openpgp)
|
krista@3428
|
311 |
SEQUOIA_LDFLAGS=$(shell pkg-config --libs-only-l --libs-only-other sequoia-openpgp)
|
krista@3428
|
312 |
SEQUOIA_LIB=$(shell pkg-config --libs-only-L sequoia-openpgp)
|
krista@3428
|
313 |
SEQUOIA_INC=$(shell pkg-config --cflags-only-I sequoia-openpgp)
|
krista@3428
|
314 |
CFLAGS+= $(SEQUOIA_CFLAGS)
|
krista@3428
|
315 |
LD_FLAGS+= $(SEQUOIA_LDFLAGS)
|
krista@3428
|
316 |
endif
|
krista@3428
|
317 |
|
damiano@3201
|
318 |
# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
|
damiano@3201
|
319 |
export YML_PATH=$(YML2_PATH)
|