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