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