-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.mk
205 lines (165 loc) · 5.14 KB
/
config.mk
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Copyright (c) 2015 Turbulenz Limited.
# Released under "Modified BSD License". See COPYING for full text.
ifeq ($(BUILDDIR),)
$(error BUILDDIR not set)
endif
include $(BUILDDIR)/utils.mk
############################################################
BUILDVERBOSE ?= 0
CMDVERBOSE ?= 0
CONFIG ?= release
VALGRIND ?= 0
ABSPATHS ?= 0
ABSPATHS_EXT ?= 1
UNITY ?= 1
PCH ?= 1
# Disable all build-in rules
.SUFFIXES:
############################################################
# Get basic platform info (HOST and TARGET)
############################################################
include $(BUILDDIR)/config_platform_info.mk
# $(info tzbuild: config.mk: called config_platform_info.mk)
############################################################
# CONFIG default settings
############################################################
ifeq ($(CONFIG),debug)
C_SYMBOLS ?= 1
C_OPTIMIZE ?= 0
C_RUNTIME_CHECKS ?= 0
LD_OPTIMIZE ?= 0
WIN_DLL=debug
endif
ifeq ($(CONFIG),development)
C_SYMBOLS ?= 1
C_OPTIMIZE ?= 0
C_RUNTIME_CHECKS ?= 0
LD_OPTIMIZE ?= 0
WIN_DLL=release
endif
ifeq ($(CONFIG),release-noltcg)
C_SYMBOLS ?= 1
C_OPTIMIZE ?= 1
C_RUNTIME_CHECKS ?= 0
LD_OPTIMIZE ?= 0
WIN_DLL=release
endif
ifeq ($(CONFIG),release)
C_SYMBOLS ?= 1
C_OPTIMIZE ?= 1
C_RUNTIME_CHECKS ?= 0
LD_OPTIMIZE ?= 1
WIN_DLL=release
endif
############################################################
# Target PLATFORM variables
############################################################
_platform_config := \
$(wildcard $(BUILDDIR)/platform_$(TARGET).mk) \
$(wildcard $(CUSTOMSCRIPTS)/platform_$(TARGET).mk)
ifeq (,$(strip $(_platform_config)))
$(error Cannot find platform_$(TARGET).mk)
endif
include $(_platform_config)
############################################################
OBJDIR = obj/$(TARGET)$(VARIANT)-$(CONFIG)
DEPDIR = $(OBJDIR)
LIBDIR = lib/$(TARGET)$(VARIANT)-$(CONFIG)
BINDIR = bin/$(TARGET)$(VARIANT)-$(CONFIG)
BINOUTDIR = bin/$(TARGET)-$(CONFIG)
############################################################
ifeq ($(BUILDVERBOSE),1)
log=$(warning $(1))
endif
$(call log,Verbose Mode Enabled...)
# $(call log,OBJDIR=$(OBJDIR))
# $(call log,LIBDIR=$(LIBDIR))
# $(call log,BINDIR=$(BINDIR))
############################################################
ifneq ($(CMDVERBOSE),1)
CMDPREFIX:=@
endif
ifeq ($(VALGRIND),1)
RUNPREFIX += valgrind --dsymutil=yes --track-origins=yes --leak-check=full \
--error-exitcode=15
# --gen-suppressions=all
CXXFLAGS += -DTZ_VALGRIND
endif
BUILDDIR_ABS := $(realpath $(BUILDDIR))
MV := python $(BUILDDIR_ABS)/commands/mv.py
CP := python $(BUILDDIR_ABS)/commands/cp.py
CAT := python $(BUILDDIR_ABS)/commands/cat.py
MKDIR := python $(BUILDDIR_ABS)/commands/mkdir.py
FIND := python $(BUILDDIR_ABS)/commands/find.py
RELPATH := python $(BUILDDIR_ABS)/commands/relpath.py
TSC ?= tsc
MAKE_APK_PROJ := python $(BUILDDIR)/commands/make_android_project.py
CLANG_TIDY ?= clang-tidy
ifneq (,$(filter win%,$(BUILDHOST)))
RM := python $(BUILDDIR)/commands/rm.py
TRUE := cmd /c "exit /b 0"
FALSE := cmd /c "exit /b 1"
else
RM := rm
TRUE := true
FALSE := false
endif
############################################################
# Util functions for the build description
# 1 - file name
file_flags = CXXFLAGS_$(subst /,_,$(realpath $(1)))
# 1 - source file name
# 2 - flags
set_file_flags = $(eval \
$(call file_flags,$(1)) := $(2) \
)
############################################################
# Common rules (building directories, etc)
############################################################
.SECONDEXPANSION:
_TZ_DIRS :=
# 1 - directory name
_dir_marker = $(foreach d,$(1),$(d).mkdir)
# 1 - directory name
define _create_mkdir_rule
$(if $(filter $(1),$(_TZ_DIRS)),$(error already have rule for dir: $1))
$(call _dir_marker,$(1)) :
@echo "[MKDIR] $1"
$(CMDPREFIX)$(MKDIR) $$(dir $$@)
$(CMDPREFIX)echo directory marker > $$@
_TZ_DIRS += $(1)
endef
# 1 - directory name
_mkdir_rule = \
$(foreach d,$(1), \
$(if $(filter $(d),$(_TZ_DIRS)),, \
$(eval $(call _create_mkdir_rule,$(d))) \
) \
)
############################################################
# Resolve externals.
#
# EXT list and all external versions
############################################################
# Pull in all platform-specific externals
EXT := $(sort $(EXT) $(EXT_$(TARGETNAME)) $(EXT_$(TARGET)))
# Let platform-specific versions <external>_version_<targetname>
# override defaults.
$(foreach ext,$(EXT),$(eval \
$(ext)_version := $(strip \
$(if $($(ext)_version_$(TARGETNAME)), \
$($(ext)_version_$(TARGETNAME)), \
$($(ext)_version)) \
)))
ifeq (,$(CONFIG))
$(error CONFIG not defined)
endif
ifeq (,$(TARGETNAME))
$(error TARGETNAME not defined)
endif
ifeq (,$(COMPILER))
$(error COMPILER not defined)
endif
ifeq (,$(ARCH))
$(error ARCH not defined)
endif