2017-03-09 23:47:39 +03:00
|
|
|
MODEST_BUILD_OS := UNDEF
|
|
|
|
|
2017-03-11 22:53:26 +03:00
|
|
|
#********************
|
|
|
|
# Version
|
|
|
|
#***************
|
|
|
|
MODEST_VERSION_MAJOR := 1
|
|
|
|
MODEST_VERSION_MINOR := 0
|
|
|
|
MODEST_VERSION_PATCH := 0
|
|
|
|
|
|
|
|
MODEST_VERSION_STRING := $(MODEST_VERSION_MAJOR).$(MODEST_VERSION_MINOR).$(MODEST_VERSION_PATCH)
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# Flags
|
|
|
|
#***************
|
|
|
|
MODEST_CFLAGS ?= -Wall -Werror
|
|
|
|
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
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# Build
|
|
|
|
#***************
|
|
|
|
MODEST_BUILD_SHARED_AFTER :=
|
|
|
|
MODEST_BUILD_STATIC_AFTER :=
|
|
|
|
|
|
|
|
MODEST_BUILD_CLEAN_AFTER :=
|
|
|
|
|
|
|
|
#********************
|
|
|
|
# DEFAULT
|
|
|
|
#***************
|
|
|
|
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-12 21:04:09 +03:00
|
|
|
#********************
|
|
|
|
# Utils
|
|
|
|
#***************
|
|
|
|
define MODEST_UTILS_NEW_LINE
|
|
|
|
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
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-12 21:04:09 +03:00
|
|
|
MODEST_LIBRARY_NAME_WITH_VERSION := lib$(LIB_NAME).$(MODEST_VERSION_MAJOR)$(LIB_NAME_SUFFIX)
|
|
|
|
|
2017-03-11 12:23:24 +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
|
|
|
|
|
|
|
# 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-09 23:59:56 +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-12 21:04:09 +03:00
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -s $(call MODEST_LIBRARY_WITH_VERSION) $(call MODEST_LIBRARY) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -s $(call MODEST_LIBRARY_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -s $(call MODEST_LIBRARY_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
|
|
|
|
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
|
|
|
|
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
|
|
|
|
MODEST_CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS
|
|
|
|
endif
|
|
|
|
|
|
|
|
# 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-09 23:59:56 +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-12 21:04:09 +03:00
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -s $(call MODEST_LIBRARY_WITH_VERSION) $(call MODEST_LIBRARY) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -s $(call MODEST_LIBRARY_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
MODEST_BUILD_SHARED_AFTER += ln -s $(call MODEST_LIBRARY_WITH_VERSION) $(call MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR) $(MODEST_UTILS_NEW_LINE)
|
|
|
|
|
|
|
|
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
|
|
|
|
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
|
|
|
|
MODEST_CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS
|
|
|
|
else
|
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
|