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