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@2081
|
6 |
# This file gives an overview over all the parameters that can be easily customized for a build.
|
damiano@2083
|
7 |
# There are three ways in which you can customize your build:
|
damiano@2083
|
8 |
# 1) Edit the variable assignments in this file
|
damiano@2083
|
9 |
# 2) Create `local.conf` and fill it with variable assignments.
|
damiano@2083
|
10 |
# These `local.conf` takes precedence over the assignments below.
|
damiano@2083
|
11 |
# 3) Set the environment variable `BUILD_CONFIG` to an absolute path.
|
damiano@2083
|
12 |
# The variable assignments found at the path indicated by `BUILD_CONFIG` take precedence over the assignments below and the assignments in `local.conf`.
|
damiano@2083
|
13 |
# If nothing is changed according to these 3 methods, a default configuration for your platform will be used for the build.
|
damiano@2081
|
14 |
|
damiano@2081
|
15 |
HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
|
damiano@1968
|
16 |
|
damiano@2081
|
17 |
######### General #########
|
damiano@2081
|
18 |
# To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
|
damiano@2081
|
19 |
# All the *_INC and *_LIB variables are command line flags, not paths.
|
damiano@2081
|
20 |
# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
|
damiano@1953
|
21 |
|
damiano@2081
|
22 |
BUILD_ON:=$(shell uname)
|
vb@1517
|
23 |
|
damiano@2081
|
24 |
# This variable specifies the platform that the engine should be cross-compiled for.
|
damiano@2081
|
25 |
BUILD_FOR=$(BUILD_ON)
|
damiano@2081
|
26 |
|
damiano@2070
|
27 |
# Cross-compiling is currently not supported.
|
damiano@2081
|
28 |
# Maybe you can hack something with `local.conf`.
|
damiano@2081
|
29 |
ifneq ($(BUILD_ON),$(BUILD_FOR))
|
damiano@2081
|
30 |
$(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
|
damiano@2081
|
31 |
endif
|
damiano@2081
|
32 |
|
damiano@2081
|
33 |
# Installation path prefix for libraries and binaries, except for system.db
|
damiano@2081
|
34 |
PREFIX=$(HOME)
|
damiano@2081
|
35 |
|
damiano@2081
|
36 |
# Installation path for system.db
|
damiano@2081
|
37 |
SYSTEM_DB=/usr/local/share/pEp/system.db
|
damiano@2081
|
38 |
|
damiano@2081
|
39 |
# Filename of the pEpEngine library
|
damiano@2081
|
40 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
41 |
TARGET=libpEpEngine.so
|
damiano@2081
|
42 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
43 |
TARGET=libpEpEngine.dylib
|
damiano@2081
|
44 |
endif
|
damiano@2081
|
45 |
|
damiano@2081
|
46 |
# If empty, create a release build.
|
damiano@2081
|
47 |
# Otherwise, create a debug build.
|
damiano@2146
|
48 |
# This variable is ineffective in your local.conf file.
|
krista@2101
|
49 |
DEBUG=YES
|
damiano@2081
|
50 |
|
damiano@2081
|
51 |
# If empty, suppress compiler warnings.
|
damiano@2081
|
52 |
# Otherwise, print warnings.
|
damiano@2146
|
53 |
# This variable is ineffective in your local.conf file.
|
damiano@2081
|
54 |
WARN=placeholder
|
damiano@2081
|
55 |
|
damiano@2081
|
56 |
|
damiano@2081
|
57 |
######### C and C++ #########
|
damiano@2081
|
58 |
TARGET_ARCH=
|
damiano@2081
|
59 |
# The following two variables will be appended to.
|
damiano@2081
|
60 |
# You can thus not set them to a fixed value here.
|
damiano@2081
|
61 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
62 |
LDFLAGS=
|
damiano@2081
|
63 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
64 |
# "-bind_at_load" helps find symbol resolution errors faster
|
damiano@2081
|
65 |
LDFLAGS=-bind_at_load
|
damiano@2081
|
66 |
endif
|
damiano@2081
|
67 |
|
damiano@2081
|
68 |
LDLIBS=
|
damiano@2081
|
69 |
|
damiano@2081
|
70 |
|
damiano@2081
|
71 |
######### C #########
|
damiano@2081
|
72 |
ifeq ($(BUILD_FOR),Linux)
|
krista@2123
|
73 |
CC=gcc -std=c99 -pthread
|
damiano@2081
|
74 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2083
|
75 |
# clang issues a warning when "-pthread" is used for linking.
|
damiano@2083
|
76 |
# So, include it in CFLAGS, and not in CC
|
krista@2123
|
77 |
CC=clang -std=c99
|
damiano@2081
|
78 |
endif
|
damiano@2081
|
79 |
|
damiano@2081
|
80 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
81 |
CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
|
damiano@2081
|
82 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
83 |
CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
|
damiano@2081
|
84 |
endif
|
damiano@2081
|
85 |
|
damiano@2081
|
86 |
CPPFLAGS=
|
damiano@2081
|
87 |
|
damiano@2081
|
88 |
# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
|
damiano@2081
|
89 |
# The tests do not work properly, if compiled with -DNDEBUG
|
damiano@2081
|
90 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
91 |
ifdef WARN
|
damiano@2081
|
92 |
CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
|
damiano@2081
|
93 |
else
|
damiano@2081
|
94 |
CFLAGS+= -w
|
damiano@2081
|
95 |
endif
|
damiano@2081
|
96 |
ifdef DEBUG
|
damiano@2081
|
97 |
CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK
|
damiano@2081
|
98 |
else
|
damiano@2081
|
99 |
CFLAGS+= -O3 -DNDEBUG
|
damiano@2081
|
100 |
endif
|
damiano@2161
|
101 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
102 |
ifdef WARN
|
damiano@2081
|
103 |
# FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
|
damiano@2081
|
104 |
CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
|
damiano@2081
|
105 |
else
|
damiano@2081
|
106 |
CFLAGS+= -w
|
damiano@2081
|
107 |
endif
|
damiano@2081
|
108 |
ifdef DEBUG
|
damiano@2081
|
109 |
CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
|
damiano@2081
|
110 |
else
|
damiano@2081
|
111 |
CFLAGS+= -O3 -DNDEBUG
|
damiano@2081
|
112 |
endif
|
damiano@2081
|
113 |
endif
|
damiano@2081
|
114 |
|
damiano@2081
|
115 |
# Additional CFLAGS used for compiling ASN1C-generated code
|
damiano@2081
|
116 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2083
|
117 |
# The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning
|
damiano@2083
|
118 |
# _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
|
damiano@2083
|
119 |
# otherwise printed during the compilation of every asn1c-generated C file.
|
damiano@2083
|
120 |
# It's a glibc specific warning, only present in few versions around ~2.19.
|
damiano@2083
|
121 |
# See https://lwn.net/Articles/590381/ for a discussion.
|
damiano@2081
|
122 |
CFLAGS_GENERATED=-D_DEFAULT_SOURCE
|
damiano@2081
|
123 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
124 |
CFLAGS_GENERATED=
|
damiano@2081
|
125 |
endif
|
damiano@2081
|
126 |
|
damiano@2081
|
127 |
|
damiano@2081
|
128 |
######### C++ #########
|
damiano@2081
|
129 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
130 |
CXX=g++ -std=gnu++11 -pthread
|
damiano@2081
|
131 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
132 |
# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
|
damiano@2081
|
133 |
CXX=clang -std=c++11
|
damiano@1953
|
134 |
endif
|
damiano@2081
|
135 |
|
damiano@2081
|
136 |
# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
|
damiano@2081
|
137 |
# The tests do not work properly, if compiled with -DNDEBUG
|
damiano@2081
|
138 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
139 |
CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
|
damiano@2081
|
140 |
ifdef WARN
|
damiano@2081
|
141 |
CXXFLAGS+=
|
damiano@2081
|
142 |
else
|
damiano@2081
|
143 |
CXXFLAGS+= -w
|
damiano@2081
|
144 |
endif
|
damiano@2081
|
145 |
ifdef DEBUG
|
damiano@2081
|
146 |
CXXFLAGS+= -Og -ggdb
|
damiano@2081
|
147 |
else
|
damiano@2081
|
148 |
CXXFLAGS+= -O3 -DNDEBUG
|
damiano@2081
|
149 |
endif
|
damiano@2081
|
150 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
151 |
CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
|
damiano@2081
|
152 |
ifdef WARN
|
damiano@2081
|
153 |
CXXFLAGS+=
|
damiano@2081
|
154 |
else
|
damiano@2081
|
155 |
CXXFLAGS+= -w
|
damiano@2081
|
156 |
endif
|
damiano@2081
|
157 |
ifdef DEBUG
|
damiano@2081
|
158 |
CXXFLAGS+= -O0 -g
|
damiano@2081
|
159 |
else
|
damiano@2081
|
160 |
CXXFLAGS+= -O3 -DNDEBUG
|
damiano@2081
|
161 |
endif
|
damiano@1958
|
162 |
endif
|
damiano@2081
|
163 |
|
damiano@2081
|
164 |
|
damiano@2081
|
165 |
######### YML2 #########
|
damiano@2081
|
166 |
YML2_PATH=$(HOME)/yml2
|
damiano@2081
|
167 |
|
damiano@2081
|
168 |
YML2_PROC=$(YML2_PATH)/yml2proc
|
damiano@2081
|
169 |
|
damiano@2081
|
170 |
YML2_OPTS=--encoding=utf8
|
damiano@2081
|
171 |
|
krista@2141
|
172 |
export YML_PATH=$(YML2_PATH)
|
damiano@2081
|
173 |
|
damiano@2081
|
174 |
######### asn1c #########
|
damiano@2081
|
175 |
# asn1c binary
|
damiano@2081
|
176 |
ASN1C=asn1c
|
damiano@2081
|
177 |
|
damiano@2081
|
178 |
# asn1c include search flag
|
damiano@2081
|
179 |
ASN1C_INC=
|
damiano@2081
|
180 |
#ASN1C_INC=-I$(HOME)/include
|
damiano@2081
|
181 |
|
damiano@2081
|
182 |
|
damiano@2081
|
183 |
######### libetpan #########
|
damiano@2081
|
184 |
# libetpan library search flag
|
damiano@2081
|
185 |
ETPAN_LIB=-L$(PREFIX)/lib
|
damiano@2081
|
186 |
|
damiano@2081
|
187 |
# libetpan include search flag
|
damiano@2081
|
188 |
ETPAN_INC=-I$(PREFIX)/include
|
damiano@2081
|
189 |
|
damiano@2081
|
190 |
|
damiano@2081
|
191 |
######### sqlite3 #########
|
damiano@2081
|
192 |
# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
|
damiano@2081
|
193 |
# Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
|
damiano@2081
|
194 |
SQLITE3_FROM_OS=placeholder
|
damiano@2081
|
195 |
|
damiano@2081
|
196 |
|
damiano@2081
|
197 |
######### OpenPGP #########
|
damiano@2081
|
198 |
# Path of GPG binary
|
damiano@2163
|
199 |
# 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@2081
|
200 |
GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
|
damiano@2081
|
201 |
|
damiano@2081
|
202 |
# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
|
damiano@2081
|
203 |
OPENPGP=GPG
|
damiano@2081
|
204 |
|
damiano@2081
|
205 |
# Path of libGPGME binary
|
damiano@2081
|
206 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
207 |
LIBGPGME=libgpgme.so.11
|
damiano@2081
|
208 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
209 |
LIBGPGME=libgpgme.dylib
|
damiano@2081
|
210 |
endif
|
damiano@2081
|
211 |
|
damiano@2081
|
212 |
# libGPGME library search flag
|
damiano@2081
|
213 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
214 |
GPGME_LIB=
|
damiano@2081
|
215 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
216 |
GPGME_LIB=-L$(HOME)/lib
|
damiano@2081
|
217 |
endif
|
damiano@2081
|
218 |
|
damiano@2081
|
219 |
# libGPGME include search flag
|
damiano@2081
|
220 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@2081
|
221 |
GPGME_INC=
|
damiano@2081
|
222 |
else ifeq ($(BUILD_FOR),Darwin)
|
damiano@2081
|
223 |
GPGME_INC=-I$(HOME)/include
|
damiano@2081
|
224 |
endif
|
damiano@2081
|
225 |
|
damiano@2081
|
226 |
# NETPGP library search flag
|
damiano@2081
|
227 |
NETPGP_LIB=
|
damiano@2081
|
228 |
#NETPGP_LIB=-L$(PREFIX)/lib
|
damiano@2081
|
229 |
|
damiano@2081
|
230 |
# libGPGME include search flag
|
damiano@2081
|
231 |
NETPGP_INC=
|
damiano@2081
|
232 |
#NETPGP_INC=-I$(PREFIX)/include
|
damiano@2081
|
233 |
|
damiano@2081
|
234 |
|
damiano@2081
|
235 |
######### Engine internals #########
|
damiano@2081
|
236 |
# C macros (not environment variables) that can be overridden:
|
damiano@2081
|
237 |
# DEFAULT_KEYSERVER - string with default keyserver
|
damiano@2081
|
238 |
# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
|
damiano@2081
|
239 |
# Example:
|
damiano@2081
|
240 |
# EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
|
damiano@2081
|
241 |
EXTRA_MACROS=
|
damiano@2081
|
242 |
|
damiano@2081
|
243 |
|
damiano@2081
|
244 |
######### Misc #########
|
damiano@2081
|
245 |
# FIXME Maybe include these variables here.
|
damiano@2081
|
246 |
# Check how they are used throughout the project before setting them here
|
damiano@2081
|
247 |
#LLDB_BIN
|
damiano@2081
|
248 |
|
damiano@2081
|
249 |
|
damiano@2086
|
250 |
-include $(HERE)/local.conf
|
damiano@2083
|
251 |
|
damiano@2087
|
252 |
ifdef BUILD_CONFIG
|
damiano@2087
|
253 |
-include $(BUILD_CONFIG)
|
damiano@2083
|
254 |
endif
|