xref: /trunk/main/icu/makefile.mk (revision 91144cd0085a7583d2099b982122deb2184ab956)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23PRJ=.
24
25PRJNAME=icu
26TARGET=so_icu
27
28# --- Settings -----------------------------------------------------
29
30.INCLUDE :  settings.mk
31
32# --- Files --------------------------------------------------------
33
34.INCLUDE :  icuversion.mk
35
36.IF "$(ICU_MICRO)"!="0"
37TARFILE_NAME=icu4c-$(ICU_MAJOR)_$(ICU_MINOR)_$(ICU_MICRO)-src
38TARFILE_MD5=e3738abd0d3ce1870dc1fd1f22bba5b1
39.ELSE
40TARFILE_NAME=icu4c-$(ICU_MAJOR)_$(ICU_MINOR)-src
41TARFILE_MD5=
42.ENDIF
43TARFILE_ROOTDIR=icu
44
45# TODO file icu-mp.patch does not seem to be required
46PATCH_FILES=${TARFILE_NAME}.patch icu-win-layout.patch \
47    icu-parallel-build.patch \
48    icu-format-security.patch icu-win-icutu-dll-version.patch \
49    icu-vcproj-outputdirectory.patch
50
51.IF "$(OS)"=="MACOSX"
52PATCH_FILES+=icu-darwin.patch
53.ENDIF
54
55# ADDITIONAL_FILES=
56
57.IF "$(GUI)"=="UNX"
58.IF "$(COMNAME)"=="sunpro5"
59#.IF "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
60#CC:=$(COMPATH)$/bin$/cc
61#CXX:=$(COMPATH)$/bin$/CC
62#.ENDIF          # "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
63.ENDIF          # "$(COMNAME)"=="sunpro5"
64
65.IF "$(SYSBASE)"!=""
66icu_CFLAGS+=-I$(SYSBASE)$/usr$/include
67.IF "$(COMNAME)"=="sunpro5"
68icu_CFLAGS+=$(C_RESTRICTIONFLAGS)
69.ENDIF          # "$(COMNAME)"=="sunpro5"
70# add SYSBASE libraries and make certain that they are found *after* the
71# icu build internal libraries - in case that icu is available in SYSBASE
72# as well
73icu_LDFLAGS+= -L../lib  -L../../lib -L../stubdata -L../../stubdata  -L$(SYSBASE)$/usr$/lib
74.ENDIF          # "$(SYSBASE)"!=""
75
76icu_CFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
77icu_LDFLAGS+=$(EXTRA_LINKFLAGS)
78icu_CXXFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
79
80# remove conversion and transliteration data to reduce binary size.
81CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
82
83# until someone introduces SOLARIS 64-bit builds
84.IF "$(OS)"=="SOLARIS"
85DISABLE_64BIT=--enable-64bit-libs=no
86.ENDIF          # "$(OS)"=="SOLARIS"
87
88.IF "$(HAVE_LD_HASH_STYLE)"  == "TRUE"
89LDFLAGSADD += -Wl,--hash-style=both
90.ENDIF
91
92.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)"  == "TRUE"
93LDFLAGSADD += -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
94.ENDIF
95
96# FreeBSD with gcc from ports needs -Wl,-rpath= to find the matching libstdc++
97.IF "$(OS)"=="FREEBSD"
98LDFLAGSADD+=$(FBSD_GCC_RPATH)
99.ENDIF
100
101CONFIGURE_DIR=source
102
103CONFIGURE_ACTION+=sh -c 'CFLAGS="$(icu_CFLAGS)" CXXFLAGS="$(icu_CXXFLAGS)" LDFLAGS="$(icu_LDFLAGS) $(LDFLAGSADD)" ./configure --enable-layout --enable-static --enable-shared=yes $(DISABLE_64BIT)'
104
105#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
106CONFIGURE_FLAGS=
107
108# Use of
109# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
110# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
111# doesn't work as it would result in
112# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
113# note the position of the single quotes.
114
115BUILD_DIR=$(CONFIGURE_DIR)
116BUILD_ACTION=$(AUGMENT_LIBRARY_PATH) $(GNUMAKE) -j$(EXTMAXPROCESS)
117OUT2LIB= \
118    $(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
119    $(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
120    $(BUILD_DIR)$/lib$/libicudata$(DLLPOST) \
121    $(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
122    $(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
123    $(BUILD_DIR)$/lib$/libicuuc$(DLLPOST) \
124    $(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
125    $(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
126    $(BUILD_DIR)$/lib$/libicui18n$(DLLPOST) \
127    $(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
128    $(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
129    $(BUILD_DIR)$/lib$/libicule$(DLLPOST) \
130    $(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
131    $(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
132    $(BUILD_DIR)$/lib$/libicutu$(DLLPOST)
133
134OUT2BIN= \
135    $(BUILD_DIR)$/bin$/genccode \
136    $(BUILD_DIR)$/bin$/genbrk \
137    $(BUILD_DIR)$/bin$/gencmn
138
139.ENDIF
140
141.IF "$(GUI)"=="WNT"
142CONFIGURE_DIR=source
143.IF "$(COM)"=="GCC"
144CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
145.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
146icu_LDFLAGS+=-shared-libgcc
147.ENDIF
148.IF "$(USE_MINGW)"=="cygwin"
149icu_LDFLAGS+=-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api
150.ENDIF
151icu_LDFLAGS+=-L$(COMPATH)$/lib
152icu_LIBS=
153.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
154icu_LIBS+=$(MINGW_SHARED_LIBSTDCPP)
155.ENDIF
156icu_LDFLAGS+=-Wl,--enable-runtime-pseudo-reloc-v2
157CONFIGURE_ACTION+=sh -c 'CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" LDFLAGS="$(icu_LDFLAGS)" LIBS="$(icu_LIBS)" ./configure --build=i586-pc-mingw32 --enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no'
158
159#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
160CONFIGURE_FLAGS=
161
162# Use of
163# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
164# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
165# doesn't work as it would result in
166# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
167# note the position of the single quotes.
168
169BUILD_DIR=$(CONFIGURE_DIR)
170BUILD_ACTION=$(GNUMAKE)
171OUT2LIB=
172
173OUT2BIN= \
174    $(BUILD_DIR)$/lib$/icudt$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
175    $(BUILD_DIR)$/lib$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
176    $(BUILD_DIR)$/lib$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
177    $(BUILD_DIR)$/lib$/icule$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
178    $(BUILD_DIR)$/lib$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
179    $(BUILD_DIR)$/bin$/genccode.exe \
180    $(BUILD_DIR)$/bin$/genbrk.exe \
181    $(BUILD_DIR)$/bin$/gencmn.exe
182
183.ELSE
184BUILD_DIR=source
185.IF "full_debug" == ""
186
187# Activating the debug mechanism produces incompatible libraries, you'd have
188# at least to relink all modules that are directly using ICU. Note that library
189# names get a 'd' appended and you'd have to edit the solenv/inc/libs.mk
190# ICU*LIB macros as well. Normally you don't want all this.
191#
192# Instead, use the normal already existing Release build and edit the
193# corresponding *.vcproj file of the section you're interested in. Make sure
194# that
195# - for the VCCLCompilerTool section the following line exists:
196#   DebugInformationFormat="3"
197# - and for the VCLinkerTool the line
198#   GenerateDebugInformation="TRUE"
199# Then delete the corresponding Release output directory, and delete the target
200# flag files
201# $(OUTPATH)/misc/build/so_built_so_icu
202# $(OUTPATH)/misc/build/so_predeliver_so_icu
203# and run dmake again, after which you may copy the resulting libraries to your
204# OOo/SO installation.
205ICU_BUILD_VERSION=Debug
206ICU_BUILD_LIBPOST=d
207.ELSE
208ICU_BUILD_VERSION=Release
209ICU_BUILD_LIBPOST=
210.ENDIF
211
212.IF "$(CPUNAME)"=="INTEL"
213CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmak.cfg .
214.ELIF "$(CPUNAME)"=="X86_64"
215CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmakWin64.cfg .
216.ENDIF
217
218.IF "$(CCNUMVER)"<="001400000000"
219BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHsc" && cd ..$/..
220.ELIF "$(COMEX)"=="14"
221# ICU 4.2's test programs use the C++03 idiom `".."MACRO' -- a string literal
222# glued straight onto an identifier.  C++11 reads that as a user-defined
223# literal suffix, so a modern compiler stops with
224#     letest.cpp(418): error C3688: invalid literal suffix 'U_FILE_SEP_STRING'
225# and there are ~85 such sites across letest, intltest and iotest.
226#
227# None of them is delivered.  OUT2BIN and OUT2LIB below take the five
228# libraries, the five DLLs and three tools, and nothing else -- ICU's tests
229# are never built into the product and never run by this build.  So the fix
230# is to stop building them rather than to rewrite eighty-five lines of
231# vendored test code.
232#
233# This is all.mak's own ALL: list with letest, cintltst, intltest and iotest
234# removed, in its original order.  Naming the targets rather than patching
235# all.mak keeps the VC9 branch above and the default branch below reaching
236# ICU exactly as they always have.
237BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHa -Zc:wchar_t-" stubdata common i18n cal date layout layoutex toolutil gensprep genprops genpname genctd icupkg gencnval derb makeconv genbidi ctestfw gentest genccode gennorm genrb gencase genuca gennames gencmn pkgdata uconv genbrk gencfu makedata && cd ..$/..
238.ELSE
239BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHa -Zc:wchar_t-" && cd ..$/..
240.ENDIF
241
242OUT2LIB= \
243    $(BUILD_DIR)$/..$/lib$/icudata.lib \
244    $(BUILD_DIR)$/..$/lib$/icuin$(ICU_BUILD_LIBPOST).lib \
245    $(BUILD_DIR)$/..$/lib$/icuuc$(ICU_BUILD_LIBPOST).lib \
246    $(BUILD_DIR)$/..$/lib$/icule$(ICU_BUILD_LIBPOST).lib \
247    $(BUILD_DIR)$/..$/lib$/icutu$(ICU_BUILD_LIBPOST).lib
248
249OUT2BIN= \
250    $(BUILD_DIR)$/..$/bin$/icudt$(ICU_MAJOR)$(ICU_MINOR).dll \
251    $(BUILD_DIR)$/..$/bin$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
252    $(BUILD_DIR)$/..$/bin$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
253    $(BUILD_DIR)$/..$/bin$/icule$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
254    $(BUILD_DIR)$/..$/bin$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
255    $(BUILD_DIR)$/..$/bin$/genccode.exe \
256    $(BUILD_DIR)$/..$/bin$/genbrk.exe \
257    $(BUILD_DIR)$/..$/bin$/gencmn.exe
258
259.ENDIF
260.ENDIF      # "$(GUI)"=="WNT"
261
262# --- Targets ------------------------------------------------------
263
264.INCLUDE : set_ext.mk
265.INCLUDE :  target.mk
266.INCLUDE :  tg_ext.mk
267
268.IF "$(BINARY_PATCH_FILES)"!=""
269
270$(PACKAGE_DIR)$/so_add_binary :  $(PACKAGE_DIR)$/$(ADD_FILES_FLAG_FILE)
271    cd $(PACKAGE_DIR) && gunzip -c $(BACK_PATH)$(BINARY_PATCH_FILES) | tar -xvf -
272    $(TOUCH) $(PACKAGE_DIR)$/so_add_binary
273
274$(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE) : $(PACKAGE_DIR)$/so_add_binary
275
276.ENDIF
277
278.IF "$(GUI)$(COM)"=="WNTGCC"
279ALLTAR : \
280    $(LB)$/icudata.lib \
281    $(LB)$/icuin$(ICU_BUILD_LIBPOST).lib \
282    $(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib \
283    $(LB)$/icule$(ICU_BUILD_LIBPOST).lib \
284    $(LB)$/icutu$(ICU_BUILD_LIBPOST).lib
285
286$(LB)$/icudata.lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
287    $(TOUCH) $@
288
289$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
290    $(TOUCH) $@
291
292$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
293    $(TOUCH) $@
294
295$(LB)$/icule$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
296    $(TOUCH) $@
297
298$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
299    $(TOUCH) $@
300.ENDIF
301
302# Since you never know what will be in a patch (for example, it may already
303# patch at configure level) or in the case of a binary patch, we remove the
304# entire package directory if a patch is newer.
305# Changes in this makefile could also make a complete build necessary if
306# configure is affected.
307$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : makefile.mk
308