1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
THIS_DIRECTORY := $(dir $(lastword $(MAKEFILE_LIST)))
PROJECT_ROOT := $(abspath $(THIS_DIRECTORY)/..)
BUILD_ROOT ?= $(PROJECT_ROOT)/build
GMOCK_ROOT ?= $(PROJECT_ROOT)/external/gmock-1.7.0
# Without this, rm -rf *.(o,so) fails
SHELL=/bin/bash
INCLUDES := -I$(PROJECT_ROOT)/include -I$(PROJECT_ROOT)/external
ifdef COVERAGE
OBJDIR := $(BUILD_ROOT)/C++/Coverage
else
OBJDIR := $(BUILD_ROOT)/C++
endif
VPATH := src/C++/ \
:src/C++/Align \
:src/C++/Edna \
:src/C++/Matrix/ \
:src/C++/Quiver/ \
:src/C++/Quiver/detail \
:src/C++/Poa/ \
:src/C++/Statistics \
:src/C++/Logging
CXX_LIB := $(abspath $(OBJDIR)/libConsensusCore.a)
CXX_SRCS := $(notdir $(shell find src/C++/ -name "*.cpp" | grep -v '\#'))
CXX_OPT_FLAGS_DEBUG := -O0 -g
CXX_OPT_FLAGS_RELEASE := -O3 -DNDEBUG -g
ifeq ($(DEBUG),)
CXX_OPT_FLAGS = $(CXX_OPT_FLAGS_RELEASE)
else
CXX_OPT_FLAGS = $(CXX_OPT_FLAGS_DEBUG)
endif
# Detect mac/linux
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
GXX ?= clang++
else
GXX ?= g++
endif
ifeq ($(GXX),clang++)
CXX_FLAGS = $(GXX_FLAGS) $(CXX_OPT_FLAGS) -fPIC -Qunused-arguments -fno-omit-frame-pointer
CXX_STRICT_FLAGS = $(GXX_FLAGS) $(CXX_FLAGS) -pedantic -std=$(CPP_STD) -Wall
else
CXX_FLAGS = $(CXX_OPT_FLAGS) $(CXX_EXTRA_ARGS) -fPIC -fno-omit-frame-pointer
CXX_STRICT_FLAGS = $(CXX_FLAGS) -pedantic -std=$(CPP_STD) -Wall
endif
CXX = $(CCACHE) $(GXX) $(MACHINE) $(CPPFLAGS) $(CXXFLAGS) $(CXX_FLAGS) $(INCLUDES) -I$(BOOST) $(LDFLAGS)
CXX_STRICT = $(CCACHE) $(GXX) $(MACHINE) $(CPPFLAGS) $(CXXFLAGS) $(CXX_STRICT_FLAGS) $(INCLUDES) -I$(BOOST) $(LDFLAGS)
ifeq ($(UNAME), Darwin)
SHLIB_FLAGS = -shared -undefined dynamic_lookup
else
SHLIB_FLAGS = -pthread -shared -Wl,-O1
endif
GMOCK_LIBSRC := $(GMOCK_ROOT)/gmock-gtest-all.cc
GMOCK_MAIN := $(GMOCK_ROOT)/gmock_main.cc
PYTHON_BUILD_DIR := $(BUILD_ROOT)/Python
CSHARP_BUILD_DIR := $(BUILD_ROOT)/CSharp
SWIG_INTERFACE = src/SWIG/ConsensusCore.i
SWIG_INTERFACES = $(shell find src/SWIG/ -name "*.i" | grep -v '\#')
|