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