]> git.ipfire.org Git - thirdparty/glibc.git/blob - timezone/Makefile
Update.
[thirdparty/glibc.git] / timezone / Makefile
1 # Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
13
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18
19 #
20 # Makefile for timezone information
21 #
22 subdir := timezone
23
24 distribute := tzfile.h private.h scheck.c ialloc.c yearistype \
25 iso3166.tab zone.tab tzselect.ksh checktab.awk \
26 README
27
28 extra-objs := scheck.o ialloc.o
29
30 others := zdump zic
31 tests := test-tz tst-timezone
32
33 tzbases := africa antarctica asia australasia europe northamerica \
34 southamerica etcetera factory systemv \
35 solar87 solar88 solar89
36 tzlinks := backward
37 tzfiles := $(tzbases) $(tzlinks)
38 # pacificnew doesn't compile; if it is to be used, it should be included in
39 # northamerica.
40 distribute += $(tzfiles) leapseconds pacificnew simplebackw
41
42 generated := $(addprefix z.,$(tzfiles))
43 install-sbin := zic zdump
44
45 generated-dirs = testdata
46
47 all: # Make this the default target; it will be defined in Rules.
48
49 include ../Makeconfig # Get objpfx defined so we can use it below.
50
51 # z.* use this variable.
52 define nl
53
54
55 endef
56 ifndef avoid-generated
57 ifndef inhibit_timezone_rules
58 -include $(addprefix $(objpfx)z.,$(tzfiles))
59 endif
60 endif
61
62 # Make these absolute file names.
63 installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \
64 $(addprefix $(inst_zonedir)/, \
65 $(localtime-file)))
66 installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
67 $(addprefix $(inst_zonedir)/, \
68 $(posixrules-file)))
69
70 ifeq ($(cross-compiling),no)
71 # Don't try to install the zoneinfo files since we can't run zic.
72 install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \
73 $(zonenames:%=posix/%) \
74 $(zonenames:%=right/%)) \
75 $(installed-localtime-file) $(installed-posixrules-file)
76 endif
77
78 ifeq ($(have-ksh),yes)
79 install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab
80 install-bin += tzselect
81 generated += tzselect
82 endif
83
84 include ../Rules
85
86
87 $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
88 # Kludge alert: we use an implicit rule (in what we are generating here)
89 # because that is the only way to tell Make that the one command builds all
90 # the files.
91 # The extra kludge for the $(tzlinks) files is necessary since running zic
92 # this file requires all other files to exist. Blech!
93 $(make-target-directory)
94 (echo 'define $*-zones' ;\
95 $(AWK) '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\
96 echo 'endef' ;\
97 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
98 echo 'ifdef $*-zones' ;\
99 if test x$(findstring $*, $(tzlinks)) != x; then \
100 echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\
101 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\
102 echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\
103 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\
104 echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\
105 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
106 fi ;\
107 echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
108 echo '$< $$(objpfx)zic leapseconds yearistype' ;\
109 echo ' $$(tzcompile)' ;\
110 echo '$$(addprefix $$(inst_datadir)/zone%/posix/,$$($*-zones)): \' ;\
111 echo '$< $$(objpfx)zic /dev/null yearistype' ;\
112 echo ' $$(tzcompile)' ;\
113 echo '$$(addprefix $$(inst_datadir)/zone%/,$$($*-zones)): \' ;\
114 echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
115 echo ' $$(tzcompile)' ;\
116 echo 'endif' ;\
117 echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
118 ) > $@.new
119 mv $@.new $@
120
121 .PHONY: echo-zonenames
122 echo-zonenames:
123 @echo 'Known zones: $(zonenames)'
124
125
126 # We have to use `-d $(inst_zonedir)' to explictly tell zic where to
127 # place the output files although $(zonedir) is compiled in. But the
128 # user might have set $(install_root) on the command line of `make install'.
129 zic-cmd = $(built-program-cmd) -d $(inst_zonedir)
130 tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
131 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
132
133 # The source files specify the zone names relative to the -d directory,
134 # so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix
135 # and the like. This magic extracts /posix or /right if it's the first
136 # component after $(inst_zonedir) in the target name $@.
137 target-zone-flavor = $(filter /posix /right, \
138 /$(firstword $(subst /, , \
139 $(patsubst $(inst_zonedir)/%,%,$@))))
140
141 ifdef localtime
142 $(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \
143 $(+force)
144 $(make-target-directory)
145 if test -r $@; then \
146 echo Site timezone NOT reset to Factory.; \
147 else \
148 rm -f $@T; \
149 $(SHELL) $(..)scripts/rellns-sh $< $@T; \
150 mv -f $@T $@; \
151 fi
152 endif
153 ifdef posixrules
154 $(installed-posixrules-file): $(inst_zonedir)/$(posixrules) $(objpfx)zic \
155 $(+force)
156 $(zic-cmd) -p $(posixrules)
157 endif
158
159
160 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
161
162 tz-cflags = -DTZDIR='"$(zonedir)"' \
163 -DTZDEFAULT='"$(localtime-file)"' \
164 -DTZDEFRULES='"$(posixrules-file)"' \
165 -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
166
167 CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
168 CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
169 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
170 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
171
172 # We have to make sure the data for testing the tz functions is available.
173 # Don't add leapseconds here since test-tz made checks that work only without
174 # leapseconds.
175 testdata = $(objpfx)testdata
176 define build-testdata
177 GCONV_PATH=${common-objpfx}iconvdata \
178 $(built-program-cmd) -d $(testdata) -y ./yearistype $<
179 endef
180
181 $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
182 $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
183 Europe/Berlin Universal \
184 Australia/Melbourne \
185 America/Sao_Paulo Asia/Tokyo \
186 Europe/London)
187
188 test-tz-ENV = TZDIR=$(testdata)
189 tst-timezone-ENV = TZDIR=$(testdata)
190
191 $(testdata)/America/New_York: northamerica $(objpfx)zic $(leapseconds) \
192 yearistype
193 $(build-testdata)
194 $(testdata)/Etc/UTC: etcetera $(objpfx)zic $(leapseconds) yearistype
195 $(build-testdata)
196 $(testdata)/UTC: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \
197 $(leapseconds) yearistype
198 $(build-testdata)
199 $(testdata)/Europe/Berlin: europe $(objpfx)zic $(leapseconds) yearistype
200 $(build-testdata)
201 $(testdata)/Universal: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \
202 $(leapseconds) yearistype
203 $(build-testdata)
204 $(testdata)/Australia/Melbourne: australasia $(objpfx)zic $(leapseconds) \
205 yearistype
206 $(build-testdata)
207 $(testdata)/America/Sao_Paulo: southamerica $(objpfx)zic $(leapseconds) \
208 yearistype
209 $(build-testdata)
210 $(testdata)/Asia/Tokyo: asia $(objpfx)zic $(leapseconds) yearistype
211 $(build-testdata)
212 $(testdata)/Europe/London: europe $(objpfx)zic $(leapseconds) yearistype
213 $(build-testdata)
214
215
216 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
217 sed -e 's%@KSH@%$(KSH)%g' \
218 -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new
219 chmod 555 $@.new
220 mv -f $@.new $@
221
222 $(addprefix $(inst_zonedir)/,iso3166.tab zone.tab): \
223 $(inst_zonedir)/%: % $(+force)
224 $(do-install)