-# Some Portions Copyright (c) 2006-2007 IBM and others. All Rights Reserved.
+# Copyright (C) 2016 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+# Some Portions Copyright (c) 2006-2012 IBM and others. All Rights Reserved.
srcdir = @srcdir@
top_srcdir = @top_srcdir@
include $(top_builddir)/icudefs.mk
-OBJECTS= zic.o localtime.o asctime.o scheck.o ialloc.o
+ifeq ($(TZDATA),)
TZDATA = $(firstword $(wildcard ./tzdata*.tar.gz) $(wildcard $(srcdir)/tzdata*.tar.gz))
+endif
+ifeq ($(TZCODE),)
TZCODE = $(firstword $(wildcard ./tzcode*.tar.gz) $(wildcard $(srcdir)/tzcode*.tar.gz))
+endif
+
+
+PRIMARY_YDATA= africa antarctica asia australasia \
+ europe northamerica southamerica
+YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward
+NDATA= systemv
+SDATA= solar87 solar88 solar89
+#TDATA= $(YDATA) $(NDATA) $(SDATA)
+TDATA= $(YDATA) $(NDATA)
+YEARISTYPE= ./yearistype
+
+TZDIR=zoneinfo
+
+CFLAGS+=-D_POSIX_C_SOURCE=200112L
+CPPFLAGS+= -DTZDIR=\"$(TZDIR)\"
+
+# more data
+XDATA=zone.tab yearistype.sh leapseconds iso3166.tab
+ICUDATA=ZoneMetaData.java icu_zone.txt tz2icu zoneinfo64.txt zoneinfo.txt
+
+VANGUARD_DIR= ./vanguard
+# For TZ DB/ICU comparison
TZORIG=./tzorig
TZORIG_TZDIR=./tzorig/tzdir
TZORIG_ABS := $(shell pwd)/tzorig
ZDUMP_OPTS= -v -a -d $(ZDUMPOUT) -c 1902,2038 -i
ICUZDUMP_OPTS= -a -d $(ICUZDUMPOUT)
+# Executables & objects
+ZICOBJECTS= zic.o localtime.o asctime.o scheck.o ialloc.o
+ZICTARG=$(BINDIR)/zic$(EXEEXT)
+ZICEXEC=$(TOOLBINDIR)/zic$(TOOLEXEEXT)
+TZ2ICUOBJ= tz2icu.o
+TZ2ICUTARG=$(BINDIR)/tz2icu$(EXEEXT)
+TZ2ICUEXEC=$(TOOLBINDIR)/tz2icu$(TOOLEXEEXT)
+ICUZDUMPTARG=$(BINDIR)/icuzdump$(EXEEXT)
+ICUZDUMPEXEC=$(TOOLBINDIR)/icuzdump$(TOOLEXEEXT)
+ICUZDUMPOBJ= icuzdump.o
+
ifeq ($(TZDATA),)
all:
@echo ERROR "tzdata*.tar.gz" can\'t be found.
mkdir $(TZORIG_TZDIR)
gunzip -d < $(TZDATA) | ( cd $@ ; tar xf - )
gunzip -d < $(TZCODE) | ( cd $@ ; tar xf - )
+ if test -e $(TZORIG)/ziguard.awk; then \
+ for tzfile in $(TDATA) ; do \
+ mv $(TZORIG)/$$tzfile $(TZORIG)/$$tzfile.bak && \
+ awk -v DATAFORM=rearguard -f $(TZORIG)/ziguard.awk $(TZORIG)/$$tzfile.bak > $(TZORIG)/$$tzfile; \
+ done; \
+ fi;
-mv $(TZORIG)/zdump.c $(TZORIG)/zdump.c.orig
cp $(srcdir)/zdump.c $(TZORIG)/zdump.c
-mv $(TZORIG)/factory $(TZORIG)/factory.orig
cat $(TZORIG)/factory.orig $(srcdir)/icuzones > $(TZORIG)/factory
+ -mv $(TZORIG)/zishrink.awk $(TZORIG)/zishrink.awk.orig
+ sed -e '/if (line ~ \/^R SystemV \/) return/s/^/#/' $(TZORIG)/zishrink.awk.orig > $(TZORIG)/zishrink.awk
+ -mv $(TZORIG)/Makefile $(TZORIG)/Makefile.orig
+ sed -e "s/^BACKWARD=.*/BACKWARD= backward pacificnew/" $(TZORIG)/Makefile.orig > $(TZORIG)/Makefile
$(MAKE) -C $@ $(TZORIG_OPTS) zdump zones
$(ZDUMPOUT): tzorig
( cd $(TZORIG) ; ./zdump$(EXEEXT) $(ZDUMP_OPTS) )
-
+ find $(ZDUMPOUT) -name '*--ICU' -exec sh -c 'mv "$${0}" $${0%--ICU}' {} \;
dump-out: $(ZDUMPOUT) $(ICUZDUMPOUT)
endif
endif
-$(ICUZDUMPOUT): icuzdump$(EXEEXT)
+$(ICUZDUMPOUT): $(ICUZDUMPEXEC)
-$(RMV) $(ICUZDUMPOUT)
-mkdir $(ICUZDUMPOUT)
- $(INVOKE) ./icuzdump $(ICUZDUMP_OPTS)
+ $(INVOKE) $(ICUZDUMPEXEC) $(ICUZDUMP_OPTS)
#
#
-PRIMARY_YDATA= africa antarctica asia australasia \
- europe northamerica southamerica
-YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward
-NDATA= systemv
-SDATA= solar87 solar88 solar89
-TDATA= $(YDATA) $(NDATA) $(SDATA)
-YEARISTYPE= ./yearistype
-
-ZIC = ./zic
-TZDIR=zoneinfo
-
-CFLAGS+=-D_POSIX_C_SOURCE
-CPPFLAGS+= -DTZDIR=\"$(TZDIR)\"
+# create modified CXXFLAGS without -fXXX, -Wxxxx (the settings for these don't work for tz2icu)
+TZCODE_CXXFLAGS=$(patsubst -W%,,$(patsubst -f%,,$(CXXFLAGS)))
-# more data
-XDATA=zone.tab yearistype.sh leapseconds iso3166.tab
-ICUDATA=ZoneMetaData.java icu_zone.txt tz2icu zoneinfo.txt
+$(ZICTARG): $(ZICOBJECTS) $(TDATA) yearistype $(srcdir)/tz2icu.h
+ $(CC) $(CFLAGS) $(TZORIG_EXTRA_CFLAGS) $(LFLAGS) -I$(srcdir) $(ZICOBJECTS) $(LDLIBS) -o $@
-zic: $(OBJECTS) yearistype $(srcdir)/tz2icu.h
- $(CC) $(CFLAGS) $(TZORIG_EXTRA_CFLAGS) $(LFLAGS) -I$(srcdir) $(OBJECTS) $(LDLIBS) -o $@
+$(TZ2ICUOBJ): $(srcdir)/tz2icu.cpp $(srcdir)/tz2icu.h
+ $(CXX) -W -Wall $(TZCODE_CXXFLAGS) -I$(srcdir) -I$(top_srcdir)/common -pedantic $(srcdir)/tz2icu.cpp -c -o $@
-tz2icu: $(srcdir)/tz2icu.cpp $(srcdir)/tz2icu.h
- $(CXX) -W -Wall -I$(srcdir) -I$(top_srcdir)/common -pedantic $(srcdir)/tz2icu.cpp -o $@
+$(TZ2ICUTARG): $(TZ2ICUOBJ)
+ $(CXX) -W -Wall $(TZCODE_CXXFLAGS) -I$(srcdir) -I$(top_srcdir)/common -pedantic $(TZ2ICUOBJ) -o $@
-icuzdump${EXEEXT}: $(srcdir)/icuzdump.cpp
+$(ICUZDUMPTARG): $(srcdir)/icuzdump.cpp
$(LINK.cc) -I$(srcdir) -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/io -pedantic $(srcdir)/icuzdump.cpp $(LIBICUUC) $(LIBICUDT) $(LIBICUI18N) $(LIBICUIO) $(LIBICUTOOLUTIL) -o $@
+$(ICUZDUMPOBJ): $(srcdir)/icuzdump.cpp
+ $(CXX) -W -Wall $(TZCODE_CXXFLAGS) --std=c++0x -I$(srcdir) -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/io $(srcdir)/icuzdump.cpp -c -o $@
-# $(CXX) -W -Wall -I$(srcdir) -I$(top_srcdir)/common -pedantic $(srcdir)/icuzdump.cpp -o $@
+$(TDATA): tdatamarker
-yearistype.sh: $(TZDATA)
- gunzip -d < $(TZDATA) | tar xf -
+tdatamarker: $(TZDATA)
+ mkdir $(VANGUARD_DIR)
+ gunzip -d < $(TZDATA) | tar xf - --exclude=Makefile
+ if test -e ziguard.awk; then \
+ for tzfile in $(TDATA) ; do \
+ mv $$tzfile $(VANGUARD_DIR)/$$tzfile && \
+ awk -v DATAFORM=rearguard -f ziguard.awk $(VANGUARD_DIR)/$$tzfile > $$tzfile; \
+ done; \
+ fi;
+ touch $@
+
+yearistype.sh: | $(TDATA)
yearistype: yearistype.sh
cp yearistype.sh yearistype
chmod +x yearistype
-posix_only: zic $(TDATA) $(srcdir)/icuzones
- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones
+posix_only: $(ZICEXEC) $(TDATA) $(srcdir)/icuzones
+ $(ZICEXEC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones
+
+icu_data: $(TZ2ICUEXEC) posix_only
+ $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"`
+ $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` --old
-icu_data: tz2icu posix_only
- ./tz2icu $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"`
+tztoolobjs: $(ZICOBJECTS) $(TZ2ICUOBJ) $(ICUZDUMPOBJ)
clean:
- -rm -f core *.o *.out zdump${EXEEXT} zic${EXEEXT} yearistype date tz2icu${EXEEXT}
+ -rm -f core *.o *.out zdump${EXEEXT} $(ZICTARG) yearistype date $(TZ2ICUTARG)
@echo ICU specific cleanup:
-rm -f $(ICUDATA)
-rm -rf $(TZDIR)
- -$(RMV) icuzdump${EXEEXT} tzorig ./zdumpout/ ./icuzdumpout/
+ -rm -rf $(VANGUARD_DIR)
+ -$(RMV) $(ICUZDUMPTARG) tzorig ./zdumpout/ ./icuzdumpout/
ifneq ($(TZDATA),)
- -rm -rf `gunzip -d < $(TZDATA) | tar tf - | grep -o '[^ ]*$$' | tr '\n' ' '`
+ -rm -rf `gunzip -d < $(TZDATA) | tar tf - --exclude=Makefile | grep -o '[^ ]*$$' | tr '\n' ' '`
+ -rm -f tdatamarker
endif
checkclean: