ICU-4716 Allow tzcode to work from tools/tzcode instead of only in ICU's

data directory.

X-SVN-Rev: 20043
This commit is contained in:
George Rhoten 2006-08-11 22:23:08 +00:00
parent ba117fc5a8
commit 54aaf000b8
4 changed files with 34 additions and 38 deletions

3
.gitignore vendored
View file

@ -517,6 +517,9 @@ icu4c/source/tools/toolutil/Debug
icu4c/source/tools/toolutil/Makefile
icu4c/source/tools/toolutil/Release
icu4c/source/tools/toolutil/libicu*
icu4c/source/tools/tzcode/Makefile
icu4c/source/tools/tzcode/tz2icu
icu4c/source/tools/tzcode/zic
icu4j/.classpath
icu4j/.clover
icu4j/.externalToolBuilders

View file

@ -493,41 +493,24 @@ all-RES: $(RES_FILES)
$(BUILDDIR)/%.res: $(LOCSRCDIR)/%.txt $(BINDIR)/genrb$(EXEEXT) $(DAT_FILES)
$(INVOKE) $(BINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(LOCSRCDIR) -d $(BUILDDIR) $(<F)
# if the 'in' directory contains a new tzdata*.tar.gz file, use it for zoneinfo.txt
TZDATA = $(firstword $(wildcard ./in/tzdata*.tar.gz) $(wildcard $(srcdir)/in/tzdata*.tar.gz))
# if the tzcode directory contains a new tzdata*.tar.gz file, use it for zoneinfo.txt
TZDATA = $(firstword $(wildcard $(top_builddir)/tools/tzcode/tzdata*.tar.gz) $(wildcard $(top_srcdir)/tools/tzcode/tzdata*.tar.gz))
ifneq ($(TZDATA),)
OUTMISC=$(OUTDIR)/misc
ZONEINFO=$(OUTMISC)/zoneinfo.txt
TZCODE=$(OUTTMPDIR)/tzcode
TZCODE_DIR=$(top_builddir)/tools/tzcode
ZONEINFO=$(TZCODE_DIR)/zoneinfo.txt
# Override the normal genrb for zoneinfo.txt to always pull from out/zoneinfo.txt
# Override the normal genrb for zoneinfo.txt to always pull from
# icu/source/tools/tzcode/zoneinfo.txt
$(BUILDDIR)/zoneinfo.res: $(ZONEINFO) $(BINDIR)/genrb$(EXEEXT)
@echo Note: $(MISCSRCDIR)/zoneinfo.txt is IGNORED because $(TZDATA) is present.
$(INVOKE) $(BINDIR)/genrb $(GENRBOPTS) -q -i $(BUILDDIR) -s $(OUTMISC) -d $(BUILDDIR) $(<F)
@echo Note: $(MISCSRCDIR)/zoneinfo.txt is IGNORED because $(TZDATA) is present.
$(INVOKE) $(BINDIR)/genrb $(GENRBOPTS) -q -i $(BUILDDIR) -d $(BUILDDIR) $(ZONEINFO)
# create the out/tmp/tzcode directory from source/tools/tzcode
$(TZCODE):
-$(MKINSTALLDIRS) $(TZCODE)
-$(MKINSTALLDIRS)
(cd $(top_srcdir)/tools/ ; tar cf - tzcode ) | (cd $(OUTTMPDIR) ; tar xf -)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/out/tmp/tzcode/Makefile CONFIG_HEADERS= $(SHELL) ./config.status
$(OUTMISC):
-$(MKINSTALLDIRS) $@
# perform the actual build.
$(ZONEINFO): $(OUTMISC) $(TZCODE) $(TZDATA)
@echo "******* Updating $(ZONEINFO) from $(TZDATA) ..."
cp $(TZDATA) $(TZCODE)
gunzip -d < $(TZDATA) | ( cd $(TZCODE) ; tar xf - )
$(MAKE) -C $(TZCODE) icu_data
mv $(TZCODE)/zoneinfo.txt $@
# $(MAKE) -C $(TZCODE) dataclean
# $(RMV) $(top_builddir)/tools/tzcode/tzdata*.tar.gz
@echo "******* Done building $@ from $< **********"
# Create the tzcode tool and zoneinfo.txt as needed.
$(ZONEINFO): $(TZDATA)
@echo "$(MAKE)[$(MAKELEVEL)]: Making \`$(ZONEINFO)' in \`$(TZCODE_DIR)'"; \
(cd $(TZCODE_DIR) && $(MAKE)) || exit; \
# end of zoneinfo.txt-generation
endif

View file

@ -0,0 +1,3 @@
Makefile
tz2icu
zic

View file

@ -1,20 +1,23 @@
# Some Portions Copyright (c) 2006 IBM and others. All Rights Reserved.
all:
@echo This code is intended to be run by the icu/source/data makefile only.
@echo Furthermore, it is intended to be relocated to data/out/tmp/tzcode
false
srcdir = @srcdir@
top_srcdir = @top_srcdir@
subdir = data/out/tmp/tzcode
subdir = tools/tzcode
top_builddir = ../../../..
top_builddir = ../..
include $(top_builddir)/icudefs.mk
TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
TZDATA = $(firstword $(wildcard ./tzdata*.tar.gz) $(wildcard $(srcdir)/tzdata*.tar.gz))
ifeq ($(TZDATA),)
all:
@echo ERROR tzdata*.tar.gz can\'t be found.
@false
else
all: icu_data
endif
PRIMARY_YDATA= africa antarctica asia australasia \
europe northamerica southamerica
@ -42,6 +45,9 @@ zic: $(TZCOBJS) yearistype tz2icu.h
tz2icu: tz2icu.cpp tz2icu.h
$(CXX) -W -Wall -pedantic tz2icu.cpp -o $@
yearistype.sh: $(TZDATA)
gunzip -d < $(TZDATA) | tar xf -
yearistype: yearistype.sh
cp yearistype.sh yearistype
chmod +x yearistype
@ -51,7 +57,7 @@ posix_only: zic $(TDATA)
icu_data: tz2icu posix_only
./tz2icu $(TZDIR) zone.tab `ls tzdata*.tar.gz | sed -e "s/^tzdata//;s/\.tar\.gz$$//"`
./tz2icu $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"`
clean:
-rm -f core *.o *.out zdump zic yearistype date
@ -65,7 +71,8 @@ dataclean: clean
distclean: dataclean clean
-rm -f Makefile
## NB: this Makefile.in is sourced from $(builddir), because it was copied.
Makefile: Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status