p≡p JSON adapter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

163 lines
4.1 KiB

# Copyright 2017 pEp Security SA
#
# This file is part of pEp JSON Server Adapter.
#
# pEp JSON Server Adapter is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License, version 3, as
# published by the Free Software Foundation.
#
# pEp JSON Server Adapter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with pEp JSON Server Adapter. If not, see <http://www.gnu.org/licenses/>.
HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
######### General #########
BUILD_ON:=$(shell uname)
# 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`.
ifneq ($(BUILD_ON),$(BUILD_FOR))
$(error "I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).")
endif
# Installation path prefix for libraries and binaries, except for HTML files
PREFIX=/usr
# Installation path for HTML files
HTML_DIRECTORY=$(PREFIX)/share/pEp/json-adapter/html
# Filename of the pEp JSON Server Adapter binary
TARGET=pEp-mini-json-adapter
# Filename of the pEp JSON Server Adapter testing binary
TARGET_TEST=servertest
# Filename of the unittest binary
TARGET_GTEST=unittests
# If empty, create a release build.
# Otherwise, create a debug build.
# This variable is ineffective in your local.conf file.
DEBUG=placeholder
# If empty, suppress compiler warnings.
# Otherwise, print warnings.
# This variable is ineffective in your local.conf file.
WARN=placeholder
######### C++ #########
TARGET_ARCH=
ifeq ($(BUILD_FOR),Linux)
CXX=g++ -std=c++14 -pthread -fPIC
else ifeq ($(BUILD_FOR),Darwin)
# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
# "c++" != "clang"
CXX=c++ -std=c++14 -fPIC
endif
HTML_DIR ?= "html"
CPPFLAGS=-isystem $(GTEST_DIR)/include -DHTML_DIR=$(HTML_DIR)
ifeq ($(BUILD_FOR),Linux)
CXXFLAGS=-fstack-protector-all # -fdiagnostics-color=always
ifdef WARN
CXXFLAGS+= -Wall
else
CXXFLAGS+= -w
endif
ifdef DEBUG
CXXFLAGS+= -O0 -g -ggdb -DDEBUG_ENABLED
else
CXXFLAGS+= -O3 -DNDEBUG
endif
CXXFLAGS+=-fvisibility=hidden
else ifeq ($(BUILD_FOR),Darwin)
CXXFLAGS=-pthread -fstack-protector-all # -fcolor-diagnostics
ifdef WARN
CXXFLAGS+= -Wall
else
CXXFLAGS+= -w
endif
ifdef DEBUG
CXXFLAGS+= -O0 -g -DDEBUG_ENABLED
else
CXXFLAGS+= -O3 -DNDEBUG
endif
CXXFLAGS+=-fvisibility=hidden
endif
CXXFLAGS+= -Ijson_spirit $(BOOST_INC) $(ENGINE_INC) $(ETPAN_INC) $(GPGME_INC) $(UUID_INC)
LDFLAGS+= $(BOOST_LIB) $(ENGINE_LIB) $(ETPAN_LIB) $(GPGME_LIB) $(UUID_LIB)
LDLIBS+=$(WEBSERVER_LIB)
ifeq ($(MIME_LIB),etpan)
LDLIBS+=-letpan
else ifeq ($(MIME_LIB),pEpMIME)
LDLIBS+=-lpEpMIME
else
$(error "You must set MIME_LIB to 'etpan' or 'pEpMIME'!" )
endif
ifeq ($(BUILD_FOR),Linux)
LDLIBS+= -lpEpEngine -lpEpAdapter -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_regex
GTEST_DIR=/usr/src/googletest/googletest/
else ifeq ($(BUILD_FOR),Darwin)
LDLIBS+= -lpEpEngine -lpEpAdapter -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-mt -lboost_regex-mt
endif
######### Google Test #########
#GTEST_DIR=
######### boost #########
BOOST_INC=
BOOST_LIB=
######### Engine #########
ENGINE_INC=-I$(HOME)/code/engine/build/include
ENGINE_LIB=-L$(HOME)/code/engine/build/lib
######### Etpan #########
ETPAN_INC=-I$(HOME)/code/libetpan/build/include
ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
######### pEp::Webserver #########
WEBSERVER_LIB=$(HOME)/local/lib/libpEpwebserver.a
######### GPGME #########
GPGME_INC=
GPGME_LIB=
######### OSSP uuid #########
UUID_INC=
UUID_LIB=
######### Footer #########
-include $(HERE)/local.conf-old
ifdef BUILD_CONFIG
-include $(BUILD_CONFIG)
endif