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