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