Split platform-specific parts of Makefile.conf into separate files ENGINE-228
authorDamiano Boppart <damiano@pep-security.net>
Sun, 13 Aug 2017 02:22:03 +0200
branchENGINE-228
changeset 1953e9f2e628cc12
parent 1952 4722b371f609
child 1954 23ca366b1a8a
Split platform-specific parts of Makefile.conf into separate files
Makefile.conf
build-config/Darwin.conf
build-config/Linux.conf
build-config/common.conf
     1.1 --- a/Makefile.conf	Fri Aug 11 15:25:16 2017 +0200
     1.2 +++ b/Makefile.conf	Sun Aug 13 02:22:03 2017 +0200
     1.3 @@ -1,30 +1,18 @@
     1.4 -# this file is in the Public Domain
     1.5 +# Copyright 2017, pEp Security SA
     1.6 +# This file is part of pEpEngine
     1.7 +# This file may be used under the terms of the GNU General Public License version 3
     1.8 +# see LICENSE.txt
     1.9  
    1.10 -BUILD_ON=$(shell uname)
    1.11 -BUILD_FOR=$(BUILD_ON)
    1.12 -OPTIMIZE=-g -Wall -O0 -fPIC -DDEBUG_ERRORSTACK
    1.13 -#OPTIMIZE=-O3 -Wall -DNDEBUG -std=c99
    1.14 -LD=$(CC)
    1.15 -#CC=gcc-mp-4.9 -std=c99 -fstrict-aliasing -Wstrict-aliasing=3
    1.16 -#LD=gcc-mp-4.9
    1.17 -SYSTEM_DB=/usr/local/share/pEp/system.db
    1.18 -PREFIX=$(HOME)
    1.19 -YML2PROC=$(HOME)/yml2/yml2proc
    1.20 -YML_OPTS=--encoding=utf8
    1.21 -YML_PATH=$(HOME)/yml2
    1.22 -ASN1C=asn1c
    1.23 -ASN1C_INCLUDE=/opt/local/share/asn1c
    1.24 -#ETPAN_IN=$(HOME)
    1.25 -#LIBGPGME=/opt/local/lib/libgpgme.11.dylib
    1.26 +# To use custom build configuration variables, put them in a new file at `build-config/<name>.conf`. Execute `export PLATFORM_OVERRIDE=<name>` before running make. If this environment variable is not set, make will load a default configuration for your platform.
    1.27  
    1.28 -# C makros (not environment variables) to overwrite:
    1.29 -#
    1.30 -# DEFAULT_KEYSERVER - string with default keyserver
    1.31 -# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
    1.32 +BUILD_CONFIG=build-config
    1.33  
    1.34 -#EXTRAMACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
    1.35 -
    1.36 -# second instance for testing
    1.37 -
    1.38 -#EXTRAMACROS=-DLOCAL_DB_FILENAME=\".pEp_management2.db\"
    1.39 -#TARGET=libpEpEngine2.dylib 
    1.40 +include $(BUILD_CONFIG)/common.conf
    1.41 +ifdef PLATFORM_OVERRIDE
    1.42 +    include $(BUILD_CONFIG)/$(PLATFORM_OVERRIDE).conf
    1.43 +# cross-compiling is currently not supported, but maybe you can hack something with `PLATFORM_OVERRIDE`
    1.44 +else ifeq ($(BUILD_ON),$(BUILD_FOR))
    1.45 +    include $(BUILD_CONFIG)/$(BUILD_ON).conf
    1.46 +else
    1.47 +    $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON))
    1.48 +endif
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/build-config/Darwin.conf	Sun Aug 13 02:22:03 2017 +0200
     2.3 @@ -0,0 +1,27 @@
     2.4 +# Copyright 2017, pEp Security SA
     2.5 +# This file is part of pEpEngine
     2.6 +# This file may be used under the terms of the GNU General Public License version 3
     2.7 +# see LICENSE.txt
     2.8 +
     2.9 +######### General #########
    2.10 +TARGET=libpEpEngine.dylib
    2.11 +
    2.12 +######### C #########
    2.13 +CC=clang -std=c99 -pthread
    2.14 +
    2.15 +######### C++ #########
    2.16 +CXX=clang -std=c++11
    2.17 +
    2.18 +######### C and C++ #########
    2.19 +
    2.20 +######### YML2 #########
    2.21 +
    2.22 +######### asn1c #########
    2.23 +
    2.24 +######### libetpan #########
    2.25 +
    2.26 +######### OpenPGP #########
    2.27 +
    2.28 +######### Engine internals #########
    2.29 +
    2.30 +######### Misc #########
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/build-config/Linux.conf	Sun Aug 13 02:22:03 2017 +0200
     3.3 @@ -0,0 +1,27 @@
     3.4 +# Copyright 2017, pEp Security SA
     3.5 +# This file is part of pEpEngine
     3.6 +# This file may be used under the terms of the GNU General Public License version 3
     3.7 +# see LICENSE.txt
     3.8 +
     3.9 +######### General #########
    3.10 +TARGET=libpEpEngine.so
    3.11 +
    3.12 +######### C #########
    3.13 +CC=gcc -std=c99
    3.14 +
    3.15 +######### C++ #########
    3.16 +CXX=g++ -std=gnu++11 -pthread
    3.17 +
    3.18 +######### C and C++ #########
    3.19 +
    3.20 +######### YML2 #########
    3.21 +
    3.22 +######### asn1c #########
    3.23 +
    3.24 +######### libetpan #########
    3.25 +
    3.26 +######### OpenPGP #########
    3.27 +
    3.28 +######### Engine internals #########
    3.29 +
    3.30 +######### Misc #########
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/build-config/common.conf	Sun Aug 13 02:22:03 2017 +0200
     4.3 @@ -0,0 +1,89 @@
     4.4 +# Copyright 2017, pEp Security SA
     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 +######### General #########
    4.10 +BUILD_ON:=$(shell uname)
    4.11 +BUILD_FOR=$(BUILD_ON)
    4.12 +# Installation path prefix for libraries and binaries, except for system.db
    4.13 +PREFIX=$(HOME)
    4.14 +# Installation path for system.db
    4.15 +SYSTEM_DB=/usr/local/share/pEp/system.db
    4.16 +# Filename of the pEpEngine library
    4.17 +#TARGET This option is platform-specific
    4.18 +# If defined, create a debug build
    4.19 +DEBUG=
    4.20 +# If defined, print compiler warnings
    4.21 +WARN=
    4.22 +
    4.23 +######### C #########
    4.24 +#CC This option is platform-specific
    4.25 +CPPFLAGS=
    4.26 +CFLAGS= -fPIC -fstrict-aliasing
    4.27 +ifdef WARN
    4.28 +    CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
    4.29 +else
    4.30 +    CFLAGS+= -w
    4.31 +endif
    4.32 +ifdef DEBUG
    4.33 +    CFLAGS+= -O0 -g -DNDEBUG -DDEBUG_ERRORSTACK
    4.34 +else
    4.35 +    CFLAGS+= -O3
    4.36 +endif
    4.37 +
    4.38 +######### C++ #########
    4.39 +#CXX This option is platform-specific
    4.40 +CXXFLAGS=
    4.41 +ifdef WARN
    4.42 +    CXXFLAGS+= 
    4.43 +else
    4.44 +    CXXFLAGS+= -w
    4.45 +endif
    4.46 +ifdef DEBUG
    4.47 +    CXXFLAGS+= -O0 -g -DNDEBUG
    4.48 +else
    4.49 +    CXXFLAGS+= -O3
    4.50 +endif
    4.51 +
    4.52 +######### C and C++ #########
    4.53 +#LD=
    4.54 +
    4.55 +######### YML2 #########
    4.56 +YML2_PATH=$(HOME)/yml2
    4.57 +YML2_PROC=$(YML2_PATH)/yml2proc
    4.58 +YML2_OPTS=--encoding=utf8
    4.59 +
    4.60 +######### asn1c #########
    4.61 +# asn1c binary path
    4.62 +ASN1C=asn1c
    4.63 +ASN1C_INCLUDE=/usr/include
    4.64 +
    4.65 +######### libetpan #########
    4.66 +# libetpan distribution path
    4.67 +ETPAN_IN=$(HOME)
    4.68 +
    4.69 +######### OpenPGP #########
    4.70 +# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
    4.71 +OPENPGP=GPG
    4.72 +# Path of libGPGME binary
    4.73 +#LIBGPGME=/opt/local/lib/libgpgme.11.dylib
    4.74 +# Path of GPG binary
    4.75 +GPG_CMD=gpg
    4.76 +ifneq ($(shell which gpg2),)
    4.77 +    GPG_CMD = gpg2
    4.78 +endif
    4.79 +
    4.80 +######### Engine internals #########
    4.81 +# C macros (not environment variables) that can be overridden:
    4.82 +# DEFAULT_KEYSERVER - string with default keyserver
    4.83 +# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
    4.84 +# Example:
    4.85 +#    EXTRAMACROS= -DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
    4.86 +EXTRAMACROS=
    4.87 +
    4.88 +######### Misc #########
    4.89 +# Maybe include these variables here. Check how they are used throughout the project before setting them here
    4.90 +#LDFLAGS=
    4.91 +#LDLIBS=
    4.92 +#LLDB_BIN