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