Add default.conf into the build system diphoton_M1
authorDamiano Boppart <damiano@pep-security.net>
Thu, 26 Oct 2017 15:43:22 +0200
branchdiphoton_M1
changeset 225255793aea82fb
parent 2251 ea72e0be3194
child 2253 fc11282f88dc
Add default.conf into the build system
Makefile
asn.1/Makefile
db/Makefile
default.conf
doc/build-debian.md
doc/build-macos.md
src/Makefile
sync/Makefile
test/Makefile
     1.1 --- a/Makefile	Thu Oct 26 14:06:26 2017 +0200
     1.2 +++ b/Makefile	Thu Oct 26 15:43:22 2017 +0200
     1.3 @@ -5,7 +5,7 @@
     1.4  
     1.5  HERE_REL := $(notdir $(CURDIR))
     1.6  
     1.7 -include Makefile.conf
     1.8 +include default.conf
     1.9  
    1.10  .PHONY: all
    1.11  all: _override_info
     2.1 --- a/asn.1/Makefile	Thu Oct 26 14:06:26 2017 +0200
     2.2 +++ b/asn.1/Makefile	Thu Oct 26 15:43:22 2017 +0200
     2.3 @@ -3,7 +3,7 @@
     2.4  # This file may be used under the terms of the GNU General Public License version 3
     2.5  # see LICENSE.txt
     2.6  
     2.7 -include ../Makefile.conf
     2.8 +include ../default.conf
     2.9  
    2.10  ALL_SOURCE=$(wildcard *.c)
    2.11  ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
     3.1 --- a/db/Makefile	Thu Oct 26 14:06:26 2017 +0200
     3.2 +++ b/db/Makefile	Thu Oct 26 15:43:22 2017 +0200
     3.3 @@ -3,7 +3,7 @@
     3.4  # This file may be used under the terms of the GNU General Public License version 3
     3.5  # see LICENSE.txt
     3.6  
     3.7 -include ../Makefile.conf
     3.8 +include ../default.conf
     3.9  
    3.10  .PHONY: db
    3.11  db: system.db
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/default.conf	Thu Oct 26 15:43:22 2017 +0200
     4.3 @@ -0,0 +1,260 @@
     4.4 +# Copyright 2017, pEp Foundation
     4.5 +# This file is part of pEpEngine
     4.6 +# This file may be used under the terms of the GNU General Public License version 3
     4.7 +# see LICENSE.txt
     4.8 +
     4.9 +# This file gives an overview over all the parameters that can be easily customized for a build.
    4.10 +# There are three ways in which you can customize your build:
    4.11 +# 1) Edit the variable assignments in this file
    4.12 +# 2) Create `local.conf` and fill it with variable assignments.
    4.13 +#    These `local.conf` takes precedence over the assignments below.
    4.14 +# 3) Set the environment variable `BUILD_CONFIG` to an absolute path.
    4.15 +#    The variable assignments found at the path indicated by `BUILD_CONFIG` take precedence over the assignments below and the assignments in `local.conf`.
    4.16 +# If nothing is changed according to these 3 methods, a default configuration for your platform will be used for the build.
    4.17 +
    4.18 +
    4.19 +######### Header #########
    4.20 +HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
    4.21 +
    4.22 +######### General #########
    4.23 +# To use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
    4.24 +# All the *_INC and *_LIB variables are command line flags, not paths.
    4.25 +# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
    4.26 +
    4.27 +BUILD_ON:=$(shell uname)
    4.28 +
    4.29 +# This variable specifies the platform that the engine should be cross-compiled for.
    4.30 +BUILD_FOR=$(BUILD_ON)
    4.31 +
    4.32 +# Cross-compiling is currently not supported.
    4.33 +# Maybe you can hack something with `local.conf`.
    4.34 +ifneq ($(BUILD_ON),$(BUILD_FOR))
    4.35 +    $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
    4.36 +endif
    4.37 +
    4.38 +# Installation path prefix for libraries and binaries, except for system.db
    4.39 +PREFIX=$(HOME)
    4.40 +
    4.41 +# Installation path for system.db
    4.42 +SYSTEM_DB=/usr/local/share/pEp/system.db
    4.43 +
    4.44 +# Filename of the pEpEngine library
    4.45 +ifeq ($(BUILD_FOR),Linux)
    4.46 +    TARGET=libpEpEngine.so
    4.47 +else ifeq ($(BUILD_FOR),Darwin)
    4.48 +    TARGET=libpEpEngine.dylib
    4.49 +endif
    4.50 +
    4.51 +# If empty, create a release build.
    4.52 +# Otherwise, create a debug build.
    4.53 +# This variable is ineffective in your local.conf file.
    4.54 +DEBUG=YES
    4.55 +
    4.56 +# If empty, suppress compiler warnings.
    4.57 +# Otherwise, print warnings.
    4.58 +# This variable is ineffective in your local.conf file.
    4.59 +WARN=placeholder
    4.60 +
    4.61 +
    4.62 +######### C and C++ #########
    4.63 +TARGET_ARCH=
    4.64 +# The following two variables will be appended to.
    4.65 +# You can thus not set them to a fixed value here.
    4.66 +ifeq ($(BUILD_FOR),Linux)
    4.67 +    LDFLAGS=
    4.68 +else ifeq ($(BUILD_FOR),Darwin)
    4.69 +    # "-bind_at_load" helps find symbol resolution errors faster
    4.70 +    LDFLAGS=-bind_at_load
    4.71 +endif
    4.72 +
    4.73 +LDLIBS=
    4.74 +
    4.75 +
    4.76 +######### C #########
    4.77 +ifeq ($(BUILD_FOR),Linux)
    4.78 +    CC=gcc -std=c99 -pthread
    4.79 +else ifeq ($(BUILD_FOR),Darwin)
    4.80 +    # clang issues a warning when "-pthread" is used for linking.
    4.81 +    # So, include it in CFLAGS, and not in CC
    4.82 +    CC=clang -std=c99
    4.83 +endif
    4.84 +
    4.85 +ifeq ($(BUILD_FOR),Linux)
    4.86 +    CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
    4.87 +else ifeq ($(BUILD_FOR),Darwin)
    4.88 +    CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
    4.89 +endif
    4.90 +
    4.91 +CPPFLAGS=
    4.92 +
    4.93 +# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
    4.94 +# The tests do not work properly, if compiled with -DNDEBUG
    4.95 +ifeq ($(BUILD_FOR),Linux)
    4.96 +    ifdef WARN
    4.97 +        CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
    4.98 +    else
    4.99 +        CFLAGS+= -w
   4.100 +    endif
   4.101 +    ifdef DEBUG
   4.102 +        CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK
   4.103 +    else
   4.104 +        CFLAGS+= -O3 -DNDEBUG
   4.105 +    endif
   4.106 +else ifeq ($(BUILD_FOR),Darwin)
   4.107 +    ifdef WARN
   4.108 +        # FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
   4.109 +        CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
   4.110 +    else
   4.111 +        CFLAGS+= -w
   4.112 +    endif
   4.113 +    ifdef DEBUG
   4.114 +        CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
   4.115 +    else
   4.116 +        CFLAGS+= -O3 -DNDEBUG
   4.117 +    endif
   4.118 +endif
   4.119 +
   4.120 +# Additional CFLAGS used for compiling ASN1C-generated code
   4.121 +ifeq ($(BUILD_FOR),Linux)
   4.122 +    # The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning
   4.123 +    #   _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
   4.124 +    # otherwise printed during the compilation of every asn1c-generated C file.
   4.125 +    # It's a glibc specific warning, only present in few versions around ~2.19.
   4.126 +    # See https://lwn.net/Articles/590381/ for a discussion.
   4.127 +    CFLAGS_GENERATED=-D_DEFAULT_SOURCE
   4.128 +else ifeq ($(BUILD_FOR),Darwin)
   4.129 +    CFLAGS_GENERATED=
   4.130 +endif
   4.131 +
   4.132 +
   4.133 +######### C++ #########
   4.134 +ifeq ($(BUILD_FOR),Linux)
   4.135 +    CXX=g++ -std=gnu++11 -pthread
   4.136 +else ifeq ($(BUILD_FOR),Darwin)
   4.137 +    # clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
   4.138 +    CXX=clang -std=c++11
   4.139 +endif
   4.140 +
   4.141 +# The flag -DNDEBUG will always be removed from CXXFLAGS for compiling tests.
   4.142 +# The tests do not work properly, if compiled with -DNDEBUG
   4.143 +ifeq ($(BUILD_FOR),Linux)
   4.144 +    CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
   4.145 +    ifdef WARN
   4.146 +        CXXFLAGS+=
   4.147 +    else
   4.148 +        CXXFLAGS+= -w
   4.149 +    endif
   4.150 +    ifdef DEBUG
   4.151 +        CXXFLAGS+= -Og -ggdb
   4.152 +    else
   4.153 +        CXXFLAGS+= -O3 -DNDEBUG
   4.154 +    endif
   4.155 +else ifeq ($(BUILD_FOR),Darwin)
   4.156 +    CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
   4.157 +    ifdef WARN
   4.158 +        CXXFLAGS+=
   4.159 +    else
   4.160 +        CXXFLAGS+= -w
   4.161 +    endif
   4.162 +    ifdef DEBUG
   4.163 +        CXXFLAGS+= -O0 -g
   4.164 +    else
   4.165 +        CXXFLAGS+= -O3 -DNDEBUG
   4.166 +    endif
   4.167 +endif
   4.168 +
   4.169 +
   4.170 +######### YML2 #########
   4.171 +YML2_PATH=$(HOME)/yml2
   4.172 +
   4.173 +YML2_PROC=$(YML2_PATH)/yml2proc
   4.174 +
   4.175 +YML2_OPTS=--encoding=utf8
   4.176 +
   4.177 +# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
   4.178 +export YML_PATH=$(YML2_PATH)
   4.179 +
   4.180 +######### asn1c #########
   4.181 +# asn1c binary
   4.182 +ASN1C=asn1c
   4.183 +
   4.184 +# asn1c include search flag
   4.185 +ASN1C_INC=
   4.186 +#ASN1C_INC=-I$(HOME)/include
   4.187 +
   4.188 +
   4.189 +######### libetpan #########
   4.190 +# libetpan library search flag
   4.191 +ETPAN_LIB=-L$(PREFIX)/lib
   4.192 +
   4.193 +# libetpan include search flag
   4.194 +ETPAN_INC=-I$(PREFIX)/include
   4.195 +
   4.196 +
   4.197 +######### sqlite3 #########
   4.198 +# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution.
   4.199 +# Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
   4.200 +SQLITE3_FROM_OS=placeholder
   4.201 +
   4.202 +
   4.203 +######### OpenPGP #########
   4.204 +# Path of GPG binary
   4.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.
   4.206 +GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
   4.207 +
   4.208 +# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
   4.209 +OPENPGP=GPG
   4.210 +
   4.211 +# Path of libGPGME binary
   4.212 +ifeq ($(BUILD_FOR),Linux)
   4.213 +    LIBGPGME=libgpgme.so.11
   4.214 +else ifeq ($(BUILD_FOR),Darwin)
   4.215 +    LIBGPGME=libgpgme.dylib
   4.216 +endif
   4.217 +
   4.218 +# libGPGME library search flag
   4.219 +ifeq ($(BUILD_FOR),Linux)
   4.220 +    GPGME_LIB=
   4.221 +else ifeq ($(BUILD_FOR),Darwin)
   4.222 +    GPGME_LIB=-L$(HOME)/lib
   4.223 +endif
   4.224 +
   4.225 +# libGPGME include search flag
   4.226 +ifeq ($(BUILD_FOR),Linux)
   4.227 +    GPGME_INC=
   4.228 +else ifeq ($(BUILD_FOR),Darwin)
   4.229 +    GPGME_INC=-I$(HOME)/include
   4.230 +endif
   4.231 +
   4.232 +# NETPGP library search flag
   4.233 +NETPGP_LIB=
   4.234 +#NETPGP_LIB=-L$(PREFIX)/lib
   4.235 +
   4.236 +# libGPGME include search flag
   4.237 +NETPGP_INC=
   4.238 +#NETPGP_INC=-I$(PREFIX)/include
   4.239 +
   4.240 +
   4.241 +######### Engine internals #########
   4.242 +# C macros (not environment variables) that can be overridden:
   4.243 +# DEFAULT_KEYSERVER - string with default keyserver
   4.244 +# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
   4.245 +# Example:
   4.246 +#    EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
   4.247 +EXTRA_MACROS=
   4.248 +
   4.249 +
   4.250 +######### Misc #########
   4.251 +# FIXME Maybe include these variables here.
   4.252 +# Check how they are used throughout the project before setting them here
   4.253 +#LLDB_BIN
   4.254 +
   4.255 +
   4.256 +######### Footer #########
   4.257 +include $(HERE)/Makefile.conf
   4.258 +
   4.259 +-include $(HERE)/local.conf
   4.260 +
   4.261 +ifdef BUILD_CONFIG
   4.262 +    include $(BUILD_CONFIG)
   4.263 +endif
     5.1 --- a/doc/build-debian.md	Thu Oct 26 14:06:26 2017 +0200
     5.2 +++ b/doc/build-debian.md	Thu Oct 26 15:43:22 2017 +0200
     5.3 @@ -66,6 +66,8 @@
     5.4  
     5.5  Note: Everything PLATFORM_OVERRIDE-related is currenty outdated. Do not rely on the documentation here!
     5.6  
     5.7 +Note: Everything Makefile.conf-related is currenty outdated. Do not rely on the documentation here!
     5.8 +
     5.9  For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
    5.10  In this guide, the platform-specific configuration will be called `local`.
    5.11  The installation directory will be a subdirectory of the repository.
     6.1 --- a/doc/build-macos.md	Thu Oct 26 14:06:26 2017 +0200
     6.2 +++ b/doc/build-macos.md	Thu Oct 26 15:43:22 2017 +0200
     6.3 @@ -78,6 +78,8 @@
     6.4  
     6.5  Note: Everything PLATFORM_OVERRIDE-related is currenty outdated. Do not rely on the documentation here!
     6.6  
     6.7 +Note: Everything Makefile.conf-related is currenty outdated. Do not rely on the documentation here!
     6.8 +
     6.9  For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
    6.10  In this guide, the platform-specific configuration will be called `local`.
    6.11  The installation directory will be a subdirectory of the repository.
     7.1 --- a/src/Makefile	Thu Oct 26 14:06:26 2017 +0200
     7.2 +++ b/src/Makefile	Thu Oct 26 15:43:22 2017 +0200
     7.3 @@ -3,7 +3,7 @@
     7.4  # This file may be used under the terms of the GNU General Public License version 3
     7.5  # see LICENSE.txt
     7.6  
     7.7 -include ../Makefile.conf
     7.8 +include ../default.conf
     7.9  
    7.10  CFLAGS+= $(ETPAN_INC) -I../asn.1 -DSYSTEM_DB=\"$(SYSTEM_DB)\" $(EXTRA_MACROS)
    7.11  LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -shared
     8.1 --- a/sync/Makefile	Thu Oct 26 14:06:26 2017 +0200
     8.2 +++ b/sync/Makefile	Thu Oct 26 15:43:22 2017 +0200
     8.3 @@ -3,7 +3,7 @@
     8.4  # This file may be used under the terms of the GNU General Public License version 3
     8.5  # see LICENSE.txt
     8.6  
     8.7 -include ../Makefile.conf
     8.8 +include ../default.conf
     8.9  
    8.10  .PHONY: all
    8.11  all: .codegen
     9.1 --- a/test/Makefile	Thu Oct 26 14:06:26 2017 +0200
     9.2 +++ b/test/Makefile	Thu Oct 26 15:43:22 2017 +0200
     9.3 @@ -5,7 +5,7 @@
     9.4  
     9.5  HERE:=$(CURDIR)
     9.6  
     9.7 -include ../Makefile.conf
     9.8 +include ../default.conf
     9.9  
    9.10  TARGET=pEpEngineTest
    9.11