glibc/timezone/Makefile
Paul Eggert 1f94147a79 timezone: sync to TZDB 2024a
Sync tzselect, zdump, zic to TZDB 2024a.
This patch incorporates the following TZDB source code changes,
listed roughly in descending order of importance.

  zic now supports links to links, needed for future tzdata
  zic now defaults to '-b slim'
  zic now updates output files atomically
  zic has new options -R, -l -, -p -
  zic -r now uses -00 for unspecified timestamps
  zdump now uses [lo,hi) for both -c and -t
  Fix several integer overflow bugs
  zic now checks input bytes more carefully
  Simplify and fix new TZDIR setup
  Default time_t to 64 bits on glibc 2.34+ 32-bit
  zic now generates TZ strings that conform to POSIX when all-year DST
  zic -v now shows extreme-int tm_year transitions
  Fix zic bug in last time type of Asia/Gaza etc.
  Fix zic bug with Palestine after 2075
  Fix bug uncovered by recent change to Iran history
  Fix 'zic -b fat' bug with Port Moresby 32-bit data
  Fix zic bug with -r @X where X is deduced from TZ
  Fix bug with zic -r cutoff before 1st transition
  Fix leap second expiry and truncation
  Fix zic bug on Linux 2.6.16 and 2.6.17
  Fix bug with 'zic -d /a/b/c' if /a is unwriteable
  Don't mistruncate TZif files at leap seconds
  Fix zdump undefined behavior if !USE_LTZ
  zdump -v reports localtime+gmtime failures better
  Fix zdump diagnostic for missing timezone
  Don't assume nonempty argv
  Port better to C23
  Do not assume negative >> behavior
  I18nize zdump a bit better
  Port zdump to right_only installations
  New tzselect menu option 'now'
  tzselect can now use current time to help choose
  Improve tzselect behavior for Turkey etc.
  tzselect: do not create temporary files
  tzselect: work around mawk bug with {2,}
  tzselect: Port to POSIX awk, which prohibits -v newlines
  Do not use empty RE in tzselect
  Don't set TZ in tzselect
  Avoid sed, expr in tzselect
  tzselect: Fix problems with spaces in TZDIR
  Improve tzselect diagnostics
  Remove zic workaround for Qt bug 53071
  Remove zic support for "min" in Rule lines
  Remove zic support for zic -y, Rule TYPEs, pacificnew
  Remove tzselect workaround for Bash 1.14.7 bug

* SHARED-FILES: Update to match current sync.
* config.h.in (HAVE_STRERROR): Remove; no longer needed.
* timezone/Makefile ($(objpfx)zic.o): Depend on tzdir.h.
($(objpfx)tzdir.h): New rule to build a placeholder.
* timezone/private.h, timezone/tzfile.h, timezone/version:
* timezone/zdump.c, timezone/zic.c: Copy verbatim from TZDB 2024a.
2024-04-07 13:35:48 -07:00

149 lines
4.8 KiB
Makefile

