]> git.saurik.com Git - apple/icu.git/blob - makefile
ICU-64260.0.1.tar.gz
[apple/icu.git] / makefile
1 ##
2 # Wrapper makefile for ICU
3 # Copyright (C) 2003-2018 Apple Inc. All rights reserved.
4 #
5 # See http://www.gnu.org/manual/make/html_chapter/make_toc.html#SEC_Contents
6 # for documentation on makefiles. Most of this was culled from the ncurses makefile.
7 #
8 #################################
9 # Apple ICU repository tag and submission numbers
10 #
11 # The repository tag number consists of a main version and an optional branch version, as
12 # follows:
13 # ICU-MMmAA[.B]
14 #
15 # MM comes from the open-source ICU major version, and can range from 1 to 214 (the max is
16 # due to B&I limits on submission versions). As of March 2016 this is 57; it increases
17 # by 1 for each ICU major release (usually 2 / year). This corresponds to
18 # U_ICU_VERSION_MAJOR_NUM.
19 # m is a single digit specifying the open-source ICU minor version. This is 0 before final
20 # release (e.g. for pre-release milestones), becomes 1 for release candidate and final
21 # release, and may increase to 2 or a little more for occasional dot releases with
22 # maintenance fixes. This corresponds to U_ICU_VERSION_MINOR_NUM.
23 #
24 # Note that the ICU release may also utilize U_ICU_VERSION_PATCHLEVEL_NUM; however
25 # that is ignored for the Apple ICU tag and submission numbers, and any related code
26 # or data changes will bne distinguished by updating the Apple delta version AA below.
27 #
28 # AA is a 2-digit value specifying the version of the additional Apple deltas after
29 # integrating a major release. This is always 2 digits (zero padded) and ranges from
30 # 00 (the first release after integrating a new ICU version) to 99.
31 # B is an optional branch version, i.e. a branch from the mainline version specified by
32 # the MMmAA part. It can range from 1 to 99 and is NOT zero-padded.
33 #
34 # For Windows builds, the first 3 values of the 4-part FILEVERSION and PRODUCTVERSION
35 # are formed from U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, and
36 # U_ICU_VERSION_PATCHLEVEL_NUM; the 4th value is ICU_BUILD, formed from AA and B as
37 # ICU_BUILD = 100*AA + B.
38 #
39 # The B&I submission version always has 3 parts separated by '.':
40 # MMmAA.(0 | B).T
41 #
42 # The first part MMmAA is the same as the repository tag number.
43 # If the repository tag has no branch version, the second part is 0, otherwise it is
44 # the same as the branch version (1..99).
45 # The third part is a single digit designating the submission train; since the installsrc
46 # target now submits different sources to different trains, we have to distinguish them.
47 # The values currently defined for T are
48 # 1 OSX trains
49 # 2 embedded trains (iOS, tvos, watchos, bridgeos) including simulator versions thereof
50 # 8 AAS for Windows
51 # 9 linux for Siri servers
52 # (additional train numbers for Apple platforms can be assigned from 3 up, additional
53 # train numbers for non-Apple platforms can be assigned from 7 down).
54 #
55 #################################
56 # Notes on building for AAS using Windows (10) + Visual Studio (2015) + Cygwin:
57 #
58 # Either this should be run indirectly from the VS command prompt via the
59 # BuildICUForAAS script or project, using the instructions there (which build
60 # both 32-bit and 64-bit), or it should be run from within Cygwin using the
61 # following instructions or equivalent (different steps for 32-bit or 64-bit
62 # targets, details may also differ if you have the 32-bit cygwin install vs the
63 # 64-bit one, i.e. cygwin vs cygwin64):
64 #
65 # 1. From VS command prompt, run vcvarsall.bat to set various environment variables.
66 # For a 32-bit build:
67 # > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
68 # For a 64-bit build:
69 # > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
70 #
71 # 2. Launch Cygwin, e.g. for the 64-bit cygwin install:
72 # > C:\cygwin64\cygwin.bat
73 #
74 # 3. Within cygwin, cd to the top level of the ICU sources directory, e.g.
75 # $ cd ICU
76 #
77 # 4. Adjust the PATH to put the appropriate VC tools directory first:
78 # For a 32-bit build:
79 # $ export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/":$PATH
80 # For a 64-bit build:
81 # $ export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/":$PATH
82 #
83 # 5. Run the ICU makefile
84 # For a 32-bit build:
85 # make [install] WINDOWS=YES [ARCH64=NO] [DSTROOT=...]
86 # For a 64-bit build:
87 # make [install] WINDOWS=YES ARCH64=YES [DSTROOT=...]
88 #
89 #################################
90
91 #################################
92 #################################
93 # MAKE VARS
94 #################################
95 #################################
96
97 # ':=' denotes a "simply expanded" variable. It's value is
98 # set at the time of definition and it never recursively expands
99 # when used. This is in contrast to using '=' which denotes a
100 # recursively expanded variable.
101
102 # Sane defaults, which are typically overridden on the command line
103 #or by the environment
104 ifeq ($(OS),Windows_NT)
105 WINDOWS=YES
106 LINUX=NO
107 else
108 WINDOWS=NO
109 LINUX?=$(shell [[ "`uname -s`" == "Linux" ]] && echo YES || echo NO)
110 endif
111 ARCH64?=YES
112 RC_ARCHS=
113 ifndef RC_ProjectSourceVersion
114 ifdef RC_PROJECTSOURCEVERSION
115 RC_ProjectSourceVersion=$(RC_PROJECTSOURCEVERSION)
116 endif
117 endif
118 $(info # RC_XBS=$(RC_XBS))
119 $(info # RC_ARCHS=$(RC_ARCHS))
120 $(info # RC_ProjectName=$(RC_ProjectName))
121 $(info # RC_ProjectSourceVersion=$(RC_ProjectSourceVersion))
122
123 # Disallow $(WINDOWS) and $(LINUX) both YES
124 ifeq "$(WINDOWS)" "YES"
125 ifeq "$(LINUX)" "YES"
126 $(error WINDOWS and LINUX cannot both be YES)
127 endif
128 endif
129
130 # chicken and egg problem: we can't use cygpath until PATH & SHELL are set,
131 # but we have to convert VS140VCTOOLS_PATH in order to set PATH. So instead we
132 # convert using subst.
133 ifeq "$(WINDOWS)" "YES"
134 ifneq "$(VS140VCTOOLS_PATH)" ""
135 VS140VCTOOLS_CYGPATH:= /cygdrive/$(subst :/,/,$(subst \,/,$(VS140VCTOOLS_PATH)))
136 PATH:=$(VS140VCTOOLS_CYGPATH):/usr/local/bin/:/usr/bin/:$(PATH)
137 endif
138 endif
139 $(info # PATH=$(PATH))
140
141 # For some reason, cygwin bash (at least when run non-login) needs to use
142 # bash for pwd, echo etc. (but uname does not work, see below)
143 ifeq "$(WINDOWS)" "YES"
144 SHELL := /bin/bash
145 else
146 SHELL := /bin/sh
147 endif
148
149 # if building for windows from batch script, convert Win-style paths
150 # for SRCROOT etc. to cygwin-style paths. Don't define them if not
151 # already defined.
152 ifeq "$(WINDOWS)" "YES"
153 ifneq "$(VS140VCTOOLS_PATH)" ""
154 ifdef SRCROOT
155 SRCROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(SRCROOT)))
156 endif
157 ifdef OBJROOT
158 OBJROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(OBJROOT)))
159 endif
160 ifdef DSTROOT
161 DSTROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(DSTROOT)))
162 endif
163 ifdef SYMROOT
164 SYMROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(SYMROOT)))
165 endif
166 endif
167 endif
168
169 ifndef SRCROOT
170 SRCROOT:=$(shell pwd)
171 endif
172 ifndef OBJROOT
173 OBJROOT:=$(SRCROOT)/build
174 endif
175 ifndef DSTROOT
176 DSTROOT:=$(OBJROOT)
177 endif
178 ifndef SYMROOT
179 SYMROOT:=$(OBJROOT)
180 endif
181 $(info # SRCROOT=$(SRCROOT))
182 $(info # OBJROOT=$(OBJROOT))
183 $(info # DSTROOT=$(DSTROOT))
184
185 # Disallow $(SRCROOT) == $(OBJROOT)
186 ifeq ($(OBJROOT), $(SRCROOT))
187 $(error SRCROOT same as OBJROOT)
188 endif
189
190 ifeq "$(WINDOWS)" "YES"
191 ifeq "$(ARCH64)" "YES"
192 OBJROOT_CURRENT=$(OBJROOT)/obj64
193 SYMROOT_CURRENT=$(SYMROOT)/obj64
194 else
195 OBJROOT_CURRENT=$(OBJROOT)/obj32
196 SYMROOT_CURRENT=$(SYMROOT)/obj32
197 endif
198 else ifeq "$(LINUX)" "YES"
199 ifeq "$(ARCH64)" "YES"
200 OBJROOT_CURRENT=$(OBJROOT)/obj64
201 SYMROOT_CURRENT=$(SYMROOT)/obj64
202 else
203 OBJROOT_CURRENT=$(OBJROOT)/obj32
204 SYMROOT_CURRENT=$(SYMROOT)/obj32
205 endif
206 else
207 OBJROOT_CURRENT=$(OBJROOT)
208 SYMROOT_CURRENT=$(SYMROOT)
209 endif
210
211 ifndef SDKROOT
212 SDKPATH:=/
213 else ifeq "$(SDKROOT)" ""
214 SDKPATH:=/
215 else
216 SDKPATH:=$(shell xcodebuild -version -sdk $(SDKROOT) Path)
217 ifeq "$(SDKPATH)" ""
218 SDKPATH:=/
219 endif
220 endif
221 $(info # SDKROOT=$(SDKROOT))
222 $(info # SDKPATH=$(SDKPATH))
223
224 # An Apple submission version (passed in RC_ProjectSourceVersion for official builds) is
225 # X[.Y[.Z]]
226 # where X is in range 0-214747, Y and Z are in range 0-99 (with no leading zeros).
227 # This corresponds to MMmAA.(0 | B).T where
228 # MM is U_ICU_VERSION_MAJOR_NUM
229 # m is U_ICU_VERSION_MINOR_NUM
230 # AA is the Apple delta version
231 # B is the Apple branch version (1 or 2 digits)
232 # T is the Apple train code for submissions.
233 # Note The value for the SourceVersion property in version.plists will be calculated as
234 # (X*10000 + Y*100 + Z).
235 # We want ICU_BUILD = 100*AA + B.
236 #
237 ifneq "$(RC_ProjectSourceVersion)" ""
238 ifeq "$(WINDOWS)" "YES"
239 ICU_BUILD_AA := $(shell echo $(RC_ProjectSourceVersion) | /usr/bin/sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\2/')
240 ICU_BUILD_B1 := $(shell echo $(RC_ProjectSourceVersion) | /usr/bin/sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\4/')
241 ICU_BUILD_B2 := $(shell echo $(RC_ProjectSourceVersion) | /usr/bin/sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\5/')
242 ICU_TRAIN_CODE := $(shell echo $(RC_ProjectSourceVersion) | /usr/bin/sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\7/')
243 else
244 ICU_BUILD_AA := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\2/')
245 ICU_BUILD_B1 := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\4/')
246 ICU_BUILD_B2 := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\5/')
247 ICU_TRAIN_CODE := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\7/')
248 endif
249 ifeq "$(ICU_BUILD_AA)" ""
250 ICU_BUILD := 0
251 else
252 ICU_BUILD := $(subst a,$(ICU_BUILD_AA),abc)
253 ifeq "$(ICU_BUILD_B1)" ""
254 ICU_BUILD := $(subst b,0,$(ICU_BUILD))
255 ICU_BUILD := $(subst c,0,$(ICU_BUILD))
256 else
257 ifeq "$(ICU_BUILD_B2)" ""
258 ICU_BUILD := $(subst b,0,$(ICU_BUILD))
259 ICU_BUILD := $(subst c,$(ICU_BUILD_B1),$(ICU_BUILD))
260 else
261 ICU_BUILD := $(subst b,$(ICU_BUILD_B1),$(ICU_BUILD))
262 ICU_BUILD := $(subst c,$(ICU_BUILD_B2),$(ICU_BUILD))
263 endif
264 endif
265 endif
266 ifeq "$(ICU_TRAIN_CODE)" ""
267 ICU_TRAIN_CODE := 0
268 endif
269 else
270 ICU_BUILD := 0
271 ICU_TRAIN_CODE := 0
272 endif
273 $(info # ICU_BUILD=$(ICU_BUILD))
274 $(info # ICU_TRAIN_CODE=$(ICU_TRAIN_CODE))
275 ifeq "$(ICU_BUILD)" "0"
276 DEFINE_BUILD_LEVEL =
277 else
278 DEFINE_BUILD_LEVEL =-DU_ICU_VERSION_BUILDLEVEL_NUM=$(ICU_BUILD)
279 endif
280
281 # Determine build type. In some cases (e.g. running installsrc for submitproject)
282 # the only accurate information we may have about build type is from ICU_TRAIN_CODE,
283 # so give priority to that if nonzero.
284 # The values currently defined for ICU_TRAIN_CODE and corresponding ICU_BUILD_TYPE are
285 # 1 OSX trains
286 # 2 embedded trains (iOS, tvos, watchos) including simulator versions thereof.
287 # may have BUILD_TYPE=DEVICE,SIMULATOR,TOOL
288 # 8 AAS for Windows
289 # 9 linux for Siri servers
290 #
291 ifeq "$(WINDOWS)" "YES"
292 ICU_FOR_APPLE_PLATFORMS:=NO
293 else ifeq "$(ICU_TRAIN_CODE)" "8"
294 override WINDOWS=YES
295 ICU_FOR_APPLE_PLATFORMS:=NO
296 else ifeq "$(LINUX)" "YES"
297 ICU_FOR_APPLE_PLATFORMS:=NO
298 else ifeq "$(ICU_TRAIN_CODE)" "9"
299 override LINUX=YES
300 ICU_FOR_APPLE_PLATFORMS:=NO
301 else
302 ICU_FOR_APPLE_PLATFORMS:=YES
303 endif
304
305 # For Apple builds, get more details from the SDK if available
306 # In TargetConditionals.h:
307 # TARGET_OS_IPHONE -is 1 iff generating code for firmware, devices, or simulator (all embedded trains)
308 # in that case:
309 # exactly one of the following is 1: TARGET_OS_SIMULATOR, TARGET_OS_EMBEDDED (i.e. device)
310 # exactly one of the following is 1: TARGET_OS_IOS, TARGET_OS_TV, TARGET_OS_WATCH, TARGET_OS_BRIDGE
311 #
312 ifeq "$(ICU_FOR_APPLE_PLATFORMS)" "YES"
313 HOSTCC := $(shell xcrun --sdk macosx --find cc)
314 HOSTCXX := $(shell xcrun --sdk macosx --find c++)
315 HOSTSDKPATH := $(shell xcrun --sdk macosx.internal --show-sdk-path)
316 HOSTISYSROOT = -isysroot $(HOSTSDKPATH)
317 ifeq "$(SDKPATH)" "/"
318 ISYSROOT:= -isysroot $(HOSTSDKPATH)
319 CC := $(HOSTCC)
320 CXX := $(HOSTCXX)
321 NM := $(shell xcrun --sdk macosx --find nm)
322 STRIPCMD := $(shell xcrun --sdk macosx --find strip)
323 ifeq "$(ICU_TRAIN_CODE)" "2"
324 export ICU_FOR_EMBEDDED_TRAINS:=YES
325 else
326 export ICU_FOR_EMBEDDED_TRAINS:=NO
327 endif
328 else
329 ISYSROOT:= -isysroot $(SDKPATH)
330 CC := $(shell xcrun --sdk $(SDKPATH) --find cc)
331 CXX := $(shell xcrun --sdk $(SDKPATH) --find c++)
332 NM := $(shell xcrun --sdk $(SDKPATH) --find nm)
333 STRIPCMD := $(shell xcrun --sdk $(SDKPATH) --find strip)
334 EMBEDDEDTRAIN:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_IPHONE | cut -d' ' -f3)
335 ifeq "$(EMBEDDEDTRAIN)" "1"
336 export ICU_FOR_EMBEDDED_TRAINS:=YES
337 else
338 export ICU_FOR_EMBEDDED_TRAINS:=NO
339 endif
340 endif
341 SIMULATOROS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_SIMULATOR | cut -d' ' -f3)
342 TVOS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_TV | cut -d' ' -f3)
343 WATCHOS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_WATCH | cut -d' ' -f3)
344 BRIDGEOS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_BRIDGE | cut -d' ' -f3)
345 ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
346 ifeq "$(SIMULATOROS)" "1"
347 BUILD_TYPE=SIMULATOR
348 else
349 BUILD_TYPE=DEVICE
350 endif
351 else ifeq "$(RC_ProjectName)" "tzTools"
352 BUILD_TYPE=TOOL
353 else
354 BUILD_TYPE=
355 endif
356 else
357 ifeq "$(LINUX)" "YES"
358 ISYSROOT:=
359 ifeq "$(shell (which clang >& /dev/null && which clang++ >& /dev/null && echo YES) || echo NO)" "YES"
360 CC := clang
361 CXX := clang++
362 else
363 CC := gcc
364 CXX := g++
365 endif
366 endif
367 export ICU_FOR_EMBEDDED_TRAINS:=NO
368 TVOS:=0
369 WATCHOS:=0
370 BRIDGEOS:=0
371 BUILD_TYPE=
372 endif
373
374 CROSS_BUILD:=$(ICU_FOR_EMBEDDED_TRAINS)
375 CROSSHOST_OBJROOT=$(OBJROOT)/crossbuildhost
376
377 $(info # ICU_FOR_APPLE_PLATFORMS=$(ICU_FOR_APPLE_PLATFORMS))
378 $(info # HOSTCC=$(HOSTCC))
379 $(info # HOSTCXX=$(HOSTCXX))
380 $(info # HOSTISYSROOT=$(HOSTISYSROOT))
381 $(info # CC=$(CC))
382 $(info # CXX=$(CXX))
383 $(info # ISYSROOT=$(ISYSROOT))
384 $(info # ICU_FOR_EMBEDDED_TRAINS=$(ICU_FOR_EMBEDDED_TRAINS))
385 $(info # CROSS_BUILD=$(CROSS_BUILD))
386 $(info # BUILD_TYPE=$(BUILD_TYPE))
387
388 # Disallow cross builds on Windows/Linux for now
389 # (since those builds are not out-of-source as required for cross-builds)
390 ifeq "$(CROSS_BUILD)" "YES"
391 ifeq "$(WINDOWS)" "YES"
392 $(error Cross-builds currently not allowed on Windows)
393 endif
394 ifeq "$(LINUX)" "YES"
395 $(error Cross-builds currently not allowed on Linux)
396 endif
397 endif
398
399 MAC_OS_X_VERSION_MIN_REQUIRED=101400
400 OSX_HOST_VERSION_MIN_STRING=10.14
401
402 ifndef IPHONEOS_DEPLOYMENT_TARGET
403 IOS_VERSION_TARGET_STRING=13.0
404 else ifeq "$(IPHONEOS_DEPLOYMENT_TARGET)" ""
405 IOS_VERSION_TARGET_STRING=13.0
406 else
407 IOS_VERSION_TARGET_STRING=$(IPHONEOS_DEPLOYMENT_TARGET)
408 endif
409
410 ifndef MACOSX_DEPLOYMENT_TARGET
411 OSX_VERSION_TARGET_STRING=10.15
412 else ifeq "$(MACOSX_DEPLOYMENT_TARGET)" ""
413 OSX_VERSION_TARGET_STRING=10.15
414 else
415 OSX_VERSION_TARGET_STRING=$(MACOSX_DEPLOYMENT_TARGET)
416 endif
417
418 ifndef WATCHOS_DEPLOYMENT_TARGET
419 WATCHOS_VERSION_TARGET_STRING=6.0
420 else ifeq "$(WATCHOS_DEPLOYMENT_TARGET)" ""
421 WATCHOS_VERSION_TARGET_STRING=6.0
422 else
423 WATCHOS_VERSION_TARGET_STRING=$(WATCHOS_DEPLOYMENT_TARGET)
424 endif
425
426 ifndef TVOS_DEPLOYMENT_TARGET
427 TVOS_VERSION_TARGET_STRING=13.0
428 else ifeq "$(TVOS_DEPLOYMENT_TARGET)" ""
429 TVOS_VERSION_TARGET_STRING=13.0
430 else
431 TVOS_VERSION_TARGET_STRING=$(TVOS_DEPLOYMENT_TARGET)
432 endif
433
434 ifndef BRIDGEOS_DEPLOYMENT_TARGET
435 BRIDGEOS_VERSION_TARGET_STRING=3.0
436 else ifeq "$(BRIDGEOS_DEPLOYMENT_TARGET)" ""
437 BRIDGEOS_VERSION_TARGET_STRING=3.0
438 else
439 BRIDGEOS_VERSION_TARGET_STRING=$(BRIDGEOS_DEPLOYMENT_TARGET)
440 endif
441
442 $(info # IOS_VERSION_TARGET_STRING=$(IOS_VERSION_TARGET_STRING))
443 $(info # OSX_VERSION_TARGET_STRING=$(OSX_VERSION_TARGET_STRING))
444 $(info # WATCHOS_VERSION_TARGET_STRING=$(WATCHOS_VERSION_TARGET_STRING))
445 $(info # TVOS_VERSION_TARGET_STRING=$(TVOS_VERSION_TARGET_STRING))
446 $(info # BRIDGEOS_VERSION_TARGET_STRING=$(BRIDGEOS_VERSION_TARGET_STRING))
447
448 ifeq "$(BUILD_TYPE)" "DEVICE"
449 ifeq "$(WATCHOS)" "1"
450 ICU_TARGET_VERSION := -mwatchos-version-min=$(WATCHOS_VERSION_TARGET_STRING)
451 else ifeq "$(TVOS)" "1"
452 ICU_TARGET_VERSION := -mtvos-version-min=$(TVOS_VERSION_TARGET_STRING)
453 else ifeq "$(BRIDGEOS)" "1"
454 ICU_TARGET_VERSION := -mbridgeos-version-min=$(BRIDGEOS_VERSION_TARGET_STRING)
455 else
456 ICU_TARGET_VERSION := -miphoneos-version-min=$(IOS_VERSION_TARGET_STRING)
457 endif
458 else ifeq "$(BUILD_TYPE)" "SIMULATOR"
459 ifeq "$(WATCHOS)" "1"
460 ICU_TARGET_VERSION := -mwatchos-simulator-version-min=$(WATCHOS_VERSION_TARGET_STRING)
461 else ifeq "$(TVOS)" "1"
462 ICU_TARGET_VERSION := -mtvos-simulator-version-min=$(TVOS_VERSION_TARGET_STRING)
463 else
464 ICU_TARGET_VERSION := -mios-simulator-version-min=$(IOS_VERSION_TARGET_STRING)
465 endif
466 else
467 ICU_TARGET_VERSION :=
468 endif
469 $(info # ICU_TARGET_VERSION=$(ICU_TARGET_VERSION))
470
471
472 DISABLE_DRAFT:=$(ICU_FOR_EMBEDDED_TRAINS)
473 ifeq "$(DISABLE_DRAFT)" "YES"
474 DRAFT_FLAG=--disable-draft
475 else
476 DRAFT_FLAG=
477 endif
478
479 # For some reason, under cygwin, bash uname is not found, and
480 # sh uname does not produce a result with -p or -m. So we just
481 # hardcode here.
482 ifeq "$(WINDOWS)" "YES"
483 UNAME_PROCESSOR:=i386
484 else
485 UNAME_PROCESSOR:=$(shell uname -p)
486 endif
487
488 ifneq "$(RC_ARCHS)" ""
489 INSTALLHDRS_ARCH=-arch $(shell echo $(RC_ARCHS) | cut -d' ' -f1)
490 else
491 INSTALLHDRS_ARCH=
492 endif
493 $(info # INSTALLHDRS_ARCH=$(INSTALLHDRS_ARCH))
494 $(info # buildhost=$(UNAME_PROCESSOR))
495
496
497 # FORCEENDIAN below is to override silly configure behavior in which if
498 # __APPLE_CC__ is defined and archs are in { ppc, ppc64, i386, x86_64 }
499 # then it assumes a universal build (ac_cv_c_bigendian=universal) with
500 # data file initially built big-endian.
501 #
502 # darwin releases
503 # darwin 17.0.0 2017-Sep: macOS 10.13, iOS 11
504 # darwin 17.5.0 2018-Mar: macOS 10.13.4
505 # darwin 17.6.0 2018-Jun: macOS 10.13.5
506 # darwin 17.7.0 2018-Jul: macOS 10.13.6, iOS 11.4.1
507 # darwin 18.0.0 2018-Sep: macOS 10.14, iOS 12
508 # darwin 18.2.0 2018-Oct: macOS 10.14.1, iOS 12.1
509 # darwin 19.0.0 2019-fall: macOS 10.15, iOS 13
510 #
511 ifeq "$(CROSS_BUILD)" "YES"
512 RC_ARCHS_FIRST=$(shell echo $(RC_ARCHS) | cut -d' ' -f1)
513 TARGET_SPEC=$(RC_ARCHS_FIRST)-apple-darwin19.0.0
514 ENV_CONFIGURE_ARCHS=-arch $(RC_ARCHS_FIRST)
515 ICUPKGTOOLIBS="$(CROSSHOST_OBJROOT)/lib:$(CROSSHOST_OBJROOT)/stubdata"
516 ICUPKGTOOL=$(CROSSHOST_OBJROOT)/bin/icupkg
517 ifeq "$(filter-out i386 x86_64,$(RC_ARCHS))" ""
518 FORCEENDIAN= ac_cv_c_bigendian=no
519 else
520 FORCEENDIAN=
521 endif
522 else ifeq "$(LINUX)" "YES"
523 TARGET_SPEC=$(UNAME_PROCESSOR)-unknown-linux-gnu
524 ENV_CONFIGURE_ARCHS=
525 ICUPKGTOOLIBS="$(OBJROOT_CURRENT)/lib:$(OBJROOT_CURRENT)/stubdata"
526 ICUPKGTOOL=$(OBJROOT_CURRENT)/bin/icupkg
527 FORCEENDIAN=
528 else
529 TARGET_SPEC=$(UNAME_PROCESSOR)-apple-darwin19.0.0
530 ENV_CONFIGURE_ARCHS=
531 ICUPKGTOOLIBS="$(OBJROOT_CURRENT)/lib:$(OBJROOT_CURRENT)/stubdata"
532 ICUPKGTOOL=$(OBJROOT_CURRENT)/bin/icupkg
533 FORCEENDIAN=
534 endif
535 $(info # TARGET_SPEC=$(TARGET_SPEC))
536 $(info # ENV_CONFIGURE_ARCHS=$(ENV_CONFIGURE_ARCHS))
537
538 ICU_TARGET_VERSION_FOR_TZ_EXTRA :=
539 ifeq "$(BUILD_TYPE)" "SIMULATOR"
540 ICU_TARGET_VERSION_FOR_TZ_EXTRA := -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING)
541 endif
542
543 ifeq "$(BUILD_TYPE)" "DEVICE"
544 THUMB_FLAG = -mthumb
545 else
546 THUMB_FLAG =
547 endif
548
549 # even for a crossbuild host build, we want to use the target's latest tzdata as pointed to by latest_tzdata.tar.gz;
550 # first try RC_EMBEDDEDPROJECT_DIR (<rdar://problem/28141177>), else SDKPATH.
551 ifdef RC_EMBEDDEDPROJECT_DIR
552 ifeq "$(shell test -L $(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/latest_tzdata.tar.gz && echo YES )" "YES"
553 export TZDATA:=$(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/$(shell readlink $(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/latest_tzdata.tar.gz)
554 endif
555 ifeq "$(shell test -d $(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/icudata && echo YES )" "YES"
556 export TZAUXFILESDIR:=$(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/icudata
557 endif
558 endif
559 ifndef TZDATA
560 ifeq "$(shell test -L $(SDKPATH)/usr/local/share/tz/latest_tzdata.tar.gz && echo YES )" "YES"
561 export TZDATA:=$(SDKPATH)/usr/local/share/tz/$(shell readlink $(SDKPATH)/usr/local/share/tz/latest_tzdata.tar.gz)
562 endif
563 ifeq "$(shell test -d $(SDKPATH)/usr/local/share/tz/icudata && echo YES )" "YES"
564 export TZAUXFILESDIR:=$(SDKPATH)/usr/local/share/tz/icudata
565 endif
566 endif
567 $(info # RC_EMBEDDEDPROJECT_DIR=$(RC_EMBEDDEDPROJECT_DIR))
568 $(info # TZDATA=$(TZDATA))
569 $(info # TZAUXFILESDIR=$(TZAUXFILESDIR))
570 ifndef TZAUXFILESDIR
571 TZAUXFILESDIR:=.
572 endif
573
574 APPLE_INTERNAL_DIR=/AppleInternal
575 DSYMTOOL := /usr/bin/dsymutil
576 DSYMSUFFIX := .dSYM
577
578 #################################
579 # Headers
580 #################################
581
582 # For installhdrs. Not every compiled module has an associated header. Normally,
583 # ICU installs headers as a sub-target of the install target. But since we only want
584 # certain libraries to install (and since we link all of our own .o modules), we need
585 # invoke the headers targets ourselves. This may be problematic because there isn't a
586 # good way to dist-clean afterwards...we need to do explicit dist-cleans, especially if
587 # install the extra libraries.
588
589 EXTRA_HDRS =
590 # EXTRA_HDRS = ./extra/ustdio/ ./layout/
591 ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
592 HDR_MAKE_SUBDIR = ./common/ ./i18n/ $(EXTRA_HDRS)
593 else ifeq "$(WINDOWS)" "YES"
594 HDR_MAKE_SUBDIR = ./common/ ./i18n/ $(EXTRA_HDRS)
595 else
596 HDR_MAKE_SUBDIR = ./common/ ./i18n/ ./io/ $(EXTRA_HDRS)
597 endif
598 ifeq "$(WINDOWS)" "YES"
599 PRIVATE_HDR_PREFIX=$(APPLE_INTERNAL_DIR)
600 else ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
601 HDR_PREFIX=/usr
602 PRIVATE_HDR_PREFIX=/usr/local
603 else
604 PRIVATE_HDR_PREFIX=/usr/local
605 endif
606
607 #################################
608 # Install
609 #################################
610
611 # For install. We currently don't install EXTRA_LIBS. We also don't install the data
612 # directly into the ICU library. It is now installed at /usr/share/icu/*.dat. Thus we
613 # don't use DATA_OBJ anymore. This could change if we decide to move the data back into
614 # the icucore monolithic library.
615
616 INSTALL = /usr/bin/install
617 COMMON_OBJ = ./common/*.o
618 I18N_OBJ = ./i18n/*.o
619 IO_OBJ = ./io/*.o
620 STUB_DATA_OBJ = ./stubdata/*.o
621 EXTRA_LIBS =
622 #EXTRA_LIBS =./extra/ ./layout/ ./tools/ctestfw/ ./tools/toolutil/
623 #DATA_OBJ = ./data/out/build/*.o
624 ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
625 DYLIB_OBJS=$(COMMON_OBJ) $(I18N_OBJ) $(STUB_DATA_OBJ)
626 else ifeq "$(WINDOWS)" "YES"
627 DYLIB_OBJS=$(COMMON_OBJ) ./common/common.res $(I18N_OBJ) $(STUB_DATA_OBJ)
628 else
629 DYLIB_OBJS=$(COMMON_OBJ) $(I18N_OBJ) $(IO_OBJ) $(STUB_DATA_OBJ)
630 endif
631
632 #################################
633 # Sources
634 #################################
635
636 # For installsrc (B&I)
637 # Note that installsrc is run on the system from which ICU is submitted, which
638 # may be a different environment than the one for a which a build is targeted.
639
640 INSTALLSRC_VARFILES=./ICU_embedded.order \
641 ./minimalapis.txt ./minimalapisTest.c ./minimalpatchconfig.txt ./windowspatchconfig.txt ./patchconfig.txt ./crosshostpatchconfig.txt \
642 BuildICUForAAS_script.bat EXPORT.APPLE
643
644 #################################
645 # Cleaning
646 #################################
647
648 #We need to clean after installing.
649
650 EXTRA_CLEAN =
651
652 # Some directories aren't cleaned recursively. Clean them manually...
653 MANUAL_CLEAN_TOOLS = ./tools/dumpce
654 MANUAL_CLEAN_EXTRA = ./extra/scrptrun ./samples/layout ./extra/ustdio ./extra
655 MANUAL_CLEAN_TEST = ./test/collperf ./test/iotest ./test/letest ./test/thaitest ./test/threadtest ./test/testmap ./test
656 MANUAL_CLEAN_SAMPLE = ./samples/layout ./samples
657
658 CLEAN_SUBDIR = ./stubdata ./common ./i18n ./io ./layout ./layoutex ./data ./tools ./$(MANUAL_CLEAN_TOOLS) $(MANUAL_CLEAN_EXTRA) $(MANUAL_CLEAN_TEST) $(MANUAL_CLEAN_SAMPLE)
659
660 #################################
661 # Config flags
662 #################################
663
664 ifeq "$(WINDOWS)" "YES"
665 ifeq "$(ARCH64)" "YES"
666 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples --disable-icuio \
667 --with-data-packaging=library --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=64 \
668 $(DRAFT_FLAG)
669 else
670 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples --disable-icuio \
671 --with-data-packaging=library --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=32 \
672 $(DRAFT_FLAG)
673 endif
674 else ifeq "$(LINUX)" "YES"
675 ifeq "$(ARCH64)" "YES"
676 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
677 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=64 \
678 $(DRAFT_FLAG)
679 else
680 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
681 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=32 \
682 $(DRAFT_FLAG)
683 endif
684 else ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
685 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
686 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) \
687 $(DRAFT_FLAG)
688 else
689 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
690 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) \
691 $(DRAFT_FLAG)
692 endif
693
694 #################################
695 # Install paths
696 #################################
697
698 # This may or may not be an appropriate name for the icu dylib. This naming scheme is
699 # an attempt to follow the icu convention in naming the dylib and then having symbolic
700 # links of easier to remember library names point it it. *UPDATE* the version and
701 # sub-version variables as needed. The Core version should be 'A' until the core
702 # version changes it's API...that is a new version isn't backwards compatible.
703 # The ICU version/subversion should reflect the actual ICU version.
704
705 LIB_NAME = icucore
706 ICU_VERS = 64
707 ICU_SUBVERS = 2
708 CORE_VERS = A
709
710 ifeq "$(WINDOWS)" "YES"
711 DYLIB_SUFF = dll
712 ifeq "$(ARCH64)" "YES"
713 winprogdir = /Program\ Files/Common\ Files/Apple/Apple\ Application\ Support/
714 winintlibdir = /AppleInternal/lib64/
715 else
716 winprogdir = /Program\ Files\ \(x86\)/Common\ Files/Apple/Apple\ Application\ Support/
717 winintlibdir = /AppleInternal/lib32/
718 endif
719 libdir =
720 else ifeq "$(LINUX)" "YES"
721 DYLIB_SUFF = so
722 ifeq "$(ARCH64)" "YES"
723 libdir = /usr/local/lib/
724 else
725 libdir = /usr/local/lib32/
726 endif
727 winprogdir =
728 winintlibdir =
729 else
730 DYLIB_SUFF = dylib
731 libdir = /usr/lib/
732 winprogdir =
733 winintlibdir =
734 endif
735
736 DYLIB = lib$(LIB_NAME).$(DYLIB_SUFF)
737 DYLIB_DEBUG = lib$(LIB_NAME)_debug.$(DYLIB_SUFF)
738 DYLIB_PROFILE = lib$(LIB_NAME)_profile.$(DYLIB_SUFF)
739 ifeq "$(WINDOWS)" "YES"
740 INSTALLED_DYLIB = $(LIB_NAME).$(DYLIB_SUFF)
741 INSTALLED_DYLIB_DEBUG = $(LIB_NAME)_debug.$(DYLIB_SUFF)
742 INSTALLED_DYLIB_PROFILE = $(LIB_NAME)_profile.$(DYLIB_SUFF)
743 else ifeq "$(LINUX)" "YES"
744 INSTALLED_DYLIB = lib$(LIB_NAME).$(DYLIB_SUFF)
745 INSTALLED_DYLIB_DEBUG = lib$(LIB_NAME)_debug.$(DYLIB_SUFF)
746 INSTALLED_DYLIB_PROFILE = lib$(LIB_NAME)_profile.$(DYLIB_SUFF)
747 else
748 INSTALLED_DYLIB = lib$(LIB_NAME).$(CORE_VERS).$(DYLIB_SUFF)
749 INSTALLED_DYLIB_DEBUG = lib$(LIB_NAME).$(CORE_VERS)_debug.$(DYLIB_SUFF)
750 INSTALLED_DYLIB_PROFILE = lib$(LIB_NAME).$(CORE_VERS)_profile.$(DYLIB_SUFF)
751 endif
752
753 INSTALLED_DYLIB_icu = INSTALLED_DYLIB
754 INSTALLED_DYLIB_debug = INSTALLED_DYLIB_DEBUG
755 INSTALLED_DYLIB_profile = INSTALLED_DYLIB_PROFILE
756 DYLIB_icu = DYLIB
757 DYLIB_debug = DYLIB_DEBUG
758 DYLIB_profile = DYLIB_PROFILE
759
760 #################################
761 # Data files
762 #################################
763
764 OPEN_SOURCE_VERSIONS_DIR=/usr/local/OpenSourceVersions/
765 OPEN_SOURCE_LICENSES_DIR=/usr/local/OpenSourceLicenses/
766
767 B_DATA_FILE=icudt$(ICU_VERS)b.dat
768 L_DATA_FILE=icudt$(ICU_VERS)l.dat
769 DATA_BUILD_SUBDIR= data/out
770 ifeq "$(LINUX)" "YES"
771 DATA_INSTALL_DIR=/usr/local/share/icu/
772 else
773 DATA_INSTALL_DIR=/usr/share/icu/
774 endif
775
776 # DATA_LOOKUP_DIR is what the target ICU_DATA_DIR gets set to in CFLAGS, CXXFLAGS;
777 # DATA_LOOKUP_DIR_BUILDHOST is what any crossbuild host ICU_DATA_DIR gets set to.
778 # Formerly we had DATA_LOOKUP_DIR=/var/db/icu/ for embedded non-simulator builds
779 # and DATA_LOOKUP_DIR=/usr/share/icu/ for everything else. Now all systems look
780 # in the same place for the main data file:
781 DATA_LOOKUP_DIR=$(DATA_INSTALL_DIR)
782 DATA_LOOKUP_DIR_BUILDHOST=$(DATA_INSTALL_DIR)
783
784 # Timezone data file(s)
785 # ICU will look for /var/db/timezone/icutz/icutz44l.dat
786 # If directory or file is not present, the timesone data in
787 # current data file e.g. /usr/share/icu/icudt56l.dat will be used.
788 # Currently we are not conditionalizing the definition of
789 # TZDATA_LOOKUP_DIR as in
790 # ifeq "$(BUILD_TYPE)" "DEVICE"
791 # TZDATA_LOOKUP_DIR = /var/db/timezone/icutz
792 # else
793 # ...
794 # since the code stats the path for TZDATA_LOOKUP_DIR and does
795 # not try to use it if it does not exist. We could define it
796 # as TZDATA_LOOKUP_DIR = /usr/share/icutz when not needed...
797 # TZDATA_LOOKUP_DIR is passed to compiler as U_TIMEZONE_FILES_DIR
798 # TZDATA_PACKAGE is passed to compiler as U_TIMEZONE_PACKAGE
799 TZDATA_LOOKUP_DIR = /var/db/timezone/icutz
800 TZDATA_PACKAGE = icutz44l
801 TZDATA_FORMAT_STRING = "44l"
802 TZDATA_FORMAT_FILE = icutzformat.txt
803
804
805 # Name of runtime environment variable to get the prefix path for DATA_LOOKUP_DIR
806 # Currently we are only using this for LINUX, should also use for iOS simulator
807 ifeq "$(LINUX)" "YES"
808 DATA_DIR_PREFIX_ENV_VAR=APPLE_FRAMEWORKS_ROOT
809 else
810 DATA_DIR_PREFIX_ENV_VAR=
811 endif
812
813 #################################
814 # Tools
815 #################################
816
817 localtooldir=/usr/local/bin/
818 locallibdir=/usr/local/lib/
819
820 INFOTOOL = icuinfo
821 INFOTOOL_OBJS = ./tools/icuinfo/icuinfo.o ./tools/toolutil/udbgutil.o ./tools/toolutil/uoptions.o
822
823 ICUZDUMPTOOL = icuzdump
824 ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
825 ICUZDUMPTOOL_OBJS = ./tools/tzcode/icuzdump.o $(IO_OBJ)
826 else
827 ICUZDUMPTOOL_OBJS = ./tools/tzcode/icuzdump.o
828 endif
829
830 TOOLSLIB_NAME = icutu
831 TOOLS_DYLIB = libicutu.$(DYLIB_SUFF)
832 TOOLS_DYLIB_OBJS = ./tools/toolutil/*.o
833
834 # The following modified version enables the tz toools to be used on systems with ICU 55 or later.
835 # It is used with the toolchain tools below.
836 TOOLSLIB_NAME_FORTOOLS = icutux
837 TOOLS_DYLIB_FORTOOLS = libicutux.$(DYLIB_SUFF)
838 TOOLS_DYLIB_OBJS_FORTOOLS = ./tools/toolutil/collationinfo.o ./tools/toolutil/filestrm.o \
839 ./tools/toolutil/package.o ./tools/toolutil/pkg_icu.o ./tools/toolutil/pkgitems.o \
840 ./tools/toolutil/swapimpl.o ./tools/toolutil/toolutil.o ./tools/toolutil/ucbuf.o \
841 ./tools/toolutil/unewdata.o ./tools/toolutil/uoptions.o ./tools/toolutil/uparse.o \
842 $(COMMON_OBJ) $(STUB_DATA_OBJ)
843
844 ZICTOOL = icuzic
845 ZICTOOL_OBJS = ./tools/tzcode/zic.o ./tools/tzcode/localtime.o ./tools/tzcode/asctime.o ./tools/tzcode/scheck.o ./tools/tzcode/ialloc.o
846
847 RESTOOL = icugenrb
848 RESTOOL_OBJS = ./tools/genrb/errmsg.o ./tools/genrb/genrb.o ./tools/genrb/parse.o ./tools/genrb/read.o ./tools/genrb/reslist.o ./tools/genrb/ustr.o \
849 ./tools/genrb/rbutil.o ./tools/genrb/wrtjava.o ./tools/genrb/rle.o ./tools/genrb/wrtxml.o ./tools/genrb/prscmnts.o ./tools/genrb/filterrb.o
850
851 # note there is also a symbol ICUPKGTOOL which refers to the one used
852 # internally which is linked against the separate uc and i18n libs.
853 PKGTOOL = icupkg
854 PKGTOOL_OBJS = ./tools/icupkg/icupkg.o
855
856 TZ2ICUTOOL = tz2icu
857 TZ2ICUTOOL_OBJS = ./tools/tzcode/tz2icu.o
858
859 GENBRKTOOL = icugenbrk
860 GENBRKTOOL_OBJS = ./tools/genbrk/genbrk.o
861
862 #################################
863 # Ancillary files
864 # e.g. supplementalData.xml, per <rdar://problem/13426014>
865 # These are like internal headers in that they are only installed for
866 # (other) projects to build against, not needed at runtime.
867 # Install during installhdrs? That does not seem to work for CLDRFILESDIR
868 #################################
869
870 CLDRFILESDIR=/usr/local/share/cldr
871
872 EMOJI_DATA_DIR=/usr/local/share/emojiData
873
874 #################################
875 # Environment variables
876 #################################
877
878 # $(RC_ARCHS:%=-arch %) is a substitution reference. It denotes, in this case,
879 # for every value <val> in RC_ARCHS, replace it with "-arch <val>". Substitution
880 # references have the form $(var:a=b). We can insert the strip and prebinding commands
881 # into CFLAGS (and CXXFLAGS). This controls a lot of the external variables so we don't
882 # need to directly modify the ICU files (like for CFLAGS, etc).
883
884 LIBOVERRIDES=LIBICUDT="-L$(OBJROOT_CURRENT) -l$(LIB_NAME)" \
885 LIBICUUC="-L$(OBJROOT_CURRENT) -l$(LIB_NAME)" \
886 LIBICUI18N="-L$(OBJROOT_CURRENT) -l$(LIB_NAME)"
887
888 CFLAGS_SANITIZER :=
889 CXXFLAGS_SANITIZER :=
890 LDFLAGS_SANITIZER :=
891 ifeq ($(RC_ENABLE_ADDRESS_SANITIZATION),1)
892 $(info Enabling Address Sanitizer)
893 ASAN_FLAGS:=-fsanitize=address
894 CFLAGS_SANITIZER += $(ASAN_FLAGS)
895 CXXFLAGS_SANITIZER += $(ASAN_FLAGS)
896 LDFLAGS_SANITIZER += $(ASAN_FLAGS)
897 endif
898
899 ifeq ($(RC_ENABLE_UNDEFINED_BEHAVIOR_SANITIZATION),1)
900 $(info Enabling Undefined Behaviour Sanitizer)
901 UBSAN_FLAGS:=-fsanitize=undefined
902 CFLAGS_SANITIZER += $(UBSAN_FLAGS)
903 CXXFLAGS_SANITIZER += $(UBSAN_FLAGS)
904 LDFLAGS_SANITIZER += $(UBSAN_FLAGS)
905 endif
906
907 ifeq ($(RC_ENABLE_THREAD_SANITIZATION),1)
908 $(info Enabling Thread Sanitizer)
909 TSAN_FLAGS:=-fsanitize=thread
910 CFLAGS_SANITIZER += $(TSAN_FLAGS)
911 CXXFLAGS_SANITIZER += $(TSAN_FLAGS)
912 LDFLAGS_SANITIZER += $(TSAN_FLAGS)
913 endif
914 LDFLAGS += $(LDFLAGS_SANITIZER)
915
916 # For normal Windows builds set the ENV= options here; for debug Windows builds set the ENV_DEBUG=
917 # options here and also the update the LINK.EXE lines in the TARGETS section below.
918 ifeq "$(WINDOWS)" "YES"
919 ifeq "$(ARCH64)" "YES"
920 ENV= CFLAGS="/utf-8 /O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
921 CXXFLAGS="/utf-8 /O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /Zc:wchar_t /DU_SHOW_CPLUSPLUS_API=1" \
922 LDFLAGS="/NXCOMPAT /DYNAMICBASE /DEBUG /OPT:REF"
923 else
924 ENV= CFLAGS="/utf-8 /O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
925 CXXFLAGS="/utf-8 /O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /Zc:wchar_t /DU_SHOW_CPLUSPLUS_API=1" \
926 LDFLAGS="/NXCOMPAT /SAFESEH /DYNAMICBASE /DEBUG /OPT:REF"
927 endif
928 ENV_CONFIGURE= CPPFLAGS="-DU_DISABLE_RENAMING=1 $(DEFINE_BUILD_LEVEL)" \
929 CFLAGS="/utf-8 /O2 /Ob2 /MD /GF /GS /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
930 CXXFLAGS="/utf-8 /O2 /Ob2 /MD /GF /GS /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /Zc:wchar_t /DU_SHOW_CPLUSPLUS_API=1"
931 ENV_DEBUG= CFLAGS="/utf-8 /O2 /Ob2 /MDd /GF /GS /Zi /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
932 CXXFLAGS="/utf-8 /O2 /Ob2 /MDd /GF /GS /Zi /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /DU_SHOW_CPLUSPLUS_API=1" \
933 LDFLAGS="/DEBUG /DYNAMICBASE"
934 ENV_PROFILE=
935 else ifeq "$(LINUX)" "YES"
936 ifeq "$(ARCH64)" "YES"
937 ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
938 LANG="en_US.utf8" \
939 CPPFLAGS="-DU_DISABLE_RENAMING=1 $(DEFINE_BUILD_LEVEL)" \
940 CC="$(CC)" \
941 CXX="$(CXX)" \
942 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden" \
943 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
944 TZDATA="$(TZDATA)" \
945 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
946
947 ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
948 LANG="en_US.utf8" \
949 CC="$(CC)" \
950 CXX="$(CXX)" \
951 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden" \
952 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
953 TZDATA="$(TZDATA)" \
954 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
955
956 ENV_DEBUG= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
957 LANG="en_US.utf8" \
958 CC="$(CC)" \
959 CXX="$(CXX)" \
960 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -O0 -gfull -fno-exceptions -fvisibility=hidden" \
961 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -O0 -gfull -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
962 TZDATA="$(TZDATA)" \
963 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
964
965 ENV_PROFILE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
966 LANG="en_US.utf8" \
967 CC="$(CC)" \
968 CXX="$(CXX)" \
969 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -pg -fno-exceptions -fvisibility=hidden" \
970 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -pg -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
971 TZDATA="$(TZDATA)" \
972 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
973 else
974 ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
975 LANG="en_US.utf8" \
976 CPPFLAGS="-DU_DISABLE_RENAMING=1 $(DEFINE_BUILD_LEVEL)" \
977 CC="$(CC)" \
978 CXX="$(CXX)" \
979 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden" \
980 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
981 TZDATA="$(TZDATA)" \
982 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
983
984 ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
985 LANG="en_US.utf8" \
986 CC="$(CC)" \
987 CXX="$(CXX)" \
988 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden" \
989 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
990 TZDATA="$(TZDATA)" \
991 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
992
993 ENV_DEBUG= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
994 LANG="en_US.utf8" \
995 CC="$(CC)" \
996 CXX="$(CXX)" \
997 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -O0 -gfull -fno-exceptions -fvisibility=hidden" \
998 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -O0 -gfull -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
999 TZDATA="$(TZDATA)" \
1000 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1001
1002 ENV_PROFILE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1003 LANG="en_US.utf8" \
1004 CC="$(CC)" \
1005 CXX="$(CXX)" \
1006 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -pg -fno-exceptions -fvisibility=hidden" \
1007 CXXFLAGS="-std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -pg -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
1008 TZDATA="$(TZDATA)" \
1009 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1010 endif
1011 else
1012 CPPOPTIONS =
1013 ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1014 CPPFLAGS="$(DEFINE_BUILD_LEVEL) -DSTD_INSPIRED -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) $(ISYSROOT) $(ENV_CONFIGURE_ARCHS)" \
1015 CC="$(CC)" \
1016 CXX="$(CXX)" \
1017 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(ENV_CONFIGURE_ARCHS) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG) $(CFLAGS_SANITIZER)" \
1018 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(ENV_CONFIGURE_ARCHS) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) $(CXXFLAGS_SANITIZER)" \
1019 RC_ARCHS="$(RC_ARCHS)" $(FORCEENDIAN)\
1020 TZDATA="$(TZDATA)" \
1021 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1022
1023 ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1024 CC="$(CC)" \
1025 CXX="$(CXX)" \
1026 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG) $(CFLAGS_SANITIZER)" \
1027 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) $(CXXFLAGS_SANITIZER)" \
1028 RC_ARCHS="$(RC_ARCHS)" \
1029 TZDATA="$(TZDATA)" \
1030 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1031
1032 ENV_DEBUG= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1033 CC="$(CC)" \
1034 CXX="$(CXX)" \
1035 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -O0 -gfull -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG) $(CFLAGS_SANITIZER)" \
1036 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -O0 -gfull -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) $(CXXFLAGS_SANITIZER)" \
1037 RC_ARCHS="$(RC_ARCHS)" \
1038 TZDATA="$(TZDATA)" \
1039 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1040
1041 ENV_PROFILE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1042 CC="$(CC)" \
1043 CXX="$(CXX)" \
1044 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -pg -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG) $(CFLAGS_SANITIZER)" \
1045 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -pg -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) $(CXXFLAGS_SANITIZER)" \
1046 RC_ARCHS="$(RC_ARCHS)" \
1047 TZDATA="$(TZDATA)" \
1048 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1049
1050 ENV_CONFIGURE_BUILDHOST= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1051 CPPFLAGS="$(DEFINE_BUILD_LEVEL) -DSTD_INSPIRED -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) $(HOSTISYSROOT)" \
1052 CC="$(HOSTCC)" \
1053 CXX="$(HOSTCXX)" \
1054 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(CFLAGS_SANITIZER)" \
1055 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(CXXFLAGS_SANITIZER)" \
1056 TZDATA="$(TZDATA)" \
1057 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1058
1059 ENV_BUILDHOST= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
1060 CC="$(HOSTCC)" \
1061 CXX="$(HOSTCXX)" \
1062 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(CFLAGS_SANITIZER)" \
1063 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(CXXFLAGS_SANITIZER)" \
1064 TZDATA="$(TZDATA)" \
1065 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
1066
1067 endif
1068
1069 ENV_icu = ENV
1070 ENV_debug = ENV_DEBUG
1071 ENV_profile = ENV_PROFILE
1072
1073 ifeq "$(BUILD_TYPE)" "DEVICE"
1074 ORDERFILE=$(SDKPATH)/AppleInternal/OrderFiles/libicucore.order
1075 else ifeq "$(BUILD_TYPE)" "SIMULATOR"
1076 ORDERFILE=$(SRCROOT)/ICU_embedded.order
1077 else
1078 ORDERFILE=/usr/local/lib/OrderFiles/libicucore.order
1079 endif
1080 ifeq "$(shell test -f $(ORDERFILE) && echo YES )" "YES"
1081 SECTORDER_FLAGS=-sectorder __TEXT __text $(ORDERFILE)
1082 else
1083 SECTORDER_FLAGS=
1084 endif
1085
1086
1087 #################################
1088 #################################
1089 # TARGETS
1090 #################################
1091 #################################
1092
1093 .PHONY : icu check installsrc installhdrs installhdrsint clean install debug debug-install \
1094 crossbuildhost icutztoolsforsdk
1095 .DELETE_ON_ERROR :
1096
1097 # Rule for adjusting sources for different train types.
1098 # Assumes current directory is icuSources to be patched.
1099 # This may be:
1100 # $(SRCROOT)/icuSources for installsrc, or
1101 # $(OBJROOT_CURRENT) if sources are copied for e.g. a local make.
1102 #
1103 # The various patchconfig files should assume the current directory is icuSources.
1104 #
1105 # Note that if sources have been installed by installsrc (only run as part of buildit or
1106 # submitproject for Apple platforms, not for Windows/Linux), then
1107 # $(SRCROOT)/installsrcNotRunFlag is not present, and
1108 # ADJUST_SOURCES has already have been run.
1109 # Otherwise, if we are doing a local build (e.g. make check, make install), or if
1110 # sources were submitted using submitproject for non-Apple platforms (Windows/Linux) then
1111 # $(SRCROOT)/installsrcNotRunFlag is present, and
1112 # ADJUST_SOURCES has not been run (run it after copying sources to OBJROOT_CURRENT)
1113 #
1114
1115 ADJUST_SOURCES = \
1116 if test "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1117 patch -p1 <$(SRCROOT)/minimalpatchconfig.txt; \
1118 elif test "$(WINDOWS)" = "YES"; then \
1119 patch -p1 <$(SRCROOT)/windowspatchconfig.txt; \
1120 else \
1121 patch -p1 <$(SRCROOT)/patchconfig.txt; \
1122 fi; \
1123 if test "$(WINDOWS)" = "YES"; then \
1124 mv data/unidata/base_unidata/*.txt data/unidata/; \
1125 mv data/unidata/norm2/base_norm2/*.txt data/unidata/norm2/; \
1126 mv data/in/base_in/*.nrm data/in/; \
1127 mv data/in/base_in/*.icu data/in/; \
1128 elif test "$(LINUX)" = "YES"; then \
1129 mv data/unidata/base_unidata/*.txt data/unidata/; \
1130 mv data/unidata/norm2/base_norm2/*.txt data/unidata/norm2/; \
1131 mv data/in/base_in/*.nrm data/in/; \
1132 mv data/in/base_in/*.icu data/in/; \
1133 fi
1134
1135
1136 icu debug profile : $(OBJROOT_CURRENT)/Makefile
1137 echo "# make for target";
1138 (cd $(OBJROOT_CURRENT); \
1139 $(MAKE) $($(ENV_$@)) || exit 1; \
1140 if test "$(WINDOWS)" = "YES"; then \
1141 (cd common; \
1142 rc.exe /folibicuuc.res $(CPPFLAGS) -DU_RELEASE=1 -D_CRT_SECURE_NO_DEPRECATE -I. -I../i18n \
1143 "-DDEFAULT_ICU_PLUGINS=\"/AppleInternal/lib/icu\" " -DU_LOCAL_SERVICE_HOOK=1 libicuuc.rc; \
1144 ); \
1145 (cd i18n; \
1146 rc.exe /folibicuin.res $(CPPFLAGS) -DU_RELEASE=1 -D_CRT_SECURE_NO_DEPRECATE -I. -I../common libicuin.rc; \
1147 ); \
1148 if test "$@" = "debug"; then \
1149 (cd common; \
1150 LINK.EXE /subsystem:console /DLL /nologo /base:"0x4a800000" /DYNAMICBASE /DEBUG \
1151 /IMPLIB:../lib/libicuuc_$@.lib /out:../lib/libicuuc_$@.dll \
1152 *.o libicuuc.res ../stubdata/icudt.lib advapi32.lib; \
1153 ); \
1154 (cd i18n; \
1155 LINK.EXE /subsystem:console /DLL /nologo /base:"0x4a900000" /DYNAMICBASE /DEBUG \
1156 /IMPLIB:../lib/libicuin_$@.lib /out:../lib/libicuin_$@.dll \
1157 *.o libicuin.res ../lib/libicuuc_$@.lib ../stubdata/icudt.lib advapi32.lib; \
1158 ); \
1159 else \
1160 (cd common; \
1161 rm -f ../lib/libicuuc.dll.manifest; \
1162 if test "$(ARCH64)" = "YES"; then \
1163 LINK.EXE /DLL /NXCOMPAT /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1164 /IMPLIB:../lib/libicuuc.lib /out:../lib/libicuuc.dll \
1165 *.o libicuuc.res ../stubdata/icudt.lib advapi32.lib; \
1166 else \
1167 LINK.EXE /DLL /NXCOMPAT /SAFESEH /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1168 /IMPLIB:../lib/libicuuc.lib /out:../lib/libicuuc.dll \
1169 *.o libicuuc.res ../stubdata/icudt.lib advapi32.lib; \
1170 fi; \
1171 mt.exe -nologo -manifest ../lib/libicuuc.dll.manifest -outputresource:"../lib/libicuuc.dll;2"; \
1172 ); \
1173 (cd i18n; \
1174 rm -f ../lib/libicuin.dll.manifest; \
1175 if test "$(ARCH64)" = "YES"; then \
1176 LINK.EXE /DLL /NXCOMPAT /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1177 /IMPLIB:../lib/libicuin.lib /out:../lib/libicuin.dll \
1178 *.o libicuin.res ../lib/libicuuc.lib ../stubdata/icudt.lib advapi32.lib; \
1179 else \
1180 LINK.EXE /DLL /NXCOMPAT /SAFESEH /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1181 /IMPLIB:../lib/libicuin.lib /out:../lib/libicuin.dll \
1182 *.o libicuin.res ../lib/libicuuc.lib ../stubdata/icudt.lib advapi32.lib; \
1183 fi; \
1184 mt.exe -nologo -manifest ../lib/libicuin.dll.manifest -outputresource:"../lib/libicuin.dll;2"; \
1185 ); \
1186 fi; \
1187 else \
1188 if test "$(LINUX)" = "YES"; then \
1189 if test "$(ARCH64)" = "YES"; then \
1190 $($(ENV_$@)) $(CXX) \
1191 -m64 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden \
1192 $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname,$($(INSTALLED_DYLIB_$@)) -Wl,-L/usr/lib64/ -ldl \
1193 -o ./$($(INSTALLED_DYLIB_$@)) $(DYLIB_OBJS); \
1194 else \
1195 $($(ENV_$@)) $(CXX) \
1196 -m32 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden \
1197 $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname,$($(INSTALLED_DYLIB_$@)) -ldl \
1198 -o ./$($(INSTALLED_DYLIB_$@)) $(DYLIB_OBJS); \
1199 fi; \
1200 else \
1201 tmpfile=`mktemp -t weakexternal.XXXXXX` || exit 1; \
1202 $(NM) -m $(RC_ARCHS:%=-arch %) $(DYLIB_OBJS) | fgrep "weak external" | fgrep -v "undefined" | sed -e 's/.*weak external[^_]*//' | sort | uniq | cat >$$tmpfile; \
1203 if test ! "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1204 ZIPPERING_LDFLAGS=-Wl,-iosmac_version_min,12.0; \
1205 fi; \
1206 $($(ENV_$@)) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic \
1207 $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) \
1208 $(CXXFLAGS) $(LDFLAGS) $$ZIPPERING_LDFLAGS -single_module $(SECTORDER_FLAGS) -unexported_symbols_list $$tmpfile -dead_strip \
1209 -install_name $(libdir)$($(INSTALLED_DYLIB_$@)) -o ./$($(INSTALLED_DYLIB_$@)) $(DYLIB_OBJS); \
1210 if test "$@" = "icu"; then \
1211 ln -fs $(INSTALLED_DYLIB) $(DYLIB); \
1212 echo '# build' $(INFOTOOL) 'linked against' $(LIB_NAME) ; \
1213 $($(ENV_$@)) $(CXX) --std=c++11 $(RC_ARCHS:%=-arch %) -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) \
1214 $(LDFLAGS) -dead_strip -o ./$(INFOTOOL) $(INFOTOOL_OBJS) -L./ -l$(LIB_NAME) ; \
1215 echo '# build' $(TOOLS_DYLIB) 'linked against' $(LIB_NAME) ; \
1216 $($(ENV_$@)) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic \
1217 $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) \
1218 $(CXXFLAGS) $(LDFLAGS) -single_module \
1219 -install_name $(locallibdir)$(TOOLS_DYLIB) -o ./$(TOOLS_DYLIB) $(TOOLS_DYLIB_OBJS) -L./ -l$(LIB_NAME) ; \
1220 echo '# build' $(ICUZDUMPTOOL) 'linked against' $(TOOLSLIB_NAME) $(LIB_NAME) ; \
1221 $($(ENV_$@)) $(LINK.cc) $(RC_ARCHS:%=-arch %) -g -Os $(ISYSROOT) $(THUMB_FLAG) --std=c++11 \
1222 -dead_strip -o ./$(ICUZDUMPTOOL) $(ICUZDUMPTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME) -l$(LIB_NAME); \
1223 fi; \
1224 fi; \
1225 if test -f ./$(DATA_BUILD_SUBDIR)/$(B_DATA_FILE); then \
1226 ln -fs ./$(DATA_BUILD_SUBDIR)/$(B_DATA_FILE); \
1227 fi; \
1228 if test -f ./$(DATA_BUILD_SUBDIR)/$(L_DATA_FILE); then \
1229 ln -fs ./$(DATA_BUILD_SUBDIR)/$(L_DATA_FILE); \
1230 else \
1231 DYLD_LIBRARY_PATH=$(ICUPKGTOOLIBS) \
1232 $(ICUPKGTOOL) -tl ./$(DATA_BUILD_SUBDIR)/$(B_DATA_FILE) $(L_DATA_FILE); \
1233 fi; \
1234 printf $(TZDATA_FORMAT_STRING) > $(TZDATA_FORMAT_FILE); \
1235 fi; \
1236 );
1237
1238 crossbuildhost : $(CROSSHOST_OBJROOT)/Makefile
1239 echo "# make for crossbuild host";
1240 (cd $(CROSSHOST_OBJROOT); \
1241 $(MAKE) $($(ENV_BUILDHOST)) || exit 1; \
1242 );
1243
1244 # For the install-icutztoolsforsdk target, SDKROOT will always be an OSX SDK root.
1245 # If the sources were installed using the minimalpatchconfig.txt patch, then
1246 # we need to patch using crosshostpatchconfig.txt as for $(CROSSHOST_OBJROOT)/Makefile
1247 # (otherwise we ignore the patch in crosshostpatchconfig.txt, using -N)
1248 icutztoolsforsdk : $(OBJROOT_CURRENT)/Makefile
1249 echo "# make icutztoolsforsdk";
1250 (cd $(OBJROOT_CURRENT); \
1251 if test ! -e $(SRCROOT)/installsrcNotRunFlag ; then patch -N -p1 <$(SRCROOT)/crosshostpatchconfig.txt; fi; \
1252 $(MAKE) $($(ENV)) || exit 1; \
1253 echo '# build' $(TOOLS_DYLIB_FORTOOLS) 'linked against' $(LIB_NAME) ; \
1254 $($(ENV)) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic \
1255 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) \
1256 $(CXXFLAGS) $(LDFLAGS) -single_module \
1257 -install_name $(locallibdir)$(TOOLS_DYLIB_FORTOOLS) -o ./$(TOOLS_DYLIB_FORTOOLS) $(TOOLS_DYLIB_OBJS_FORTOOLS) -L./ -l$(LIB_NAME) ; \
1258 echo '# build' $(ZICTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
1259 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
1260 $(LDFLAGS) -dead_strip -o ./$(ZICTOOL) $(ZICTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1261 echo '# build' $(RESTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) $(LIB_NAME) ; \
1262 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
1263 $(LDFLAGS) -dead_strip -o ./$(RESTOOL) $(RESTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) -l$(LIB_NAME) ; \
1264 echo '# build' $(PKGTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
1265 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
1266 $(LDFLAGS) -dead_strip -o ./$(PKGTOOL) $(PKGTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1267 echo '# build' $(TZ2ICUTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
1268 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
1269 $(LDFLAGS) -dead_strip -o ./$(TZ2ICUTOOL) $(TZ2ICUTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1270 echo '# build' $(GENBRKTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
1271 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
1272 $(LDFLAGS) -dead_strip -o ./$(GENBRKTOOL) $(GENBRKTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1273 );
1274
1275 check : icu
1276 ifneq "$(CROSS_BUILD)" "YES"
1277 (cd $(OBJROOT_CURRENT); \
1278 ICU_DATA=$(OBJROOT_CURRENT) $(MAKE) $(ENV) check; \
1279 );
1280 else
1281 $(warning check not supported for cross-build)
1282 endif
1283
1284 check-debug: debug
1285 ifneq "$(CROSS_BUILD)" "YES"
1286 (cd $(OBJROOT_CURRENT); \
1287 ICU_DATA=$(OBJROOT_CURRENT) $(MAKE) $(ENV_DEBUG) check; \
1288 );
1289 else
1290 $(warning check not supported for cross-build)
1291 endif
1292
1293 samples: icu
1294 (cd $(OBJROOT_CURRENT)/samples; \
1295 $(MAKE) $(ENV_DEBUG) $(LIBOVERRIDES); \
1296 );
1297
1298 extra: icu
1299 (cd $(OBJROOT_CURRENT)/extra; \
1300 $(MAKE) $(ENV_DEBUG) $(LIBOVERRIDES); \
1301 );
1302
1303 ifneq "$(CROSS_BUILD)" "YES"
1304 $(OBJROOT_CURRENT)/Makefile :
1305 else
1306 $(OBJROOT_CURRENT)/Makefile : crossbuildhost
1307 endif
1308 if test ! -d $(OBJROOT_CURRENT); then \
1309 mkdir -p $(OBJROOT_CURRENT); \
1310 fi;
1311 cp -Rpf $(SRCROOT)/icuSources/* $(OBJROOT_CURRENT)/;
1312 (cd $(OBJROOT_CURRENT); \
1313 if test -e $(SRCROOT)/installsrcNotRunFlag ; then $(ADJUST_SOURCES); fi; \
1314 if test -f $(TZAUXFILESDIR)/metaZones.txt ; then cp -p $(TZAUXFILESDIR)/metaZones.txt data/misc/; fi; \
1315 if test -f $(TZAUXFILESDIR)/timezoneTypes.txt ; then cp -p $(TZAUXFILESDIR)/timezoneTypes.txt data/misc/; fi; \
1316 if test -f $(TZAUXFILESDIR)/windowsZones.txt ; then cp -p $(TZAUXFILESDIR)/windowsZones.txt data/misc/; fi; \
1317 if test -f $(TZAUXFILESDIR)/icuregions ; then cp -p $(TZAUXFILESDIR)/icuregions tools/tzcode/; fi; \
1318 if test -f $(TZAUXFILESDIR)/icuzones ; then cp -p $(TZAUXFILESDIR)/icuzones tools/tzcode/; fi; \
1319 if test "$(WINDOWS)" = "YES"; then \
1320 echo "# configure for target"; \
1321 $(ENV_CONFIGURE) ./runConfigureICU Cygwin/MSVC $(CONFIG_FLAGS); \
1322 elif test "$(LINUX)" = "YES"; then \
1323 echo "# configure for target"; \
1324 $(ENV_CONFIGURE) ./runConfigureICU Linux $(CONFIG_FLAGS); \
1325 elif test "$(CROSS_BUILD)" = "YES"; then \
1326 echo "# configure for crossbuild target"; \
1327 $(ENV_CONFIGURE) ./configure --host=$(TARGET_SPEC) --with-cross-build=$(CROSSHOST_OBJROOT) $(CONFIG_FLAGS); \
1328 else \
1329 echo "# configure for non-crossbuild target"; \
1330 $(ENV_CONFIGURE) ./runConfigureICU MacOSX $(CONFIG_FLAGS); \
1331 fi; \
1332 );
1333
1334 # for the tools that build the data file, cannot set UDATA_DEFAULT_ACCESS = UDATA_ONLY_PACKAGES
1335 # as minimalpatchconfig.txt does; need different patches for the host build. Thus
1336 # we have to use crosshostpatchconfig.txt to undo the udata.h changes that would have
1337 # been made for ICU_FOR_EMBEDDED_TRAINS builds.
1338 $(CROSSHOST_OBJROOT)/Makefile :
1339 if test ! -d $(CROSSHOST_OBJROOT); then \
1340 mkdir -p $(CROSSHOST_OBJROOT); \
1341 fi;
1342 cp -Rpf $(SRCROOT)/icuSources/* $(CROSSHOST_OBJROOT);
1343 (cd $(CROSSHOST_OBJROOT); \
1344 if test -e $(SRCROOT)/installsrcNotRunFlag; then $(ADJUST_SOURCES); fi; \
1345 if test -f $(TZAUXFILESDIR)/metaZones.txt ; then cp -p $(TZAUXFILESDIR)/metaZones.txt data/misc/; fi; \
1346 if test -f $(TZAUXFILESDIR)/timezoneTypes.txt ; then cp -p $(TZAUXFILESDIR)/timezoneTypes.txt data/misc/; fi; \
1347 if test -f $(TZAUXFILESDIR)/windowsZones.txt ; then cp -p $(TZAUXFILESDIR)/windowsZones.txt data/misc/; fi; \
1348 if test -f $(TZAUXFILESDIR)/icuregions ; then cp -p $(TZAUXFILESDIR)/icuregions tools/tzcode/; fi; \
1349 if test -f $(TZAUXFILESDIR)/icuzones ; then cp -p $(TZAUXFILESDIR)/icuzones tools/tzcode/; fi; \
1350 if test "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1351 patch -p1 <$(SRCROOT)/crosshostpatchconfig.txt; \
1352 fi; \
1353 echo "# configure for crossbuild host"; \
1354 $(ENV_CONFIGURE_BUILDHOST) ./runConfigureICU MacOSX $(CONFIG_FLAGS); \
1355 );
1356
1357 #################################
1358 # B&I TARGETS
1359 #################################
1360
1361 # Since our sources are in icuSources (ignore the ICU subdirectory for now), we wish to
1362 # copy them to somewhere else. We tar it to stdout, cd to the appropriate directory, and
1363 # untar from stdin.
1364 # Do NOT include installsrcNotRunFlag in the list of files to tar up, that defeats the purpose.
1365
1366 installsrc :
1367 if test ! -d $(SRCROOT); then mkdir $(SRCROOT); fi;
1368 if test -d $(SRCROOT)/icuSources ; then rm -rf $(SRCROOT)/icuSources; fi;
1369 tar cf - ./makefile ./ICU.plist ./LICENSE ./icuSources ./cldrFiles ./emojiData ./modules $(INSTALLSRC_VARFILES) | (cd $(SRCROOT) ; tar xfp -); \
1370 (cd $(SRCROOT)/icuSources; $(ADJUST_SOURCES) );
1371
1372 # This works. Just not for ~ in the DSTROOT. We run configure first (in case it hasn't
1373 # been already). Then we make the install-headers target on specific makefiles (since
1374 # not every subdirectory/sub-component has a install-headers target).
1375
1376 # installhdrs should be no-op for BUILD_TYPE=TOOL
1377 ifeq "$(BUILD_TYPE)" "TOOL"
1378 installhdrs :
1379 else
1380 installhdrs : installhdrsint
1381 endif
1382
1383 MKINSTALLDIRS=$(SHELL) $(SRCROOT)/icuSources/mkinstalldirs
1384 INSTALL_DATA=${INSTALL} -m 644
1385
1386 ifneq "$(ICU_FOR_APPLE_PLATFORMS)" "YES"
1387 installhdrsint : $(OBJROOT_CURRENT)/Makefile
1388 else ifneq "$(RC_XBS)" "YES"
1389 installhdrsint : $(OBJROOT_CURRENT)/Makefile
1390 else
1391 installhdrsint :
1392 endif
1393 (if test -e $(SRCROOT)/installsrcNotRunFlag; then cd $(OBJROOT_CURRENT); else cd $(SRCROOT)/icuSources/; fi; \
1394 $(MKINSTALLDIRS) $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/; \
1395 for subdir in $(HDR_MAKE_SUBDIR); do \
1396 echo "# Subdir $$subdir"; \
1397 (cd $$subdir/unicode; \
1398 for i in *.h; do \
1399 echo "$(INSTALL_DATA) $$i $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/"; \
1400 $(INSTALL_DATA) $$i $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/ || exit; \
1401 done; \
1402 ); \
1403 done; \
1404 if test "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1405 if test ! -d $(DSTROOT)/$(HDR_PREFIX)/include/unicode/; then \
1406 $(INSTALL) -d -m 0755 $(DSTROOT)/$(HDR_PREFIX)/include/unicode/; \
1407 fi; \
1408 if test -d $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/; then \
1409 (cd $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode; \
1410 for i in *.h; do \
1411 if fgrep -q -x $$i $(SRCROOT)/minimalapis.txt ; then \
1412 mv $$i $(DSTROOT)/$(HDR_PREFIX)/include/unicode ; \
1413 fi ; \
1414 done ); \
1415 if test ! "$(RC_XBS)" = "YES"; then \
1416 echo "# Not building for XBS, so running minimal test"; \
1417 $(CC) $(SRCROOT)/minimalapisTest.c $(INSTALLHDRS_ARCH) $(ISYSROOT) -nostdinc \
1418 -I $(DSTROOT)/$(HDR_PREFIX)/include/ -I $(SDKPATH)/usr/include/ -E > /dev/null ; \
1419 fi; \
1420 fi; \
1421 $(INSTALL_DATA) $(SRCROOT)/modules/embedded/module.modulemap $(DSTROOT)/$(HDR_PREFIX)/include/unicode/ ; \
1422 $(INSTALL_DATA) $(SRCROOT)/modules/embedded/module.private.modulemap $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/ ; \
1423 else \
1424 if test "$(ICU_FOR_APPLE_PLATFORMS)" = "YES"; then \
1425 $(INSTALL_DATA) $(SRCROOT)/modules/macos/module.private.modulemap $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/ ; \
1426 fi; \
1427 fi; \
1428 );
1429
1430 # We run configure and run make first. This generates the .o files. We then link them
1431 # all up together into libicucore. Then we put it into its install location, create
1432 # symbolic links, and then strip the main dylib. Then install the remaining libraries.
1433 # We cleanup the sources folder.
1434
1435 install : installhdrsint icu
1436 if test "$(WINDOWS)" = "YES"; then \
1437 if test ! -d $(DSTROOT)/$(winprogdir)/; then \
1438 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winprogdir)/; \
1439 fi; \
1440 if test ! -d $(DSTROOT)/$(winintlibdir)/; then \
1441 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winintlibdir)/; \
1442 fi; \
1443 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc.lib $(DSTROOT)/$(winintlibdir)libicuuc.lib; \
1444 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc.pdb $(DSTROOT)/$(winprogdir)libicuuc.pdb; \
1445 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuuc.dll $(DSTROOT)/$(winprogdir)libicuuc.dll; \
1446 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin.lib $(DSTROOT)/$(winintlibdir)libicuin.lib; \
1447 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin.pdb $(DSTROOT)/$(winprogdir)libicuin.pdb; \
1448 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuin.dll $(DSTROOT)/$(winprogdir)libicuin.dll; \
1449 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/icudt$(ICU_VERS).dll $(DSTROOT)/$(winprogdir)icudt$(ICU_VERS).dll; \
1450 else \
1451 if test ! -d $(DSTROOT)/$(libdir)/; then \
1452 $(INSTALL) -d -m 0755 $(DSTROOT)/$(libdir)/; \
1453 fi; \
1454 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(INSTALLED_DYLIB) $(DSTROOT)/$(libdir)$(INSTALLED_DYLIB); \
1455 if test "$(LINUX)" = "YES"; then \
1456 if test ! -d $(SYMROOT_CURRENT)/; then \
1457 $(INSTALL) -d -m 0755 $(SYMROOT_CURRENT)/; \
1458 fi; \
1459 cp $(OBJROOT_CURRENT)/$(INSTALLED_DYLIB) $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB); \
1460 strip -x -S $(DSTROOT)/$(libdir)$(INSTALLED_DYLIB); \
1461 else \
1462 (cd $(DSTROOT)/$(libdir); \
1463 ln -fs $(INSTALLED_DYLIB) $(DYLIB)); \
1464 cp $(OBJROOT_CURRENT)/$(INSTALLED_DYLIB) $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB); \
1465 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB); \
1466 $(STRIPCMD) -x -u -r -S $(DSTROOT)/$(libdir)$(INSTALLED_DYLIB); \
1467 fi; \
1468 for subdir in $(EXTRA_LIBS); do \
1469 (cd $(OBJROOT_CURRENT)/$$subdir; $(MAKE) -e DESTDIR=$(DSTROOT)/ $(ENV) install-library;) \
1470 done; \
1471 if test ! -d $(DSTROOT)/$(DATA_INSTALL_DIR)/; then \
1472 $(INSTALL) -d -m 0755 $(DSTROOT)/$(DATA_INSTALL_DIR)/; \
1473 fi; \
1474 if test -f $(OBJROOT_CURRENT)/$(L_DATA_FILE); then \
1475 $(INSTALL) -b -m 0444 $(OBJROOT_CURRENT)/$(L_DATA_FILE) $(DSTROOT)/$(DATA_INSTALL_DIR)$(L_DATA_FILE); \
1476 fi; \
1477 if test -f $(OBJROOT_CURRENT)/$(TZDATA_FORMAT_FILE); then \
1478 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/$(TZDATA_FORMAT_FILE) $(DSTROOT)/$(DATA_INSTALL_DIR)$(TZDATA_FORMAT_FILE); \
1479 fi; \
1480 if test ! -d $(DSTROOT)/$(OPEN_SOURCE_VERSIONS_DIR)/; then \
1481 $(INSTALL) -d -m 0755 $(DSTROOT)/$(OPEN_SOURCE_VERSIONS_DIR)/; \
1482 fi; \
1483 $(INSTALL) -b -m 0644 $(SRCROOT)/ICU.plist $(DSTROOT)/$(OPEN_SOURCE_VERSIONS_DIR)ICU.plist; \
1484 if test ! -d $(DSTROOT)/$(OPEN_SOURCE_LICENSES_DIR)/; then \
1485 $(INSTALL) -d -m 0755 $(DSTROOT)/$(OPEN_SOURCE_LICENSES_DIR)/; \
1486 fi; \
1487 $(INSTALL) -b -m 0644 $(SRCROOT)/LICENSE $(DSTROOT)/$(OPEN_SOURCE_LICENSES_DIR)ICU.txt; \
1488 if test ! -d $(DSTROOT)/$(CLDRFILESDIR)/; then \
1489 $(INSTALL) -d -m 0755 $(DSTROOT)/$(CLDRFILESDIR)/; \
1490 fi; \
1491 $(INSTALL) -b -m 0644 $(SRCROOT)/cldrFiles/supplementalData.xml $(DSTROOT)/$(CLDRFILESDIR)/supplementalData.xml; \
1492 $(INSTALL) -b -m 0644 $(SRCROOT)/cldrFiles/plurals.xml $(DSTROOT)/$(CLDRFILESDIR)/plurals.xml; \
1493 if test ! -d $(DSTROOT)/$(EMOJI_DATA_DIR)/; then \
1494 $(INSTALL) -d -m 0755 $(DSTROOT)/$(EMOJI_DATA_DIR)/; \
1495 fi; \
1496 $(INSTALL) -b -m 0644 $(SRCROOT)/emojiData/charClasses.txt $(DSTROOT)/$(EMOJI_DATA_DIR)/charClasses.txt; \
1497 $(INSTALL) -b -m 0644 $(SRCROOT)/emojiData/lineClasses.txt $(DSTROOT)/$(EMOJI_DATA_DIR)/lineClasses.txt; \
1498 if test "$(LINUX)" != "YES"; then \
1499 if test ! -d $(DSTROOT)/$(localtooldir)/; then \
1500 $(INSTALL) -d -m 0755 $(DSTROOT)/$(localtooldir)/; \
1501 fi; \
1502 if test -f $(OBJROOT_CURRENT)/$(INFOTOOL); then \
1503 echo '# install' $(INFOTOOL) 'to' $(DSTROOT)/$(localtooldir)$(INFOTOOL) ; \
1504 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(INFOTOOL) $(DSTROOT)/$(localtooldir)$(INFOTOOL); \
1505 cp $(OBJROOT_CURRENT)/$(INFOTOOL) $(SYMROOT_CURRENT)/$(INFOTOOL); \
1506 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(INFOTOOL)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(INFOTOOL); \
1507 fi; \
1508 if test ! -d $(DSTROOT)/$(locallibdir)/; then \
1509 $(INSTALL) -d -m 0755 $(DSTROOT)/$(locallibdir)/; \
1510 fi; \
1511 if test -f $(OBJROOT_CURRENT)/$(TOOLS_DYLIB); then \
1512 echo '# install' $(TOOLS_DYLIB) 'to' $(DSTROOT)/$(locallibdir)$(TOOLS_DYLIB) ; \
1513 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(TOOLS_DYLIB) $(DSTROOT)/$(locallibdir)$(TOOLS_DYLIB); \
1514 cp $(OBJROOT_CURRENT)/$(TOOLS_DYLIB) $(SYMROOT_CURRENT)/$(TOOLS_DYLIB); \
1515 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(TOOLS_DYLIB)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(TOOLS_DYLIB); \
1516 fi; \
1517 if test -f $(OBJROOT_CURRENT)/$(ICUZDUMPTOOL); then \
1518 echo '# install' $(ICUZDUMPTOOL) 'to' $(DSTROOT)/$(localtooldir)$(ICUZDUMPTOOL) ; \
1519 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(ICUZDUMPTOOL) $(DSTROOT)/$(localtooldir)$(ICUZDUMPTOOL); \
1520 cp $(OBJROOT_CURRENT)/$(ICUZDUMPTOOL) $(SYMROOT_CURRENT)/$(ICUZDUMPTOOL); \
1521 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(ICUZDUMPTOOL)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(ICUZDUMPTOOL); \
1522 fi; \
1523 fi; \
1524 fi;
1525
1526 DEPEND_install_debug = debug
1527 DEPEND_install_profile = profile
1528
1529 .SECONDEXPANSION:
1530 install_debug install_profile : $$(DEPEND_$$@)
1531 if test "$(WINDOWS)" = "YES"; then \
1532 if test ! -d $(DSTROOT)/$(winprogdir)/; then \
1533 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winprogdir)/; \
1534 fi; \
1535 if test ! -d $(DSTROOT)/$(winintlibdir)/; then \
1536 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winintlibdir)/; \
1537 fi; \
1538 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc_$(DEPEND_$@).lib $(DSTROOT)/$(winintlibdir)libicuuc_$(DEPEND_$@).lib; \
1539 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc_$(DEPEND_$@).pdb $(DSTROOT)/$(winprogdir)libicuuc_$(DEPEND_$@).pdb; \
1540 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuuc_$(DEPEND_$@).dll $(DSTROOT)/$(winprogdir)libicuuc_$(DEPEND_$@).dll; \
1541 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin_$(DEPEND_$@).lib $(DSTROOT)/$(winintlibdir)libicuin_$(DEPEND_$@).lib; \
1542 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin_$(DEPEND_$@).pdb $(DSTROOT)/$(winprogdir)libicuin_$(DEPEND_$@).pdb; \
1543 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuin_$(DEPEND_$@).dll $(DSTROOT)/$(winprogdir)libicuin_$(DEPEND_$@).dll; \
1544 else \
1545 if test ! -d $(DSTROOT)/$(libdir)/; then \
1546 $(INSTALL) -d -m 0755 $(DSTROOT)/$(libdir)/; \
1547 fi; \
1548 $(INSTALL) -b -m 0664 $(OBJROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))) $(DSTROOT)/$(libdir)$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
1549 if test "$(LINUX)" = "YES"; then \
1550 if test ! -d $(SYMROOT_CURRENT)/; then \
1551 $(INSTALL) -d -m 0755 $(SYMROOT_CURRENT)/; \
1552 fi; \
1553 cp $(OBJROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))) $(SYMROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
1554 strip -x -S $(DSTROOT)/$(libdir)$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
1555 else \
1556 (cd $(DSTROOT)/$(libdir); \
1557 ln -fs $($(INSTALLED_DYLIB_$(DEPEND_$@))) $($(DYLIB_$(DEPEND_$@)))); \
1558 cp $(OBJROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))) $(SYMROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
1559 $(STRIPCMD) -x -u -r -S $(DSTROOT)/$(libdir)$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
1560 fi; \
1561 for subdir in $(EXTRA_LIBS); do \
1562 (cd $(OBJROOT_CURRENT)/$$subdir; $(MAKE) -e DESTDIR=$(DSTROOT)/ $(ENV) install-library;) \
1563 done; \
1564 fi;
1565
1566 clean :
1567 -rm -rf $(OBJROOT)
1568
1569 # For the install-icutztoolsforsdk target, SDKROOT will always be an OSX SDK root
1570 install-icutztoolsforsdk : icutztoolsforsdk
1571 if test ! -d $(DSTROOT)$(localtooldir)/; then \
1572 $(INSTALL) -d -m 0755 $(DSTROOT)$(localtooldir)/; \
1573 fi;
1574 if test ! -d $(DSTROOT)$(locallibdir)/; then \
1575 $(INSTALL) -d -m 0755 $(DSTROOT)$(locallibdir)/; \
1576 fi;
1577 if test -f $(OBJROOT_CURRENT)/$(TOOLS_DYLIB_FORTOOLS); then \
1578 echo '# install' $(TOOLS_DYLIB_FORTOOLS) 'to' $(DSTROOT)$(locallibdir)$(TOOLS_DYLIB_FORTOOLS) ; \
1579 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(TOOLS_DYLIB_FORTOOLS) $(DSTROOT)$(locallibdir)$(TOOLS_DYLIB_FORTOOLS); \
1580 fi;
1581 if test -f $(OBJROOT_CURRENT)/$(ZICTOOL); then \
1582 echo '# install' $(ZICTOOL) 'to' $(DSTROOT)$(localtooldir)$(ZICTOOL) ; \
1583 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(ZICTOOL) $(DSTROOT)$(localtooldir)$(ZICTOOL); \
1584 fi;
1585 if test -f $(OBJROOT_CURRENT)/$(RESTOOL); then \
1586 echo '# install' $(RESTOOL) 'to' $(DSTROOT)$(localtooldir)$(RESTOOL) ; \
1587 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(RESTOOL) $(DSTROOT)$(localtooldir)$(RESTOOL); \
1588 fi;
1589 if test -f $(OBJROOT_CURRENT)/$(PKGTOOL); then \
1590 echo '# install' $(PKGTOOL) 'to' $(DSTROOT)$(localtooldir)$(PKGTOOL) ; \
1591 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(PKGTOOL) $(DSTROOT)$(localtooldir)$(PKGTOOL); \
1592 fi;
1593 if test -f $(OBJROOT_CURRENT)/$(TZ2ICUTOOL); then \
1594 echo '# install' $(TZ2ICUTOOL) 'to' $(DSTROOT)$(localtooldir)$(TZ2ICUTOOL) ; \
1595 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(TZ2ICUTOOL) $(DSTROOT)$(localtooldir)$(TZ2ICUTOOL); \
1596 fi;
1597 if test -f $(OBJROOT_CURRENT)/$(GENBRKTOOL); then \
1598 echo '# install' $(GENBRKTOOL) 'to' $(DSTROOT)$(localtooldir)$(GENBRKTOOL) ; \
1599 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(GENBRKTOOL) $(DSTROOT)$(localtooldir)$(GENBRKTOOL); \
1600 fi;