|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
# Copyright 2017, pEp Foundation
|
|
|
|
|
# Copyright 2017-2023, pEp Foundation
|
|
|
|
|
# This file is part of pEpEngine
|
|
|
|
|
# This file may be used under the terms of the GNU General Public License version 3
|
|
|
|
|
# see LICENSE.txt
|
|
|
|
@ -24,10 +24,11 @@ HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
|
|
|
|
|
# All the *_INC and *_LIB variables are command line flags, not paths.
|
|
|
|
|
# Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
|
|
|
|
|
|
|
|
|
|
BUILD_ON:=$(shell uname)
|
|
|
|
|
BUILD_ON := $(shell uname)
|
|
|
|
|
|
|
|
|
|
# This variable specifies the platform that the engine should be cross-compiled for.
|
|
|
|
|
BUILD_FOR=$(BUILD_ON)
|
|
|
|
|
# This variable specifies the platform that the engine should be cross-compiled
|
|
|
|
|
# for.
|
|
|
|
|
BUILD_FOR ?= $(BUILD_ON)
|
|
|
|
|
|
|
|
|
|
# Cross-compiling is currently not supported.
|
|
|
|
|
# Maybe you can hack something with `local.conf`.
|
|
|
|
@ -39,18 +40,18 @@ ifneq ($(BUILD_ON),$(BUILD_FOR))
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Installation path prefix for libraries and binaries, except for system.db
|
|
|
|
|
PREFIX=$(HOME)
|
|
|
|
|
PREFIX ?= $(HOME)
|
|
|
|
|
|
|
|
|
|
# pEp files and directories
|
|
|
|
|
#
|
|
|
|
|
# the PER_USER_DIRECTORY will be in $(HOME), respectively
|
|
|
|
|
# in debug builds the PER_USER_DIRECTORY will be in $(PEP_HOME) instead if set
|
|
|
|
|
#
|
|
|
|
|
# PER_MACHINE_DIRECTORY is calculated depending on platform; overwrite if
|
|
|
|
|
# PER_MACHINE_DIRECTORY is calculated depending on the platform; overwrite if
|
|
|
|
|
# necessary
|
|
|
|
|
|
|
|
|
|
#PER_USER_DIRECTORY=.pEp
|
|
|
|
|
PER_MACHINE_DIRECTORY=/usr/local/share/pEp
|
|
|
|
|
PER_USER_DIRECTORY = .pEp
|
|
|
|
|
PER_MACHINE_DIRECTORY = $(PREFIX)/share/pEp
|
|
|
|
|
|
|
|
|
|
# Filename of the pEpEngine library
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
@ -62,7 +63,7 @@ else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# DEBUG can be set to:
|
|
|
|
|
# * (empty or undefined)
|
|
|
|
|
# * release
|
|
|
|
|
# for a release build;
|
|
|
|
|
# * debug
|
|
|
|
|
# for a debug build (default);
|
|
|
|
@ -70,184 +71,12 @@ endif
|
|
|
|
|
# for a maintainer build.
|
|
|
|
|
# See the comment in local.conf.example for more information. This definition
|
|
|
|
|
# is meant to be easy to override in local.conf .
|
|
|
|
|
DEBUG = debug
|
|
|
|
|
DEBUG ?= debug
|
|
|
|
|
|
|
|
|
|
# If empty, suppress compiler warnings.
|
|
|
|
|
# Otherwise, print warnings.
|
|
|
|
|
# This variable is ineffective when set anywhere else but here.
|
|
|
|
|
WARN=placeholder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### C and C++ #########
|
|
|
|
|
TARGET_ARCH=
|
|
|
|
|
|
|
|
|
|
# The following two variables will be appended to.
|
|
|
|
|
# You can thus not set them to a final, fixed value here.
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
LDFLAGS+=
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
# "-bind_at_load" helps find symbol resolution errors faster
|
|
|
|
|
LDFLAGS+=-bind_at_load
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Are we wiping this on purpose?
|
|
|
|
|
LDLIBS=
|
|
|
|
|
|
|
|
|
|
# Define compiler.
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CC=xlclang
|
|
|
|
|
else ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
# We could actually use C17, but only recent compilers understand the option
|
|
|
|
|
# -std=c17; for example GCC 7, which dates back from 2017 and should work
|
|
|
|
|
# well, does not. The 2011 standard is almost identical to the 2017 version
|
|
|
|
|
# anyway.
|
|
|
|
|
# So here we could use -std=c11 . However when trying -std=c11 for a while
|
|
|
|
|
# GCC was bothering me all the time with warnings about the non-standard
|
|
|
|
|
# __PRETTY_FUNCTION__ , which are useless noise since we use that
|
|
|
|
|
# conditionally only where supported. Doing away with that, and using gnu11
|
|
|
|
|
# instead of c11 to silently allow GNU extension, while *not* using them
|
|
|
|
|
# except in conditional code when we also have a fallback alternative.
|
|
|
|
|
#
|
|
|
|
|
# If I use some unsupported C feature by mistake people will tell me
|
|
|
|
|
# --positron.
|
|
|
|
|
CC=gcc -std=gnu11 -pthread
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CC=clang
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Add platform-specific compilation options.
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CFLAGS= -Wno-gnu-include-next -qnosearch -I$(HERE) -I.
|
|
|
|
|
CFLAGS+= -I/usr/include
|
|
|
|
|
CFLAGS+= -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L -qlanglvl=NOLIBEXT
|
|
|
|
|
else ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CFLAGS+=-fPIC -fstrict-aliasing -fdiagnostics-color=auto
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CFLAGS+=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# The flag -DNDEBUG will always be removed from CFLAGS for compiling tests.
|
|
|
|
|
# The tests do not work properly, if compiled with -DNDEBUG
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
ifdef WARN
|
|
|
|
|
CFLAGS+= -Wall -pedantic
|
|
|
|
|
else
|
|
|
|
|
CFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
ifneq ($(strip $(DEBUG)),)
|
|
|
|
|
CFLAGS+= -g -DDEBUG_ERRORSTACK
|
|
|
|
|
else
|
|
|
|
|
CFLAGS+= -O3 -DNDEBUG
|
|
|
|
|
endif
|
|
|
|
|
else ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
ifdef WARN
|
|
|
|
|
# I removed -pedantic from here in October 2022. See the comment
|
|
|
|
|
# about -std=... above.
|
|
|
|
|
CFLAGS+= -Wall -Wstrict-aliasing=3
|
|
|
|
|
else
|
|
|
|
|
CFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
ifneq ($(strip $(DEBUG)),)
|
|
|
|
|
CFLAGS+= -g -ggdb -DDEBUG_ERRORSTACK
|
|
|
|
|
else
|
|
|
|
|
CFLAGS+= -O3 -DNDEBUG
|
|
|
|
|
endif
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
ifdef WARN
|
|
|
|
|
CFLAGS+= -Wall -pedantic
|
|
|
|
|
else
|
|
|
|
|
CFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
ifneq ($(strip $(DEBUG)),)
|
|
|
|
|
CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
|
|
|
|
|
else
|
|
|
|
|
CFLAGS+= -O3 -DNDEBUG
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Additional CFLAGS used for compiling ASN1C-generated code
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
# 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.
|
|
|
|
|
CPPFLAGS_GENERATED=-D_DEFAULT_SOURCE
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CPPFLAGS_GENERATED=
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### C++ #########
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CXX=g++
|
|
|
|
|
CXXFLAGS+=-std=gnu++11
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
|
|
|
|
|
CXX=clang -std=c++11
|
|
|
|
|
else ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CXX=xlclang++ -std=c++11
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifneq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CXXFLAGS+=-pthread
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# The flag -DNDEBUG will always be removed from CPPFLAGS for compiling tests.
|
|
|
|
|
#
|
|
|
|
|
# The tests do not work properly, if compiled with -DNDEBUG
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CXXFLAGS+= -fdiagnostics-color=auto -Wno-gnu-include-next
|
|
|
|
|
CXXFLAGS+= -qnosearch -I$(HERE) -I. -I../src -I../asn.1 $(ETPAN_INC) -I/usr/lpp/java/J8.0_64/include -I/usr/include
|
|
|
|
|
CXXFLAGS+= -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L
|
|
|
|
|
ifdef WARN
|
|
|
|
|
CXXFLAGS+=
|
|
|
|
|
else
|
|
|
|
|
CXXFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
ifneq ($(strip $(DEBUG)),)
|
|
|
|
|
CXXFLAGS+= -g
|
|
|
|
|
else
|
|
|
|
|
CXXFLAGS+= -O3 -DNDEBUG
|
|
|
|
|
endif
|
|
|
|
|
else ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CXXFLAGS+=-fdiagnostics-color=auto -I../src -I../asn.1 $(ETPAN_INC)
|
|
|
|
|
ifdef WARN
|
|
|
|
|
CXXFLAGS+=
|
|
|
|
|
else
|
|
|
|
|
CXXFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
ifneq ($(strip $(DEBUG)),)
|
|
|
|
|
CXXFLAGS+= -g -ggdb
|
|
|
|
|
else
|
|
|
|
|
CXXFLAGS+= -O3
|
|
|
|
|
CPPFLAGS+= -DNDEBUG
|
|
|
|
|
endif
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CXXFLAGS+=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
|
|
|
|
|
ifdef WARN
|
|
|
|
|
CXXFLAGS+=
|
|
|
|
|
else
|
|
|
|
|
CXXFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
ifneq ($(strip $(DEBUG)),)
|
|
|
|
|
CXXFLAGS+= -O0 -g
|
|
|
|
|
else
|
|
|
|
|
CXXFLAGS+= -O3
|
|
|
|
|
CPPFLAGS+= -DNDEBUG
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### C and C++ #########
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CPPFLAGS+=-W "l,xplink,dll" -W "c,float(ieee),xplink,dll,exportall"
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CPPFLAGS+=-D_DARWIN_C_SOURCE
|
|
|
|
|
else
|
|
|
|
|
LDLIBS+=-luuid
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
WARN ?= placeholder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### YML2 #########
|
|
|
|
@ -289,24 +118,28 @@ PEP_MIME_SRC=$(HOME)/src/pEpMIME/src
|
|
|
|
|
######### libetpan #########
|
|
|
|
|
# libetpan library search flag
|
|
|
|
|
#
|
|
|
|
|
ETPAN_LIB=
|
|
|
|
|
ETPAN_LIB =
|
|
|
|
|
#ETPAN_LIB=-L$(HOME)/lib
|
|
|
|
|
|
|
|
|
|
# libetpan include search flag
|
|
|
|
|
ETPAN_INC=
|
|
|
|
|
ETPAN_INC =
|
|
|
|
|
#ETPAN_INC=-I$(HOME)/include
|
|
|
|
|
|
|
|
|
|
# positron, early 2023: before my factoring this was included in the compilation
|
|
|
|
|
# flags on every platform; it is not needed on GNU/Linux as far as I can tell.
|
|
|
|
|
CPPFLAGS += $(ETPAN_INC)
|
|
|
|
|
|
|
|
|
|
######### OpenPGP #########
|
|
|
|
|
# Selects OpenPGP implementation. must be `SEQUOIA`
|
|
|
|
|
# Selects OpenPGP implementation.
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
OPENPGP=NETPGP
|
|
|
|
|
OPENPGP=NETPGP
|
|
|
|
|
else
|
|
|
|
|
OPENPGP=SEQUOIA
|
|
|
|
|
OPENPGP=SEQUOIA
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Sequoia-specific variables
|
|
|
|
|
SEQUOIA_CFLAGS+=
|
|
|
|
|
SEQUOIA_LDFLAGS+=
|
|
|
|
|
SEQUOIA_CFLAGS=
|
|
|
|
|
SEQUOIA_LDFLAGS=
|
|
|
|
|
SEQUOIA_LIB=
|
|
|
|
|
SEQUOIA_INC=
|
|
|
|
|
|
|
|
|
@ -316,64 +149,171 @@ SEQUOIA_INC=
|
|
|
|
|
# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
|
|
|
|
|
# Example:
|
|
|
|
|
# EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
|
|
|
|
|
EXTRA_MACROS=
|
|
|
|
|
EXTRA_MACROS =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### C and C++ #########
|
|
|
|
|
|
|
|
|
|
CFLAGS+=$(EXTRA_MACROS)
|
|
|
|
|
CXXFLAGS+=$(EXTRA_MACROS)
|
|
|
|
|
# The following two variables will be appended to.
|
|
|
|
|
# You can thus not set them to a final, fixed value here.
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
LDFLAGS +=
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
# "-bind_at_load" helps find symbol resolution errors faster
|
|
|
|
|
LDFLAGS += -bind_at_load
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
######### Misc #########
|
|
|
|
|
# FIXME Maybe include these variables here.
|
|
|
|
|
# Check how they are used throughout the project before setting them here
|
|
|
|
|
#LLDB_BIN
|
|
|
|
|
# Define C and C++ compilers.
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CC = xlclang
|
|
|
|
|
CXX = xlclang++
|
|
|
|
|
else ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CC = gcc
|
|
|
|
|
CXX = g++
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CC = clang
|
|
|
|
|
CXX = clang
|
|
|
|
|
# Notice that clang issues a warning when "-pthread" is used for linking;
|
|
|
|
|
# we do not want it as part of the compiler name expansion.
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Add this for running tests in debugger
|
|
|
|
|
#TEST_DEBUGGER=lldb --batch -o r
|
|
|
|
|
# Almost all the options in CFLAGS and CXXFLAGS are the same. Define a single
|
|
|
|
|
# variable CORCXXFLAGS; we will use twice further down, to define CFLAGS and
|
|
|
|
|
# CXXFLAGS.
|
|
|
|
|
# Start defining some sensible CORCXXFLAGS and CPPFLAGS that are correct on
|
|
|
|
|
# every platform.
|
|
|
|
|
ifeq ($(DEBUG),release)
|
|
|
|
|
CORCXXFLAGS += -O3
|
|
|
|
|
# We can define this with no fear: the test suite does not work with NDEBUG
|
|
|
|
|
# defined, but its makefile will filter the option out.
|
|
|
|
|
CPPFLAGS += -DNDEBUG
|
|
|
|
|
# I believe that we can afford some extra cost in binary size in exchange for
|
|
|
|
|
# debugging symbols being available everywhere.
|
|
|
|
|
COMPILEWITHDEBUGGINGSYMBOLS = yes
|
|
|
|
|
else
|
|
|
|
|
CORCXXFLAGS += -O0
|
|
|
|
|
CPPFLAGS += -DDEBUG_ERRORSTACK
|
|
|
|
|
# Non-release build: include debug symbols.
|
|
|
|
|
COMPILEWITHDEBUGGINGSYMBOLS = yes
|
|
|
|
|
endif
|
|
|
|
|
ifdef WARN
|
|
|
|
|
CORCXXFLAGS+= -Wall
|
|
|
|
|
# I do *not* want -pedantic: for example I am currently using, on purpose,
|
|
|
|
|
# __PRETTY_FUNCTION__ only where supported.
|
|
|
|
|
# CORCXXFLAGS+= -pedantic
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CORCXXFLAGS += -Wstrict-aliasing=3
|
|
|
|
|
endif
|
|
|
|
|
else
|
|
|
|
|
# positron, early 2023: this has been there since before my time but I doubt
|
|
|
|
|
# it is a good idea. Let us suppress known-false-positive warnings, rather
|
|
|
|
|
# than all of them, blindly.
|
|
|
|
|
# CORCXXFLAGS+= -w
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# comma-separated list of tests to exclude from gensuite (relevant for running tests only)
|
|
|
|
|
EXCLUDE=
|
|
|
|
|
# These options are needed everywhere to make #include paths work.
|
|
|
|
|
CPPFLAGS += -I../src -I../asn.1
|
|
|
|
|
|
|
|
|
|
# Extend with platform-specific options.
|
|
|
|
|
ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CORCXXFLAGS += -Wno-gnu-include-next -qnosearch -qlanglvl=NOLIBEXT
|
|
|
|
|
CORCXXFLAGS += -fdiagnostics-color=auto
|
|
|
|
|
CORCXXFLAGS += -Wno-gnu-include-next -qnosearch
|
|
|
|
|
CPPFLAGS += -I$(HERE) -I. -I/usr/include
|
|
|
|
|
CPPFLAGS += -I/usr/lpp/java/J8.0_64/include -I/usr/include
|
|
|
|
|
CPPFLAGS += -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L -qlanglvl=NOLIBEXT
|
|
|
|
|
CPPFLAGS+=-W "l,xplink,dll" -W "c,float(ieee),xplink,dll,exportall"
|
|
|
|
|
else ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CORCXXFLAGS += -pthread -fPIC -fstrict-aliasing
|
|
|
|
|
CORCXXFLAGS += -fdiagnostics-color=auto
|
|
|
|
|
LDLIBS += -luuid
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CORCXXFLAGS += -pthread -fPIC -fstrict-aliasing
|
|
|
|
|
CORCXXFLAGS += -fcolor-diagnostics
|
|
|
|
|
CPPFLAGS+=-D_DARWIN_C_SOURCE
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Additional flags used for compiling ASN1C-generated code
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
# 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.
|
|
|
|
|
CPPFLAGS_GENERATED = -D_DEFAULT_SOURCE
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CPPFLAGS_GENERATED =
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### CFLAGS and CXXFLAGS #########
|
|
|
|
|
|
|
|
|
|
# We have essentially everything we need for both CFLAGS and CXXFLAGS in
|
|
|
|
|
# CORCXXFLAGS. Add the what ware still missing and is different, which is
|
|
|
|
|
# to say the language version.
|
|
|
|
|
CFLAGS = $(CORCXXFLAGS)
|
|
|
|
|
CXXFLAGS = $(CORCXXFLAGS)
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
# We could actually use C17, but only recent compilers understand the option
|
|
|
|
|
# -std=c17; for example GCC 7, which dates back from 2017 and should work
|
|
|
|
|
# well, does not. The 2011 standard is almost identical to the 2017 version
|
|
|
|
|
# anyway.
|
|
|
|
|
# So here we could use -std=c11 . However when trying -std=c11 for a while
|
|
|
|
|
# GCC was bothering me all the time with warnings about the non-standard
|
|
|
|
|
# __PRETTY_FUNCTION__ , which are useless noise since we use that
|
|
|
|
|
# conditionally only where supported. Doing away with that, and using gnu11
|
|
|
|
|
# instead of c11 to silently allow GNU extension, while *not* using them
|
|
|
|
|
# except in conditional code when we also have a fallback alternative.
|
|
|
|
|
#
|
|
|
|
|
# If I use some unsupported C feature by mistake people will tell me
|
|
|
|
|
# --positron.
|
|
|
|
|
# At least on GNU/Linux, where culturally we are used to use environment
|
|
|
|
|
# variables, honor CC instead of unconditionally overriding it!
|
|
|
|
|
CFLAGS += -std=gnu11
|
|
|
|
|
CXXFLAGS += -std=c++11
|
|
|
|
|
else ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
|
CXXFLAGS += -std=c++11
|
|
|
|
|
else ifeq ($(BUILD_FOR),OS/390)
|
|
|
|
|
CXXFLAGS += -std=c++11
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
######### Footer #########
|
|
|
|
|
|
|
|
|
|
################################
|
|
|
|
|
# Include local.conf for any overrides and additional flags
|
|
|
|
|
################################
|
|
|
|
|
-include $(HERE)/local.conf
|
|
|
|
|
|
|
|
|
|
ifdef BUILD_CONFIG
|
|
|
|
|
include $(BUILD_CONFIG)
|
|
|
|
|
endif
|
|
|
|
|
# From now on we can keep into account user overrides.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Post processing assignments ########
|
|
|
|
|
######### Directories ########
|
|
|
|
|
|
|
|
|
|
# Notice the single quotes below: since user definitions can contain dollar
|
|
|
|
|
# signs it is important to prevent their expansion: shell variable references
|
|
|
|
|
# here must be expanded at run time, and not at compile time.
|
|
|
|
|
ifdef PER_USER_DIRECTORY
|
|
|
|
|
EXTRA_MACROS+= -DPER_USER_DIRECTORY='"$(PER_USER_DIRECTORY)"'
|
|
|
|
|
EXTRA_MACROS += -DPER_USER_DIRECTORY='"$(PER_USER_DIRECTORY)"'
|
|
|
|
|
endif
|
|
|
|
|
ifdef PER_MACHINE_DIRECTORY
|
|
|
|
|
EXTRA_MACROS+= -DPER_MACHINE_DIRECTORY='"$(PER_MACHINE_DIRECTORY)"'
|
|
|
|
|
EXTRA_MACROS += -DPER_MACHINE_DIRECTORY='"$(PER_MACHINE_DIRECTORY)"'
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# If sequoia has been set up and the SEQUOIA flags aren't defined, set them up.
|
|
|
|
|
# Otherwise, add them to the CFLAGS/CXXFLAGS/LDFLAGS and library/include variables
|
|
|
|
|
ifeq ($(OPENPGP),SEQUOIA)
|
|
|
|
|
ifeq ($(SEQUOIA_CFLAGS),)
|
|
|
|
|
SEQUOIA_CFLAGS+=$(shell pkg-config --cflags-only-other pep_engine_sequoia_backend) -O2
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(SEQUOIA_LDFLAGS),)
|
|
|
|
|
SEQUOIA_LDFLAGS+=$(shell pkg-config --libs-only-L pep_engine_sequoia_backend)
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(SEQUOIA_LIB),)
|
|
|
|
|
SEQUOIA_LIB=$(shell pkg-config --libs-only-l --libs-only-other pep_engine_sequoia_backend)
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(SEQUOIA_INC),)
|
|
|
|
|
SEQUOIA_INC=$(shell pkg-config --cflags-only-I pep_engine_sequoia_backend)
|
|
|
|
|
endif
|
|
|
|
|
CFLAGS+= $(SEQUOIA_CFLAGS)
|
|
|
|
|
CXXFLAGS+= $(SEQUOIA_CFLAGS)
|
|
|
|
|
LD_FLAGS+= $(SEQUOIA_LDFLAGS)
|
|
|
|
|
# Overridable (default empty): SEQUOIA_CFLAGS
|
|
|
|
|
# Overridable (default empty): SEQUOIA_LDFLAGS
|
|
|
|
|
ifeq ($(SEQUOIA_LIB),)
|
|
|
|
|
SEQUOIA_LIB = -lpep_engine_sequoia_backend
|
|
|
|
|
endif
|
|
|
|
|
# Overridable (default empty): SEQUOIA_INC
|
|
|
|
|
|
|
|
|
|
# Use the Sequoia variables.
|
|
|
|
|
CORCXXFLAGS += $(SEQUOIA_CFLAGS)
|
|
|
|
|
CPPFLAGS += $(SEQUOIA_INC)
|
|
|
|
|
LD_FLAGS += $(SEQUOIA_LDFLAGS)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
|
|
|
|
@ -385,61 +325,111 @@ ifdef PEP_MIME
|
|
|
|
|
CXXFLAGS:=$(subst ++11,++14,$(CXXFLAGS)) -fPIC -fvisibility=hidden
|
|
|
|
|
endif
|
|
|
|
|
ifdef PEP_MIME
|
|
|
|
|
ifndef PEP_MIME_SRC
|
|
|
|
|
$(error "Compiling with the PEP_MIME option set requires the value of PEP_MIME_SRC to be set to the source directory for libpEpMIME")
|
|
|
|
|
else
|
|
|
|
|
CPPFLAGS+=-DPEP_BUILTIN_MIME
|
|
|
|
|
ifneq ($(BUILD_ON),OS/390)
|
|
|
|
|
LDLIBS+=-lstdc++
|
|
|
|
|
endif
|
|
|
|
|
ETPAN_LIB=
|
|
|
|
|
ETPAN_INC=
|
|
|
|
|
ifndef PEP_MIME_SRC
|
|
|
|
|
$(error "Compiling with the PEP_MIME option set requires the value of \
|
|
|
|
|
PEP_MIME_SRC to be set to the source directory for libpEpMIME")
|
|
|
|
|
else
|
|
|
|
|
CPPFLAGS+=-DPEP_BUILTIN_MIME
|
|
|
|
|
ifneq ($(BUILD_ON),OS/390)
|
|
|
|
|
LDLIBS+=-lstdc++
|
|
|
|
|
endif
|
|
|
|
|
ETPAN_LIB=
|
|
|
|
|
ETPAN_INC=
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Append user-specified CPPFLAGS ########
|
|
|
|
|
|
|
|
|
|
CPPFLAGS += $(EXTRA_MACROS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Handle COMPILEWITHDEBUGGINGSYMBOLS ########
|
|
|
|
|
|
|
|
|
|
# Add -g or equivalent if needed.
|
|
|
|
|
ifeq ($(COMPILEWITHDEBUGGINGSYMBOLS),yes)
|
|
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
|
|
|
|
CORCXXFLAGS += -ggdb
|
|
|
|
|
else
|
|
|
|
|
CORCXXFLAGS += -g
|
|
|
|
|
endif
|
|
|
|
|
else ifeq ($(COMPILEWITHDEBUGGINGSYMBOLS),no)
|
|
|
|
|
# All good: do nothing.
|
|
|
|
|
else
|
|
|
|
|
$(error "COMPILEWITHDEBUGGINGSYMBOLS is defined as \
|
|
|
|
|
'$(COMPILEWITHDEBUGGINGSYMBOLS)' which is different from both \
|
|
|
|
|
'no' and 'yes'.")
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Handle DEBUG ########
|
|
|
|
|
|
|
|
|
|
# Set safety mode through a command-line preprocessor definition.
|
|
|
|
|
ifeq ($(strip $(DEBUG)),)
|
|
|
|
|
CPPFLAGS += -DPEP_SAFETY_MODE=PEP_SAFETY_MODE_RELEASE
|
|
|
|
|
else
|
|
|
|
|
ifeq ($(strip $(DEBUG)),debug)
|
|
|
|
|
ifeq ($(DEBUG),release)
|
|
|
|
|
CPPFLAGS += -DPEP_SAFETY_MODE=PEP_SAFETY_MODE_RELEASE
|
|
|
|
|
else ifeq ($(DEBUG),debug)
|
|
|
|
|
CPPFLAGS += -DPEP_SAFETY_MODE=PEP_SAFETY_MODE_DEBUG
|
|
|
|
|
else
|
|
|
|
|
ifeq ($(strip $(DEBUG)),maintainer)
|
|
|
|
|
CPPFLAGS += -DPEP_SAFETY_MODE=PEP_SAFETY_MODE_MAINTAINER
|
|
|
|
|
else
|
|
|
|
|
$(error "DEBUG is defined as '$(strip $(DEBUG))' which is different from '', \
|
|
|
|
|
'debug' and 'maintainer'. Please read local.conf.example .")
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
else ifeq ($(DEBUG),maintainer)
|
|
|
|
|
CPPFLAGS += -DPEP_SAFETY_MODE=PEP_SAFETY_MODE_MAINTAINER
|
|
|
|
|
else
|
|
|
|
|
$(error "DEBUG is defined as '$(DEBUG)' which is different from \
|
|
|
|
|
'release', 'debug' and 'maintainer'. Please read \
|
|
|
|
|
local.conf.example .")
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Handle MAXLOGLEVEL ########
|
|
|
|
|
|
|
|
|
|
# Set maximum log level through a command-line preprocessor definition.
|
|
|
|
|
ifndef MAXLOGLEVEL
|
|
|
|
|
ifeq ($(strip $(DEBUG)),)
|
|
|
|
|
MAXLOGLEVEL = PRODUCTION
|
|
|
|
|
else
|
|
|
|
|
ifeq ($(strip $(DEBUG)),debug)
|
|
|
|
|
MAXLOGLEVEL = FUNCTION
|
|
|
|
|
else
|
|
|
|
|
ifeq ($(strip $(DEBUG)),maintainer)
|
|
|
|
|
ifeq ($(DEBUG),release)
|
|
|
|
|
MAXLOGLEVEL = PRODUCTION
|
|
|
|
|
else ifeq ($(DEBUG),debug)
|
|
|
|
|
MAXLOGLEVEL = FUNCTION
|
|
|
|
|
else ifeq ($(DEBUG),maintainer)
|
|
|
|
|
MAXLOGLEVEL = EVERYTHING
|
|
|
|
|
else
|
|
|
|
|
$(error "DEBUG is defined as '$(strip $(DEBUG))' which is different from 'debug' \
|
|
|
|
|
and 'maintainer'")
|
|
|
|
|
endif
|
|
|
|
|
else
|
|
|
|
|
$(error "DEBUG is defined as '$(DEBUG)' which is different from \
|
|
|
|
|
'release', 'debug' and 'maintainer'. Please read \
|
|
|
|
|
local.conf.example .")
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
CPPFLAGS += -DPEP_LOG_LEVEL_MAXIMUM=PEP_LOG_LEVEL_$(MAXLOGLEVEL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Handle LOGDESTINATIONS ########
|
|
|
|
|
|
|
|
|
|
# Set log destinations through a command-line preprocessor definition.
|
|
|
|
|
ifndef LOGDESTINATIONS
|
|
|
|
|
LOGDESTINATIONS = '(PEP_LOG_DESTINATION_STDERR|PEP_LOG_DESTINATION_DATABASE)'
|
|
|
|
|
LOGDESTINATIONS = '(PEP_LOG_DESTINATION_STDERR|PEP_LOG_DESTINATION_DATABASE)'
|
|
|
|
|
endif
|
|
|
|
|
CPPFLAGS += -DPEP_LOG_DESTINATIONS=$(LOGDESTINATIONS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Handle TRUSTWORDSXORCOMPATIBILITY ########
|
|
|
|
|
|
|
|
|
|
# Set xor-trustword compatibility through a command-line preprocessor
|
|
|
|
|
# definition.
|
|
|
|
|
ifdef TRUSTWORDSXORCOMPATIBILITY
|
|
|
|
|
CPPFLAGS += -DPEP_TRUSTWORDS_XOR_COMPATIBILITY=1
|
|
|
|
|
CPPFLAGS += -DPEP_TRUSTWORDS_XOR_COMPATIBILITY=1
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######### Makefile debugging #########
|
|
|
|
|
|
|
|
|
|
# We are about to define the target, which (considering that Makefile.conf is
|
|
|
|
|
# included) will probably be the first of the Makefile. But we do not want that
|
|
|
|
|
# target to be the default target.
|
|
|
|
|
first: all
|
|
|
|
|
|
|
|
|
|
# Print the value of some make variables
|
|
|
|
|
dump-make-variables:
|
|
|
|
|
@echo "BUILD_ON: $(BUILD_FOR)"
|
|
|
|
|
@echo "BUILD_FOR: $(BUILD_FOR)"
|
|
|
|
|
@echo "DEBUG: $(DEBUG)"
|
|
|
|
|
@echo "CC: $(CC)"
|
|
|
|
|
@echo "CXX: $(CXX)"
|
|
|
|
|
@echo "CFLAGS: $(CFLAGS)"
|
|
|
|
|
@echo "CXXFLAGS: $(CXXFLAGS)"
|
|
|
|
|
@echo "CPPFLAGS: $(CPPFLAGS)"
|
|
|
|
|
@echo "SQLITE3_FROM_OS: $(SQLITE3_FROM_OS)"
|
|
|
|
|