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