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