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