]>
Commit | Line | Data |
---|---|---|
51004dcb | 1 | # Some Portions Copyright (c) 2006-2012 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 | 33 | # Executables & objects |
2ca993e8 | 34 | ZICOBJECTS= zic.o localtime.o asctime.o scheck.o ialloc.o |
729e4ab9 A |
35 | ZICTARG=$(BINDIR)/zic$(EXEEXT) |
36 | ZICEXEC=$(TOOLBINDIR)/zic$(TOOLEXEEXT) | |
2ca993e8 | 37 | TZ2ICUOBJ= tz2icu.o |
729e4ab9 A |
38 | TZ2ICUTARG=$(BINDIR)/tz2icu$(EXEEXT) |
39 | TZ2ICUEXEC=$(TOOLBINDIR)/tz2icu$(TOOLEXEEXT) | |
40 | ICUZDUMPTARG=$(BINDIR)/icuzdump$(EXEEXT) | |
41 | ICUZDUMPEXEC=$(TOOLBINDIR)/icuzdump$(TOOLEXEEXT) | |
2ca993e8 | 42 | ICUZDUMPOBJ= icuzdump.o |
729e4ab9 | 43 | |
73c04bcf A |
44 | ifeq ($(TZDATA),) |
45 | all: | |
4162bf98 | 46 | @echo ERROR "tzdata*.tar.gz" can\'t be found. |
73c04bcf A |
47 | @false |
48 | else | |
49 | all: icu_data | |
50 | endif | |
51 | ||
4162bf98 A |
52 | TZCODE_TARGETS= tzorig check-dump |
53 | ||
54 | ifeq ($(TZCODE),) | |
55 | # we're broken. | |
56 | $(TZCODE_TARGETS): | |
57 | @echo ERROR "tzcode*.tar.gz" can\'t be found. | |
58 | @false | |
59 | ||
60 | else | |
61 | ifeq ($(TZDATA),) | |
62 | # we're broken. | |
63 | $(TZCODE_TARGETS): | |
64 | @echo ERROR "tzdata*.tar.gz" can\'t be found. | |
65 | @false | |
66 | else | |
67 | tzorig: $(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 | ||
83 | dump-out: $(ZDUMPOUT) $(ICUZDUMPOUT) | |
84 | ||
85 | check-dump: dump-out | |
86 | diff -r zdumpout icuzdumpout | |
87 | ||
88 | endif | |
89 | endif | |
90 | ||
729e4ab9 | 91 | $(ICUZDUMPOUT): $(ICUZDUMPEXEC) |
4162bf98 A |
92 | -$(RMV) $(ICUZDUMPOUT) |
93 | -mkdir $(ICUZDUMPOUT) | |
729e4ab9 | 94 | $(INVOKE) $(ICUZDUMPEXEC) $(ICUZDUMP_OPTS) |
4162bf98 A |
95 | |
96 | ||
97 | # | |
98 | # old 'tz' rules start here | |
99 | # | |
100 | ||
101 | ||
73c04bcf A |
102 | PRIMARY_YDATA= africa antarctica asia australasia \ |
103 | europe northamerica southamerica | |
104 | YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward | |
105 | NDATA= systemv | |
106 | SDATA= solar87 solar88 solar89 | |
57a6839d | 107 | #TDATA= $(YDATA) $(NDATA) $(SDATA) |
4d9eefca | 108 | TDATA= $(YDATA) $(NDATA) |
73c04bcf A |
109 | YEARISTYPE= ./yearistype |
110 | ||
73c04bcf A |
111 | TZDIR=zoneinfo |
112 | ||
113 | CFLAGS+=-D_POSIX_C_SOURCE | |
4162bf98 | 114 | CPPFLAGS+= -DTZDIR=\"$(TZDIR)\" |
73c04bcf A |
115 | |
116 | # more data | |
117 | XDATA=zone.tab yearistype.sh leapseconds iso3166.tab | |
729e4ab9 | 118 | ICUDATA=ZoneMetaData.java icu_zone.txt tz2icu zoneinfo64.txt zoneinfo.txt |
73c04bcf | 119 | |
51004dcb A |
120 | # create modified CXXFLAGS without -fXXX, -Wxxxx (the settings for these don't work for tz2icu) |
121 | TZCODE_CXXFLAGS=$(patsubst -W%,,$(patsubst -f%,,$(CXXFLAGS))) | |
122 | ||
2ca993e8 A |
123 | $(ZICTARG): $(ZICOBJECTS) $(TDATA) yearistype $(srcdir)/tz2icu.h |
124 | $(CC) $(CFLAGS) $(TZORIG_EXTRA_CFLAGS) $(LFLAGS) -I$(srcdir) $(ZICOBJECTS) $(LDLIBS) -o $@ | |
73c04bcf | 125 | |
2ca993e8 A |
126 | $(TZ2ICUOBJ): $(srcdir)/tz2icu.cpp $(srcdir)/tz2icu.h |
127 | $(CXX) -W -Wall $(TZCODE_CXXFLAGS) -I$(srcdir) -I$(top_srcdir)/common -pedantic $(srcdir)/tz2icu.cpp -c -o $@ | |
128 | ||
129 | $(TZ2ICUTARG): $(TZ2ICUOBJ) | |
130 | $(CXX) -W -Wall $(TZCODE_CXXFLAGS) -I$(srcdir) -I$(top_srcdir)/common -pedantic $(TZ2ICUOBJ) -o $@ | |
4162bf98 | 131 | |
729e4ab9 | 132 | $(ICUZDUMPTARG): $(srcdir)/icuzdump.cpp |
4162bf98 A |
133 | $(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 $@ |
134 | ||
2ca993e8 A |
135 | $(ICUZDUMPOBJ): $(srcdir)/icuzdump.cpp |
136 | $(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 | 137 | |
729e4ab9 | 138 | $(TDATA): tdatamarker |
73c04bcf | 139 | |
729e4ab9 | 140 | tdatamarker: $(TZDATA) |
51004dcb | 141 | gunzip -d < $(TZDATA) | tar xf - --exclude=Makefile |
729e4ab9 | 142 | touch $@ |
73c04bcf A |
143 | |
144 | yearistype: yearistype.sh | |
145 | cp yearistype.sh yearistype | |
146 | chmod +x yearistype | |
147 | ||
729e4ab9 A |
148 | posix_only: $(ZICEXEC) $(TDATA) $(srcdir)/icuzones |
149 | $(ZICEXEC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) $(srcdir)/icuzones | |
73c04bcf | 150 | |
73c04bcf | 151 | |
729e4ab9 A |
152 | icu_data: $(TZ2ICUEXEC) posix_only |
153 | $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` | |
154 | $(TZ2ICUEXEC) $(TZDIR) zone.tab `echo $(TZDATA) | sed -e "s/.*\/tzdata//;s/\.tar\.gz$$//"` --old | |
73c04bcf | 155 | |
2ca993e8 A |
156 | tztoolobjs: $(ZICOBJECTS) $(TZ2ICUOBJ) $(ICUZDUMPOBJ) |
157 | ||
73c04bcf | 158 | clean: |
729e4ab9 | 159 | -rm -f core *.o *.out zdump${EXEEXT} $(ZICTARG) yearistype date $(TZ2ICUTARG) |
73c04bcf A |
160 | @echo ICU specific cleanup: |
161 | -rm -f $(ICUDATA) | |
162 | -rm -rf $(TZDIR) | |
729e4ab9 | 163 | -$(RMV) $(ICUZDUMPTARG) tzorig ./zdumpout/ ./icuzdumpout/ |
73c04bcf | 164 | ifneq ($(TZDATA),) |
51004dcb | 165 | -rm -rf `gunzip -d < $(TZDATA) | tar tf - --exclude=Makefile | grep -o '[^ ]*$$' | tr '\n' ' '` |
729e4ab9 | 166 | -rm tdatamarker |
73c04bcf A |
167 | endif |
168 | ||
4162bf98 A |
169 | checkclean: |
170 | ||
73c04bcf A |
171 | dataclean: clean |
172 | -rm -f $(TDATA) $(XDATA) | |
173 | ||
174 | distclean: dataclean clean | |
175 | -rm -f Makefile | |
176 | ||
177 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
178 | cd $(top_builddir) \ | |
179 | && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status | |
180 | ||
181 |