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