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