Home | History | Annotate | Line # | Download | only in time
      1 # Make and install tzdb code and data.
      2 # This file is in the public domain, so clarified as of
      3 # 2009-05-17 by Arthur David Olson.
      4 # Request POSIX conformance; this must be the first non-comment line.
      5 .POSIX:
      6 # By default, builds of code and data assume POSIX.1-2001 or later;
      7 # this assumption can be relaxed by tailoring the build as described below.
      8 # On older platforms you may need to scrounge for POSIX conformance.
      9 # For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007),
     10 # use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'.
     11 # Reproducible builds of distribution tarballs also need a copy of the
     12 # Git repository, and assume the behavior of the following programs
     13 # (or later versions):
     14 #	Git 2.7.0 (2016)
     15 #	GNU Coreutils 6.3 (2006)
     16 #	GNU Tar 1.14 (2004)
     17 #	GnuPG 1.4 (2004)
     18 # Although tzdb does not come with a software bill of materials,
     19 # you should be able to construct one based on the above information,
     20 # your platform, and the way you use this Makefile.
     21 
     22 # To affect how this Makefile works, you can run a shell script like this:
     23 #
     24 #	#!/bin/sh
     25 #	make CFLAGS='-O2 -DHAVE_GETTEXT=0' "$@"
     26 #
     27 # This example script is appropriate for a GNU/Linux system
     28 # which needs more optimization than default, and which does not want
     29 # gettext's internationalization of diagnostics.
     30 #
     31 # Alternatively, you can simply edit this Makefile to tailor the following
     32 # macro definitions.
     33 
     34 ###############################################################################
     35 # Start of macros that one plausibly might want to tailor.
     36 
     37 # Package name for the code distribution.
     38 PACKAGE=	tzcode
     39 
     40 # Version number for the distribution, overridden in the 'tarballs' rule below.
     41 VERSION=	unknown
     42 
     43 # Email address for bug reports.
     44 BUGEMAIL=	tz@iana.org
     45 
     46 # DATAFORM selects the data format.
     47 # Available formats represent essentially the same data, albeit
     48 # possibly with minor discrepancies that users are not likely to notice.
     49 # To get new features and the best data right away, use:
     50 #	DATAFORM=	vanguard
     51 # To wait a while before using new features, to give downstream users
     52 # time to upgrade zic (the default), use:
     53 #	DATAFORM=	main
     54 # To wait even longer for new features, use:
     55 #	DATAFORM=	rearguard
     56 # Rearguard users might also want "ZFLAGS = -b fat"; see below.
     57 DATAFORM=		main
     58 
     59 # Change the line below for your timezone (after finding the one you want in
     60 # one of the $(TDATA) source files, or adding it to a source file).
     61 # Alternatively, if you discover you've got the wrong timezone, you can just
     62 # 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
     63 # Use the command
     64 #	make zonenames
     65 # to get a list of the values you can use for LOCALTIME.
     66 
     67 LOCALTIME=	Factory
     68 
     69 # The POSIXRULES macro controls interpretation of POSIX-like TZ
     70 # settings like TZ='EET-2EEST' that lack DST transition rules.
     71 # If POSIXRULES is '-', no template is installed; this is the default.
     72 # Any other value for POSIXRULES is obsolete and should not be relied on, as:
     73 # * It does not work correctly in popular implementations such as GNU/Linux.
     74 # * It does not work even in tzcode, except for historical timestamps
     75 #   that precede the last explicit transition in the POSIXRULES file.
     76 #   Hence it typically does not work for current and future timestamps.
     77 # If, despite the above, you want a template for handling these settings,
     78 # you can change the line below (after finding the timezone you want in the
     79 # one of the $(TDATA) source files, or adding it to a source file).
     80 # Alternatively, if you discover you've got the wrong timezone, you can just
     81 # 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
     82 # Use the command
     83 #	make zonenames
     84 # to get a list of the values you can use for POSIXRULES.
     85 
     86 POSIXRULES=	-
     87 
     88 # Also see TZDEFRULESTRING below, which takes effect only
     89 # if POSIXRULES is '-' or if the template file cannot be accessed.
     90 
     91 
     92 # Installation locations.
     93 #
     94 # The defaults are suitable for Debian, except that if REDO is
     95 # posix_right or right_posix then files that Debian puts under
     96 # /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
     97 # put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
     98 # respectively.  Problems with the Debian approach are discussed in
     99 # the commentary for the right_posix rule (below).
    100 
    101 # Destination directory, which can be used for staging.
    102 # 'make DESTDIR=/stage install' installs under /stage (e.g., to
    103 # /stage/etc/localtime instead of to /etc/localtime).  Files under
    104 # /stage are not intended to work as-is, but can be copied by hand to
    105 # the root directory later.  If DESTDIR is empty, 'make install' does
    106 # not stage, but installs directly into production locations.
    107 DESTDIR =
    108 
    109 # Everything is installed into subdirectories of TOPDIR, and used there.
    110 # TOPDIR should be empty (meaning the root directory),
    111 # or a directory name that does not end in "/".
    112 # TOPDIR should be empty or an absolute name unless you're just testing.
    113 TOPDIR =
    114 
    115 # The default local timezone is taken from the file TZDEFAULT.
    116 TZDEFAULT = $(TOPDIR)/etc/localtime
    117 
    118 # The subdirectory containing installed program and data files, and
    119 # likewise for installed files that can be shared among architectures.
    120 # These should be relative file names.
    121 USRDIR = usr
    122 USRSHAREDIR = $(USRDIR)/share
    123 
    124 # "Compiled" timezone information is placed in the "TZDIR" directory
    125 # (and subdirectories).
    126 # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
    127 TZDIR_BASENAME=	zoneinfo
    128 TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
    129 
    130 # The "tzselect" and (if you do "make INSTALL") "date" commands go in:
    131 BINDIR = $(TOPDIR)/$(USRDIR)/bin
    132 
    133 # The "zdump" command goes in:
    134 ZDUMPDIR = $(BINDIR)
    135 
    136 # The "zic" command goes in:
    137 ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
    138 
    139 # Manual pages go in subdirectories of. . .
    140 MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
    141 
    142 # Library functions are put in an archive in LIBDIR.
    143 LIBDIR = $(TOPDIR)/$(USRDIR)/lib
    144 
    145 
    146 # Types to try, as an alternative to time_t.
    147 TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
    148 TIME_T_ALTERNATIVES_HEAD = int_least64_t.ck
    149 TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \
    150   uint_least64_t.ck
    151 
    152 # What kind of TZif data files to generate.  (TZif is the binary time
    153 # zone data format that zic generates; see Internet RFC 9636.)
    154 # If you want only POSIX time, with time values interpreted as
    155 # seconds since the epoch (not counting leap seconds), use
    156 #	REDO=		posix_only
    157 # below.  If you want only "right" time, with values interpreted
    158 # as seconds since the epoch (counting leap seconds), use
    159 #	REDO=		right_only
    160 # below.  If you want both sets of data available, with leap seconds not
    161 # counted normally, use
    162 #	REDO=		posix_right
    163 # below.  If you want both sets of data available, with leap seconds counted
    164 # normally, use
    165 #	REDO=		right_posix
    166 # below.  POSIX mandates that leap seconds not be counted, and a
    167 # nonnegative TZ_CHANGE_INTERVAL also assumes this, so to be compatible with
    168 # these, use "posix_only" or "posix_right".  Use POSIX time on systems with
    169 # leap smearing; this can work better than unsmeared "right" time with
    170 # applications that are not leap second aware, and is closer to unsmeared
    171 # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
    172 
    173 REDO=		posix_right
    174 
    175 # Whether to put an "Expires" line in the leapseconds file.
    176 # Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
    177 # The EXPIRES_LINE value matters only if REDO's value contains "right".
    178 # If you change EXPIRES_LINE, remove the leapseconds file before running "make".
    179 # zic's support for the Expires line was introduced in tzdb 2020a,
    180 # and was modified in tzdb 2021b to generate version 4 TZif files.
    181 # EXPIRES_LINE defaults to 0 for now so that the leapseconds file
    182 # can be given to pre-2020a zic implementations and so that TZif files
    183 # built by newer zic implementations can be read by pre-2021b libraries.
    184 EXPIRES_LINE=	0
    185 
    186 # To install data in text form that has all the information of the TZif data,
    187 # (optionally incorporating leap second information), use
    188 #	TZDATA_TEXT=	tzdata.zi leapseconds
    189 # To install text data without leap second information (e.g., because
    190 # REDO='posix_only'), use
    191 #	TZDATA_TEXT=	tzdata.zi
    192 # To avoid installing text data, use
    193 #	TZDATA_TEXT=
    194 
    195 TZDATA_TEXT=	leapseconds tzdata.zi
    196 
    197 # For backward-compatibility links for old zone names, use
    198 #	BACKWARD=	backward
    199 # To omit these links, use
    200 #	BACKWARD=
    201 
    202 BACKWARD=	backward
    203 
    204 # If you want out-of-scope and often-wrong data from the file 'backzone',
    205 # but only for entries listed in the backward-compatibility file zone.tab, use
    206 #	PACKRATDATA=	backzone
    207 #	PACKRATLIST=	zone.tab
    208 # If you want all the 'backzone' data, use
    209 #	PACKRATDATA=	backzone
    210 #	PACKRATLIST=
    211 # To omit this data, use
    212 #	PACKRATDATA=
    213 #	PACKRATLIST=
    214 
    215 PACKRATDATA=
    216 PACKRATLIST=
    217 
    218 # The name of a locale using the UTF-8 encoding, used during self-tests.
    219 # The tests are skipped if the name does not appear to work on this system.
    220 
    221 UTF8_LOCALE=	en_US.utf8
    222 
    223 # Extra flags for producing man page files like tzfile.5.txt.
    224 # These flags are used only if groff (or mandoc) is present.
    225 # Each option should begin with "-" and should lack shell metacharacters.
    226 # Plausible options include -Tascii and -Tutf8.
    227 MANFLAGS=	-Tutf8
    228 
    229 # Non-default libraries needed to link.
    230 # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
    231 LDLIBS=
    232 
    233 # Add the following to an uncommented "CFLAGS=" line as needed
    234 # to override defaults specified in the source code or by the system.
    235 # "-DFOO" is equivalent to "-DFOO=1".
    236 #  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
    237 #	formats that generate only the last two digits of year numbers
    238 #  -DEPOCH_LOCAL if the 'time' function returns local time not UT
    239 #  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
    240 #	than what POSIX specifies, assuming local time is UT.
    241 #	For example, N is 252460800 on AmigaOS.
    242 #  -DFREE_PRESERVES_ERRNO=[01] if the 'free' function munges or preserves errno
    243 #	(default is guessed)
    244 #  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
    245 #	on POSIX platforms predating POSIX.1-2024
    246 #  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
    247 #  -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
    248 #  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
    249 #  -DHAVE_FCHMOD=0 if your system lacks the fchmod function
    250 #  -DHAVE__GENERIC=0 if _Generic does not work*
    251 #  -DHAVE_GETEUID=0 if gete?[ug]id do not work
    252 #  -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
    253 #	-DHAVE_GETRANDOM=0 to avoid using getrandom
    254 #  -DHAVE_GETRESUID=0 if getres[ug]id do not work
    255 #  -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
    256 #	where LDLIBS also needs to contain -lintl on some hosts;
    257 #	-DHAVE_GETTEXT=0 to avoid using gettext
    258 #  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
    259 #	ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier
    260 #	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
    261 #  -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
    262 #  -DHAVE_ISSETUGID=1 if issetugid works, 0 otherwise (default is guessed)
    263 #	If 0, you may also use -DHAVE_SYS_AUXV_H=1 if <sys/auxv.h> works,
    264 #	0 otherwise (default is guessed).
    265 #  -DHAVE_LINK=0 if your system lacks a link function
    266 #  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
    267 #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
    268 #	localtime_rz can make zdump significantly faster, but is nonstandard.
    269 #  -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
    270 #  -DHAVE_MEMPCPY=1 if your system has mempcpy, 0 if not (default is guessed)
    271 #  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
    272 #	variables like 'tzname' required by POSIX
    273 #  -DHAVE_PWD_H=0 if your system lacks pwd.h, grp.h and corresponding functions
    274 #	If 0, you may also need -Dgid_t=G -Duid_t=U
    275 #	to define gid_t and uid_t to be types G and U.
    276 #  -DHAVE_SETENV=0 if your system lacks the setenv function
    277 #  -DHAVE_SETMODE=[01] if your system lacks or has the setmode and getmode
    278 #	functions (default is guessed)
    279 #  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+
    280 #  -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like
    281 #	__builtin_add_overflow work*
    282 #  -DHAVE_STDINT_H=0 if <stdint.h> does not work*+
    283 #  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
    284 #  -DHAVE_STRDUP=0 if your system lacks the strdup function
    285 #  -DHAVE_STRNLEN=0 if your system lacks the strnlen function+
    286 #  -DHAVE_STRTOLL=0 if your system lacks the strtoll function+
    287 #  -DHAVE_STRUCT_STAT_ST_CTIM=0 if struct stat lacks a member st_ctim+
    288 #  -DHAVE_STRUCT_TIMESPEC=0 if your system lacks struct timespec+
    289 #  -DHAVE_SYMLINK=0 if your system lacks the symlink function
    290 #  -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
    291 #	If 0, you may also need -Dmode_t=M to define mode_t to be type M.
    292 #  -DHAVE_TZSET=0 if your system lacks a tzset function
    293 #  -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
    294 #  -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
    295 #  -Dlocale_t=XXX if your system uses XXX instead of locale_t
    296 #  -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow
    297 #  -DOPENAT_TZDIR if tzset should use openat on TZDIR then a relative open.
    298 #	See localtime.c for details.
    299 #  -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
    300 #	Typically it is better to use a later standard.  For example,
    301 #	with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
    302 #	Even with -DPORT_TO_C89, the code needs at least one C99
    303 #	feature (integers at least 64 bits wide) and maybe more.
    304 #  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
    305 #	with external linkage, e.g., applications cannot define 'localtime'.
    306 #  -Dssize_t=int on hosts like MS-Windows that lack ssize_t
    307 #  -DSUPPORT_C89=0 if the tzcode library should not support C89 callers
    308 #	Although -DSUPPORT_C89=0 might work around latent bugs in callers,
    309 #	it does not conform to POSIX.
    310 #  -DSUPPORT_POSIX2008 if the library should support older POSIX callers+
    311 #	However, this might cause problems in POSIX.1-2024-or-later callers.
    312 #  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
    313 #	security implications and is not recommended for general use
    314 #  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
    315 #	not needed by the main-program tz code, which is single-threaded.
    316 #	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
    317 #	The following options can also be used:
    318 #	  -DTHREAD_PREFER_SINGLE to prefer speed in single-threaded apps,
    319 #	    at some cost in CPU time and energy in multi-threaded apps.
    320 #	    The following options can also be used:
    321 #	      -DHAVE___ISTHREADED=1 if there is an extern int __isthreaded
    322 #		variable, 0 otherwise (default is guessed)
    323 #	      -DHAVE_SYS_SINGLE_THREADED_H=0 if <sys/single_threaded.h> works,
    324 #		0 otherwise (default is guessed)
    325 #	  -DTHREAD_RWLOCK to use read-write locks intead of mutexes.
    326 #	    This can improve paralellism and thus save real time
    327 #	    if many threads call tzcode functions simultaneously.
    328 #	    It also costs CPU time and thus energy.
    329 #	  -DTHREAD_TM_MULTI to have gmtime, localtime, and offtime
    330 #	    return different struct tm * addresses in different threads.
    331 #	    This supports unportable programs that call
    332 #	    gmtime/localtime/offtime when they should call
    333 #	    gmtime_r/localtime_r/offtime_r to avoid races.
    334 #	    Because the corresponding storage is freed on thread exit,
    335 #	    this option is incompatible with POSIX.1-2024 and earlier.
    336 #	    It also costs CPU time and memory.
    337 #  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
    338 #	This is intended for internal use only; it mangles external names.
    339 #  -DTZ_CHANGE_INTERVAL=N if functions depending on TZ should check
    340 #	no more often than every N seconds for TZif file changes.
    341 #	If N is negative (the default), no such checking is done.
    342 #	This option is intended for platforms that want localtime etc.
    343 #	to respond to changes to a file selected by TZ, including to
    344 #	TZDEFAULT (normally /etc/localtime) if TZ is unset.
    345 #	On these platforms, REDO should be "posix_only" or "posix_right".
    346 #	This option does not affect tzalloc-allocated objects.
    347 #  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
    348 #  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
    349 #	the default is system-supplied, typically "/usr/lib/locale"
    350 #  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
    351 #	DST transitions for proleptic format TZ strings lacking them,
    352 #	in the usual case where POSIXRULES is '-'.  If not specified,
    353 #	TZDEFRULESTRING defaults to US rules for future DST transitions.
    354 #	This mishandles some past timestamps, as US DST rules have changed.
    355 #	It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
    356 #	as Europe and US DST rules differ.
    357 #  -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254)
    358 #  -DUNINIT_TRAP if reading uninitialized storage can cause problems
    359 #	other than simply getting garbage data
    360 #  -DUSE_LTZ=0 to build zdump with the system time zone library
    361 #	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
    362 #  -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
    363 #	similarly for "slim".  Fat TZif files work around incompatibilities
    364 #	and bugs in some TZif readers, notably older ones that
    365 #	ignore or otherwise mishandle 64-bit data in TZif files;
    366 #	however, fat TZif files may trigger bugs in newer TZif readers.
    367 #	Slim TZif files are more efficient, and are the default.
    368 #  -DZIC_MAX_ABBR_LEN_WO_WARN=3
    369 #	(or some other number) to set the maximum time zone abbreviation length
    370 #	that zic will accept without a warning (the default is 6)
    371 #  -g to generate symbolic debugging info
    372 #  -Idir to include from directory 'dir'
    373 #  -O0 to disable optimization; other -O options to enable more optimization
    374 #  -Uname to remove any definition of the macro 'name'
    375 #  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
    376 #
    377 # * Options marked "*" can be omitted if your compiler is C23 compatible.
    378 # * Options marked "+" are obsolescent and are planned to be removed
    379 #   once the code assumes C99 or later (say in the year 2029)
    380 #   and POSIX.1-2024 or later (say in the year 2034).
    381 #
    382 # Select instrumentation via "make GCC_INSTRUMENT='whatever'".
    383 GCC_INSTRUMENT = \
    384   -fsanitize=undefined -fsanitize-address-use-after-scope \
    385   -fsanitize-trap=all -fstack-protector
    386 # Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
    387 GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \
    388   $(GCC_INSTRUMENT) \
    389   -Wall -Wextra \
    390   -Walloc-size-larger-than=100000 -Warray-bounds=2 \
    391   -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \
    392   -Wdate-time \
    393   -Wdeclaration-after-statement -Wdouble-promotion \
    394   -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \
    395   -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
    396   -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
    397   -Wmissing-declarations -Wmissing-prototypes \
    398   -Wmissing-variable-declarations -Wnested-externs \
    399   -Wnull-dereference \
    400   -Wold-style-definition -Woverlength-strings -Wpointer-arith \
    401   -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
    402   -Wstrict-prototypes -Wstringop-overflow=4 \
    403   -Wstringop-truncation -Wsuggest-attribute=cold \
    404   -Wsuggest-attribute=const -Wsuggest-attribute=format \
    405   -Wsuggest-attribute=malloc \
    406   -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
    407   -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \
    408   -Wvariadic-macros -Wvla -Wwrite-strings \
    409   -Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits
    410 #
    411 # If your system has a "GMT offset" field in its "struct tm"s
    412 # (or if you decide to add such a field in your system's "time.h" file),
    413 # add the name to a define such as
    414 #	-DTM_GMTOFF=tm_gmtoff
    415 # to the end of the "CFLAGS=" line.  If not defined, the code attempts to
    416 # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
    417 # Similarly, if your system has a "zone abbreviation" field, define
    418 #	-DTM_ZONE=tm_zone
    419 # and define NO_TM_ZONE to suppress any guessing.
    420 # Although POSIX.1-2024 requires these fields and they are widely available
    421 # on GNU/Linux and BSD systems, some older systems lack them.
    422 #
    423 # The next batch of options control support for external variables
    424 # exported by tzcode.  In practice these variables are less useful
    425 # than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
    426 # #
    427 # # To omit or support the external variable "tzname", add one of:
    428 # #	-DHAVE_TZNAME=0 # do not support "tzname"
    429 # #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
    430 # #	-DHAVE_TZNAME=2 # support and define "tzname"
    431 # # to the "CFLAGS=" line.  Although "tzname" is required by POSIX.1-1988
    432 # # and later, its contents are unspecified if you use a geographical TZ
    433 # # and the variable is planned to be removed in a future POSIX edition.
    434 # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
    435 # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
    436 # # crashes when combined with some platforms' standard libraries,
    437 # # presumably due to memory allocation issues.
    438 # #
    439 # # To omit or support the external variables "timezone" and "daylight", add
    440 # #	-DUSG_COMPAT=0 # do not support
    441 # #	-DUSG_COMPAT=1 # support, and variables are defined by system library
    442 # #	-DUSG_COMPAT=2 # support and define variables
    443 # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix
    444 # # Systems Group code and are required by POSIX.1-2008 and later (with XSI),
    445 # # although their contents are unspecified if you use a geographical TZ
    446 # # and the variables are planned to be removed in a future edition of POSIX.
    447 # # If not defined, the code attempts to guess USG_COMPAT from other macros.
    448 # #
    449 # # To support the external variable "altzone", add
    450 # #	-DALTZONE=0 # do not support
    451 # #	-DALTZONE=1 # support "altzone", which is defined by system library
    452 # #	-DALTZONE=2 # support and define "altzone"
    453 # # to the end of the "CFLAGS=" line; although "altzone" appeared in
    454 # # System V Release 3.1 it has not been standardized.
    455 # # If not defined, the code attempts to guess ALTZONE from other macros.
    456 #
    457 # If you want functions that were inspired by early versions of X3J11's work,
    458 # add
    459 #	-DSTD_INSPIRED
    460 # to the end of the "CFLAGS=" line.  This arranges for the following
    461 # functions to be added to the time conversion library.
    462 # "offtime" is like "gmtime" except that it accepts a second (long) argument
    463 # that gives an offset to add to the time_t when converting it.
    464 # "offtime_r" is to "offtime" what "gmtime_r" is to "gmtime".
    465 # I.e., "offtime" and "offtime_r" are like calling "localtime_rz"
    466 # with a fixed-offset zone.
    467 # "timelocal" is nearly equivalent to "mktime".
    468 # "timeoff" is like "timegm" except that it accepts a second (long) argument
    469 # that gives an offset to use when converting to a time_t.
    470 # I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone.
    471 # "posix2time" and "time2posix" are described in an included manual page.
    472 # X3J11's work does not describe any of these functions.
    473 # These functions may well disappear in future releases of the time
    474 # conversion package.
    475 #
    476 # If you don't want functions that were inspired by NetBSD, add
    477 #	-DNETBSD_INSPIRED=0
    478 # to the end of the "CFLAGS=" line.  Otherwise, the functions
    479 # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
    480 # time library, and if STD_INSPIRED is also defined to nonzero the functions
    481 # "posix2time_z" and "time2posix_z" are added as well.
    482 # The functions ending in "_z" (or "_rz") are like their unsuffixed
    483 # (or suffixed-by-"_r") counterparts, except with an extra first
    484 # argument of opaque type timezone_t that specifies the timezone.
    485 # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
    486 #
    487 # If you want to allocate state structures in localtime, add
    488 #	-DALL_STATE
    489 # to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
    490 #
    491 # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
    492 # out by the National Institute of Standards and Technology
    493 # which claims to test C and POSIX conformance.  If you want to pass PCTS, add
    494 #	-DPCTS
    495 # to the end of the "CFLAGS=" line.
    496 #
    497 # If you want strict compliance with XPG4 as of 1994-04-09, add
    498 #	-DXPG4_1994_04_09
    499 # to the end of the "CFLAGS=" line.  This causes "strftime" to always return
    500 # 53 as a week number (rather than 52 or 53) for January days before
    501 # January's first Monday when a "%V" format is used and January 1
    502 # falls on a Friday, Saturday, or Sunday.
    503 #
    504 # POSIX says CFLAGS defaults to "-O 1".
    505 # Uncomment the following line and edit its contents as needed.
    506 
    507 #CFLAGS= -O 1
    508 
    509 
    510 # The name of a POSIX-like library archiver, its flags, C compiler,
    511 # linker flags, and 'make' utility.  Ordinarily the defaults suffice.
    512 # The commented-out values are the defaults specified by POSIX.1-2024.
    513 #AR = ar
    514 #ARFLAGS = -rv
    515 #CC = c17
    516 #LDFLAGS =
    517 #MAKE = make
    518 
    519 # Where to fetch leap-seconds.list from.
    520 leaplist_URI = \
    521   https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
    522 # The file is generated by the IERS Earth Orientation Centre, in Paris.
    523 leaplist_TZ = Europe/Paris
    524 #
    525 # To fetch leap-seconds.list from NIST via a less-secure protocol
    526 # and with less-volatile metadata, use these settings:
    527 #leaplist_URI = ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list
    528 #leaplist_TZ = America/Denver
    529 
    530 # The zic command and its arguments.
    531 
    532 zic=		./zic
    533 ZIC=		$(zic) $(ZFLAGS)
    534 
    535 # To shrink the size of installed TZif files,
    536 # append "-r @N" to omit data before N-seconds-after-the-Epoch.
    537 # To grow the files and work around bugs in older applications,
    538 # possibly at the expense of introducing bugs in newer ones,
    539 # append "-b fat"; see ZIC_BLOAT_DEFAULT above.
    540 # See the zic man page for more about -b and -r.
    541 ZFLAGS=
    542 
    543 # How to use zic to install TZif files.
    544 
    545 ZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)'
    546 
    547 # The name of a POSIX-compliant 'awk' on your system.
    548 # mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
    549 # Also, it is better (though not essential) if 'awk' supports UTF-8,
    550 # and unfortunately mawk and busybox awk do not support UTF-8.
    551 # Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
    552 AWK=		awk
    553 
    554 # The full path name of a POSIX-compliant shell, preferably one that supports
    555 # the Korn shell's 'select' statement as an extension.
    556 # These days, Bash is the most popular.
    557 # It should be OK to set this to /bin/sh, on platforms where /bin/sh
    558 # lacks 'select' or doesn't completely conform to POSIX, but /bin/bash
    559 # is typically nicer if it works.
    560 KSHELL=		/bin/bash
    561 
    562 # Name of curl <https://curl.haxx.se/>, used for HTML validation
    563 # and to fetch leap-seconds.list from upstream.
    564 # Set CURL=: to disable use of the Internet.
    565 CURL=		curl
    566 
    567 # Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
    568 GPG=		gpg
    569 
    570 # This expensive test requires USE_LTZ.
    571 # To suppress it, define this macro to be empty.
    572 CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
    573 
    574 # SAFE_CHAR is a regular expression that matches a safe character.
    575 # Some parts of this distribution are limited to safe characters;
    576 # others can use any UTF-8 character.
    577 # For now, the safe characters are a safe subset of ASCII.
    578 # The caller must set the shell variable 'sharp' to the character '#',
    579 # since Makefile macros cannot contain '#'.
    580 # TAB_CHAR is a single tab character, in single quotes.
    581 TAB_CHAR=	'	'
    582 SAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
    583 SAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
    584 SAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
    585 SAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
    586 SAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
    587 
    588 # These non-alphabetic, non-ASCII printable characters are
    589 # used in commentary or in generated *.txt files
    590 # and are not likely to cause confusion.
    591 UNUSUAL_OK_CHARSET= 
    592 
    593 # Put this in a bracket expression to match spaces.
    594 s = [:space:]
    595 
    596 # OK_CHAR matches any character allowed in the distributed files.
    597 # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
    598 # multibyte letters are also allowed so that commentary can contain a
    599 # few safe symbols and people's names and can quote non-English sources.
    600 OK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
    601 
    602 # SAFE_LINE matches a line of safe characters.
    603 # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
    604 # this is so that comments can contain non-ASCII characters.
    605 # OK_LINE matches a line of OK characters.
    606 SAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
    607 SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
    608 OK_LINE=	'^'$(OK_CHAR)'*$$'
    609 
    610 # Flags to give 'tar' when making a distribution.
    611 # Try to use flags appropriate for GNU tar.
    612 GNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \
    613   --numeric-owner --owner=0 --group=0 \
    614   --mode=go+u,go-w --sort=name
    615 SETUP_TAR= \
    616   export LC_ALL=C && \
    617   if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \
    618     TAR='tar $(GNUTARFLAGS)'; \
    619   else \
    620     TAR=tar; \
    621   fi
    622 
    623 # Flags to give 'gzip' when making a distribution.
    624 GZIPFLAGS=	-9n
    625 
    626 # When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
    627 # This makes it easier to see which Zone has been affected.
    628 SETUP_DIFF_TZS = \
    629   if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \
    630     DIFF_TZS='diff -u -F^TZ='; \
    631   else \
    632     DIFF_TZS='diff -u'; \
    633   fi
    634 
    635 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
    636 RANLIB=		:
    637 
    638 # POSIX prohibits defining or using SHELL.  However, csh users on systems
    639 # that use the user shell for Makefile commands may need to define SHELL.
    640 #SHELL=		/bin/sh
    641 
    642 # End of macros that one plausibly might want to tailor.
    643 ###############################################################################
    644 
    645 
    646 TZCOBJS=	zic.o
    647 TZDOBJS=	zdump.o localtime.o strftime.o
    648 DATEOBJS=	date.o localtime.o strftime.o
    649 LIBSRCS=	localtime.c asctime.c difftime.c strftime.c
    650 LIBOBJS=	localtime.o asctime.o difftime.o strftime.o
    651 HEADERS=	tzfile.h private.h
    652 NONLIBSRCS=	zic.c zdump.c
    653 NEWUCBSRCS=	date.c
    654 SOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
    655 			tzselect.ksh workman.sh
    656 MANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
    657 			tzfile.5 tzselect.8 zic.8 zdump.8
    658 MANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
    659 			time2posix.3.txt \
    660 			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
    661 			date.1.txt
    662 COMMON=		calendars CONTRIBUTING LICENSE Makefile \
    663 			NEWS README SECURITY theory.html version
    664 WEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
    665 CHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck
    666 DOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
    667 PRIMARY_YDATA=	africa antarctica asia australasia \
    668 		europe northamerica southamerica
    669 YDATA=		$(PRIMARY_YDATA) etcetera
    670 NDATA=		factory
    671 TDATA_TO_CHECK=	$(YDATA) $(NDATA) backward
    672 TDATA=		$(YDATA) $(NDATA) $(BACKWARD)
    673 ZONETABLES=	zone.tab zone1970.tab zonenow.tab
    674 TABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
    675 LEAP_DEPS=	leapseconds.awk leap-seconds.list
    676 TZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) \
    677 		  $(PACKRATDATA) $(PACKRATLIST)
    678 DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
    679 DATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
    680 			leapseconds $(ZONETABLES)
    681 AWK_SCRIPTS=	checklinks.awk checknow.awk checktab.awk leapseconds.awk \
    682 			ziguard.awk zishrink.awk
    683 MISC=		$(AWK_SCRIPTS)
    684 TZS_YEAR=	2050
    685 TZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
    686 TZS=		to$(TZS_YEAR).tzs
    687 TZS_NEW=	to$(TZS_YEAR)new.tzs
    688 TZS_DEPS=	$(YDATA) localtime.c private.h \
    689 			strftime.c tzfile.h zdump.c zic.c
    690 TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
    691 # EIGHT_YARDS is just a yard short of the whole ENCHILADA.
    692 EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
    693 ENCHILADA = $(EIGHT_YARDS) $(TZS)
    694 
    695 # Consult these files when deciding whether to rebuild the 'version' file.
    696 # This list is not the same as the output of 'git ls-files', since
    697 # .gitignore is not distributed.
    698 VERSION_DEPS= \
    699 		calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
    700 		africa antarctica asctime.c asia australasia \
    701 		backward backzone \
    702 		checklinks.awk checknow.awk checktab.awk \
    703 		date.1 date.c difftime.c \
    704 		etcetera europe factory iso3166.tab \
    705 		leap-seconds.list leapseconds.awk localtime.c \
    706 		newctime.3 newstrftime.3 newtzset.3 northamerica \
    707 		private.h southamerica strftime.c theory.html \
    708 		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
    709 		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
    710 		workman.sh zdump.8 zdump.c zic.8 zic.c \
    711 		ziguard.awk zishrink.awk \
    712 		zone.tab zone1970.tab zonenow.tab
    713 
    714 all:		tzselect zic zdump libtz.a $(TABDATA) \
    715 		  vanguard.zi main.zi rearguard.zi
    716 
    717 ALL:		all date $(ENCHILADA)
    718 
    719 install:	all $(DATA) $(REDO) $(MANS)
    720 		mkdir -p '$(DESTDIR)$(BINDIR)' \
    721 			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
    722 			'$(DESTDIR)$(LIBDIR)' \
    723 			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
    724 			'$(DESTDIR)$(MANDIR)/man8'
    725 		$(ZIC_INSTALL) -l $(LOCALTIME) \
    726 			-p $(POSIXRULES) \
    727 			-t '$(DESTDIR)$(TZDEFAULT)'
    728 		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
    729 		cp tzselect '$(DESTDIR)$(BINDIR)/.'
    730 		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
    731 		cp zic '$(DESTDIR)$(ZICDIR)/.'
    732 		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
    733 		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
    734 		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
    735 		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
    736 		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
    737 
    738 INSTALL:	ALL install date.1
    739 		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
    740 		cp date '$(DESTDIR)$(BINDIR)/.'
    741 		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
    742 
    743 # Calculate version number from git, if available.
    744 # Otherwise, use $(VERSION) unless it is "unknown" and there is already
    745 # a 'version' file, in which case reuse the existing 'version' contents
    746 # and append "-dirty" if the contents do not already end in "-dirty".
    747 version:	$(VERSION_DEPS)
    748 		{ (type git) >/dev/null 2>&1 && \
    749 		  V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
    750 				--abbrev=7 --dirty) || \
    751 		  if test '$(VERSION)' = unknown && read -r V <$@; then \
    752 		    V=$${V%-dirty}-dirty; \
    753 		  else \
    754 		    V='$(VERSION)'; \
    755 		  fi; } && \
    756 		printf '%s\n' "$$V" >$@.out
    757 		mv $@.out $@
    758 
    759 # These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
    760 vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
    761 		$(AWK) \
    762 		  -v DATAFORM=$(@:.zi=) \
    763 		  -v PACKRATDATA='$(PACKRATDATA)' \
    764 		  -v PACKRATLIST='$(PACKRATLIST)' \
    765 		  -f ziguard.awk \
    766 		  $(TDATA) $(PACKRATDATA) >$@.out
    767 		mv $@.out $@
    768 # This file has a version comment that attempts to capture any tailoring
    769 # via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
    770 tzdata.zi:	$(DATAFORM).zi version zishrink.awk
    771 		read -r version <version && \
    772 		  LC_ALL=C $(AWK) \
    773 		    -v dataform='$(DATAFORM)' \
    774 		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
    775 		    -v redo='$(REDO)' \
    776 		    -v version="$$version" \
    777 		    -f zishrink.awk \
    778 		    $(DATAFORM).zi >$@.out
    779 		mv $@.out $@
    780 
    781 tzdir.h:
    782 		printf '%s\n' >$@.out \
    783 		  '#ifndef TZDEFAULT' \
    784 		  '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \
    785 		  '#endif' \
    786 		  '#ifndef TZDIR' \
    787 		  '# define TZDIR "$(TZDIR)" /* TZif directory */' \
    788 		  '#endif'
    789 		mv $@.out $@
    790 
    791 version.h:	version
    792 		read -r VERSION <version && printf '%s\n' \
    793 		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
    794 		  "static char const TZVERSION[]=\"$$VERSION\";" \
    795 		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
    796 		  >$@.out
    797 		mv $@.out $@
    798 
    799 zdump:		$(TZDOBJS)
    800 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
    801 
    802 zic:		$(TZCOBJS)
    803 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
    804 
    805 leapseconds:	$(LEAP_DEPS)
    806 		$(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
    807 		  -f leapseconds.awk leap-seconds.list >$@.out
    808 		mv $@.out $@
    809 
    810 # Awk script to extract a Git-style author from leap-seconds.list comments.
    811 EXTRACT_AUTHOR = \
    812   author_line { sub(/^.[[:space:]]*/, ""); \
    813       sub(/:[[:space:]]*/, " <"); \
    814       printf "%s>\n", $$0; \
    815       success = 1; \
    816       exit \
    817   } \
    818   /Questions or comments to:/ { author_line = 1 } \
    819   END { exit !success }
    820 
    821 # Fetch leap-seconds.list from upstream.
    822 fetch-leap-seconds.list:
    823 		$(CURL) -OR $(leaplist_URI)
    824 
    825 # Fetch leap-seconds.list from upstream and commit it to the local repository.
    826 commit-leap-seconds.list: fetch-leap-seconds.list
    827 		author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \
    828 		date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \
    829 		git commit --author="$$author" --date="$$date" -m'make $@' \
    830 		  leap-seconds.list
    831 
    832 # Arguments to pass to submakes.
    833 # They can be overridden by later submake arguments.
    834 INSTALLARGS = \
    835  BACKWARD='$(BACKWARD)' \
    836  DESTDIR='$(DESTDIR)' \
    837  PACKRATDATA='$(PACKRATDATA)' \
    838  PACKRATLIST='$(PACKRATLIST)' \
    839  TZDEFAULT='$(TZDEFAULT)' \
    840  TZDIR='$(TZDIR)' \
    841  ZIC='$(ZIC)'
    842 
    843 INSTALL_DATA_DEPS = zic leapseconds tzdata.zi
    844 
    845 posix_only: $(INSTALL_DATA_DEPS)
    846 		$(ZIC_INSTALL) tzdata.zi
    847 
    848 right_only: $(INSTALL_DATA_DEPS)
    849 		$(ZIC_INSTALL) -L leapseconds tzdata.zi
    850 
    851 # In earlier versions of this makefile, the other two directories were
    852 # subdirectories of $(TZDIR).  However, this led to configuration errors.
    853 # For example, with posix_right under the earlier scheme,
    854 # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
    855 # but gmtime without leap seconds, which led to problems with applications
    856 # like sendmail that subtract gmtime from localtime.
    857 # Therefore, the other two directories are now siblings of $(TZDIR).
    858 # You must replace all of $(TZDIR) to switch from not using leap seconds
    859 # to using them, or vice versa.
    860 right_posix:	right_only
    861 		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
    862 		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
    863 		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
    864 		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
    865 
    866 posix_right:	posix_only
    867 		rm -fr '$(DESTDIR)$(TZDIR)-posix'
    868 		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
    869 		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
    870 		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
    871 
    872 zones:		$(REDO)
    873 
    874 # dummy.zd is not a real file; it is mentioned here only so that the
    875 # top-level 'make' does not have a syntax error.
    876 ZDS = dummy.zd
    877 # Rule used only by submakes invoked by the $(TZS_NEW) rule.
    878 # It is separate so that GNU 'make -j' can run instances in parallel.
    879 $(ZDS): zdump
    880 		./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@
    881 
    882 TZS_NEW_DEPS = tzdata.zi zdump zic
    883 $(TZS_NEW): $(TZS_NEW_DEPS)
    884 		rm -fr tzs$(TZS_YEAR).dir
    885 		mkdir tzs$(TZS_YEAR).dir
    886 		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
    887 		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
    888 		   tzdata.zi | LC_ALL=C sort >$@.out
    889 		x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
    890 				tzdata.zi \
    891 		     | LC_ALL=C sort -t . -k 2,2) && \
    892 		set x $$x && \
    893 		shift && \
    894 		ZDS=$$* && \
    895 		$(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
    896 		  ZDS="$$ZDS" $$ZDS && \
    897 		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
    898 		rm -fr tzs$(TZS_YEAR).dir
    899 		mv $@.out $@
    900 
    901 # If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the
    902 # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
    903 $(TZS):
    904 		touch $@
    905 
    906 force_tzs:	$(TZS_NEW)
    907 		cp $(TZS_NEW) $(TZS)
    908 
    909 libtz.a:	$(LIBOBJS)
    910 		rm -f $@
    911 		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
    912 		$(RANLIB) $@
    913 
    914 date:		$(DATEOBJS)
    915 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
    916 
    917 tzselect:	tzselect.ksh version
    918 		read -r VERSION <version && sed \
    919 		  -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
    920 		  -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
    921 		  -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
    922 		  -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \
    923 		  -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \
    924 		  -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \
    925 		  <$@.ksh >$@.out
    926 		chmod +x $@.out
    927 		mv $@.out $@
    928 
    929 check: check_mild back.ck now.ck
    930 check_mild: check_web check_zishrink \
    931   character-set.ck white-space.ck links.ck mainguard.ck \
    932   name-lengths.ck slashed-abbrs.ck sorted.ck \
    933   tables.ck ziguard.ck tzs.ck
    934 
    935 # True if UTF8_LOCALE does not work;
    936 # otherwise, false but with LC_ALL set to $(UTF8_LOCALE).
    937 UTF8_LOCALE_MISSING = \
    938   { test ! '$(UTF8_LOCALE)' \
    939     || ! printf 'A\304\200B\n' \
    940          | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
    941     || { export LC_ALL='$(UTF8_LOCALE)'; false; }; }
    942 
    943 character-set.ck: $(ENCHILADA)
    944 	$(UTF8_LOCALE_MISSING) || { \
    945 		sharp='#' && \
    946 		! grep -Env $(SAFE_LINE) $(MANS) date.1 \
    947 			$(MISC) $(SOURCES) \
    948 			LICENSE \
    949 			version tzdata.zi && \
    950 		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
    951 			Makefile && \
    952 		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
    953 			leapseconds zone.tab && \
    954 		! grep -Env $(OK_LINE) $(ENCHILADA); \
    955 	}
    956 	touch $@
    957 
    958 white-space.ck: $(ENCHILADA)
    959 	$(UTF8_LOCALE_MISSING) || { \
    960 		patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \
    961 		! grep -En "$$pat|[$s]\$$" \
    962 		    $(ENCHILADA:leap-seconds.list=); \
    963 	}
    964 	touch $@
    965 
    966 PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
    967 FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
    968 
    969 name-lengths.ck: $(TDATA_TO_CHECK) backzone
    970 		:;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
    971 			$(TDATA_TO_CHECK) backzone
    972 		touch $@
    973 
    974 mainguard.ck: main.zi
    975 		test '$(PACKRATLIST)' || \
    976 		  cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi
    977 		touch $@
    978 
    979 PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
    980 STDOFF = [-+]?[0-9:.]+
    981 RULELESS_SAVE = (-|$(STDOFF)[sd]?)
    982 RULELESS_SLASHED_ABBRS = \
    983   $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
    984 
    985 slashed-abbrs.ck: $(TDATA_TO_CHECK)
    986 		:;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
    987 		touch $@
    988 
    989 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
    990 
    991 sorted.ck: backward backzone
    992 		$(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
    993 		  backward | LC_ALL=C sort -cu
    994 		$(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu
    995 		touch $@
    996 
    997 back.ck: checklinks.awk $(TDATA_TO_CHECK)
    998 		$(AWK) \
    999 		  -v DATAFORM=$(DATAFORM) \
   1000 		  -v backcheck=backward \
   1001 		  -f checklinks.awk $(TDATA_TO_CHECK)
   1002 		touch $@
   1003 
   1004 links.ck: checklinks.awk tzdata.zi
   1005 		$(AWK) \
   1006 		  -v DATAFORM=$(DATAFORM) \
   1007 		  -f checklinks.awk tzdata.zi
   1008 		touch $@
   1009 
   1010 # Check timestamps from now through 28 years from now, to make sure
   1011 # that zonenow.tab contains all sequences of planned timestamps,
   1012 # without any duplicate sequences.  In theory this might require
   1013 # 2800+ years but that would take a long time to check.
   1014 CHECK_NOW_TIMESTAMP = $$(./date +%s)
   1015 CHECK_NOW_FUTURE_YEARS = 28
   1016 CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) * 366 * 24 * 60 * 60
   1017 now.ck: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
   1018 		rm -fr $@d
   1019 		mkdir $@d
   1020 		./zic -d $@d tzdata.zi
   1021 		now=$(CHECK_NOW_TIMESTAMP) && \
   1022 		  future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \
   1023 		  ./zdump -i -t $$now,$$future \
   1024 		     $$(find "$$PWD/$@d"/????*/ -type f) \
   1025 		     >$@d/zdump-now.tab && \
   1026 		  ./zdump -i -t 0,$$future \
   1027 		     $$(find "$$PWD/$@d" -name Etc -prune \
   1028 			  -o -type f ! -name '*.tab' -print) \
   1029 		     >$@d/zdump-1970.tab && \
   1030 		$(AWK) \
   1031 		  -v now=$$now \
   1032 		  -v now_out=$@.out \
   1033 		  -v zdump_table=$@d/zdump-now.tab \
   1034 		  -f checknow.awk zonenow.tab
   1035 		$(AWK) \
   1036 		  'BEGIN {print "-\t-\tUTC"} /^Zone/ {print "-\t-\t" $$2}' \
   1037 		  $(PRIMARY_YDATA) backward factory | \
   1038 		 $(AWK) \
   1039 		   -v zdump_table=$@d/zdump-1970.tab \
   1040 		   -f checknow.awk
   1041 		rm -fr $@d
   1042 		touch $@.out
   1043 		mv $@.out $@
   1044 
   1045 tables.ck: checktab.awk $(YDATA) backward zone.tab zone1970.tab
   1046 		for tab in $(ZONETABLES); do \
   1047 		  test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
   1048 		  $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
   1049 		    || exit; \
   1050 		done
   1051 		touch $@
   1052 
   1053 tzs.ck: $(TZS) $(TZS_NEW)
   1054 		if test -s $(TZS); then \
   1055 		  $(SETUP_DIFF_TZS) && $$DIFF_TZS $(TZS) $(TZS_NEW); \
   1056 		else \
   1057 		  cp $(TZS_NEW) $(TZS); \
   1058 		fi
   1059 		touch $@
   1060 
   1061 check_web:	$(CHECK_WEB_PAGES)
   1062 .SUFFIXES: .ck .html
   1063 .html.ck:
   1064 		{ ! ($(CURL) --version) >/dev/null 2>&1 || \
   1065 		    $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
   1066 		          -F file=@$<; } >$@.out && \
   1067 		  test ! -s $@.out || { cat $@.out; exit 1; }
   1068 		mv $@.out $@
   1069 
   1070 ziguard.ck: rearguard.zi vanguard.zi ziguard.awk
   1071 		$(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
   1072 		  diff -u rearguard.zi -
   1073 		$(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
   1074 		  diff -u vanguard.zi -
   1075 		touch $@
   1076 
   1077 # Check that zishrink.awk does not alter the data, and that ziguard.awk
   1078 # preserves main-format data.
   1079 check_zishrink: zishrink-posix.ck zishrink-right.ck
   1080 zishrink-posix.ck zishrink-right.ck: \
   1081   zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
   1082   $(TDATA) $(DATAFORM).zi tzdata.zi
   1083 		rm -fr $@d t-$@d shrunk-$@d
   1084 		mkdir $@d t-$@d shrunk-$@d
   1085 		case $@ in \
   1086 		  *right*) leap='-L leapseconds';; \
   1087 		  *) leap=;; \
   1088 		esac && \
   1089 		  $(ZIC) $$leap -d $@d $(DATAFORM).zi && \
   1090 		  $(ZIC) $$leap -d shrunk-$@d tzdata.zi && \
   1091 		  case $(DATAFORM),$(PACKRATLIST) in \
   1092 		    main,) \
   1093 		      $(ZIC) $$leap -d t-$@d $(TDATA) && \
   1094 		      $(AWK) '/^Rule/' $(TDATA) | \
   1095 			$(ZIC) $$leap -d t-$@d - $(PACKRATDATA) && \
   1096 		      diff -r $@d t-$@d;; \
   1097 		  esac
   1098 		diff -r $@d shrunk-$@d
   1099 		rm -fr $@d t-$@d shrunk-$@d
   1100 		touch $@
   1101 
   1102 clean_misc:
   1103 		rm -fr *.ckd *.dir
   1104 		rm -f *.ck *.core *.o *.out *.t core core.* \
   1105 		  date tzdir.h tzselect version.h zdump zic libtz.a
   1106 clean:		clean_misc
   1107 		rm -fr tzdb-*/
   1108 		rm -f *.zi $(TZS_NEW)
   1109 
   1110 maintainer-clean: clean
   1111 		@echo 'This command is intended for maintainers to use; it'
   1112 		@echo 'deletes files that may need special tools to rebuild.'
   1113 		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
   1114 
   1115 names:
   1116 		@echo $(ENCHILADA)
   1117 
   1118 public: check public.ck $(CHECK_TIME_T_ALTERNATIVES) \
   1119 		tarballs signatures
   1120 
   1121 date.1.txt:	date.1
   1122 newctime.3.txt:	newctime.3
   1123 newstrftime.3.txt: newstrftime.3
   1124 newtzset.3.txt:	newtzset.3
   1125 time2posix.3.txt: time2posix.3
   1126 tzfile.5.txt:	tzfile.5
   1127 tzselect.8.txt:	tzselect.8
   1128 zdump.8.txt:	zdump.8
   1129 zic.8.txt:	zic.8
   1130 
   1131 $(MANTXTS):	workman.sh
   1132 		LC_ALL=C sh workman.sh $(MANFLAGS) $(@:.txt=) >$@.out
   1133 		mv $@.out $@
   1134 
   1135 # Set file timestamps deterministically if possible,
   1136 # so that tarballs containing the timestamps are reproducible.
   1137 #
   1138 # '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
   1139 # file DEST to the maximum of the timestamps of the files A B C ...,
   1140 # plus N if GNU ls and touch are available.
   1141 SET_TIMESTAMP_N = sh -c '\
   1142   n=$$0 dest=$$1; shift; \
   1143   <"$$dest" && \
   1144   if test $$n != 0 && \
   1145      lsout=$$(ls -nt --time-style="+%s" "$$@" 2>/dev/null); then \
   1146     set x $$lsout && \
   1147     timestamp=$$(($$7 + $$n)) && \
   1148     echo "+ touch -md @$$timestamp $$dest" && \
   1149     touch -md @$$timestamp "$$dest"; \
   1150   else \
   1151     newest=$$(ls -t "$$@" | sed 1q) && \
   1152     echo "+ touch -mr $$newest $$dest" && \
   1153     touch -mr "$$newest" "$$dest"; \
   1154   fi'
   1155 # If DEST depends on A B C ... in this Makefile, callers should use
   1156 # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
   1157 # downstream 'make' that considers equal timestamps to be out of date.
   1158 # POSIX allows this 'make' behavior, and HP-UX 'make' does it.
   1159 # If all that matters is that the timestamp be reproducible
   1160 # and plausible, use $(SET_TIMESTAMP).
   1161 SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
   1162 SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
   1163 
   1164 # Set the timestamps to those of the git repository, if available,
   1165 # and if the files have not changed since then.
   1166 # This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
   1167 # and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
   1168 # If git or GNU is absent, don't bother to sync with git timestamps.
   1169 # Also, set the timestamp of each prebuilt file like 'leapseconds'
   1170 # to be the maximum of the files it depends on.
   1171 set-timestamps.out: $(EIGHT_YARDS)
   1172 		rm -f $@
   1173 		if (type git) >/dev/null 2>&1 && \
   1174 		   files=$$(git ls-files $(EIGHT_YARDS)) && \
   1175 		   touch -md @1 test.out; then \
   1176 		  rm -f test.out && \
   1177 		  for file in $$files; do \
   1178 		    if git diff --quiet HEAD $$file; then \
   1179 		      time=$$(TZ=UTC0 git log -1 \
   1180 			--format='tformat:%cd' \
   1181 			--date='format-local:%Y-%m-%dT%H:%M:%SZ' \
   1182 			$$file) && \
   1183 		      echo "+ touch -md $$time $$file" && \
   1184 		      touch -md $$time $$file; \
   1185 		    else \
   1186 		      echo >&2 "$$file: warning: does not match repository"; \
   1187 		    fi || exit; \
   1188 		  done; \
   1189 		fi
   1190 		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
   1191 		for file in $(MANTXTS); do \
   1192 		  $(SET_TIMESTAMP_DEP) $$file $${file%.txt} workman.sh || \
   1193 		    exit; \
   1194 		done
   1195 		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
   1196 		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
   1197 		touch $@
   1198 set-tzs-timestamp.out: $(TZS)
   1199 		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
   1200 		touch $@
   1201 
   1202 # The zics below ensure that each data file can stand on its own.
   1203 # We also do an all-files run to catch links to links.
   1204 
   1205 public.ck: $(VERSION_DEPS)
   1206 		rm -fr $@d
   1207 		mkdir $@d
   1208 		ln $(VERSION_DEPS) $@d
   1209 		cd $@d \
   1210 		  && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL
   1211 		for i in $(TDATA_TO_CHECK) \
   1212 		    tzdata.zi vanguard.zi main.zi rearguard.zi; \
   1213 		do \
   1214 		  $@d/zic -v -d $@d/zoneinfo $@d/$$i || exit; \
   1215 		done
   1216 		$@d/zic -v -d $@d/zoneinfo-all $(TDATA_TO_CHECK)
   1217 		:
   1218 		: Also check 'backzone' syntax.
   1219 		rm $@d/main.zi
   1220 		cd $@d && $(MAKE) PACKRATDATA=backzone main.zi
   1221 		$@d/zic -d $@d/zoneinfo main.zi
   1222 		rm $@d/main.zi
   1223 		cd $@d && \
   1224 		  $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
   1225 		$@d/zic -d $@d/zoneinfo main.zi
   1226 		:
   1227 		rm -fr $@d
   1228 		touch $@
   1229 
   1230 # Check that the code works under various alternative
   1231 # implementations of time_t.
   1232 check_time_t_alternatives: $(TIME_T_ALTERNATIVES)
   1233 $(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
   1234 $(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
   1235 		rm -fr $@d
   1236 		mkdir $@d
   1237 		ln $(VERSION_DEPS) $@d
   1238 		case $@ in \
   1239 		  *32_t*) range=-2147483648,2147483648;; \
   1240 		  u*) range=0,4294967296;; \
   1241 		  *) range=-4294967296,4294967296;; \
   1242 		esac && \
   1243 		wd=$$PWD && \
   1244 		zones=$$($(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab) && \
   1245 		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
   1246 		  range_target=; \
   1247 		else \
   1248 		  range_target=to$$range.tzs; \
   1249 		fi && \
   1250 		(cd $@d && \
   1251 		  $(MAKE) TOPDIR="$$wd/$@d" \
   1252 		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$(@:.ck=)'" \
   1253 		    REDO='$(REDO)' \
   1254 		    D="$$wd/$@d" \
   1255 		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
   1256 		    install $$range_target) && \
   1257 		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
   1258 		  (cd $(TIME_T_ALTERNATIVES_HEAD)d && \
   1259 		    $(MAKE) TOPDIR="$$wd/$@d" \
   1260 		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
   1261 		      D="$$wd/$@d" \
   1262 		      to$$range.tzs) && \
   1263 		  $(SETUP_DIFF_TZS) && \
   1264 		  $$DIFF_TZS $(TIME_T_ALTERNATIVES_HEAD)d/to$$range.tzs \
   1265 			  $@d/to$$range.tzs && \
   1266 		  if diff -q Makefile Makefile 2>/dev/null; then \
   1267 		    quiet_option='-q'; \
   1268 		  else \
   1269 		    quiet_option=''; \
   1270 		  fi && \
   1271 		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD)d/etc \
   1272 					   $@d/etc && \
   1273 		    diff $$quiet_option -r \
   1274 		      $(TIME_T_ALTERNATIVES_HEAD)d/usr/share \
   1275 		      $@d/usr/share; \
   1276 		}
   1277 		touch $@
   1278 
   1279 TRADITIONAL_ASC = \
   1280   tzcode$(VERSION).tar.gz.asc.t \
   1281   tzdata$(VERSION).tar.gz.asc.t
   1282 REARGUARD_ASC = \
   1283   tzdata$(VERSION)-rearguard.tar.gz.asc.t
   1284 ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
   1285   tzdb-$(VERSION).tar.lz.asc.t
   1286 
   1287 tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
   1288 signatures rearguard_signatures traditional_signatures: \
   1289   version set-timestamps.out rearguard.zi vanguard.zi
   1290 		read -r VERSION <version && \
   1291 		$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
   1292 
   1293 # These *_version rules are intended for use if VERSION is set by some
   1294 # other means.  Ordinarily these rules are used only by the above
   1295 # non-_version rules, which set VERSION on the 'make' command line.
   1296 tarballs_version: traditional_tarballs_version rearguard_tarballs_version \
   1297   tzdb-$(VERSION).tar.lz.t
   1298 rearguard_tarballs_version: \
   1299   tzdata$(VERSION)-rearguard.tar.gz.t
   1300 traditional_tarballs_version: \
   1301   tzcode$(VERSION).tar.gz.t tzdata$(VERSION).tar.gz.t
   1302 tailored_tarballs_version: \
   1303   tzdata$(VERSION)-tailored.tar.gz.t
   1304 signatures_version: $(ALL_ASC)
   1305 rearguard_signatures_version: $(REARGUARD_ASC)
   1306 traditional_signatures_version: $(TRADITIONAL_ASC)
   1307 
   1308 tzcode$(VERSION).tar.gz.t: set-timestamps.out
   1309 		$(SETUP_TAR) && \
   1310 		$$TAR -cf - \
   1311 		    $(COMMON) $(DOCS) $(SOURCES) | \
   1312 		  gzip $(GZIPFLAGS) >$(@:.t=)
   1313 		$(SET_TIMESTAMP) $(@:.t=) $(COMMON) $(DOCS) $(SOURCES)
   1314 		touch $@
   1315 
   1316 tzdata$(VERSION).tar.gz.t: set-timestamps.out
   1317 		$(SETUP_TAR) && \
   1318 		$$TAR -cf - $(TZDATA_DIST) | \
   1319 		  gzip $(GZIPFLAGS) >$(@:.t=)
   1320 		$(SET_TIMESTAMP) $(@:.t=) $(TZDATA_DIST)
   1321 		touch $@
   1322 
   1323 # Create empty files with a reproducible timestamp.
   1324 CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
   1325 
   1326 # The obsolescent *rearguard* targets and related macros are present
   1327 # for backwards compatibility with tz releases 2018e through 2022a.
   1328 # They should go away eventually.  To build rearguard tarballs you
   1329 # can instead use 'make DATAFORM=rearguard tailored_tarballs'.
   1330 tzdata$(VERSION)-rearguard.tar.gz.t: rearguard.zi set-timestamps.out
   1331 		rm -fr $@.dir
   1332 		mkdir $@.dir
   1333 		ln $(TZDATA_DIST) $@.dir
   1334 		cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
   1335 		for f in $(TDATA) $(PACKRATDATA); do \
   1336 		  rearf=$@.dir/$$f; \
   1337 		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
   1338 		  $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
   1339 		done
   1340 		sed '1s/$$/-rearguard/' <version >$@.dir/version
   1341 		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
   1342 		$(CREATE_EMPTY) $@.dir/pacificnew
   1343 		touch -mr version $@.dir/version
   1344 		$(SETUP_TAR) && \
   1345 		  (cd $@.dir && \
   1346 		   $$TAR -cf - \
   1347 			$(TZDATA_DIST) pacificnew | \
   1348 		     gzip $(GZIPFLAGS)) >$(@:.t=)
   1349 		$(SET_TIMESTAMP) $(@:.t=) \
   1350 		  $$(cd $@.dir && \
   1351 		       ls $(TZDATA_DIST) pacificnew | sed 's,^,$@.dir/,')
   1352 		touch $@
   1353 
   1354 # Create a tailored tarball suitable for TZUpdater and compatible tools.
   1355 # For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
   1356 # useful for testing whether TZUpdater supports vanguard form.
   1357 # The generated tarball is not byte-for-byte equivalent to a hand-tailored
   1358 # traditional tarball, as data entries are put into 'etcetera' even if they
   1359 # came from some other source file.  However, the effect should be the same
   1360 # for ordinary use, which reads all the source files.
   1361 tzdata$(VERSION)-tailored.tar.gz.t: set-timestamps.out
   1362 		rm -fr $@.dir
   1363 		mkdir $@.dir
   1364 		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
   1365 		if test $(DATAFORM) = vanguard; then \
   1366 		  pacificnew=; \
   1367 		else \
   1368 		  pacificnew=pacificnew; \
   1369 		fi && \
   1370 		cd $@.dir && \
   1371 		  $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
   1372 		  $$pacificnew
   1373 		(sed '/^#/!d' tzdata.zi && echo && cat $(DATAFORM).zi) \
   1374 		  >$@.dir/etcetera
   1375 		touch -mr tzdata.zi $@.dir/etcetera
   1376 		sed -n \
   1377 		  -e '/^# *version  *\(.*\)/h' \
   1378 		  -e '/^# *ddeps  */H' \
   1379 		  -e '$$!d' \
   1380 		  -e 'g' \
   1381 		  -e 's/^# *version  *//' \
   1382 		  -e 's/\n# *ddeps  */-/' \
   1383 		  -e 's/ /-/g' \
   1384 		  -e 'p' \
   1385 		  <tzdata.zi >$@.dir/version
   1386 		touch -mr version $@.dir/version
   1387 		links= && \
   1388 		  for file in $(TZDATA_DIST); do \
   1389 		    test -f $@.dir/$$file || links="$$links $$file"; \
   1390 		  done && \
   1391 		  ln $$links $@.dir
   1392 		$(SETUP_TAR) && \
   1393 		  (cd $@.dir && \
   1394 		   $$TAR -cf - *) | gzip $(GZIPFLAGS) >$(@:.t=)
   1395 		$(SET_TIMESTAMP) $(@:.t=) \
   1396 		  $$(cd $@.dir && ls * | sed 's,^,$@.dir/,')
   1397 		touch $@
   1398 
   1399 tzdb-$(VERSION).tar.lz.t: set-timestamps.out set-tzs-timestamp.out
   1400 		rm -fr tzdb-$(VERSION)
   1401 		mkdir tzdb-$(VERSION)
   1402 		ln $(ENCHILADA) tzdb-$(VERSION)
   1403 		$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
   1404 		$(SETUP_TAR) && \
   1405 		  $$TAR -cf - tzdb-$(VERSION) | lzip -9 >$(@:.t=)
   1406 		$(SET_TIMESTAMP) $(@:.t=) tzdb-$(VERSION)
   1407 		touch $@
   1408 
   1409 tzcode$(VERSION).tar.gz.asc.t: tzcode$(VERSION).tar.gz.t
   1410 tzdata$(VERSION).tar.gz.asc.t: tzdata$(VERSION).tar.gz.t
   1411 tzdata$(VERSION)-rearguard.tar.gz.asc.t: tzdata$(VERSION)-rearguard.tar.gz.t
   1412 tzdb-$(VERSION).tar.lz.asc.t: tzdb-$(VERSION).tar.lz.t
   1413 $(ALL_ASC):
   1414 		$(GPG) --armor --detach-sign $(?:.t=)
   1415 		$(SET_TIMESTAMP) $(@:.t=) $(?:.t=)
   1416 		touch $@
   1417 
   1418 TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
   1419 typecheck: long-long.ck unsigned.ck
   1420 long-long.ck unsigned.ck: $(VERSION_DEPS)
   1421 		rm -fr $@d
   1422 		mkdir $@d
   1423 		ln $(VERSION_DEPS) $@d
   1424 		cd $@d && \
   1425 		  case $@ in \
   1426 		    long-long.*) i="long long";; \
   1427 		    unsigned.* ) i="unsigned" ;; \
   1428 		  esac && \
   1429 		  $(MAKE) \
   1430 		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
   1431 		    TOPDIR="$$PWD" \
   1432 		    install
   1433 		$@d/zdump -i -c 1970,1971 Europe/Rome
   1434 		touch $@
   1435 
   1436 zonenames:	tzdata.zi
   1437 		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
   1438 
   1439 asctime.o:	private.h
   1440 date.o:		private.h
   1441 difftime.o:	private.h
   1442 localtime.o:	private.h tzdir.h tzfile.h
   1443 strftime.o:	localtime.c private.h tzdir.h tzfile.h
   1444 zdump.o:	private.h version.h
   1445 zic.o:		private.h tzdir.h tzfile.h version.h
   1446 
   1447 .PHONY: ALL INSTALL all
   1448 .PHONY: check check_mild check_time_t_alternatives
   1449 .PHONY: check_web check_zishrink
   1450 .PHONY: clean clean_misc commit-leap-seconds.list dummy.zd
   1451 .PHONY: fetch-leap-seconds.list force_tzs
   1452 .PHONY: install maintainer-clean names
   1453 .PHONY: posix_only posix_right public
   1454 .PHONY: rearguard_signatures rearguard_signatures_version
   1455 .PHONY: rearguard_tarballs rearguard_tarballs_version
   1456 .PHONY: right_only right_posix signatures signatures_version
   1457 .PHONY: tarballs tarballs_version
   1458 .PHONY: traditional_signatures traditional_signatures_version
   1459 .PHONY: traditional_tarballs traditional_tarballs_version
   1460 .PHONY: tailored_tarballs tailored_tarballs_version
   1461 .PHONY: typecheck
   1462 .PHONY: zonenames zones
   1463 .PHONY: $(ZDS)
   1464