# 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 . 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++11 -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++11 -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 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 endif CXXFLAGS+= -Ijson_spirit $(BOOST_INC) $(ENGINE_INC) $(ETPAN_INC) $(EVENT_INC) $(GPGME_INC) $(UUID_INC) LDFLAGS+= $(BOOST_LIB) $(ENGINE_LIB) $(ETPAN_LIB) $(EVENT_LIB) $(GPGME_LIB) $(UUID_LIB) ifeq ($(BUILD_FOR),Linux) LDLIBS+= -levent -lpEpEngine -lpEpAdapter -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -Wl,-rpath-link="$(patsubst -L%,%,$(ETPAN_LIB))" GTEST_DIR=/usr/src/googletest/googletest/ else ifeq ($(BUILD_FOR),Darwin) LDLIBS+= -levent -lpEpEngine -lpEpAdapter -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-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 ######### Event ######### EVENT_INC=-I$(HOME)/code/libevent-2.0.22/build/include EVENT_LIB=-L$(HOME)/code/libevent-2.0.22/build/lib ######### GPGME ######### GPGME_INC= GPGME_LIB= ######### OSSP uuid ######### UUID_INC= UUID_LIB= ######### Footer ######### -include $(HERE)/local.conf ifdef BUILD_CONFIG -include $(BUILD_CONFIG) endif