major Makefile.conf refactoring and simplification; solve gitea-117

Solve #117 .
gitea-117
positron 2 weeks ago
parent 2f07868a7e
commit e61f850828

@ -24,7 +24,7 @@ BUILT_IN_MIME=
ifdef PEP_MIME
BUILT_IN_MIME=pepmime
endif
.PHONY: all $(BUILT_IN_MIME) codegen asn1 build install dbinstall uninstall clean tags test package db doc
build: $(BUILT_IN_MIME) asn1

@ -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)"

13
NEWS

@ -1,5 +1,18 @@
* DEPENDENCIES: use the most recent pEpEngineSequoiaBackend , which we made
nicer to build and install with make.
* local.conf.example: in order to build the Engine in safety mode 'release' the
DEBUG variable must now be defined as 'release', instead of being set to be
empty.
* bug fix: actually keep into account the safety mode to determine the Engine
compiler flags, so that optimisation and the presence debugging symbols can
be controlled.
Now default to *always* compiling with debugging symbols; however this new
behaviour can be overridden...
* local.conf.example: ...with new user-overridable variable
COMPILEWITHDEBUGGINGSYMBOLS , which lets the user decide whether the Engine is
compiled with the -g (or equivalent) option.
* Build system: PER_MACHINE_DIRECTORY: change the default value to use PREFIX.
I suspect the previous default was not used much.
v3.2.0-RC20 2023-01-23
* make register_sync_callbacks really side-effect-free; this fixes

@ -15,29 +15,36 @@
# suit her own configuration.
# Debugging symbols
# #########################################################
# We suggest always compiling the pEp Engine with debugging symbol: the price
# to pay is just an increase in binary code size, with no impact on execution
# speed.
# If the user disagrees with us and wants to compile without debugging symbols
# she can comment-out the line below.
# # Omit debugging symbols for a smaller (but not faster) binary.
# COMPILEWITHDEBUGGINGSYMBOLS = yes
# Satefy mode.
# #########################################################
# You may uncomment one of the three DEBUG definitions below. Any other
# definition of DEBUG will result in a build-time error.
#
# An incompatibility was introduced in pEp Engine 3.2.0-RC21: an empty value
# for DEBUG no longer means 'release', and is now considered invalid.
# Providing no definition is still supported, and yields the default safety
# mode (debug).
# Build the Engine in release mode, with assertions disabled. In this mode
# API functions will check their requirements and return PEP_ILLEVAL_VALUE on
# API functions will check their requirements and return PEP_ILLEGAL_VALUE on
# failure.
# Notice that the behaviour of DEBUG has changed in a slightly incompatible way
# since Engine 3.2.0-RC13 , even if the change is unlikely to actually bother
# users. It used to be the case that in order to have a release build the DEBUG
# variable needed to be *undefined*, as in
# undefine DEBUG
# using the undefine directive from GNU make. Now it is perfectly equivalent
# to undefine DEBUG or to define it as empty.
# An old local.conf file using an *empty* definition of DEBUG will now result
# in a release build, and not in a debug build. A debug build can be obtained
# by changing the definition from 'DEBUG =' to 'DEBUG = debug', as in the
# alternative shown below.
#
# # Build the Engine in release mode.
# DEBUG =
# DEBUG = release
# Build the Engine in debug mode. In this mode API functions check that
# requirements on their parameters are satisfied, and return PEP_ILLEGAL_VALUE
@ -51,7 +58,7 @@
# Build the Engine in maintainer mode. In this mode API functions check that
# requirements on their parameters are satisfied, weak assertions are enabled
# and so are internal assetions, only intended for Engine developers; on any
# and so are internal assertions, only intended for Engine developers; on any
# check violation the engine aborts in order to make the failure visible.
#
# This mode is intended for the few developers of the Engine itself, and not

