xref: /AOO42X/main/icu/makefile.mk (revision 11cb57bfcacc5723003f4bbb882b814fde424fc4)
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-format-security.patch icu-win-icutu-dll-version.patch
48
49.IF "$(OS)"=="MACOSX"
50PATCH_FILES+=icu-darwin.patch
51.ENDIF
52
53# ADDITIONAL_FILES=
54
55.IF "$(GUI)"=="UNX"
56.IF "$(COMNAME)"=="sunpro5"
57#.IF "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
58#CC:=$(COMPATH)$/bin$/cc
59#CXX:=$(COMPATH)$/bin$/CC
60#.ENDIF          # "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
61.ENDIF          # "$(COMNAME)"=="sunpro5"
62
63.IF "$(SYSBASE)"!=""
64icu_CFLAGS+=-I$(SYSBASE)$/usr$/include
65.IF "$(COMNAME)"=="sunpro5"
66icu_CFLAGS+=$(C_RESTRICTIONFLAGS)
67.ENDIF          # "$(COMNAME)"=="sunpro5"
68# add SYSBASE libraries and make certain that they are found *after* the
69# icu build internal libraries - in case that icu is available in SYSBASE
70# as well
71icu_LDFLAGS+= -L../lib  -L../../lib -L../stubdata -L../../stubdata  -L$(SYSBASE)$/usr$/lib
72.ENDIF          # "$(SYSBASE)"!=""
73
74icu_CFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
75icu_LDFLAGS+=$(EXTRA_LINKFLAGS)
76icu_CXXFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
77
78# remove conversion and transliteration data to reduce binary size.
79CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
80
81# until someone introduces SOLARIS 64-bit builds
82.IF "$(OS)"=="SOLARIS"
83DISABLE_64BIT=--enable-64bit-libs=no
84.ENDIF          # "$(OS)"=="SOLARIS"
85
86.IF "$(HAVE_LD_HASH_STYLE)"  == "TRUE"
87LDFLAGSADD += -Wl,--hash-style=both
88.ENDIF
89
90.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)"  == "TRUE"
91LDFLAGSADD += -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
92.ENDIF
93
94# FreeBSD with gcc from ports needs -Wl,-rpath= to find the matching libstdc++
95.IF "$(OS)"=="FREEBSD"
96LDFLAGSADD+=$(FBSD_GCC_RPATH)
97.ENDIF
98
99CONFIGURE_DIR=source
100
101CONFIGURE_ACTION+=sh -c 'CFLAGS="$(icu_CFLAGS)" CXXFLAGS="$(icu_CXXFLAGS)" LDFLAGS="$(icu_LDFLAGS) $(LDFLAGSADD)" ./configure --enable-layout --enable-static --enable-shared=yes $(DISABLE_64BIT)'
102
103#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
104CONFIGURE_FLAGS=
105
106# Use of
107# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
108# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
109# doesn't work as it would result in
110# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
111# note the position of the single quotes.
112
113BUILD_DIR=$(CONFIGURE_DIR)
114BUILD_ACTION=$(AUGMENT_LIBRARY_PATH) $(GNUMAKE) -j$(EXTMAXPROCESS)
115OUT2LIB= \
116    $(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
117    $(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
118    $(BUILD_DIR)$/lib$/libicudata$(DLLPOST) \
119    $(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
120    $(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
121    $(BUILD_DIR)$/lib$/libicuuc$(DLLPOST) \
122    $(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
123    $(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
124    $(BUILD_DIR)$/lib$/libicui18n$(DLLPOST) \
125    $(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
126    $(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
127    $(BUILD_DIR)$/lib$/libicule$(DLLPOST) \
128    $(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
129    $(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
130    $(BUILD_DIR)$/lib$/libicutu$(DLLPOST)
131
132OUT2BIN= \
133    $(BUILD_DIR)$/bin$/genccode \
134    $(BUILD_DIR)$/bin$/genbrk \
135    $(BUILD_DIR)$/bin$/gencmn
136
137.ENDIF
138
139.IF "$(GUI)"=="WNT"
140CONFIGURE_DIR=source
141.IF "$(COM)"=="GCC"
142CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
143.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
144icu_LDFLAGS+=-shared-libgcc
145.ENDIF
146.IF "$(USE_MINGW)"=="cygwin"
147icu_LDFLAGS+=-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api
148.ENDIF
149icu_LDFLAGS+=-L$(COMPATH)$/lib
150icu_LIBS=
151.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
152icu_LIBS+=$(MINGW_SHARED_LIBSTDCPP)
153.ENDIF
154icu_LDFLAGS+=-Wl,--enable-runtime-pseudo-reloc-v2
155CONFIGURE_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'
156
157#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
158CONFIGURE_FLAGS=
159
160# Use of
161# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
162# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
163# doesn't work as it would result in
164# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
165# note the position of the single quotes.
166
167BUILD_DIR=$(CONFIGURE_DIR)
168BUILD_ACTION=$(GNUMAKE)
169OUT2LIB=
170
171OUT2BIN= \
172    $(BUILD_DIR)$/lib$/icudt$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
173    $(BUILD_DIR)$/lib$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
174    $(BUILD_DIR)$/lib$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
175    $(BUILD_DIR)$/lib$/icule$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
176    $(BUILD_DIR)$/lib$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
177    $(BUILD_DIR)$/bin$/genccode.exe \
178    $(BUILD_DIR)$/bin$/genbrk.exe \
179    $(BUILD_DIR)$/bin$/gencmn.exe
180
181.ELSE
182BUILD_DIR=source
183.IF "full_debug" == ""
184
185# Activating the debug mechanism produces incompatible libraries, you'd have
186# at least to relink all modules that are directly using ICU. Note that library
187# names get a 'd' appended and you'd have to edit the solenv/inc/libs.mk
188# ICU*LIB macros as well. Normally you don't want all this.
189#
190# Instead, use the normal already existing Release build and edit the
191# corresponding *.vcproj file of the section you're interested in. Make sure
192# that
193# - for the VCCLCompilerTool section the following line exists:
194#   DebugInformationFormat="3"
195# - and for the VCLinkerTool the line
196#   GenerateDebugInformation="TRUE"
197# Then delete the corresponding Release output directory, and delete the target
198# flag files
199# $(OUTPATH)/misc/build/so_built_so_icu
200# $(OUTPATH)/misc/build/so_predeliver_so_icu
201# and run dmake again, after which you may copy the resulting libraries to your
202# OOo/SO installation.
203ICU_BUILD_VERSION=Debug
204ICU_BUILD_LIBPOST=d
205.ELSE
206ICU_BUILD_VERSION=Release
207ICU_BUILD_LIBPOST=
208.ENDIF
209
210.IF "$(CPUNAME)"=="INTEL"
211CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmak.cfg .
212.ELIF "$(CPUNAME)"=="X86_64"
213CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmakWin64.cfg .
214.ENDIF
215
216.IF "$(CCNUMVER)"<="001400000000"
217BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHsc" && cd ..$/..
218.ELSE
219BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHa -Zc:wchar_t-" && cd ..$/..
220.ENDIF
221
222OUT2LIB= \
223    $(BUILD_DIR)$/..$/lib$/icudata.lib \
224    $(BUILD_DIR)$/..$/lib$/icuin$(ICU_BUILD_LIBPOST).lib \
225    $(BUILD_DIR)$/..$/lib$/icuuc$(ICU_BUILD_LIBPOST).lib \
226    $(BUILD_DIR)$/..$/lib$/icule$(ICU_BUILD_LIBPOST).lib \
227    $(BUILD_DIR)$/..$/lib$/icutu$(ICU_BUILD_LIBPOST).lib
228
229OUT2BIN= \
230    $(BUILD_DIR)$/..$/bin$/icudt$(ICU_MAJOR)$(ICU_MINOR).dll \
231    $(BUILD_DIR)$/..$/bin$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
232    $(BUILD_DIR)$/..$/bin$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
233    $(BUILD_DIR)$/..$/bin$/icule$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
234    $(BUILD_DIR)$/..$/bin$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
235    $(BUILD_DIR)$/..$/bin$/genccode.exe \
236    $(BUILD_DIR)$/..$/bin$/genbrk.exe \
237    $(BUILD_DIR)$/..$/bin$/gencmn.exe
238
239.ENDIF
240.ENDIF      # "$(GUI)"=="WNT"
241
242# --- Targets ------------------------------------------------------
243
244.INCLUDE : set_ext.mk
245.INCLUDE :  target.mk
246.INCLUDE :  tg_ext.mk
247
248.IF "$(BINARY_PATCH_FILES)"!=""
249
250$(PACKAGE_DIR)$/so_add_binary :  $(PACKAGE_DIR)$/$(ADD_FILES_FLAG_FILE)
251    cd $(PACKAGE_DIR) && gunzip -c $(BACK_PATH)$(BINARY_PATCH_FILES) | tar -xvf -
252    $(TOUCH) $(PACKAGE_DIR)$/so_add_binary
253
254$(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE) : $(PACKAGE_DIR)$/so_add_binary
255
256.ENDIF
257
258.IF "$(GUI)$(COM)"=="WNTGCC"
259ALLTAR : \
260    $(LB)$/icudata.lib \
261    $(LB)$/icuin$(ICU_BUILD_LIBPOST).lib \
262    $(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib \
263    $(LB)$/icule$(ICU_BUILD_LIBPOST).lib \
264    $(LB)$/icutu$(ICU_BUILD_LIBPOST).lib
265
266$(LB)$/icudata.lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
267    $(TOUCH) $@
268
269$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
270    $(TOUCH) $@
271
272$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
273    $(TOUCH) $@
274
275$(LB)$/icule$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
276    $(TOUCH) $@
277
278$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
279    $(TOUCH) $@
280.ENDIF
281
282# Since you never know what will be in a patch (for example, it may already
283# patch at configure level) or in the case of a binary patch, we remove the
284# entire package directory if a patch is newer.
285# Changes in this makefile could also make a complete build necessary if
286# configure is affected.
287$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : makefile.mk
288