# Copyright (C) 1998-2024 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <https://www.gnu.org/licenses/>.
#
# Makefile for timezone information
#
subdir := timezone
include ../Makeconfig
others := zdump zic
tests := test-tz tst-timezone tst-tzset tst-bz28707 tst-bz29951
generated-dirs += testdata
generated += tzselect
testdata = $(objpfx)testdata
ifeq ($(enable-timezone-tools),yes)
install-sbin := zic
install-bin := zdump
install-bin-script = tzselect
endif
ifeq ($(run-built-tests),yes)
# List zones generated by separate commands running zic on the host.
# Each such zic run counts as a separate test.
test-zones := America/New_York Etc/UTC UTC Europe/Berlin \
Australia/Melbourne America/Sao_Paulo Asia/Tokyo \
$(posixrules-file)
tests-special += $(addprefix $(testdata)/, $(test-zones))
endif
include ../Rules
$(objpfx)zic.o: $(objpfx)tzdir.h
# In glibc this file is an empty placeholder,
# as tz-cflags defines TZDEFAULT and TZDIR.
$(objpfx)tzdir.h:
> $@
$(objpfx)zic.o $(objpfx)zdump.o: $(objpfx)version.h
$(objpfx)version.h: $(common-objpfx)config.make
echo 'static char const TZVERSION[]="$(version)";' \
> $@.new
mv -f $@.new $@
tz-cflags = -DTZDIR='"$(zonedir)"' \
-DTZDEFAULT='"$(localtime-file)"' \
-DTZDEFRULES='"$(posixrules-file)"' \
-DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone \
-DHAVE_GETTEXT -DUSE_LTZ=0 -D_ISOMAC -DTZ_DOMAIN='"libc"' \
-include $(common-objpfx)config.h -Wno-maybe-uninitialized
# The -Wno-unused-variable flag is used to prevent GCC 6
# from warning about time_t_min and time_t_max which are
# defined in private.h but not used.
CFLAGS-zdump.c += $(tz-cflags)
CFLAGS-zic.c += $(tz-cflags) -Wno-unused-variable
# We have to make sure the data for testing the tz functions is available.
# Don't add leapseconds here since test-tz made checks that work only without
# leapseconds.
define build-testdata
$(built-program-cmd) -d $(testdata) -y ./yearistype $<; \
$(evaluate-test)
endef
$(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
Europe/Berlin Universal \
Australia/Melbourne \
America/New_York \
America/Sao_Paulo Asia/Tokyo \
Europe/London)
$(objpfx)tst-tzset.out: $(addprefix $(testdata)/XT, 1 2 3 4)
$(objpfx)tst-bz28707.out: $(testdata)/XT5
$(objpfx)tst-bz29951.out: $(testdata)/XT6
test-tz-ENV = TZDIR=$(testdata)
tst-timezone-ENV = TZDIR=$(testdata)
tst-tzset-ENV = TZDIR=$(testdata)
tst-bz28707-ENV = TZDIR=$(testdata)
tst-bz29951-ENV = TZDIR=$(testdata)
# Note this must come second in the deps list for $(built-program-cmd) to work.
zic-deps = $(objpfx)zic $(leapseconds) yearistype
$(testdata)/America/New_York: northamerica $(zic-deps)
$(build-testdata)
$(testdata)/$(posixrules-file): $(testdata)/America/New_York
$(make-link); $(evaluate-test)
$(testdata)/Etc/UTC: etcetera $(zic-deps)
$(build-testdata)
# Use a pattern rule to indicate the command produces both targets at once.
# Two separate targets built separately can collide if in parallel.
%/UTC %/Universal: simplebackw $(zic-deps) %/Etc/UTC
$(build-testdata)
{ test -r $(@D)/Universal.test-result \
&& cp $(@D)/Universal.test-result $(@D)/UTC.test-result \
&& sed -i 's/Universal/UTC/' $(@D)/UTC.test-result ; exit 0; }
{ test -r $(@D)/UTC.test-result \
&& cp $(@D)/UTC.test-result $(@D)/Universal.test-result \
&& sed -i 's/UTC/Universal/' $(@D)/Universal.test-result ; exit 0; }
$(testdata)/%/Berlin $(testdata)/%/London: europe $(zic-deps)
$(build-testdata)
$(testdata)/Australia/Melbourne: australasia $(zic-deps)
$(build-testdata)
$(testdata)/America/Sao_Paulo: southamerica $(zic-deps)
$(build-testdata)
$(testdata)/Asia/Tokyo: asia $(zic-deps)
$(build-testdata)
$(testdata)/XT%: testdata/XT%
$(make-target-directory)
cp $< $@
$(testdata)/XT5: testdata/gen-XT5.sh
$(make-target-directory)
$(SHELL) $< > $@.tmp
mv $@.tmp $@
$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
sed -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
-e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
-e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
-e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
< $< > $@.new
chmod 555 $@.new
mv -f $@.new $@