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