xref: /trunk/main/icu/makefile.mk (revision 38f6c7561ee12f31d69df98de3d1c4c476629f71)
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.ELSE
221BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHa -Zc:wchar_t-" && cd ..$/..
222.ENDIF
223
224OUT2LIB= \
225    $(BUILD_DIR)$/..$/lib$/icudata.lib \
226    $(BUILD_DIR)$/..$/lib$/icuin$(ICU_BUILD_LIBPOST).lib \
227    $(BUILD_DIR)$/..$/lib$/icuuc$(ICU_BUILD_LIBPOST).lib \
228    $(BUILD_DIR)$/..$/lib$/icule$(ICU_BUILD_LIBPOST).lib \
229    $(BUILD_DIR)$/..$/lib$/icutu$(ICU_BUILD_LIBPOST).lib
230
231OUT2BIN= \
232    $(BUILD_DIR)$/..$/bin$/icudt$(ICU_MAJOR)$(ICU_MINOR).dll \
233    $(BUILD_DIR)$/..$/bin$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
234    $(BUILD_DIR)$/..$/bin$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
235    $(BUILD_DIR)$/..$/bin$/icule$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
236    $(BUILD_DIR)$/..$/bin$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
237    $(BUILD_DIR)$/..$/bin$/genccode.exe \
238    $(BUILD_DIR)$/..$/bin$/genbrk.exe \
239    $(BUILD_DIR)$/..$/bin$/gencmn.exe
240
241.ENDIF
242.ENDIF      # "$(GUI)"=="WNT"
243
244# --- Targets ------------------------------------------------------
245
246.INCLUDE : set_ext.mk
247.INCLUDE :  target.mk
248.INCLUDE :  tg_ext.mk
249
250.IF "$(BINARY_PATCH_FILES)"!=""
251
252$(PACKAGE_DIR)$/so_add_binary :  $(PACKAGE_DIR)$/$(ADD_FILES_FLAG_FILE)
253    cd $(PACKAGE_DIR) && gunzip -c $(BACK_PATH)$(BINARY_PATCH_FILES) | tar -xvf -
254    $(TOUCH) $(PACKAGE_DIR)$/so_add_binary
255
256$(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE) : $(PACKAGE_DIR)$/so_add_binary
257
258.ENDIF
259
260.IF "$(GUI)$(COM)"=="WNTGCC"
261ALLTAR : \
262    $(LB)$/icudata.lib \
263    $(LB)$/icuin$(ICU_BUILD_LIBPOST).lib \
264    $(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib \
265    $(LB)$/icule$(ICU_BUILD_LIBPOST).lib \
266    $(LB)$/icutu$(ICU_BUILD_LIBPOST).lib
267
268$(LB)$/icudata.lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
269    $(TOUCH) $@
270
271$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
272    $(TOUCH) $@
273
274$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
275    $(TOUCH) $@
276
277$(LB)$/icule$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
278    $(TOUCH) $@
279
280$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
281    $(TOUCH) $@
282.ENDIF
283
284# Since you never know what will be in a patch (for example, it may already
285# patch at configure level) or in the case of a binary patch, we remove the
286# entire package directory if a patch is newer.
287# Changes in this makefile could also make a complete build necessary if
288# configure is affected.
289$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : makefile.mk
290