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