-
Notifications
You must be signed in to change notification settings - Fork 147
/
Makefile.cfg
151 lines (121 loc) · 4.61 KB
/
Makefile.cfg
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
MODEST_BUILD_OS := UNDEF
#********************
# Version
#***************
PROJECT_VERSION_MAJOR := 4
PROJECT_VERSION_MINOR := 0
PROJECT_VERSION_PATCH := 6
PROJECT_VERSION_STRING := $(PROJECT_VERSION_MAJOR).$(PROJECT_VERSION_MINOR).$(PROJECT_VERSION_PATCH)
#********************
# Flags
#***************
MODEST_CFLAGS ?= -Wall -Werror -pipe -pedantic
MODEST_LFLAGS ?=
#********************
# Include
#***************
# include dirs
INCLUDE_DIR := $(TARGET)
INCLUDE_DIR_API := include
#********************
# Libraries
#***************
# lib name
LIB_NAME := myhtml
LIB_NAME_SUFFIX := .so
LIB_NAME_SUFFIX_STATIC := _static.a
# lib dirs
LIB_DIR_BASE := lib
# This variables used with "call" $(call MODEST_LIBRARY_WITH_VERSION),
# for use actual variables like a LIB_NAME_SUFFIX
MODEST_LIBRARY_NAME ?= lib$(LIB_NAME)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY_NAME_STATIC ?=lib$(LIB_NAME)$(LIB_NAME_SUFFIX_STATIC)
MODEST_LIBRARY_NAME_WITH_VERSION = lib$(LIB_NAME)-$(PROJECT_VERSION_STRING)$(LIB_NAME_SUFFIX)
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)
MODEST_LIBRARY_WITH_VERSION_MAJOR = $(LIB_DIR_BASE)/lib$(LIB_NAME)-$(PROJECT_VERSION_MAJOR)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR = $(LIB_DIR_BASE)/lib$(LIB_NAME)-$(PROJECT_VERSION_MAJOR).$(PROJECT_VERSION_MINOR)$(LIB_NAME_SUFFIX)
#********************
# Binaries
#***************
# binaries dirs
BINARY_DIR_BASE := bin
#********************
# Test
#***************
TEST_DIR := test
TEST_DIR_BASE := test_suite
#********************
# Build
#***************
MODEST_SOURCE ?= $(SRCDIR)
MODEST_BUILD_SHARED_AFTER :=
MODEST_BUILD_STATIC_AFTER :=
MODEST_BUILD_CLEAN_AFTER :=
#********************
# DEFAULT
#***************
SED ?= sed
MODEST_DIR_SEPARATOR ?= /
# flags
PROJECT_OPTIMIZATION_LEVEL ?= -O2
MODEST_CFLAGS += -I$(INCLUDE_DIR)
MODEST_LDFLAGS +=
OS ?= $(shell uname -s)
prefix ?= /usr/local
exec_prefix ?= $(prefix)
MODEST_CLONE_SED_HEADER_COMMAND = find $(INCLUDE_DIR_API) -name "*.h" -exec sed -i.bak -e 's,\s*\#\s*include\s*"\([^"]*\)",\#include <\1>,g' {} \;
#********************
# Set -D
#***************
ifeq ($(MyCORE_BUILD_DEBUG),YES)
override PROJECT_OPTIMIZATION_LEVEL :=
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
ifeq ($(MyCORE_WITH_PERF),YES)
MODEST_CFLAGS += -DMyCORE_WITH_PERF
endif
#********************
# Utils
#***************
define MODEST_UTILS_NEW_LINE
endef
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))))))))))))))))))))))))))
#*******************************
# Load platform specific rules for build
# We try to include all Rules.mk file in /source/myport/*/Rules.mk
#*******************
ifndef MODEST_PORT_NAME
MYPORT_BUILD_RULES := $(foreach path,$(wildcard $(MODEST_SOURCE)/myport/*/),$(dir $(path))Rules.mk)
-include $(MYPORT_BUILD_RULES)
else
MYPORT_BUILD_RULES := $(MODEST_SOURCE)/myport/$(MODEST_PORT_NAME)/Rules.mk
-include $(MYPORT_BUILD_RULES)
endif # def MODEST_PORT_NAME
#*******************************
# POSIX
#*******************
ifeq ($(MODEST_BUILD_OS),UNDEF)
MODEST_CFLAGS += -fPIC
MODEST_CFLAGS += -D_POSIX_C_SOURCE=199309L
MODEST_CFLAGS += $(PROJECT_OPTIMIZATION_LEVEL) -Wno-unused-variable -Wno-unused-function -std=c99
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)
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)
# build without threads
ifneq ($(MyCORE_BUILD_WITHOUT_THREADS),YES)
MODEST_LDFLAGS += -pthread
endif
# Need set
MODEST_BUILD_OS := $(OS)
# this name eq source/myport/<namedir>
MODEST_PORT_NAME := posix
endif
# end of POSIX