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