@ -5,116 +5,269 @@
# See `doc/build-<your platform>.md` for documentation on how to build, and customize your build.
# This file sets all the make variables that allow you to customize a build.
# There are 3 ways in which you can customize your build:
# 1) Edit the variable assignments in this file (this is a tracked file, so your repository will be dirty)
# 2) Create `local.conf` and fill it with variable assignments.
# 3) Set the environment variable `BUILD_CONFIG` to an absolute path.
# The variable assignments found in the make file at the path indicated by `BUILD_CONFIG` will be evaluated.
# Customization options are applied in the order given above. Later variable assignments take precedence over earlier ones.
# It is possible to use multiple variants simultaniously.
# If nothing is changed according to these 3 methods, a default configuration for your platform (specified below) will be used for the build.
######### Header #########
HERE := $( dir $( lastword $( MAKEFILE_LIST) ) )
######### General #########
# To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
# All the *_INC and *_LIB variables are command line flags, not paths.
# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
#BUILD_ON:=$(shell uname)
BUILD_ON := $( shell uname)
# This variable specifies the platform that the engine should be cross-compiled for.
#BUILD_FOR=$(BUILD_ON)
BUILD_FOR = $( BUILD_ON)
# Cross-compiling is currently not supported.
# Maybe you can hack something with `local.conf`.
i f n e q ( $( BUILD_ON ) , $( BUILD_FOR ) )
$( error I don' t know how to build for $( BUILD_FOR) on $( BUILD_ON) .)
e n d i f
# Installation path prefix for libraries and binaries, except for system.db
#PREFIX=$(HOME)
PREFIX = $( HOME)
# Installation path for system.db
#SYSTEM_DB=/usr/local/share/pEp/system.db
SYSTEM_DB = /usr/local/share/pEp/system.db
# Filename of the pEpEngine library
#TARGET=libpEpEngine.so
i f e q ( $( BUILD_FOR ) , L i n u x )
TARGET = libpEpEngine.so
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
TARGET = libpEpEngine.dylib
e n d i f
# If empty, create a release build.
# Otherwise, create a debug build.
# This variable is ineffective in your local.conf file.
DEBUG = placeholder
# If empty, suppress compiler warnings.
# Otherwise, print warnings.
# This variable is ineffective in your local.conf file.
WARN = placeholder
######### C and C++ #########
#TARGET_ARCH=
TARGET_ARCH =
# The following two variables will be appended to.
# You can thus not set them to a fixed value here.
#LDFLAGS=
i f e q ( $( BUILD_FOR ) , L i n u x )
LDFLAGS =
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
# "-bind_at_load" helps find symbol resolution errors faster
LDFLAGS = -bind_at_load
e n d i f
#LDLIBS=
LDLIBS =
######### C #########
#CC=
#CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
#CPPFLAGS=
#CFLAGS+= -w -O3 -DNDEBUG
i f e q ( $( BUILD_FOR ) , L i n u x )
CC = gcc -std= c99 -pthread
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
# clang issues a warning when "-pthread" is used for linking.
# So, include it in CFLAGS, and not in CC
CC = clang -std= c99
e n d i f
i f e q ( $( BUILD_FOR ) , L i n u x )
CFLAGS = -fPIC -fstrict-aliasing -fdiagnostics-color= always
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
CFLAGS = -pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
e n d i f
# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
# The tests do not work properly, if compiled with -DNDEBUG
i f e q ( $( BUILD_FOR ) , L i n u x )
ifdef WARN
CFLAGS += -Wall -pedantic -Wstrict-aliasing= 3
else
CFLAGS += -w
endif
ifdef DEBUG
CFLAGS += -g -ggdb -DDEBUG_ERRORSTACK
else
CFLAGS += -O3 -DNDEBUG
endif
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
ifdef WARN
# FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
CFLAGS += -Wall -pedantic -Wno-extended-offsetof
else
CFLAGS += -w
endif
ifdef DEBUG
CFLAGS += -O0 -g -DDEBUG_ERRORSTACK
else
CFLAGS += -O3 -DNDEBUG
endif
e n d i f
# Additional CFLAGS used for compiling ASN1C-generated code
#CFLAGS_GENERATED=-D_DEFAULT_SOURCE
i f e q ( $( BUILD_FOR ) , L i n u x )
# The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning
# _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
# otherwise printed during the compilation of every asn1c-generated C file.
# It's a glibc specific warning, only present in few versions around ~2.19.
# See https://lwn.net/Articles/590381/ for a discussion.
CFLAGS_GENERATED = -D_DEFAULT_SOURCE
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
CFLAGS_GENERATED =
e n d i f
######### C++ #########
#CXX=g++ -std=gnu++11 -pthread
i f e q ( $( BUILD_FOR ) , L i n u x )
CXX = g++ -std= gnu++11 -pthread
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
CXX = clang -std= c++11
e n d i f
# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
# The tests do not work properly, if compiled with -DNDEBUG
i f e q ( $( BUILD_FOR ) , L i n u x )
CXXFLAGS = -fdiagnostics-color= always -I../src -I../asn.1 $( ETPAN_INC)
ifdef WARN
CXXFLAGS +=
else
CXXFLAGS += -w
endif
ifdef DEBUG
CXXFLAGS += -g -ggdb
else
CXXFLAGS += -O3 -DNDEBUG
endif
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
CXXFLAGS = -pthread -fcolor-diagnostics -I../src -I../asn.1 $( ETPAN_INC)
ifdef WARN
CXXFLAGS +=
else
CXXFLAGS += -w
endif
ifdef DEBUG
CXXFLAGS += -O0 -g
else
CXXFLAGS += -O3 -DNDEBUG
endif
e n d i f
#CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC) -w -O3 -DNDEBUG
######### C and C++ #########
CPPFLAGS =
######### YML2 #########
#YML2_PATH=$(HOME)/yml2
YML2_PATH = $( HOME) /yml2
#YML2_PROC=$(YML2_PATH)/yml2proc
YML2_PROC = $( YML2_PATH) /yml2proc
#YML2_OPTS=--encoding=utf8
YML2_OPTS = --encoding= utf8
######### asn1c #########
# asn1c binary
#ASN1C=asn1c
ASN1C = asn1c
# asn1c include search flag
#ASN1C_INC=-I$(HOME)/include
ASN1C_INC =
#ASN1C_INC=-I$(PREFIX)/include
######### libetpan #########
# libetpan library search flag
ETPAN_LIB =
#ETPAN_LIB=-L$(PREFIX)/lib
# libetpan include search flag
ETPAN_INC =
#ETPAN_INC=-I$(PREFIX)/include
######### sqlite3 #########
# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
# Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
#SQLITE3_FROM_OS=placeholder
SQLITE3_FROM_OS = placeholder
######### OpenPGP #########
# Path of GPG binary
# 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.
#GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
GPG_CMD := $( shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }' )
# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
#OPENPGP=GPG
OPENPGP = GPG
# Path of libGPGME binary
#LIBGPGME=libgpgme.so.11
# libGPGME filename
i f e q ( $( BUILD_FOR ) , L i n u x )
LIBGPGME = libgpgme.so.11
e l s e i f e q ( $( BUILD_FOR ) , D a r w i n )
LIBGPGME = libgpgme.11.dylib
e n d i f
# libGPGME library search flag
#GPGME_LIB=
GPGME_LIB =
#GPGME_LIB=-L$(HOME)/lib
# libGPGME include search flag
#GPGME_INC=
GPGME_INC =
#GPGME_INC=-I$(HOME)/include
# NETPGP library search flag
NETPGP_LIB =
#NETPGP_LIB=-L$(PREFIX)/lib
# libGPGME include search flag
NETPGP_INC =
#NETPGP_INC=-I$(PREFIX)/include
######### CppUnit #########
# CppUnit library search flag
CPPUNIT_LIB =
#CPPUNIT_LIB=-L$(HOME)/local/lib
# CppUnit include search flag
CPPUNIT_INC =
#CPPUNIT_INC=-I$(HOME)/local/inc
######### Engine internals #########
# C macros (not environment variables) that can be overridden:
# DEFAULT_KEYSERVER - string with default keyserver
# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
# Example:
# EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
#EXTRA_MACROS=
EXTRA_MACROS =
######### Misc #########
#LLDB_BIN
# add this for running tests in debugger
#TEST_DEBUGGER=lldb --batch -o r
######### Footer #########
- i n c l u d e $( HERE ) / l o c a l . c o n f
i f d e f B U I L D _ C O N F I G
include $( BUILD_CONFIG)
e n d i f
# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
export YML_PATH = $( YML2_PATH)