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 21TZORIG=./tzorig 22TZORIG_TZDIR=./tzorig/tzdir 23TZORIG_ABS := $(shell pwd)/tzorig 24TZORIG_TZDIR_ABS := $(TZORIG_ABS)/tzdir 25TZORIG_OPTS := CFLAGS="-D_POSIX_C_SOURCE $(TZORIG_EXTRA_CFLAGS)" TZDIR=$(TZORIG_TZDIR_ABS) 26 27 28## Options for building zdumps 29ZDUMPOUT=$(shell pwd)/zdumpout 30ICUZDUMPOUT=$(shell pwd)/icuzdumpout 31 32ZDUMP_OPTS= -v -a -d $(ZDUMPOUT) -c 1902,2038 -i 33ICUZDUMP_OPTS= -a -d $(ICUZDUMPOUT) 34 35# Executables & objects 36OBJECTS= zic.o localtime.o asctime.o scheck.o ialloc.o 37ZICTARG=$(BINDIR)/zic$(EXEEXT) 38ZICEXEC=$(TOOLBINDIR)/zic$(TOOLEXEEXT) 39TZ2ICUTARG=$(BINDIR)/tz2icu$(EXEEXT) 40TZ2ICUEXEC=$(TOOLBINDIR)/tz2icu$(TOOLEXEEXT) 41ICUZDUMPTARG=$(BINDIR)/icuzdump$(EXEEXT) 42ICUZDUMPEXEC=$(TOOLBINDIR)/icuzdump$(TOOLEXEEXT) 43 44ifeq ($(TZDATA),) 45all: 46 @echo ERROR "tzdata*.tar.gz" can\'t be found. 47 @false 48else 49all: icu_data 50endif 51 52TZCODE_TARGETS= tzorig check-dump 53 54ifeq ($(TZCODE),) 55# we're broken. 56$(TZCODE_TARGETS): 57 @echo ERROR "tzcode*.tar.gz" can\'t be found. 58 @false 59 60else 61ifeq ($(TZDATA),) 62# we're broken. 63$(TZCODE_TARGETS): 64 @echo ERROR "tzdata*.tar.gz" can\'t be found. 65 @false 66else 67tzorig: $(TZCODE) $(TZDATA) 68 -$(RMV) ./tzorig/ 69 mkdir $@ 70 mkdir $(TZORIG_TZDIR) 71 gunzip -d < $(TZDATA) | ( cd $@ ; tar xf - ) 72 gunzip -d < $(TZCODE) | ( cd $@ ; tar xf - ) 73 -mv $(TZORIG)/zdump.c $(TZORIG)/zdump.c.orig 74 cp $(srcdir)/zdump.c $(TZORIG)/zdump.c 75 -mv $(TZORIG)/factory $(TZORIG)/factory.orig 76 cat $(TZORIG)/factory.orig $(srcdir)/icuzones > $(TZORIG)/factory 77 $(MAKE) -C $@ $(TZORIG_OPTS) zdump zones 78 79$(ZDUMPOUT): tzorig 80 ( cd $(TZORIG) ; ./zdump$(EXEEXT) $(ZDUMP_OPTS) ) 81 82 83dump-out: $(ZDUMPOUT) $(ICUZDUMPOUT) 84 85check-dump: dump-out 86 diff -r zdumpout icuzdumpout 87 88endif 89endif 90 91$(ICUZDUMPOUT): $(ICUZDUMPEXEC) 92 -$(RMV) $(ICUZDUMPOUT) 93 -mkdir $(ICUZDUMPOUT) 94 $(INVOKE) $(ICUZDUMPEXEC) $(ICUZDUMP_OPTS) 95 96 97# 98# old 'tz' rules start here 99# 100 101 102PRIMARY_YDATA= africa antarctica asia australasia \ 103 europe northamerica southamerica 104YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward 105NDATA= systemv 106SDATA= solar87 solar88 solar89 107#TDATA= $(YDATA) $(NDATA) $(SDATA) 108TDATA= $(YDATA) $(NDATA) 109YEARISTYPE= ./yearistype 110 111TZDIR=zoneinfo 112 113CFLAGS+=-D_POSIX_C_SOURCE 114CPPFLAGS+= -DTZDIR=\"$(TZDIR)\" 115 116# more data 117XDATA=zone.tab yearistype.sh leapseconds iso3166.tab 118ICUDATA=ZoneMetaData.java icu_zone.txt tz2icu zoneinfo64.txt zoneinfo.txt 119 120$(ZICTARG): $(OBJECTS) $(TDATA) yearistype $(srcdir)/tz2icu.h 121 $(CC) $(CFLAGS) $(TZORIG_EXTRA_CFLAGS) $(LFLAGS) -I$(srcdir) $(OBJECTS) $(LDLIBS) -o $@ 122 123$(TZ2ICUTARG): $(srcdir)/tz2icu.cpp $(srcdir)/tz2icu.h 124 $(CXX) $(CXXFLAGS) -I$(srcdir) -I$(top_srcdir)/common $(srcdir)/tz2icu.cpp -o $@ 125 126$(ICUZDUMPTARG): $(srcdir)/icuzdump.cpp 127 $(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 $@ 128 129 130$(TDATA): tdatamarker 131 132tdatamarker: $(TZDATA) 133 gunzip -d < $(TZDATA) | tar xf - --exclude=Makefile 134 touch $@ 135 136yearistype: yearistype.sh 137 cp yearistype.sh yearistype 138 chmod +x yearistype 139 140posix_only: $(ZICEXEC) $(TDATA) $(srcdir)/icuzones 141 $(ZICEXEC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones 142 143 144icu_data: $(TZ2ICUEXEC) posix_only 145 $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` 146 $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` --old 147 148clean: 149 -rm -f core *.o *.out zdump${EXEEXT} $(ZICTARG) yearistype date $(TZ2ICUTARG) 150 @echo ICU specific cleanup: 151 -rm -f $(ICUDATA) 152 -rm -rf $(TZDIR) 153 -$(RMV) $(ICUZDUMPTARG) tzorig ./zdumpout/ ./icuzdumpout/ 154ifneq ($(TZDATA),) 155 -rm -rf `gunzip -d < $(TZDATA) | tar tf - --exclude=Makefile | grep -o '[^ ]*$$' | tr '\n' ' '` 156 -rm tdatamarker 157endif 158 159checkclean: 160 161dataclean: clean 162 -rm -f $(TDATA) $(XDATA) 163 164distclean: dataclean clean 165 -rm -f Makefile 166 167Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 168 cd $(top_builddir) \ 169 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status 170 171 172