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