]>
Commit | Line | Data |
---|---|---|
d614a753 | 1 | # Copyright (C) 1998-2020 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 | 14 | # You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | # License along with the GNU C Library; if not, see |
5a82c748 | 16 | # <https://www.gnu.org/licenses/>. |
14ea22e9 UD |
17 | |
18 | # | |
19 | # Makefile for timezone information | |
20 | # | |
21 | subdir := timezone | |
22 | ||
a5f891ac JM |
23 | include ../Makeconfig |
24 | ||
14ea22e9 | 25 | others := zdump zic |
42261ad7 | 26 | tests := test-tz tst-timezone tst-tzset |
14ea22e9 | 27 | |
f08e9a26 | 28 | generated-dirs += testdata |
14ea22e9 | 29 | |
14ea22e9 | 30 | generated += tzselect |
14ea22e9 | 31 | |
6f99f280 JM |
32 | testdata = $(objpfx)testdata |
33 | ||
1cba4036 MF |
34 | ifeq ($(enable-timezone-tools),yes) |
35 | install-sbin := zic zdump | |
36 | install-bin-script = tzselect | |
37 | endif | |
38 | ||
85bb81c9 | 39 | ifeq ($(run-built-tests),yes) |
6f99f280 JM |
40 | # List zones generated by separate commands running zic on the host. |
41 | # Each such zic run counts as a separate test. | |
42 | test-zones := America/New_York Etc/UTC UTC Europe/Berlin \ | |
c83196b0 AS |
43 | Australia/Melbourne America/Sao_Paulo Asia/Tokyo \ |
44 | $(posixrules-file) | |
6f99f280 | 45 | tests-special += $(addprefix $(testdata)/, $(test-zones)) |
85bb81c9 | 46 | endif |
6f99f280 | 47 | |
14ea22e9 UD |
48 | include ../Rules |
49 | ||
50 | ||
9ec6f8bd JM |
51 | $(objpfx)zic.o $(objpfx)zdump.o: $(objpfx)version.h |
52 | ||
53 | $(objpfx)version.h: $(common-objpfx)config.make | |
e27d476a | 54 | echo 'static char const TZVERSION[]="$(version)";' \ |
9ec6f8bd JM |
55 | > $@.new |
56 | mv -f $@.new $@ | |
57 | ||
14ea22e9 UD |
58 | tz-cflags = -DTZDIR='"$(zonedir)"' \ |
59 | -DTZDEFAULT='"$(localtime-file)"' \ | |
a709dd43 | 60 | -DTZDEFRULES='"$(posixrules-file)"' \ |
670a687d | 61 | -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone \ |
92bd70fb JM |
62 | -DHAVE_GETTEXT -DUSE_LTZ=0 -D_ISOMAC -DTZ_DOMAIN='"libc"' \ |
63 | -include $(common-objpfx)config.h -Wno-maybe-uninitialized | |
14ea22e9 | 64 | |
939e092a SE |
65 | # The -Wno-unused-variable flag is used to prevent GCC 6 |
66 | # from warning about time_t_min and time_t_max which are | |
67 | # defined in private.h but not used. | |
36975e8e L |
68 | CFLAGS-zdump.c += $(tz-cflags) |
69 | CFLAGS-zic.c += $(tz-cflags) -Wno-unused-variable | |
14ea22e9 UD |
70 | |
71 | # We have to make sure the data for testing the tz functions is available. | |
07435eb4 UD |
72 | # Don't add leapseconds here since test-tz made checks that work only without |
73 | # leapseconds. | |
298f2566 | 74 | define build-testdata |
686554bf | 75 | $(built-program-cmd) -d $(testdata) -y ./yearistype $<; \ |
6f99f280 | 76 | $(evaluate-test) |
298f2566 | 77 | endef |
14ea22e9 | 78 | |
298f2566 UD |
79 | $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC) |
80 | $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \ | |
81 | Europe/Berlin Universal \ | |
82 | Australia/Melbourne \ | |
bd619390 | 83 | America/New_York \ |
390955cb UD |
84 | America/Sao_Paulo Asia/Tokyo \ |
85 | Europe/London) | |
42261ad7 | 86 | $(objpfx)tst-tzset.out: $(addprefix $(testdata)/XT, 1 2 3 4) |
298f2566 UD |
87 | |
88 | test-tz-ENV = TZDIR=$(testdata) | |
89 | tst-timezone-ENV = TZDIR=$(testdata) | |
42261ad7 | 90 | tst-tzset-ENV = TZDIR=$(testdata) |
298f2566 | 91 | |
21cee297 RM |
92 | # Note this must come second in the deps list for $(built-program-cmd) to work. |
93 | zic-deps = $(objpfx)zic $(leapseconds) yearistype | |
94 | ||
95 | $(testdata)/America/New_York: northamerica $(zic-deps) | |
298f2566 | 96 | $(build-testdata) |
c83196b0 AS |
97 | $(testdata)/$(posixrules-file): $(testdata)/America/New_York |
98 | $(make-link); $(evaluate-test) | |
21cee297 | 99 | $(testdata)/Etc/UTC: etcetera $(zic-deps) |
298f2566 | 100 | $(build-testdata) |
21cee297 RM |
101 | # Use a pattern rule to indicate the command produces both targets at once. |
102 | # Two separate targets built separately can collide if in parallel. | |
103 | %/UTC %/Universal: simplebackw $(zic-deps) %/Etc/UTC | |
298f2566 | 104 | $(build-testdata) |
86fe1874 SL |
105 | { test -r $(@D)/Universal.test-result \ |
106 | && cp $(@D)/Universal.test-result $(@D)/UTC.test-result \ | |
107 | && sed -i 's/Universal/UTC/' $(@D)/UTC.test-result ; exit 0; } | |
108 | { test -r $(@D)/UTC.test-result \ | |
109 | && cp $(@D)/UTC.test-result $(@D)/Universal.test-result \ | |
110 | && sed -i 's/UTC/Universal/' $(@D)/Universal.test-result ; exit 0; } | |
21cee297 | 111 | $(testdata)/%/Berlin $(testdata)/%/London: europe $(zic-deps) |
298f2566 | 112 | $(build-testdata) |
21cee297 | 113 | $(testdata)/Australia/Melbourne: australasia $(zic-deps) |
298f2566 | 114 | $(build-testdata) |
21cee297 | 115 | $(testdata)/America/Sao_Paulo: southamerica $(zic-deps) |
90865aa8 | 116 | $(build-testdata) |
21cee297 | 117 | $(testdata)/Asia/Tokyo: asia $(zic-deps) |
a3e0e9ae | 118 | $(build-testdata) |
14ea22e9 | 119 | |
42261ad7 | 120 | $(testdata)/XT%: testdata/XT% |
3cc652e9 | 121 | $(make-target-directory) |
42261ad7 | 122 | cp $< $@ |
14ea22e9 UD |
123 | |
124 | $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make | |
73f79bb7 | 125 | sed -e 's|/bin/bash|$(BASH)|' \ |
c72399fb | 126 | -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \ |
e27d476a JM |
127 | -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \ |
128 | -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \ | |
129 | -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \ | |
0aa8f8a1 | 130 | < $< > $@.new |
14ea22e9 UD |
131 | chmod 555 $@.new |
132 | mv -f $@.new $@ |