]> git.ipfire.org Git - thirdparty/glibc.git/blame - timezone/Makefile
Correct and improve fread_unlocked and fwrite_unlocked optimizations.
[thirdparty/glibc.git] / timezone / Makefile
CommitLineData
14ea22e9
UD
1# Copyright (C) 1998 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#
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 \
34 southamerica etcetera factory systemv \
35 solar87 solar88 solar89
36tzlinks := backward
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
51# z.* use this variable.
52define nl
53
54
55endef
a709dd43 56ifndef avoid-generated
14ea22e9
UD
57-include $(addprefix $(objpfx)z.,$(tzfiles))
58endif
59
60# Make these absolute file names.
61installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \
62 $(addprefix $(inst_zonedir)/, \
63 $(localtime-file)))
64installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
65 $(addprefix $(inst_zonedir)/, \
66 $(posixrules-file)))
67
68ifeq ($(cross-compiling),no)
69# Don't try to install the zoneinfo files since we can't run zic.
70install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \
71 $(zonenames:%=posix/%) \
72 $(zonenames:%=right/%)) \
73 $(installed-localtime-file) $(installed-posixrules-file)
74endif
75
76ifeq ($(have-ksh),yes)
77install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab
78install-bin += tzselect
79generated += tzselect
80endif
81
82include ../Rules
83
84
85$(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
86# Kludge alert: we use an implicit rule (in what we are generating here)
87# because that is the only way to tell Make that the one command builds all
88# the files.
89# The extra kludge for the $(tzlinks) files is necessary since running zic
90# this file requires all other files to exist. Blech!
91 (echo 'define $*-zones' ;\
5aa8ff62 92 $(AWK) '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\
14ea22e9
UD
93 echo 'endef' ;\
94 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
95 echo 'ifdef $*-zones' ;\
96 if test x$(findstring $*, $(tzlinks)) != x; then \
97 echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\
64ea8bea 98 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\
14ea22e9 99 echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\
64ea8bea 100 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\
14ea22e9 101 echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\
64ea8bea 102 echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
14ea22e9
UD
103 fi ;\
104 echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
105 echo '$< $$(objpfx)zic leapseconds yearistype' ;\
106 echo ' $$(tzcompile)' ;\
107 echo '$$(addprefix $$(inst_datadir)/zone%/posix/,$$($*-zones)): \' ;\
108 echo '$< $$(objpfx)zic /dev/null yearistype' ;\
109 echo ' $$(tzcompile)' ;\
110 echo '$$(addprefix $$(inst_datadir)/zone%/,$$($*-zones)): \' ;\
111 echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
112 echo ' $$(tzcompile)' ;\
113 echo 'endif' ;\
114 echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
115 ) > $@.new
116 mv $@.new $@
117
118.PHONY: echo-zonenames
119echo-zonenames:
120 @echo 'Known zones: $(zonenames)'
121
122
123# We have to use `-d $(inst_zonedir)' to explictly tell zic where to
124# place the output files although $(zonedir) is compiled in. But the
125# user might have set $(install_root) on the command line of `make install'.
126zic-cmd = $(built-program-cmd) -d $(inst_zonedir)
127tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
128 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
129
130# The source files specify the zone names relative to the -d directory,
131# so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix
132# and the like. This magic extracts /posix or /right if it's the first
133# component after $(inst_zonedir) in the target name $@.
134target-zone-flavor = $(filter /posix /right, \
135 /$(firstword $(subst /, , \
136 $(patsubst $(inst_zonedir)/%,%,$@))))
137
138ifdef localtime
73237de3
UD
139$(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \
140 $(+force)
14ea22e9
UD
141 $(make-target-directory)
142 if test -r $@; then \
143 echo Site timezone NOT reset to Factory.; \
144 else \
145 rm -f $@T; \
5bc2f642 146 $(SHELL) $(..)scripts/rellns-sh $< $@T; \
14ea22e9
UD
147 mv -f $@T $@; \
148 fi
149endif
150ifdef posixrules
73237de3
UD
151$(installed-posixrules-file): $(inst_zonedir)/$(posixrules) $(objpfx)zic \
152 $(+force)
14ea22e9
UD
153 $(zic-cmd) -p $(posixrules)
154endif
155
156
157$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
158
159tz-cflags = -DTZDIR='"$(zonedir)"' \
160 -DTZDEFAULT='"$(localtime-file)"' \
a709dd43
UD
161 -DTZDEFRULES='"$(posixrules-file)"' \
162 -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
14ea22e9 163
a709dd43 164CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
14ea22e9
UD
165CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
166CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
167CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
14ea22e9
UD
168
169# We have to make sure the data for testing the tz functions is available.
07435eb4
UD
170# Don't add leapseconds here since test-tz made checks that work only without
171# leapseconds.
298f2566
UD
172testdata = $(objpfx)testdata
173define build-testdata
07435eb4 174$(built-program-cmd) -d $(testdata) -y ./yearistype $<
298f2566 175endef
14ea22e9 176
298f2566
UD
177$(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
178$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
179 Europe/Berlin Universal \
180 Australia/Melbourne \
90865aa8 181 America/Sao_Paulo Asia/Tokyo)
298f2566
UD
182
183test-tz-ENV = TZDIR=$(testdata)
184tst-timezone-ENV = TZDIR=$(testdata)
185
186$(testdata)/America/New_York: northamerica $(objpfx)zic $(leapseconds) \
187 yearistype
188 $(build-testdata)
189$(testdata)/Etc/UTC: etcetera $(objpfx)zic $(leapseconds) yearistype
190 $(build-testdata)
191$(testdata)/UTC: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \
192 $(leapseconds) yearistype
193 $(build-testdata)
194$(testdata)/Europe/Berlin: europe $(objpfx)zic $(leapseconds) yearistype
195 $(build-testdata)
196$(testdata)/Universal: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \
197 $(leapseconds) yearistype
198 $(build-testdata)
199$(testdata)/Australia/Melbourne: australasia $(objpfx)zic $(leapseconds) \
200 yearistype
201 $(build-testdata)
202$(testdata)/America/Sao_Paulo: southamerica $(objpfx)zic $(leapseconds) \
203 yearistype
204 $(build-testdata)
90865aa8
UD
205$(testdata)/Asia/Tokyo: asia $(objpfx)zic $(leapseconds) yearistype
206 $(build-testdata)
14ea22e9
UD
207
208
209$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
210 sed -e 's%@KSH@%$(KSH)%g' \
211 -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new
212 chmod 555 $@.new
213 mv -f $@.new $@
214
73237de3
UD
215$(addprefix $(inst_zonedir)/,iso3166.tab zone.tab): \
216 $(inst_zonedir)/%: % $(+force)
14ea22e9 217 $(do-install)