• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Makefile.in for ICU data
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## Copyright (c) 1999-2015, International Business Machines Corporation and
5## others. All Rights Reserved.
6
7## Source directory information
8srcdir = @srcdir@
9top_srcdir = @top_srcdir@
10
11# So that you have $(top_builddir)/config.status
12top_builddir = ..
13
14## All the flags and other definitions are included here.
15include $(top_builddir)/icudefs.mk
16
17## Build directory information
18# So that  $(top_builddir)/$(subdir) ~= "here"
19subdir = data
20
21#lib icu data for link
22LIB_ICUDATA_NAME=$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX)
23LIB_STATIC_ICUDATA_NAME=$(LIBSICU)$(DATA_STUBNAME)$(ICULIBSUFFIX)
24
25# Allow Windows to override these options
26ifeq ($(PKGDATA_OPTS),)
27PKGDATA_OPTS = -O $(top_builddir)/data/icupkg.inc
28endif
29ifeq ($(PKGDATA_VERSIONING),)
30PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION)
31endif
32
33# This allows all the data to be in one directory
34ifeq ($(PKGDATA_MODE),dll)
35ICUPKGDATA_OUTDIR = $(LIBDIR)
36else
37ifeq ($(PKGDATA_MODE),static)
38ICUPKGDATA_OUTDIR = $(LIBDIR)
39else
40ICUPKGDATA_OUTDIR = $(OUTDIR)
41endif
42endif
43
44CURDIR:=$(CURR_FULL_DIR)
45# current directory should not be blank
46ifeq ($(CURDIR),)
47CURDIR=.
48endif
49ifeq ($(OS390BATCH),1)
50PKGDATA = $(TOOLBINDIR)/pkgdata $(PKGDATA_OPTS) -z -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR)
51else
52PKGDATA = $(TOOLBINDIR)/pkgdata $(PKGDATA_OPTS) -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR)
53endif
54OS390_PDS_NAME = -z -L $(BATCH_STUB_TARGET)
55
56ifeq ($(OS390_STUBDATA),1)
57OS390PKG=package390
58OS390INSTALL=install390
59
60# Additional data for 390
61OS390LIST=$(OUTTMPDIR)/icudata390.lst
62OUTTMPDIR_390STUB=$(top_builddir)/data/out/tmp_390stub
63endif
64
65ifeq ($(OS390BATCH),1)
66CPPFLAGS += -Wc,'ros,roc'
67endif
68
69# OBJDATADIR must be a short path (with ..'s) to the data.
70
71ifeq ($(top_srcdir),..)
72SRCDATADIR=.
73else
74SRCDATADIR=$(top_srcdir)/data
75endif
76ifeq ($(top_builddir),..)
77OUTDIR=./out
78else
79OUTDIR=$(top_builddir)/data/out
80endif
81
82OUTTMPDIR=$(OUTDIR)/tmp
83MAINBUILDDIR=$(OUTDIR)/build
84BUILDDIR=$(MAINBUILDDIR)/$(ICUDATA_PLATFORM_NAME)
85MISCSRCDIR=$(SRCDATADIR)/misc
86SRCLISTDEPS=Makefile $(srcdir)/Makefile.in
87
88# Variable names for rules.mk
89OUT_DIR=$(BUILDDIR)
90TMP_DIR=$(OUTTMPDIR)
91
92# relative lib links from pkgdata are the same as for tmp
93TOOLDIR=$(top_builddir)/tools
94
95## List of phony targets
96.PHONY : all all-local all-recursive install install-local install-files	\
97install-recursive clean clean-local clean-recursive distclean		\
98distclean-local distclean-recursive dist dist-local dist-recursive	\
99check check-local check-recursive clean-resindex icudata.jar	\
100check-exhaustive
101
102## Clear suffix list
103.SUFFIXES :
104
105## List of standard targets
106all: all-local
107install: all-local install-local
108clean: clean-local
109distclean : distclean-local
110dist:
111check: all check-local
112
113check-exhaustive: check
114
115-include Makefile.local
116
117
118distclean-local: clean
119	$(RMV) Makefile
120
121all-local: icupkg.inc build-local packagedata $(POST_DATA_BUILD) $(OS390PKG)
122
123dist-local:
124
125clean-map:
126	-test -z *.map || $(RMV) *.map
127
128clean-local: cleanpackage cleanfiles clean-map
129	$(RMV) $(OUTDIR) build-local packagedata uni-core-data
130
131cleanfiles:
132	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
133
134cleanpackage:
135	$(RMV) $(OUTDIR)
136	$(RMV) $(LIBDIR)/*$(LIB_ICUDATA_NAME)*.$(SO)* $(LIBDIR)/$(LIB_STATIC_ICUDATA_NAME).$(A)
137
138check-local:
139	PYTHONPATH=$(top_srcdir)/python @PYTHON@ -m icutools.databuilder.test
140
141# Find out if we have a source archive.
142# If we have that, then use that instead of building everything from scratch.
143ICUDATA_SOURCE_ARCHIVE = $(wildcard $(srcdir)/in/$(ICUDATA_PLATFORM_NAME).dat)
144ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
145ICUDATA_ARCHIVE = $(firstword $(wildcard $(srcdir)/in/$(ICUDATA_BASENAME_VERSION)*.dat))
146# We don't have the data in the current endianess or charset.
147# See if we can find data of any archive type,
148# and convert it to the current type.
149ifneq ($(ICUDATA_ARCHIVE),)
150ICUDATA_SOURCE_ARCHIVE = $(OUTDIR)/$(ICUDATA_PLATFORM_NAME).dat
151$(ICUDATA_SOURCE_ARCHIVE): $(ICUDATA_ARCHIVE)
152	$(MKINSTALLDIRS) $(OUTDIR)
153	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(ICUDATA_ARCHIVE) $(ICUDATA_SOURCE_ARCHIVE)
154
155$(OUTDIR):
156	mkdir -p $(OUTDIR)
157
158endif
159else
160ifneq ($(ENABLE_STATIC),YES)
161ifeq ($(PKGDATA_MODE),common)
162# We have a source data common archive in the native endianess,
163# and it's what we want to build. Try to not run any of ICU's tools.
164ICUDATA_SOURCE_IS_NATIVE_TARGET=YES
165endif
166endif
167endif
168
169packagedata: icupkg.inc $(PKGDATA_LIST) build-local
170ifneq ($(ENABLE_STATIC),)
171ifeq ($(PKGDATA_MODE),dll)
172	$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) -m static $(PKGDATA_VERSIONING) $(PKGDATA_LIST)
173endif
174endif
175ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
176	$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(PKGDATA_LIBNAME) $(PKGDATA_LIST)
177else
178	$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(OUTDIR)
179endif
180	echo timestamp > $@
181
182## Install ICU data.
183install-local: $(PKGDATA_LIST) ./icupkg.inc packagedata $(OS390INSTALL)
184	$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUPKGDATA_DIR)
185ifeq ($(PKGDATA_MODE),files)
186	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)
187	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(CURR_TREE)
188	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(LANG_TREE)
189	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(REGION_TREE)
190	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(ZONE_TREE)
191	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(UNIT_TREE)
192	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(BREAK_TREE)
193	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(COLLATION_TREE)
194	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(RBNF_TREE)
195	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(TRANSLIT_TREE)
196endif
197ifneq ($(ENABLE_STATIC),)
198ifeq ($(PKGDATA_MODE),dll)
199# For MinGW, do we want the DLL to go in the bin location?
200ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
201	$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir)
202else
203	$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_LIBDIR)
204endif
205endif
206endif
207ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
208# For MinGW, do we want the DLL to go in the bin location?
209ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
210	$(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir)
211else
212	$(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR)
213endif
214else
215	$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(DESTDIR)$(ICUPKGDATA_DIR)
216endif
217
218
219####
220####
221#### 390 support
222install390: package390
223	$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(libdir)
224	$(INVOKE) $(PKGDATA) -s $(BUILDDIR)$(STUB_SUFFIX) -T $(OUTTMPDIR_390STUB) -p $(ICUDATA_NAME)$(STUB_SUFFIX) $(PKGDATA_LIBNAME)$(STUB_SUFFIX) -e $(ICUDATA_ENTRY_POINT) $(OS390LIST) -m dll $(PKGDATA_VERSIONING) -I $(DESTDIR)$(ICUPKGDATA_DIR)
225ifeq ($(PKGDATA_MODE),dll)
226	$(INSTALL-L) $(ICUPKGDATA_OUTDIR)/$(FINAL_IMPORT_LIB) $(DESTDIR)$(ICUPKGDATA_DIR)/$(FINAL_IMPORT_LIB)
227endif
228
229#### $(LIB_ICUDATA_NAME)$(STUB_SUFFIX) is the subset data for batch mode
230package390: $(OUTTMPDIR)/icudata390.lst $(PKGDATA_LIST) ./icupkg.inc packagedata
231	ln -s $(ICUDATA_NAME) $(OUTDIR)/build/$(ICUDATA_NAME)$(STUB_SUFFIX)
232	$(INVOKE) $(PKGDATA) -s $(BUILDDIR)$(STUB_SUFFIX) -T $(OUTTMPDIR_390STUB) -p $(ICUDATA_NAME)$(STUB_SUFFIX) $(PKGDATA_LIBNAME)$(STUB_SUFFIX) -e $(ICUDATA_ENTRY_POINT) $(OS390LIST) -m dll $(PKGDATA_VERSIONING)
233	cp $(ICUPKGDATA_OUTDIR)/$(LIB_ICUDATA_NAME)$(STUB_SUFFIX).$(SO) $(top_builddir)/stubdata/$(LIB_ICUDATA_NAME)$(STUB_SUFFIX).$(SO)
234
235
236## Include the main build rules for data files
237include $(top_builddir)/$(subdir)/rules.mk
238
239
240ifeq ($(ENABLE_SO_VERSION_DATA),1)
241ifeq ($(PKGDATA_MODE),dll)
242SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res
243$(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc | $(TMP_DIR)/dirs.timestamp
244ifeq ($(MSYS_RC_MODE),1)
245	rc.exe -i$(srcdir)/../common -i$(top_builddir)/common -fo$@ $(CPPFLAGS) $<
246else
247	rc.exe /i$(srcdir)/../common /i$(top_builddir)/common /fo$@ $(CPPFLAGS) $(SOURCE_FILE)
248endif
249endif
250endif
251
252PKGDATA_LIST = $(TMP_DIR)/icudata.lst
253
254
255#####################################################
256# General data build rules
257
258## Files to remove for 'make clean'
259CLEANFILES = *~ icupkg.inc *.x
260
261ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
262build-local: $(SO_VERSION_DATA) $(ICUDATA_ALL_OUTPUT_FILES) $(PKGDATA_LIST) $(OS390LIST)
263	echo timestamp > $@
264else
265build-local: $(SO_VERSION_DATA) $(PKGDATA_LIST) $(OS390LIST)
266	echo timestamp > $@
267$(PKGDATA_LIST): $(SRCLISTDEPS) $(ICUDATA_SOURCE_ARCHIVE)
268ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
269	$(MKINSTALLDIRS) $(OUTTMPDIR) $(BUILDDIR)
270	@echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of data files)"
271	@-$(RMV) $@
272	$(INVOKE) $(TOOLBINDIR)/icupkg -d $(BUILDDIR) --list -x \* $(ICUDATA_SOURCE_ARCHIVE) -o $@
273else
274	@echo "$@" > $@
275endif
276endif
277
278
279# if the tzcode directory contains a new tzdata*.tar.gz file, use it for zoneinfo
280ifeq ($(TZDATA),)
281TZDATA = $(firstword $(wildcard $(top_builddir)/tools/tzcode/tzdata*.tar.gz) $(wildcard $(top_srcdir)/tools/tzcode/tzdata*.tar.gz))
282endif
283
284# TODO(ICU-20466): Make the TZDATA override part of Python icutools.databuilder
285ifneq ($(TZDATA),)
286
287TZCODE_DIR=$(top_builddir)/tools/tzcode
288ZONEINFO=$(TZCODE_DIR)/zoneinfo64.txt
289
290# Override the normal genrb for zoneinfo to always pull from
291# icu/source/tools/tzcode/zoneinfo64.txt
292$(BUILDDIR)/zoneinfo64.res: $(ZONEINFO) $(TOOLBINDIR)/genrb$(TOOLEXEEXT) | $(BUILDDIR)/cnvalias.icu
293	@echo Note: $(MISCSRCDIR)/zoneinfo.txt is IGNORED because $(TZDATA) is present.
294	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -i $(BUILDDIR) -d $(BUILDDIR) $(ZONEINFO)
295
296# Create the tzcode tool and zoneinfo as needed.
297$(ZONEINFO): $(TZDATA)
298	@echo "$(MAKE)[$(MAKELEVEL)]: Making \`$(ZONEINFO)' in \`$(TZCODE_DIR)'"; \
299	(cd $(TZCODE_DIR) && $(MAKE)) || exit; \
300
301# end of zoneinfo-generation
302endif
303
304# Build the ICU4J icudata.jar.
305# Command line:
306#   (Run this from the output data folder which may not be .../source/data in an out-of-source build.)
307#   ~/svn.icu/trunk/source/data> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk icudata.jar
308# You can omit the ICU4J_ROOT for just building the .jar files without copying them.
309# You can omit the JAR if it's just jar.
310JAR=jar
311
312# For building the testdata.jar see ../test/testdata/Makefile.
313
314ICU4J_TZDATA=$(OUTDIR)/icu4j/icutzdata.jar
315ICU4J_TZDATA_FILES=zoneinfo64 metaZones timezoneTypes windowsZones
316ICU4J_DATA_DIRNAME=com/ibm/icu/impl/data/$(ICUDATA_BASENAME_VERSION)b
317ICU4J_TZDATA_PATHS=$(ICU4J_TZDATA_FILES:%="$(ICU4J_DATA_DIRNAME)/%.res")
318
319# generate icu4j-related data to $(OUTDIR)/icu4j/com/ibm/icu/impl/data/...
320generate-data: packagedata $(OUTTMPDIR)/$(ICUDATA_PLATFORM_NAME).dat
321	mkdir -p $(OUTDIR)/icu4j/$(ICU4J_DATA_DIRNAME)
322	mkdir -p $(OUTDIR)/icu4j/tzdata/$(ICU4J_DATA_DIRNAME)
323	$(INVOKE) $(TOOLBINDIR)/icupkg $(OUTTMPDIR)/$(ICUDATA_PLATFORM_NAME).dat $(OUTDIR)/icu4j/$(ICUDATA_BASENAME_VERSION)b.dat -s $(BUILDDIR) -x '*' -tb -d $(OUTDIR)/icu4j/$(ICU4J_DATA_DIRNAME)
324	mv $(ICU4J_TZDATA_PATHS:%=$(OUTDIR)/icu4j/%) "$(OUTDIR)/icu4j/tzdata/$(ICU4J_DATA_DIRNAME)"
325
326$(OUTDIR)/icu4j/icutzdata.jar: generate-data
327	$(JAR) cf $(OUTDIR)/icu4j/icutzdata.jar -C $(OUTDIR)/icu4j/tzdata $(ICU4J_DATA_DIRNAME)/
328
329# Build icudata.jar:
330# - add the uni-core-data to the ICU package
331# - swap the ICU data
332# - extract all data items
333# - package them into the .jar file
334# TODO(ICU-20466): Move this to Python
335# NOTE: If you get the error "No rule to make target 'out/build/icudt64l/uprops.icu'",
336# you need to reconfigure with unicore data.  See icu4j-readme.txt
337$(OUTDIR)/icu4j/icudata.jar: generate-data | $(OUT_DIR)/uprops.icu
338	$(JAR) cf $(OUTDIR)/icu4j/icudata.jar -C $(OUTDIR)/icu4j $(ICU4J_DATA_DIRNAME)/
339
340ICU4J_DATA=$(OUTDIR)/icu4j/icudata.jar
341
342ifdef ICU4J_ROOT
343
344ICU4J_DATA_INSTALLED=$(ICU4J_ROOT)/main/shared/data/icudata.jar $(ICU4J_ROOT)/main/shared/data/icutzdata.jar
345
346$(ICU4J_ROOT)/main/shared/data/icudata.jar: $(OUTDIR)/icu4j/icudata.jar
347	mkdir -p $(ICU4J_ROOT)/main/shared/data
348	cp $(OUTDIR)/icu4j/icudata.jar $(ICU4J_ROOT)/main/shared/data
349
350$(ICU4J_ROOT)/main/shared/data/icutzdata.jar: $(OUTDIR)/icu4j/icutzdata.jar
351	mkdir -p $(ICU4J_ROOT)/main/shared/data
352	cp $(OUTDIR)/icu4j/icutzdata.jar $(ICU4J_ROOT)/main/shared/data
353
354icu4j-data-install: $(ICU4J_DATA_INSTALLED)
355
356else
357
358icu4j-data-install: icu4j-data
359	@echo data is built into $(OUTDIR)/icu4j
360	@echo '** Error:' ICU4J_ROOT was not set, could not install
361	exit 1
362
363endif
364
365icu4j-data: $(ICU4J_DATA) $(ICU4J_TZDATA)
366
367
368###################################################################
369Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
370	cd $(top_builddir) \
371	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
372
373icupkg.inc: pkgdataMakefile
374	$(MAKE) -f pkgdataMakefile
375
376pkgdataMakefile:
377	cd $(top_builddir) \
378	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
379
380###########
381########### 390 (z/OS) support
382UCMFILES390=ebcdic-xml-us.ucm ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm ibm-4909_P100-1999.ucm
383# used to depend on pnames.icu uprops.icu ucase.icu ubidi.icu
384# These are now hardcoded in ICU4C and only loaded in ICU4J.
385ALLFILES390=cnvalias.icu $(UCMFILES390:.ucm=.cnv)
386
387$(OUTTMPDIR)/icudata390.lst: $(SRCLISTDEPS)
388	@echo "generating $@ (list of 390 data files)"
389	@-$(RMV) $@
390	@for file in $(ALLFILES390); do \
391	  echo $$file >> $@; \
392	done;
393
394ifeq ($(POST_DATA_BUILD), os400-data-rebind)
395os400-data-rebind: $(LIBICUUC)
396
397$(LIBICUUC): $(LIBICUDT)
398	$(RMV) $(LIBICUUC)
399	(cd ../common && $(MAKE) RECURSIVE=YES) || exit;
400endif
401
402