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