1# Copyright (C) 2016 and later: Unicode, Inc. and others. 2# License & terms of use: http://www.unicode.org/copyright.html 3# Some Portions Copyright (c) 2006-2012 IBM and others. All Rights Reserved. 4 5srcdir = @srcdir@ 6top_srcdir = @top_srcdir@ 7 8top_builddir = ../.. 9 10subdir = tools/tzcode 11 12include $(top_builddir)/icudefs.mk 13 14ifeq ($(TZDATA),) 15TZDATA = $(firstword $(wildcard ./tzdata*.tar.gz) $(wildcard $(srcdir)/tzdata*.tar.gz)) 16endif 17ifeq ($(TZCODE),) 18TZCODE = $(firstword $(wildcard ./tzcode*.tar.gz) $(wildcard $(srcdir)/tzcode*.tar.gz)) 19endif 20 21 22PRIMARY_YDATA= africa antarctica asia australasia \ 23 europe northamerica southamerica 24YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward 25NDATA= systemv 26SDATA= solar87 solar88 solar89 27#TDATA= $(YDATA) $(NDATA) $(SDATA) 28TDATA= $(YDATA) $(NDATA) 29YEARISTYPE= ./yearistype 30 31TZDIR=zoneinfo 32 33CFLAGS+=-D_POSIX_C_SOURCE 34CPPFLAGS+= -DTZDIR=\"$(TZDIR)\" 35 36# more data 37XDATA=zone.tab yearistype.sh leapseconds iso3166.tab 38ICUDATA=ZoneMetaData.java icu_zone.txt tz2icu zoneinfo64.txt zoneinfo.txt 39 40VANGUARD_DIR= ./vanguard 41 42# For TZ DB/ICU comparison 43TZORIG=./tzorig 44TZORIG_TZDIR=./tzorig/tzdir 45TZORIG_ABS := $(shell pwd)/tzorig 46TZORIG_TZDIR_ABS := $(TZORIG_ABS)/tzdir 47TZORIG_OPTS := CFLAGS="-D_POSIX_C_SOURCE $(TZORIG_EXTRA_CFLAGS)" TZDIR=$(TZORIG_TZDIR_ABS) 48 49 50## Options for building zdumps 51ZDUMPOUT=$(shell pwd)/zdumpout 52ICUZDUMPOUT=$(shell pwd)/icuzdumpout 53 54ZDUMP_OPTS= -v -a -d $(ZDUMPOUT) -c 1902,2038 -i 55ICUZDUMP_OPTS= -a -d $(ICUZDUMPOUT) 56 57# Executables & objects 58OBJECTS= zic.o localtime.o asctime.o scheck.o ialloc.o 59ZICTARG=$(BINDIR)/zic$(EXEEXT) 60ZICEXEC=$(TOOLBINDIR)/zic$(TOOLEXEEXT) 61TZ2ICUTARG=$(BINDIR)/tz2icu$(EXEEXT) 62TZ2ICUEXEC=$(TOOLBINDIR)/tz2icu$(TOOLEXEEXT) 63ICUZDUMPTARG=$(BINDIR)/icuzdump$(EXEEXT) 64ICUZDUMPEXEC=$(TOOLBINDIR)/icuzdump$(TOOLEXEEXT) 65 66ifeq ($(TZDATA),) 67all: 68 @echo ERROR "tzdata*.tar.gz" can\'t be found. 69 @false 70else 71all: icu_data 72endif 73 74TZCODE_TARGETS= tzorig check-dump 75 76ifeq ($(TZCODE),) 77# we're broken. 78$(TZCODE_TARGETS): 79 @echo ERROR "tzcode*.tar.gz" can\'t be found. 80 @false 81 82else 83ifeq ($(TZDATA),) 84# we're broken. 85$(TZCODE_TARGETS): 86 @echo ERROR "tzdata*.tar.gz" can\'t be found. 87 @false 88else 89tzorig: $(TZCODE) $(TZDATA) 90 -$(RMV) ./tzorig/ 91 mkdir $@ 92 mkdir $(TZORIG_TZDIR) 93 gunzip -d < $(TZDATA) | ( cd $@ ; tar xf - ) 94 gunzip -d < $(TZCODE) | ( cd $@ ; tar xf - ) 95 for tzfile in $(TDATA) ; do \ 96 mv $(TZORIG)/$$tzfile $(TZORIG)/$$tzfile.bak && \ 97 awk -v DATAFORM=rearguard -f $(TZORIG)/ziguard.awk $(TZORIG)/$$tzfile.bak > $(TZORIG)/$$tzfile; \ 98 done 99 -mv $(TZORIG)/zdump.c $(TZORIG)/zdump.c.orig 100 cp $(srcdir)/zdump.c $(TZORIG)/zdump.c 101 -mv $(TZORIG)/factory $(TZORIG)/factory.orig 102 cat $(TZORIG)/factory.orig $(srcdir)/icuzones > $(TZORIG)/factory 103 -mv $(TZORIG)/zishrink.awk $(TZORIG)/zishrink.awk.orig 104 sed -e '/if (line ~ \/^R SystemV \/) return/s/^/#/' $(TZORIG)/zishrink.awk.orig > $(TZORIG)/zishrink.awk 105 -mv $(TZORIG)/Makefile $(TZORIG)/Makefile.orig 106 sed -e "s/^BACKWARD=.*/BACKWARD= backward pacificnew/" $(TZORIG)/Makefile.orig > $(TZORIG)/Makefile 107 $(MAKE) -C $@ $(TZORIG_OPTS) zdump zones 108 109$(ZDUMPOUT): tzorig 110 ( cd $(TZORIG) ; ./zdump$(EXEEXT) $(ZDUMP_OPTS) ) 111 find $(ZDUMPOUT) -name '*--ICU' -exec sh -c 'mv "$${0}" $${0%--ICU}' {} \; 112 113dump-out: $(ZDUMPOUT) $(ICUZDUMPOUT) 114 115check-dump: dump-out 116 diff -r zdumpout icuzdumpout 117 118endif 119endif 120 121$(ICUZDUMPOUT): $(ICUZDUMPEXEC) 122 -$(RMV) $(ICUZDUMPOUT) 123 -mkdir $(ICUZDUMPOUT) 124 $(INVOKE) $(ICUZDUMPEXEC) $(ICUZDUMP_OPTS) 125 126 127# 128# old 'tz' rules start here 129# 130 131 132$(ZICTARG): $(OBJECTS) $(TDATA) yearistype $(srcdir)/tz2icu.h 133 $(CC) $(CFLAGS) $(TZORIG_EXTRA_CFLAGS) $(LFLAGS) -I$(srcdir) $(OBJECTS) $(LDLIBS) -o $@ 134 135$(TZ2ICUTARG): $(srcdir)/tz2icu.cpp $(srcdir)/tz2icu.h 136 $(CXX) $(CXXFLAGS) -I$(srcdir) -I$(top_srcdir)/common $(srcdir)/tz2icu.cpp -o $@ 137 138$(ICUZDUMPTARG): $(srcdir)/icuzdump.cpp 139 $(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 $@ 140 141 142$(TDATA): tdatamarker 143 144tdatamarker: $(TZDATA) 145 mkdir $(VANGUARD_DIR) 146 gunzip -d < $(TZDATA) | tar xf - --exclude=Makefile 147 for tzfile in $(TDATA) ; do \ 148 mv $$tzfile $(VANGUARD_DIR)/$$tzfile && \ 149 awk -v DATAFORM=rearguard -f ziguard.awk $(VANGUARD_DIR)/$$tzfile > $$tzfile; \ 150 done 151 touch $@ 152 153yearistype: yearistype.sh 154 cp yearistype.sh yearistype 155 chmod +x yearistype 156 157posix_only: $(ZICEXEC) $(TDATA) $(srcdir)/icuzones 158 $(ZICEXEC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones 159 160 161icu_data: $(TZ2ICUEXEC) posix_only 162 $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` 163 $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` --old 164 165clean: 166 -rm -f core *.o *.out zdump${EXEEXT} $(ZICTARG) yearistype date $(TZ2ICUTARG) 167 @echo ICU specific cleanup: 168 -rm -f $(ICUDATA) 169 -rm -rf $(TZDIR) 170 -rm -rf $(VANGUARD_DIR) 171 -$(RMV) $(ICUZDUMPTARG) tzorig ./zdumpout/ ./icuzdumpout/ 172ifneq ($(TZDATA),) 173 -rm -rf `gunzip -d < $(TZDATA) | tar tf - --exclude=Makefile | grep -o '[^ ]*$$' | tr '\n' ' '` 174 -rm -f tdatamarker 175endif 176 177checkclean: 178 179dataclean: clean 180 -rm -f $(TDATA) $(XDATA) 181 182distclean: dataclean clean 183 -rm -f Makefile 184 185Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 186 cd $(top_builddir) \ 187 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status 188 189 190