2017-03-09 23:47:39 +03:00
|
|
|
MODEST_BUILD_OS := UNDEF
|
|
|
|
|
2017-03-11 22:53:26 +03:00
|
|
|
#********************
|
|
|
|
# Version
|
|
|
|
#***************
|
2017-03-12 21:11:01 +03:00
|
|
|
MODEST_VERSION_MAJOR := 0
|
2017-03-11 22:53:26 +03:00
|
|
|
MODEST_VERSION_MINOR := 0
|
2017-03-12 21:11:01 +03:00
|
|
|
MODEST_VERSION_PATCH := 6
|
2017-03-11 22:53:26 +03:00
|
|
|
|
|
|
|
MODEST_VERSION_STRING := $(MODEST_VERSION_MAJOR).$(MODEST_VERSION_MINOR).$(MODEST_VERSION_PATCH)
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# Flags
|
|
|
|
#***************
|
2017-03-13 17:52:50 +03:00
|
|
|
MODEST_CFLAGS ?= -Wall -Werror -pipe -pedantic
|
2017-03-11 22:53:26 +03:00
|
|
|
MODEST_LFLAGS ?=
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# Include
|
|
|
|
#***************
|
|
|
|
# include dirs
|
|
|
|
INCLUDE_DIR := $(TARGET)
|
|
|
|
INCLUDE_DIR_API := include
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# Libraries
|
|
|
|
#***************
|
|
|
|
# lib name
|
|
|
|
LIB_NAME := modest
|
|
|
|
LIB_NAME_SUFFIX := .so
|
|
|
|
LIB_NAME_SUFFIX_STATIC := _static.a
|
|
|
|
|
|
|
|
# lib dirs
|
|
|
|
LIB_DIR_BASE := lib
|
|
|
|
|
2017-03-10 10:36:54 +03:00
|
|
|
# This variables used with "call" $(call MODEST_LIBRARY_WITH_VERSION),
|
|
|
|
# for use actual variables like a LIB_NAME_SUFFIX
|
2017-03-12 18:05:22 +03:00
|
|
|
MODEST_LIBRARY_NAME ?= lib$(LIB_NAME)$(LIB_NAME_SUFFIX)
|
|
|
|
MODEST_LIBRARY_NAME_STATIC ?=lib$(LIB_NAME)$(LIB_NAME_SUFFIX_STATIC)
|
2017-03-12 21:04:09 +03:00
|
|
|
MODEST_LIBRARY_NAME_WITH_VERSION = lib$(LIB_NAME)-$(MODEST_VERSION_STRING)$(LIB_NAME_SUFFIX)
|
2017-03-12 18:05:22 +03:00
|
|
|
|
|
|
|
MODEST_LIBRARY ?= $(LIB_DIR_BASE)/$(MODEST_LIBRARY_NAME)
|
|
|
|
MODEST_LIBRARY_STATIC ?= $(LIB_DIR_BASE)/$(MODEST_LIBRARY_NAME_STATIC)
|
|
|
|
MODEST_LIBRARY_WITH_VERSION = $(LIB_DIR_BASE)/$(MODEST_LIBRARY_NAME_WITH_VERSION)
|
2017-03-10 10:36:54 +03:00
|
|
|
|
2017-03-12 21:04:09 +03:00
|
|
|
MODEST_LIBRARY_WITH_VERSION_MAJOR = $(LIB_DIR_BASE)/lib$(LIB_NAME)-$(MODEST_VERSION_MAJOR)$(LIB_NAME_SUFFIX)
|
|
|
|
MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR = $(LIB_DIR_BASE)/lib$(LIB_NAME)-$(MODEST_VERSION_MAJOR).$(MODEST_VERSION_MINOR)$(LIB_NAME_SUFFIX)
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# Binaries
|
|
|
|
#***************
|
|
|
|
# binaries dirs
|
|
|
|
BINARY_DIR_BASE := bin
|
|
|
|
|
2017-03-13 17:52:50 +03:00
|
|
|
#********************
|
|
|
|
# Test
|
|
|
|
#***************
|
|
|
|
TEST_DIR := test
|
|
|
|
TEST_DIR_BASE := test_suite
|
|
|
|
|
2017-03-12 21:04:09 +03:00
|
|
|
#********************
|
|
|
|
# Build
|
|
|
|
#***************
|
|
|
|
MODEST_BUILD_SHARED_AFTER :=
|
|
|
|
MODEST_BUILD_STATIC_AFTER :=
|
|
|
|
|
|
|
|
MODEST_BUILD_CLEAN_AFTER :=
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# DEFAULT
|
|
|
|
#***************
|
2017-03-16 16:38:01 +03:00
|
|
|
SED ?= sed
|
2017-03-12 21:04:09 +03:00
|
|
|
MODEST_DIR_SEPARATOR ?= /
|
2017-03-09 23:47:39 +03:00
|
|
|
MODEST_PORT_NAME ?= posix
|
|
|
|
|
|
|
|
# flags
|
2017-03-09 23:53:29 +03:00
|
|
|
MODEST_OPTIMIZATION_LEVEL ?= -O2
|
2017-03-10 10:36:54 +03:00
|
|
|
MODEST_CFLAGS += -I$(INCLUDE_DIR)
|
|
|
|
MODEST_LDFLAGS +=
|
|
|
|
|
2017-03-09 23:47:39 +03:00
|
|
|
OS ?= $(shell uname -s)
|
2017-03-16 16:38:01 +03:00
|
|
|
prefix ?= /usr/local
|
|
|
|
exec_prefix ?= $(prefix)
|
2017-03-09 23:47:39 +03:00
|
|
|
|
2017-03-12 21:49:39 +03:00
|
|
|
#********************
|
|
|
|
# Set -D
|
|
|
|
#***************
|
|
|
|
ifeq ($(MyCORE_BUILD_DEBUG),YES)
|
|
|
|
MODEST_CFLAGS += -g3 -ggdb3 -O0 -fno-omit-frame-pointer -DMyCORE_BUILD_DEBUG
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(MyCORE_BUILD_WITHOUT_THREADS),YES)
|
|
|
|
MODEST_CFLAGS += -DMyCORE_BUILD_WITHOUT_THREADS
|
|
|
|
endif
|
|
|
|
|
2017-03-14 17:27:25 +03:00
|
|
|
ifeq ($(MyCORE_WITH_PERF),YES)
|
|
|
|
MODEST_CFLAGS += -DMyCORE_WITH_PERF
|
|
|
|
endif
|
|
|
|
|
2017-03-12 21:04:09 +03:00
|
|
|
#********************
|
|
|
|
# Utils
|
|
|
|
#***************
|
|
|
|
define MODEST_UTILS_NEW_LINE
|
|
|
|
|
|
|
|
|
|
|
|
endef
|
2017-03-15 18:36:30 +03:00
|
|
|
MODEST_UTILS_TO_UPCASE = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
|
2017-03-12 21:04:09 +03:00
|
|
|
|
2017-03-09 23:47:39 +03:00
|
|
|
#*******************************
|
|
|
|
# Windows_NT
|
|
|
|
#*******************
|
|
|
|
ifeq ($(OS),Windows_NT)
|
2017-03-11 12:23:24 +03:00
|
|
|
LIB_NAME_SUFFIX := .dll
|
|
|
|
LIB_NAME_SUFFIX_STATIC := .dll.a
|
|
|
|
|
2017-03-13 09:48:06 +03:00
|
|
|
MODEST_LIBRARY_NAME_WITH_VERSION := lib$(LIB_NAME)-$(MODEST_VERSION_MAJOR)$(LIB_NAME_SUFFIX)
|
2017-03-12 21:04:09 +03:00
|
|
|
|
2017-03-13 18:02:31 +03:00
|
|
|
MODEST_CFLAGS += -Wno-unused-variable -Wno-unused-function -std=c99
|
2017-03-11 22:53:26 +03:00
|
|
|
MODEST_LDFLAGS += -Wl,--out-implib,$(call MODEST_LIBRARY_STATIC)
|
2017-03-09 23:47:39 +03:00
|
|
|
|
2017-03-12 21:17:20 +03:00
|
|
|
MODEST_BUILD_SHARED_AFTER += cp $(call MODEST_LIBRARY_WITH_VERSION) $(BINARY_DIR_BASE) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(BINARY_DIR_BASE)/$(call MODEST_LIBRARY_NAME_WITH_VERSION) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
|
2017-03-09 23:47:39 +03:00
|
|
|
# Need set
|
|
|
|
MODEST_BUILD_OS := $(OS)
|
|
|
|
# this name eq source/myport/<namedir>
|
2017-03-11 12:23:24 +03:00
|
|
|
MODEST_PORT_NAME := windows_nt
|
2017-03-09 23:47:39 +03:00
|
|
|
endif
|
|
|
|
# end of Windows_NT
|
|
|
|
|
|
|
|
#*******************************
|
|
|
|
# Darwin, Mac OS X
|
|
|
|
#*******************
|
|
|
|
ifeq ($(OS),Darwin)
|
2017-03-09 23:53:29 +03:00
|
|
|
MODEST_CFLAGS += -fPIC
|
2017-03-13 18:02:31 +03:00
|
|
|
MODEST_CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable -Wno-unused-function -std=c99
|
2017-03-09 23:47:39 +03:00
|
|
|
LIB_NAME_SUFFIX := .dylib
|
|
|
|
|
2017-03-16 16:38:01 +03:00
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -sf $(call MODEST_LIBRARY_NAME_WITH_VERSION) $(call MODEST_LIBRARY) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -sf $(call MODEST_LIBRARY_NAME_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -sf $(call MODEST_LIBRARY_NAME_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR) $(MODEST_UTILS_NEW_LINE)
|
2017-03-12 21:04:09 +03:00
|
|
|
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(call MODEST_LIBRARY) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(call MODEST_LIBRARY_WITH_VERSION_MAJOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(call MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
|
2017-03-09 23:47:39 +03:00
|
|
|
# Need set
|
|
|
|
MODEST_BUILD_OS := $(OS)
|
|
|
|
# this name eq source/myport/<namedir>
|
|
|
|
MODEST_PORT_NAME := posix
|
|
|
|
endif
|
|
|
|
# end of Darwin, Mac OS X
|
|
|
|
|
|
|
|
#*******************************
|
|
|
|
# POSIX
|
|
|
|
#*******************
|
|
|
|
ifeq ($(MODEST_BUILD_OS),UNDEF)
|
|
|
|
MODEST_CFLAGS += -fPIC
|
|
|
|
MODEST_CFLAGS += -D_POSIX_C_SOURCE=199309L
|
2017-03-13 18:02:31 +03:00
|
|
|
MODEST_CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable -Wno-unused-function -std=c99
|
2017-03-09 23:53:29 +03:00
|
|
|
|
2017-03-16 16:38:01 +03:00
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -sf $(call MODEST_LIBRARY_NAME_WITH_VERSION) $(call MODEST_LIBRARY) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -sf $(call MODEST_LIBRARY_NAME_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -sf $(call MODEST_LIBRARY_NAME_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR) $(MODEST_UTILS_NEW_LINE)
|
2017-03-12 21:04:09 +03:00
|
|
|
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(call MODEST_LIBRARY) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(call MODEST_LIBRARY_WITH_VERSION_MAJOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_CLEAN_AFTER += rm -f $(call MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
|
2017-03-09 23:47:39 +03:00
|
|
|
# build without threads
|
2017-03-12 21:49:39 +03:00
|
|
|
ifneq ($(MyCORE_BUILD_WITHOUT_THREADS),YES)
|
2017-03-10 10:36:54 +03:00
|
|
|
MODEST_LDFLAGS += -pthread
|
2017-03-09 23:47:39 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Need set
|
|
|
|
MODEST_BUILD_OS := $(OS)
|
|
|
|
# this name eq source/myport/<namedir>
|
|
|
|
MODEST_PORT_NAME := posix
|
|
|
|
endif
|
|
|
|
# end of POSIX
|