Replace FSF snail mail address with URLs.
[glibc.git] / timezone / Makefile
blobe8fb7162f4065363166257cc53f21a65e3968f87
1 # Copyright (C) 1998,1999,2000,2002,2005,2007 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 # Makefile for timezone information
21 subdir := timezone
23 distribute := tzfile.h private.h scheck.c ialloc.c yearistype \
24 iso3166.tab zone.tab tzselect.ksh checktab.awk \
25 README
27 extra-objs := scheck.o ialloc.o
29 others := zdump zic
30 tests := test-tz tst-timezone
32 tzbases := africa antarctica asia australasia europe northamerica \
33 southamerica etcetera factory \
34 solar87 solar88 solar89
35 tzlinks := backward systemv
36 tzfiles := $(tzbases) $(tzlinks)
37 # pacificnew doesn't compile; if it is to be used, it should be included in
38 # northamerica.
39 distribute += $(tzfiles) leapseconds pacificnew simplebackw
41 generated := $(addprefix z.,$(tzfiles))
42 install-sbin := zic zdump
44 generated-dirs = testdata
46 all: # Make this the default target; it will be defined in Rules.
48 include ../Makeconfig # Get objpfx defined so we can use it below.
50 CPPFLAGS-zic = -DNOT_IN_libc
52 # z.* use this variable.
53 define nl
56 endef
57 ifndef avoid-generated
58 ifndef inhibit_timezone_rules
59 -include $(addprefix $(objpfx)z.,$(tzfiles))
60 endif
61 endif
63 # Make these absolute file names.
64 installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \
65 $(addprefix $(inst_zonedir)/, \
66 $(localtime-file)))
67 installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
68 $(addprefix $(inst_zonedir)/, \
69 $(posixrules-file)))
71 ifeq ($(cross-compiling),no)
72 # Don't try to install the zoneinfo files since we can't run zic.
73 install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \
74 $(zonenames:%=posix/%) \
75 $(zonenames:%=right/%)) \
76 $(installed-localtime-file) $(installed-posixrules-file)
77 endif
79 ifeq ($(have-ksh),yes)
80 install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab
81 install-bin-script = tzselect
82 generated += tzselect
83 endif
85 include ../Rules
88 $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
89 # Kludge alert: we use an implicit rule (in what we are generating here)
90 # because that is the only way to tell Make that the one command builds all
91 # the files.
92 # The extra kludge for the $(tzlinks) files is necessary since running zic
93 # this file requires all other files to exist. Blech!
94 $(make-target-directory)
95 (echo 'define $*-zones' ;\
96 $(AWK) '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\
97 echo 'endef' ;\
98 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
99 echo 'ifdef $*-zones' ;\
100 if test x$(findstring $*, $(tzlinks)) != x; then \
101 echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\
102 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\
103 echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\
104 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\
105 echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\
106 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
107 fi ;\
108 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;\
109 echo '$< $$(objpfx)zic leapseconds yearistype' ;\
110 echo ' $$(tzcompile)' ;\
111 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;\
112 echo '$< $$(objpfx)zic /dev/null yearistype' ;\
113 echo ' $$(tzcompile)' ;\
114 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;\
115 echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
116 echo ' $$(tzcompile)' ;\
117 echo 'endif' ;\
118 echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
119 ) > $@.new
120 mv $@.new $@
122 .PHONY: echo-zonenames
123 echo-zonenames:
124 @echo 'Known zones: $(zonenames)'
127 # We have to use `-d $(inst_zonedir)' to explictly tell zic where to
128 # place the output files although $(zonedir) is compiled in. But the
129 # user might have set $(install_root) on the command line of `make install'.
130 zic-cmd = $(built-program-cmd) -d $(inst_zonedir)
131 tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
132 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
134 # The source files specify the zone names relative to the -d directory,
135 # so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix
136 # and the like. This magic extracts /posix or /right if it's the first
137 # component after $(inst_zonedir) in the target name $@.
138 target-zone-flavor = $(filter /posix /right, \
139 /$(firstword $(subst /, , \
140 $(patsubst $(inst_zonedir)/%,%,$@))))
142 ifdef localtime
143 $(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \
144 $(+force)
145 $(make-target-directory)
146 if test -r $@; then \
147 echo Site timezone NOT reset to Factory.; \
148 else \
149 rm -f $@T; \
150 $(SHELL) $(..)scripts/rellns-sh $< $@T; \
151 mv -f $@T $@; \
153 endif
154 ifdef posixrules
155 $(installed-posixrules-file): $(inst_zonedir)/$(posixrules) $(objpfx)zic \
156 $(+force)
157 $(zic-cmd) -p $(posixrules)
158 endif
161 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
163 tz-cflags = -DTZDIR='"$(zonedir)"' \
164 -DTZDEFAULT='"$(localtime-file)"' \
165 -DTZDEFRULES='"$(posixrules-file)"' \
166 -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
168 CFLAGS-zdump.c = -fwrapv -Wno-strict-prototypes -DNOID $(tz-cflags) \
169 -DHAVE_GETTEXT
170 CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags) -DHAVE_GETTEXT
171 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT
172 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT
174 # We have to make sure the data for testing the tz functions is available.
175 # Don't add leapseconds here since test-tz made checks that work only without
176 # leapseconds.
177 testdata = $(objpfx)testdata
178 define build-testdata
179 GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \
180 $(built-program-cmd) -d $(testdata) -y ./yearistype $<
181 endef
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 \
187 America/Sao_Paulo Asia/Tokyo \
188 Europe/London)
190 test-tz-ENV = TZDIR=$(testdata)
191 tst-timezone-ENV = TZDIR=$(testdata)
193 # Note this must come second in the deps list for $(built-program-cmd) to work.
194 zic-deps = $(objpfx)zic $(leapseconds) yearistype
196 $(testdata)/America/New_York: northamerica $(zic-deps)
197 $(build-testdata)
198 $(testdata)/Etc/UTC: etcetera $(zic-deps)
199 $(build-testdata)
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
203 $(build-testdata)
204 $(testdata)/%/Berlin $(testdata)/%/London: europe $(zic-deps)
205 $(build-testdata)
206 $(testdata)/Australia/Melbourne: australasia $(zic-deps)
207 $(build-testdata)
208 $(testdata)/America/Sao_Paulo: southamerica $(zic-deps)
209 $(build-testdata)
210 $(testdata)/Asia/Tokyo: asia $(zic-deps)
211 $(build-testdata)
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 $@
220 $(addprefix $(inst_zonedir)/,iso3166.tab zone.tab): \
221 $(inst_zonedir)/%: % $(+force)
222 $(do-install)