Makefile.conf
branchENGINE-261
changeset 2081 1593ebbb7f31
parent 2070 d834a86b51e9
child 2083 361a6dc2c075
     1.1 --- a/Makefile.conf	Wed Sep 20 11:57:26 2017 +0200
     1.2 +++ b/Makefile.conf	Wed Sep 20 17:53:25 2017 +0200
     1.3 @@ -3,22 +3,237 @@
     1.4  # This file may be used under the terms of the GNU General Public License version 3
     1.5  # see LICENSE.txt
     1.6  
     1.7 -# This file assembles all the make variables that a maintainer or dev may want to adapt for a distribution.
     1.8 +# This file gives an overview over all the parameters that can be easily customized for a build.
     1.9 +# If you want to customized the build configuration without making the working copy unclean, create an addional makefile at `local.conf`.
    1.10 +# `local.conf` will be included at the end of this file, and thus allows overriding any of the variables here.
    1.11 +# If nothing is changed here (or in `local.conf`) a default configuration for your platform will be used.
    1.12  
    1.13 -# To use custom build configuration variables, put them in a new file with the path `build-config/<name>.conf`.
    1.14 -# Execute `export PLATFORM_OVERRIDE=<name>` before running make.
    1.15 -# If this environment variable is not set, make will load a default configuration for your platform.
    1.16 +HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
    1.17  
    1.18 -BUILD_CONFIG:=$(dir $(lastword $(MAKEFILE_LIST)))build-config
    1.19 +######### General #########
    1.20 +# To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
    1.21 +# All the *_INC and *_LIB variables are command line flags, not paths.
    1.22 +# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
    1.23  
    1.24 -include $(BUILD_CONFIG)/common.conf
    1.25 +BUILD_ON:=$(shell uname)
    1.26 +
    1.27 +# This variable specifies the platform that the engine should be cross-compiled for.
    1.28 +BUILD_FOR=$(BUILD_ON)
    1.29 +
    1.30  # Cross-compiling is currently not supported.
    1.31 -# Maybe you can hack something with `PLATFORM_OVERRIDE`
    1.32 -ifeq ($(BUILD_ON),$(BUILD_FOR))
    1.33 -    include $(BUILD_CONFIG)/$(BUILD_ON).conf
    1.34 -else
    1.35 -    $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON))
    1.36 +# Maybe you can hack something with `local.conf`.
    1.37 +ifneq ($(BUILD_ON),$(BUILD_FOR))
    1.38 +    $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
    1.39  endif
    1.40 -ifdef PLATFORM_OVERRIDE
    1.41 -    include $(BUILD_CONFIG)/$(PLATFORM_OVERRIDE).conf
    1.42 +
    1.43 +# Installation path prefix for libraries and binaries, except for system.db
    1.44 +PREFIX=$(HOME)
    1.45 +
    1.46 +# Installation path for system.db
    1.47 +SYSTEM_DB=/usr/local/share/pEp/system.db
    1.48 +
    1.49 +# Filename of the pEpEngine library
    1.50 +ifeq ($(BUILD_FOR),Linux)
    1.51 +    TARGET=libpEpEngine.so
    1.52 +else ifeq ($(BUILD_FOR),Darwin)
    1.53 +    TARGET=libpEpEngine.dylib
    1.54  endif
    1.55 +
    1.56 +# If empty, create a release build.
    1.57 +# Otherwise, create a debug build.
    1.58 +# This variable is ineffective in your override.conf file.
    1.59 +DEBUG=
    1.60 +
    1.61 +# If empty, suppress compiler warnings.
    1.62 +# Otherwise, print warnings.
    1.63 +# This variable is ineffective in your override.conf file.
    1.64 +WARN=placeholder
    1.65 +
    1.66 +
    1.67 +######### C and C++ #########
    1.68 +TARGET_ARCH=
    1.69 +# The following two variables will be appended to.
    1.70 +# You can thus not set them to a fixed value here.
    1.71 +ifeq ($(BUILD_FOR),Linux)
    1.72 +    LDFLAGS=
    1.73 +else ifeq ($(BUILD_FOR),Darwin)
    1.74 +    # "-bind_at_load" helps find symbol resolution errors faster
    1.75 +    LDFLAGS=-bind_at_load
    1.76 +endif
    1.77 +
    1.78 +LDLIBS=
    1.79 +
    1.80 +
    1.81 +######### C #########
    1.82 +ifeq ($(BUILD_FOR),Linux)
    1.83 +    CC=gcc -std=c99 -pthread
    1.84 +else ifeq ($(BUILD_FOR),Darwin)
    1.85 +    # clang issues a warning when "-pthread" is used for linking. So, include it in CFLAGS, and not in CC
    1.86 +    CC=clang -std=c99
    1.87 +endif
    1.88 +
    1.89 +ifeq ($(BUILD_FOR),Linux)
    1.90 +    CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
    1.91 +else ifeq ($(BUILD_FOR),Darwin)
    1.92 +    CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
    1.93 +endif
    1.94 +
    1.95 +CPPFLAGS=
    1.96 +
    1.97 +# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
    1.98 +# The tests do not work properly, if compiled with -DNDEBUG
    1.99 +ifeq ($(BUILD_FOR),Linux)
   1.100 +    ifdef WARN
   1.101 +        CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
   1.102 +    else
   1.103 +        CFLAGS+= -w
   1.104 +    endif
   1.105 +    ifdef DEBUG
   1.106 +        CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK
   1.107 +    else
   1.108 +        CFLAGS+= -O3 -DNDEBUG
   1.109 +    endif
   1.110 +else ifeq ($(BUILD_FOR),Darwin)    
   1.111 +    ifdef WARN
   1.112 +        # FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
   1.113 +        CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
   1.114 +    else
   1.115 +        CFLAGS+= -w
   1.116 +    endif
   1.117 +    ifdef DEBUG
   1.118 +        CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
   1.119 +    else
   1.120 +        CFLAGS+= -O3 -DNDEBUG
   1.121 +    endif
   1.122 +endif
   1.123 +
   1.124 +# Additional CFLAGS used for compiling ASN1C-generated code
   1.125 +ifeq ($(BUILD_FOR),Linux)
   1.126 +    # The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" otherwise printed during the compilation of every asn1c-generated C file. It's a glibc specific warning, only present in few versions around ~2.19. See https://lwn.net/Articles/590381/ for a discussion.
   1.127 +    CFLAGS_GENERATED=-D_DEFAULT_SOURCE
   1.128 +else ifeq ($(BUILD_FOR),Darwin)
   1.129 +    CFLAGS_GENERATED=
   1.130 +endif
   1.131 +
   1.132 +
   1.133 +######### C++ #########
   1.134 +ifeq ($(BUILD_FOR),Linux)
   1.135 +    CXX=g++ -std=gnu++11 -pthread
   1.136 +else ifeq ($(BUILD_FOR),Darwin)
   1.137 +    # clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
   1.138 +    CXX=clang -std=c++11
   1.139 +endif
   1.140 +
   1.141 +# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
   1.142 +# The tests do not work properly, if compiled with -DNDEBUG
   1.143 +ifeq ($(BUILD_FOR),Linux)
   1.144 +    CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
   1.145 +    ifdef WARN
   1.146 +        CXXFLAGS+=
   1.147 +    else
   1.148 +        CXXFLAGS+= -w
   1.149 +    endif
   1.150 +    ifdef DEBUG
   1.151 +        CXXFLAGS+= -Og -ggdb
   1.152 +    else
   1.153 +        CXXFLAGS+= -O3 -DNDEBUG
   1.154 +    endif
   1.155 +else ifeq ($(BUILD_FOR),Darwin)
   1.156 +    CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
   1.157 +    ifdef WARN
   1.158 +        CXXFLAGS+=
   1.159 +    else
   1.160 +        CXXFLAGS+= -w
   1.161 +    endif
   1.162 +    ifdef DEBUG
   1.163 +        CXXFLAGS+= -O0 -g
   1.164 +    else
   1.165 +        CXXFLAGS+= -O3 -DNDEBUG
   1.166 +    endif
   1.167 +endif
   1.168 +
   1.169 +
   1.170 +######### YML2 #########
   1.171 +YML2_PATH=$(HOME)/yml2
   1.172 +
   1.173 +YML2_PROC=$(YML2_PATH)/yml2proc
   1.174 +
   1.175 +YML2_OPTS=--encoding=utf8
   1.176 +
   1.177 +
   1.178 +######### asn1c #########
   1.179 +# asn1c binary
   1.180 +ASN1C=asn1c
   1.181 +
   1.182 +# asn1c include search flag
   1.183 +ASN1C_INC=
   1.184 +#ASN1C_INC=-I$(HOME)/include
   1.185 +
   1.186 +
   1.187 +######### libetpan #########
   1.188 +# libetpan library search flag
   1.189 +ETPAN_LIB=-L$(PREFIX)/lib
   1.190 +
   1.191 +# libetpan include search flag
   1.192 +ETPAN_INC=-I$(PREFIX)/include
   1.193 +
   1.194 +
   1.195 +######### sqlite3 #########
   1.196 +# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
   1.197 +# Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
   1.198 +SQLITE3_FROM_OS=placeholder
   1.199 +
   1.200 +
   1.201 +######### OpenPGP #########
   1.202 +# Path of GPG binary
   1.203 +GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
   1.204 +
   1.205 +# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
   1.206 +OPENPGP=GPG
   1.207 +
   1.208 +# Path of libGPGME binary
   1.209 +ifeq ($(BUILD_FOR),Linux)
   1.210 +    LIBGPGME=libgpgme.so.11
   1.211 +else ifeq ($(BUILD_FOR),Darwin)
   1.212 +    LIBGPGME=libgpgme.dylib
   1.213 +endif
   1.214 +
   1.215 +# libGPGME library search flag
   1.216 +ifeq ($(BUILD_FOR),Linux)
   1.217 +    GPGME_LIB=
   1.218 +else ifeq ($(BUILD_FOR),Darwin)
   1.219 +    GPGME_LIB=-L$(HOME)/lib
   1.220 +endif
   1.221 +
   1.222 +# libGPGME include search flag
   1.223 +ifeq ($(BUILD_FOR),Linux)
   1.224 +    GPGME_INC=
   1.225 +else ifeq ($(BUILD_FOR),Darwin)
   1.226 +    GPGME_INC=-I$(HOME)/include
   1.227 +endif
   1.228 +
   1.229 +# NETPGP library search flag
   1.230 +NETPGP_LIB=
   1.231 +#NETPGP_LIB=-L$(PREFIX)/lib
   1.232 +
   1.233 +# libGPGME include search flag
   1.234 +NETPGP_INC=
   1.235 +#NETPGP_INC=-I$(PREFIX)/include
   1.236 +
   1.237 +
   1.238 +######### Engine internals #########
   1.239 +# C macros (not environment variables) that can be overridden:
   1.240 +# DEFAULT_KEYSERVER - string with default keyserver
   1.241 +# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
   1.242 +# Example:
   1.243 +#    EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
   1.244 +EXTRA_MACROS=
   1.245 +
   1.246 +
   1.247 +######### Misc #########
   1.248 +# FIXME Maybe include these variables here.
   1.249 +# Check how they are used throughout the project before setting them here
   1.250 +#LLDB_BIN
   1.251 +
   1.252 +
   1.253 +-include HERE/local.conf
   1.254 \ No newline at end of file