@ -5,51 +5,43 @@
include ../Makefile.conf
ifneq ($(BUILD_ON),OS/390)
LDFLAGS+= -shared
ifneq ($(BUILD_FOR),OS/390)
LDFLAGS += -shared
endif
NO_SOURCE=
ifndef PEP_MIME
ifeq ($(BUILD_ON),OS/390)
LDLIBS+= -letpan-no-mt
else
LDLIBS+= -letpan
endif
ifeq ($(BUILD_FOR),OS/390)
LDLIBS+= -letpan-no-mt
else
LDLIBS+= -letpan
endif
else
LDLIBS+= -lpEpMIME
NO_SOURCE+= etpan_mime.c
endif
CFLAGS+= -I../asn.1 $(EXTRA_MACROS)
CFLAGS+= -I$(PREFIX)/include
CPPFLAGS+= -DSQLITE_THREADSAFE=1
LDFLAGS+= -L../asn.1
LDFLAGS+= -L$(PREFIX)/lib
ifneq ($(BUILD_ON),OS/390)
LDFLAGS+= -shared
LDLIBS+= -lc
ifneq ($(BUILD_FOR),OS/390)
LDFLAGS+= -shared
LDLIBS+= -lc
endif
LDLIBS+= -lasn1
ifeq ($(BUILD_ON),OS/390)
ifeq ($(BUILD_FOR),OS/390)
OPENPGP=NETPGP
LDLIBS+= -lzz
else ifeq ($(BUILD_ON),Darwin)
ifeq ($(BUILD_FOR),Darwin)
LDLIBS+= -lz -liconv
else
$(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
endif
else ifeq ($(BUILD_ON),Linux)
ifeq ($(BUILD_FOR),Linux)
CPPFLAGS+= -D_GNU_SOURCE
LDLIBS+= -ldl -luuid
else
$(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
endif
else ifeq ($(BUILD_FOR),Darwin)
LDLIBS+= -lz -liconv
else ifeq ($(BUILD_FOR),Linux)
CPPFLAGS+= -D_GNU_SOURCE
LDLIBS+= -ldl -luuid
else
$(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
endif
@ -79,7 +71,7 @@ endif
ALL_SOURCE=$(filter-out $(NO_SOURCE),$(wildcard *.c))
DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
ifeq ($(BUILD_ON),OS/390)
ifeq ($(BUILD_FOR),OS/390)
ALL_OBJECTS+=/usr/lib/GSKCMS64.x
ALL_OBJECTS+=/usr/lib/CSNPCA64.x
endif
@ -102,9 +94,9 @@ ifneq ($(MAKECMDGOALS),clean)
endif
$(TARGET): libpEpEngine.a
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(CFLAGS) $(ALL_OBJECTS) $(LDLIBS)
$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $(ALL_OBJECTS) $(LDLIBS)
.PHONY: objects clean install_headers install uninstall beinstall doc
.PHONY: first all objects clean install_headers install uninstall beinstall doc
objects: $(ALL_OBJECTS)

@ -41,7 +41,7 @@ ifdef PEP_MIME
LDLIBS+= -lpEpMIME
else
ifneq ($(BUILD_ON),OS/390)
LDLIBS+= -letpan -lpEpEngine -lstdc++
LDLIBS+= -lpEpEngine -letpan -lstdc++
endif
endif
@ -72,7 +72,13 @@ else ifeq ($(OPENPGP),NETPGP)
endif
endif
# Ignore NDEBUG being defined. The first definition is correct; the others not
# really, but I am keeping them for compatibility since that was the old style
# and some people might have overriden CFLAGS or CXXFLAGS with preprocessor
# options.
CPPFLAGS:=$(filter-out -DNDEBUG,$(CPPFLAGS))
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
# FIXME Possibly missing incdirs: ASN1C_INC
CXXFLAGS+= -I$(GTEST_INC_DIR) -I./src -I../sync $(INC_FLAGS) -Wno-deprecated -Wno-unused-variable

Loading…
Cancel
Save