]> git.saurik.com Git - apple/icu.git/blame - icuSources/data/makedata.mak
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / data / makedata.mak
CommitLineData
b75a7d8f
A
1#**********************************************************************
2#* Copyright (C) 1999-2003, International Business Machines Corporation
3#* and others. All Rights Reserved.
4#**********************************************************************
5# nmake file for creating data files on win32
6# invoke with
7# nmake /f makedata.mak [Debug|Release]
8#
9# 12/10/1999 weiv Created
10
11##############################################################################
12# Keep the following in sync with the version - see common/unicode/uversion.h
13U_ICUDATA_NAME=icudt26
14##############################################################################
15U_ICUDATA_ENDIAN_SUFFIX=l
16UNICODE_VERSION=4
17
18# ICUMAKE
19# Must be provided by whoever runs this makefile.
20# Is the directory containing this file (makedata.mak)
21# Is the directory into which most data is built (prior to packaging)
22# Is icu\source\data\build
23#
24!IF "$(ICUMAKE)"==""
25!ERROR Can't find ICUMAKE (ICU Data Make dir, should point to icu\source\data\ )!
26!ENDIF
27!MESSAGE ICU data make path is $(ICUMAKE)
28
29ICUOUT=$(ICUMAKE)\out
30
31# need to nuke \\ for .NET...
32ICUOUT=$(ICUOUT:\\=\)
33
34ICUBLD=$(ICUOUT)\build
35
36# ICUDT
37# the prefix "icudt21_" for use in filenames
38ICUPKG=$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX)
39ICUDT=$(ICUPKG)_
40
41# ICUP
42# The root of the ICU source directory tree
43#
44ICUP=$(ICUMAKE)\..\..
45ICUP=$(ICUP:\source\data\..\..=)
46# In case the first one didn't do it, try this one. .NET would do the second one.
47ICUP=$(ICUP:\source\data\\..\..=)
48!MESSAGE ICU root path is $(ICUP)
49
50
51# ICUSRCDATA
52# The data directory in source
53#
54ICUSRCDATA=$(ICUP)\source\data
55ICUSRCDATA_RELATIVE_PATH=..\..\
56
57# ICUUCM
58# The directory that contains ucmcore.mk files along with *.ucm files
59#
60ICUUCM=mappings
61
62# ICULOC
63# The directory that contains resfiles.mk files along with *.txt locale data files
64#
65ICULOC=locales
66
67# ICUTRANSLIT
68# The directory that contains trfiles.mk files along with *.txt transliterator files
69#
70ICUTRNS=translit
71
72# ICUBRK
73# The directory that contains resfiles.mk files along with *.txt break iterator files
74#
75ICUBRK=$(ICUP)\source\data\brkitr
76
77# ICUUNIDATA
78# The directory that contains Unicode data files
79#
80ICUUNIDATA=$(ICUP)\source\data\unidata
81
82
83# ICUMISC
84# The directory that contains files that are miscelleneous data
85#
86ICUMISC=$(ICUP)\source\data\misc
87
88#
89# ICUDATA
90# The source directory. Contains the source files for the common data to be built.
91# WARNING: NOT THE SAME AS ICU_DATA environment variable. Confusing.
92ICUDATA=$(ICUP)\source\data
93
94#
95# DLL_OUTPUT
96# Destination directory for the common data DLL file.
97# This is the same place that all of the other ICU DLLs go (the code-containing DLLs)
98# The lib file for the data DLL goes in $(DLL_OUTPUT)/../lib/
99#
100DLL_OUTPUT=$(ICUP)\bin
101
102#
103# TESTDATA
104# The source directory for data needed for test programs.
105TESTDATA=$(ICUP)\source\test\testdata
106
107#
108# TESTDATAOUT
109# The destination directory for the built test data .dat file
110# When running the tests, ICU_DATA environment variable is set to here
111# so that test data files can be loaded. (Tests are NOT run from this makefile,
112# only the data is put in place.)
113TESTDATAOUT=$(ICUP)\source\test\testdata\out\
114
115#
116# TESTDATABLD
117# The build directory for test data intermidiate files
118# (Tests are NOT run from this makefile,
119# only the data is put in place.)
120TESTDATABLD=$(ICUP)\source\test\testdata\out\build
121
122#
123# ICUTOOLS
124# Directory under which all of the ICU data building tools live.
125#
126ICUTOOLS=$(ICUP)\source\tools
127
128
129PATH = $(PATH);$(ICUP)\bin
130
131
132# We have to prepare params for pkgdata - to help it find the tools
133!IF "$(CFG)" == "Debug" || "$(CFG)" == "debug"
134!MESSAGE makedata.mak: doing a Debug build.
135PKGOPT=D:$(ICUP)
136!ELSE
137!MESSAGE makedata.mak: doing a Release build.
138PKGOPT=R:$(ICUP)
139!ENDIF
140
141
142# Suffixes for data files
143.SUFFIXES : .ucm .cnv .dll .dat .res .txt .c
144
145# We're including a list of .ucm files.
146# There are several lists, they are all optional.
147
148# Always build the mapping files for the EBCDIC fallback codepages
149# They are necessary on EBCDIC machines, and
150# the following logic is much easier if UCM_SOURCE is never empty.
151# (They are small.)
152UCM_SOURCE=ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm
153
154!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmcore.mk")
155!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmcore.mk"
156UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_CORE)
157!ELSE
158!MESSAGE Warning: cannot find "ucmcore.mk". Not building core MIME/Unix/Windows converter files.
159!ENDIF
160
161!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmfiles.mk")
162!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmfiles.mk"
163UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_FILES)
164!ELSE
165!MESSAGE Warning: cannot find "ucmfiles.mk". Not building many converter files.
166!ENDIF
167
168!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmebcdic.mk")
169!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmebcdic.mk"
170UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_EBCDIC)
171!ELSE
172!MESSAGE Warning: cannot find "ucmebcdic.mk". Not building EBCDIC converter files.
173!ENDIF
174
175!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmlocal.mk")
176!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmlocal.mk"
177UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_LOCAL)
178!ELSE
179!MESSAGE Information: cannot find "ucmlocal.mk". Not building user-additional converter files.
180!ENDIF
181
182CNV_FILES=$(UCM_SOURCE:.ucm=.cnv)
183
184# Read list of locale resource bundle files
185!IF EXISTS("$(ICUSRCDATA)\$(ICULOC)\resfiles.mk")
186!INCLUDE "$(ICUSRCDATA)\$(ICULOC)\resfiles.mk"
187!IF EXISTS("$(ICUSRCDATA)\$(ICULOC)\reslocal.mk")
188!INCLUDE "$(ICUSRCDATA)\$(ICULOC)\reslocal.mk"
189GENRB_SOURCE=$(GENRB_SOURCE) $(GENRB_SOURCE_LOCAL)
190!ELSE
191!MESSAGE Information: cannot find "reslocal.mk". Not building user-additional resource bundle files.
192!ENDIF
193!ELSE
194!MESSAGE Warning: cannot find "resfiles.mk"
195!ENDIF
196
197RB_FILES = root.res $(GENRB_ALIAS_SOURCE:.txt=.res) $(GENRB_SOURCE:.txt=.res)
198
199# Read list of transliterator resource bundle files
200!IF EXISTS("$(ICUSRCDATA)\$(ICUTRNS)\trnsfiles.mk")
201!INCLUDE "$(ICUSRCDATA)\$(ICUTRNS)\trnsfiles.mk"
202!IF EXISTS("$(ICUSRCDATA)\$(ICUTRNS)\trnslocal.mk")
203!INCLUDE "$(ICUSRCDATA)\$(ICUTRNS)\trnslocal.mk"
204TRANLIT_SOURCE=$(TRANSLIT_SOURCE) $(TRANSLIT_SOURCE_LOCAL)
205!ELSE
206!MESSAGE Information: cannot find "trnslocal.mk". Not building user-additional transliterator files.
207!ENDIF
208!ELSE
209!MESSAGE Warning: cannot find "trnsfiles.mk"
210!ENDIF
211
212TRANSLIT_FILES = $(TRANSLIT_SOURCE:.txt=.res)
213
214INDEX_RES_FILES = res_index.res
215
216ALL_RES = $(INDEX_RES_FILES) $(RB_FILES) $(TRANSLIT_FILES)
217
218#############################################################################
219#
220# ALL
221# This target builds all the data files. The world starts here.
222# Note: we really want the common data dll to go to $(DLL_OUTPUT), not $(ICUBLD). But specifying
223# that here seems to cause confusion with the building of the stub library of the same name.
224# Building the common dll in $(ICUBLD) unconditionally copies it to $(DLL_OUTPUT) too.
225#
226#############################################################################
227ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat"
228 @echo All targets are up to date
229
230#
231# testdata - nmake will invoke pkgdata, which will create testdata.dat
232#
233"$(TESTDATAOUT)\testdata.dat": $(ICUDT)ucadata.icu $(TRANSLIT_FILES) $(RB_FILES) {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe
234 @cd "$(TESTDATA)"
235 @echo building testdata...
236 nmake /nologo /f "$(TESTDATA)\testdata.mk" TESTDATA=. ICUTOOLS="$(ICUTOOLS)" PKGOPT="$(PKGOPT)" CFG=$(CFG) TESTDATAOUT="$(TESTDATAOUT)" ICUDATA="$(ICUDATA)" TESTDATABLD="$(TESTDATABLD)"
237
238#
239# Break iterator data files.
240#
241BRK_FILES = $(ICUDT)sent.brk $(ICUDT)char.brk $(ICUDT)line.brk $(ICUDT)word.brk $(ICUDT)title.brk $(ICUDT)line_th.brk $(ICUDT)word_th.brk
242
243#invoke pkgdata for ICU common data
244# pkgdata will drop all output files (.dat, .dll, .lib) into the target (ICUBLD) directory.
245# move the .dll and .lib files to their final destination afterwards.
246# The $(U_ICUDATA_NAME).lib and $(U_ICUDATA_NAME).exp should already be in the right place due to stubdata.
247#
248"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : "$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata.exe" $(CNV_FILES) $(BRK_FILES) "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu" "$(ICUBLD)\$(ICUDT)cnvalias.icu" "$(ICUBLD)\$(ICUDT)tz.icu" "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)invuca.icu" "$(ICUBLD)\$(ICUDT)uidna.icu" $(ALL_RES) "$(ICUBLD)\$(ICUDT)icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
249 @echo Building icu data
250 @cd "$(ICUBLD)"
251 @"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -f -e $(U_ICUDATA_NAME) -v -m dll -c -p $(ICUPKG) -O "$(PKGOPT)" -d "$(ICUBLD)" -s . <<pkgdatain.txt
252$(ICUDT)unorm.icu
253$(ICUDT)uprops.icu
254$(ICUDT)pnames.icu
255$(ICUDT)unames.icu
256$(ICUDT)ucadata.icu
257$(ICUDT)invuca.icu
258$(ICUDT)uidna.icu
259$(ICUDT)tz.icu
260$(ICUDT)cnvalias.icu
261$(CNV_FILES:.cnv =.cnv
262)
263$(ALL_RES:.res =.res
264)
265$(BRK_FILES:.brk =.brk
266)
267<<KEEP
268 copy "$(ICUPKG).dll" "$(DLL_OUTPUT)"
269 -@erase "$(ICUPKG).dll"
270 copy "$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
271 -@erase "$(ICUPKG).dat"
272
273
274
275# RBBI .brk file generation.
276# TODO: set up an inference rule, so these don't need to be written out one by one...
277#
278
279BRKDEPS = "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu"
280
281$(ICUDT)char.brk : "$(ICUBRK)\char.txt" $(BRKDEPS)
282 genbrk -r "$(ICUBRK)\char.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
283
284$(ICUDT)word.brk : "$(ICUBRK)\word.txt" $(BRKDEPS)
285 genbrk -r "$(ICUBRK)\word.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
286
287$(ICUDT)line.brk : "$(ICUBRK)\line.txt" $(BRKDEPS)
288 genbrk -r "$(ICUBRK)\line.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
289
290$(ICUDT)sent.brk : "$(ICUBRK)\sent.txt" $(BRKDEPS)
291 genbrk -r "$(ICUBRK)\sent.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
292
293$(ICUDT)title.brk : "$(ICUBRK)\title.txt" $(BRKDEPS)
294 genbrk -r "$(ICUBRK)\title.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
295
296$(ICUDT)word_th.brk : "$(ICUBRK)\word_th.txt" $(BRKDEPS)
297 genbrk -r "$(ICUBRK)\word_th.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
298
299$(ICUDT)line_th.brk : "$(ICUBRK)\line_th.txt" $(BRKDEPS)
300 genbrk -r "$(ICUBRK)\line_th.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
301
302
303# utility target to send us to the right dir
304GODATA :
305 @if not exist "$(ICUOUT)\$(NULL)" mkdir "$(ICUOUT)"
306 @if not exist "$(ICUBLD)\$(NULL)" mkdir "$(ICUBLD)"
307 @if not exist "$(TESTDATAOUT)\$(NULL)" mkdir "$(TESTDATAOUT)"
308 @if not exist "$(TESTDATABLD)\$(NULL)" mkdir "$(TESTDATABLD)"
309 @cd "$(ICUBLD)"
310
311# This is to remove all the data files
312CLEAN : GODATA
313 @echo Cleaning up the data files.
314 @cd "$(ICUBLD)"
315 -@erase "*.brk"
316 -@erase "*.cnv"
317 -@erase "*.dat"
318 -@erase "*.exp"
319 -@erase "*.obj"
320 -@erase "*.icu"
321 -@erase "*.lib"
322 -@erase "*.mak"
323 -@erase "*.res"
324 -@erase "*.txt"
325 @cd "$(ICUOUT)"
326 -@erase "*.dat"
327 @cd "$(TESTDATABLD)"
328 -@erase "*.res"
329 -@erase "*.dat"
330 -@erase "*.mak"
331 @cd "$(TESTDATAOUT)"
332 -@erase "*.dat"
333 -@erase "*.cnv"
334 @cd "$(ICUBLD)"
335
336
337# Batch inference rule for creating converters
338{$(ICUSRCDATA_RELATIVE_PATH)\$(ICUUCM)}.ucm.cnv::
339 @echo Generating converters
340 @"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
341
342# Batch infrence rule for creating transliterator resource files
343{$(ICUSRCDATA_RELATIVE_PATH)\$(ICUTRNS)}.txt.res::
344 @echo Making Transliterator Resource Bundle files
345 @"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
346
347$(INDEX_RES_FILES):
348 @echo Generating <<res_index.txt
349// Warning this file is automatically generated
350res_index {
351 InstalledLocales {
352 $(GENRB_SOURCE:.txt= {""}
353 )
354 }
355}
356<<KEEP
357 @"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" .\res_index.txt
358
359# Inference rule for creating resource bundle files
360{$(ICUSRCDATA_RELATIVE_PATH)\$(ICULOC)}.txt.res::
361 @echo Making Locale Resource Bundle files
362 @"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
363
364# DLL version information
365"$(ICUBLD)\$(ICUDT)icudata.res": "$(ICUMISC)\icudata.rc"
366 @echo Creating data DLL version information from $**
367 @rc.exe /i "..\..\..\..\include" /r /fo $@ $**
368
369# Targets for unames.icu
370"$(ICUBLD)\$(ICUDT)unames.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennames\$(CFG)\gennames.exe"
371 @echo Creating data file for Unicode Names
372 @set ICU_DATA=$(ICUBLD)
373 @"$(ICUTOOLS)\gennames\$(CFG)\gennames" -1 -u $(UNICODE_VERSION) "$(ICUUNIDATA)\UnicodeData.txt"
374
375# Targets for pnames.icu
376# >> Depends on the Unicode data as well as uchar.h and uscript.h <<
377"$(ICUBLD)\$(ICUDT)pnames.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\genpname\$(CFG)\genpname.exe" "$(ICUP)\source\common\unicode\uchar.h" "$(ICUP)\source\common\unicode\uscript.h"
378 @echo Creating data file for Unicode Property Names
379 @set ICU_DATA=$(ICUBLD)
380 @"$(ICUTOOLS)\genpname\$(CFG)\genpname" -d "$(ICUBLD)"
381
382# Targets for uprops.icu
383"$(ICUBLD)\$(ICUDT)uprops.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\genprops\$(CFG)\genprops.exe" "$(ICUBLD)\$(ICUDT)pnames.icu"
384 @echo Creating data file for Unicode Character Properties
385 @set ICU_DATA=$(ICUBLD)
386 @"$(ICUTOOLS)\genprops\$(CFG)\genprops" -u $(UNICODE_VERSION) -s "$(ICUUNIDATA)"
387
388# Targets for unorm.icu
389"$(ICUBLD)\$(ICUDT)unorm.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennorm\$(CFG)\gennorm.exe"
390 @echo Creating data file for Unicode Normalization
391 @set ICU_DATA=$(ICUBLD)
392 @"$(ICUTOOLS)\gennorm\$(CFG)\gennorm" -u $(UNICODE_VERSION) -s "$(ICUUNIDATA)"
393
394# Targets for converters
395"$(ICUBLD)\$(ICUDT)cnvalias.icu" : {"$(ICUSRCDATA)\$(ICUUCM)"}\convrtrs.txt "$(ICUTOOLS)\gencnval\$(CFG)\gencnval.exe"
396 @echo Creating data file for Converter Aliases
397 @set ICU_DATA=$(ICUBLD)
398 @"$(ICUTOOLS)\gencnval\$(CFG)\gencnval" "$(ICUSRCDATA)\$(ICUUCM)\convrtrs.txt"
399
400# Targets for tz
401"$(ICUBLD)\$(ICUDT)tz.icu" : {"$(ICUMISC)"}timezone.txt {"$(ICUTOOLS)\gentz\$(CFG)"}gentz.exe
402 @echo Creating data file for Timezones
403 @set ICU_DATA=$(ICUBLD)
404 @"$(ICUTOOLS)\gentz\$(CFG)\gentz" "$(ICUMISC)\timezone.txt"
405
406# Targets for ucadata.icu & invuca.icu
407"$(ICUBLD)\$(ICUDT)invuca.icu" "$(ICUBLD)\$(ICUDT)ucadata.icu": "$(ICUUNIDATA)\FractionalUCA.txt" "$(ICUTOOLS)\genuca\$(CFG)\genuca.exe" $(ICUDT)uprops.icu $(ICUDT)unorm.icu
408 @echo Creating UCA data files
409 @set ICU_DATA=$(ICUBLD)
410 @"$(ICUTOOLS)\genuca\$(CFG)\genuca" -s "$(ICUUNIDATA)"
411
412# Targets for uidna.icu
413"$(ICUBLD)\$(ICUDT)uidna.icu" : "$(ICUUNIDATA)\*.txt" "$(ICUMISC)\*.txt"
414 genidna -s "$(ICUDATA)" -d "$(ICUBLD)\\"
415
416# Dependencies on the tools for the batch inference rules
417
418$(UCM_SOURCE) : {"$(ICUTOOLS)\makeconv\$(CFG)"}makeconv.exe
419
420$(TRANSLIT_SOURCE) $(GENRB_SOURCE) "$(ICUBLD)\$(ICUDT)root.res" : {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unorm.icu"
421