35 kx # Make and install tzdb code and data.
35 kx
35 kx # This file is in the public domain, so clarified as of
35 kx # 2009-05-17 by Arthur David Olson.
35 kx
35 kx # Package name for the code distribution.
35 kx PACKAGE= tzcode
35 kx
35 kx # Version number for the distribution, overridden in the 'tarballs' rule below.
35 kx VERSION= 2023c
35 kx
35 kx # Email address for bug reports.
35 kx BUGEMAIL= tz@iana.org
35 kx
35 kx # DATAFORM selects the data format.
35 kx # Available formats represent essentially the same data, albeit
35 kx # possibly with minor discrepancies that users are not likely to notice.
35 kx # To get new features and the best data right away, use:
35 kx # DATAFORM= vanguard
35 kx # To wait a while before using new features, to give downstream users
35 kx # time to upgrade zic (the default), use:
35 kx # DATAFORM= main
35 kx # To wait even longer for new features, use:
35 kx # DATAFORM= rearguard
35 kx # Rearguard users might also want "ZFLAGS = -b fat"; see below.
35 kx DATAFORM= main
35 kx
35 kx # Change the line below for your timezone (after finding the one you want in
35 kx # one of the $(TDATA) source files, or adding it to a source file).
35 kx # Alternatively, if you discover you've got the wrong timezone, you can just
35 kx # 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
35 kx # Use the command
35 kx # make zonenames
35 kx # to get a list of the values you can use for LOCALTIME.
35 kx
35 kx LOCALTIME= Factory
35 kx
35 kx # The POSIXRULES macro controls interpretation of POSIX-like TZ
35 kx # settings like TZ='EET-2EEST' that lack DST transition rules.
35 kx # If POSIXRULES is '-', no template is installed; this is the default.
35 kx # Any other value for POSIXRULES is obsolete and should not be relied on, as:
35 kx # * It does not work correctly in popular implementations such as GNU/Linux.
35 kx # * It does not work even in tzcode, except for historical timestamps
35 kx # that precede the last explicit transition in the POSIXRULES file.
35 kx # Hence it typically does not work for current and future timestamps.
35 kx # If, despite the above, you want a template for handling these settings,
35 kx # you can change the line below (after finding the timezone you want in the
35 kx # one of the $(TDATA) source files, or adding it to a source file).
35 kx # Alternatively, if you discover you've got the wrong timezone, you can just
35 kx # 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
35 kx # Use the command
35 kx # make zonenames
35 kx # to get a list of the values you can use for POSIXRULES.
35 kx
35 kx POSIXRULES= -
35 kx
35 kx # Also see TZDEFRULESTRING below, which takes effect only
35 kx # if POSIXRULES is '-' or if the template file cannot be accessed.
35 kx
35 kx
35 kx # Installation locations.
35 kx #
35 kx # The defaults are suitable for Debian, except that if REDO is
35 kx # posix_right or right_posix then files that Debian puts under
35 kx # /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
35 kx # put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
35 kx # respectively. Problems with the Debian approach are discussed in
35 kx # the commentary for the right_posix rule (below).
35 kx
35 kx # Destination directory, which can be used for staging.
35 kx # 'make DESTDIR=/stage install' installs under /stage (e.g., to
35 kx # /stage/etc/localtime instead of to /etc/localtime). Files under
35 kx # /stage are not intended to work as-is, but can be copied by hand to
35 kx # the root directory later. If DESTDIR is empty, 'make install' does
35 kx # not stage, but installs directly into production locations.
35 kx DESTDIR =
35 kx
35 kx # Everything is installed into subdirectories of TOPDIR, and used there.
35 kx # TOPDIR should be empty (meaning the root directory),
35 kx # or a directory name that does not end in "/".
35 kx # TOPDIR should be empty or an absolute name unless you're just testing.
35 kx TOPDIR =
35 kx
35 kx # The default local timezone is taken from the file TZDEFAULT.
35 kx TZDEFAULT = $(TOPDIR)/etc/localtime
35 kx
35 kx # The subdirectory containing installed program and data files, and
35 kx # likewise for installed files that can be shared among architectures.
35 kx # These should be relative file names.
35 kx USRDIR = usr
35 kx USRSHAREDIR = $(USRDIR)/share
35 kx
35 kx # "Compiled" timezone information is placed in the "TZDIR" directory
35 kx # (and subdirectories).
35 kx # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
35 kx TZDIR_BASENAME= zoneinfo
35 kx TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
35 kx
35 kx # The "tzselect" and (if you do "make INSTALL") "date" commands go in:
35 kx BINDIR = $(TOPDIR)/$(USRDIR)/bin
35 kx
35 kx # The "zdump" command goes in:
35 kx ZDUMPDIR = $(BINDIR)
35 kx
35 kx # The "zic" command goes in:
35 kx ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
35 kx
35 kx # Manual pages go in subdirectories of. . .
35 kx MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
35 kx
35 kx # Library functions are put in an archive in LIBDIR.
35 kx LIBDIR = $(TOPDIR)/$(USRDIR)/lib
35 kx
35 kx
35 kx # Types to try, as an alternative to time_t.
35 kx TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
35 kx TIME_T_ALTERNATIVES_HEAD = int_least64_t
35 kx TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
35 kx
35 kx # What kind of TZif data files to generate. (TZif is the binary time
35 kx # zone data format that zic generates; see Internet RFC 8536.)
35 kx # If you want only POSIX time, with time values interpreted as
35 kx # seconds since the epoch (not counting leap seconds), use
35 kx # REDO= posix_only
35 kx # below. If you want only "right" time, with values interpreted
35 kx # as seconds since the epoch (counting leap seconds), use
35 kx # REDO= right_only
35 kx # below. If you want both sets of data available, with leap seconds not
35 kx # counted normally, use
35 kx # REDO= posix_right
35 kx # below. If you want both sets of data available, with leap seconds counted
35 kx # normally, use
35 kx # REDO= right_posix
35 kx # below. POSIX mandates that leap seconds not be counted; for compatibility
35 kx # with it, use "posix_only" or "posix_right". Use POSIX time on systems with
35 kx # leap smearing; this can work better than unsmeared "right" time with
35 kx # applications that are not leap second aware, and is closer to unsmeared
35 kx # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
35 kx
35 kx REDO= posix_right
35 kx
35 kx # Whether to put an "Expires" line in the leapseconds file.
35 kx # Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
35 kx # The EXPIRES_LINE value matters only if REDO's value contains "right".
35 kx # If you change EXPIRES_LINE, remove the leapseconds file before running "make".
35 kx # zic's support for the Expires line was introduced in tzdb 2020a,
35 kx # and was modified in tzdb 2021b to generate version 4 TZif files.
35 kx # EXPIRES_LINE defaults to 0 for now so that the leapseconds file
35 kx # can be given to pre-2020a zic implementations and so that TZif files
35 kx # built by newer zic implementations can be read by pre-2021b libraries.
35 kx EXPIRES_LINE= 0
35 kx
35 kx # To install data in text form that has all the information of the TZif data,
35 kx # (optionally incorporating leap second information), use
35 kx # TZDATA_TEXT= tzdata.zi leapseconds
35 kx # To install text data without leap second information (e.g., because
35 kx # REDO='posix_only'), use
35 kx # TZDATA_TEXT= tzdata.zi
35 kx # To avoid installing text data, use
35 kx # TZDATA_TEXT=
35 kx
35 kx TZDATA_TEXT= leapseconds tzdata.zi
35 kx
35 kx # For backward-compatibility links for old zone names, use
35 kx # BACKWARD= backward
35 kx # To omit these links, use
35 kx # BACKWARD=
35 kx
35 kx BACKWARD= backward
35 kx
35 kx # If you want out-of-scope and often-wrong data from the file 'backzone',
35 kx # but only for entries listed in the backward-compatibility file zone.tab, use
35 kx # PACKRATDATA= backzone
35 kx # PACKRATLIST= zone.tab
35 kx # If you want all the 'backzone' data, use
35 kx # PACKRATDATA= backzone
35 kx # PACKRATLIST=
35 kx # To omit this data, use
35 kx # PACKRATDATA=
35 kx # PACKRATLIST=
35 kx
35 kx PACKRATDATA=
35 kx PACKRATLIST=
35 kx
35 kx # The name of a locale using the UTF-8 encoding, used during self-tests.
35 kx # The tests are skipped if the name does not appear to work on this system.
35 kx
35 kx UTF8_LOCALE= en_US.utf8
35 kx
35 kx # Non-default libraries needed to link.
35 kx # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
35 kx LDLIBS=
35 kx
35 kx # Add the following to the end of the "CFLAGS=" line as needed to override
35 kx # defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1".
35 kx # -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
35 kx # formats that generate only the last two digits of year numbers
35 kx # -DEPOCH_LOCAL if the 'time' function returns local time not UT
35 kx # -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
35 kx # than what POSIX specifies, assuming local time is UT.
35 kx # For example, N is 252460800 on AmigaOS.
35 kx # -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
35 kx # -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
35 kx # -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
35 kx # -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
35 kx # -DHAVE__GENERIC=0 if _Generic does not work*
35 kx # -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
35 kx # -DHAVE_GETRANDOM=0 to avoid using getrandom
35 kx # -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
35 kx # where LDLIBS also needs to contain -lintl on some hosts;
35 kx # -DHAVE_GETTEXT=0 to avoid using gettext
35 kx # -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
35 kx # ctime_r and asctime_r incompatibly with the POSIX standard
35 kx # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
35 kx # -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
35 kx # -DHAVE_LINK=0 if your system lacks a link function
35 kx # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
35 kx # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
35 kx # localtime_rz can make zdump significantly faster, but is nonstandard.
35 kx # -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
35 kx # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
35 kx # functions like 'link' or variables like 'tzname' required by POSIX
35 kx # -DHAVE_SETENV=0 if your system lacks the setenv function
35 kx # -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+
35 kx # -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like
35 kx # __builtin_add_overflow work*
35 kx # -DHAVE_STDINT_H=0 if <stdint.h> does not work*+
35 kx # -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
35 kx # -DHAVE_STRDUP=0 if your system lacks the strdup function
35 kx # -DHAVE_STRTOLL=0 if your system lacks the strtoll function+
35 kx # -DHAVE_SYMLINK=0 if your system lacks the symlink function
35 kx # -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
35 kx # -DHAVE_TZSET=0 if your system lacks a tzset function
35 kx # -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
35 kx # -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
35 kx # -Dlocale_t=XXX if your system uses XXX instead of locale_t
35 kx # -DPORT_TO_C89 if tzcode should also run on C89 platforms+
35 kx # -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
35 kx # with external linkage, e.g., applications cannot define 'localtime'.
35 kx # -Dssize_t=long on hosts like MS-Windows that lack ssize_t
35 kx # -DSUPPORT_C89 if the tzcode library should support C89 callers+
35 kx # -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
35 kx # security implications and is not recommended for general use
35 kx # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
35 kx # not needed by the main-program tz code, which is single-threaded.
35 kx # Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
35 kx # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
35 kx # This is intended for internal use only; it mangles external names.
35 kx # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
35 kx # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
35 kx # the default is system-supplied, typically "/usr/lib/locale"
35 kx # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
35 kx # DST transitions for POSIX-style TZ strings lacking them,
35 kx # in the usual case where POSIXRULES is '-'. If not specified,
35 kx # TZDEFRULESTRING defaults to US rules for future DST transitions.
35 kx # This mishandles some past timestamps, as US DST rules have changed.
35 kx # It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
35 kx # as Europe and US DST rules differ.
35 kx # -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
35 kx # -DUNINIT_TRAP if reading uninitialized storage can cause problems
35 kx # other than simply getting garbage data
35 kx # -DUSE_LTZ=0 to build zdump with the system time zone library
35 kx # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
35 kx # -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
35 kx # similarly for "slim". Fat TZif files work around incompatibilities
35 kx # and bugs in some TZif readers, notably older ones that
35 kx # ignore or otherwise mishandle 64-bit data in TZif files;
35 kx # however, fat TZif files may trigger bugs in newer TZif readers.
35 kx # Slim TZif files are more efficient, and are the default.
35 kx # -DZIC_MAX_ABBR_LEN_WO_WARN=3
35 kx # (or some other number) to set the maximum time zone abbreviation length
35 kx # that zic will accept without a warning (the default is 6)
35 kx # $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
35 kx #
35 kx # * Options marked "*" can be omitted if your compiler is C23 compatible.
35 kx # * Options marked "+" are obsolescent and are planned to be removed
35 kx # once the code assumes C99 or later.
35 kx #
35 kx # Select instrumentation via "make GCC_INSTRUMENT='whatever'".
35 kx GCC_INSTRUMENT = \
35 kx -fsanitize=undefined -fsanitize-address-use-after-scope \
35 kx -fsanitize-undefined-trap-on-error -fstack-protector
35 kx # Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
35 kx GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
35 kx $(GCC_INSTRUMENT) \
35 kx -Wall -Wextra \
35 kx -Walloc-size-larger-than=100000 -Warray-bounds=2 \
35 kx -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
35 kx -Wdeclaration-after-statement -Wdouble-promotion \
35 kx -Wduplicated-branches -Wduplicated-cond \
35 kx -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
35 kx -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
35 kx -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
35 kx -Wnull-dereference \
35 kx -Wold-style-definition -Woverlength-strings -Wpointer-arith \
35 kx -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
35 kx -Wstrict-prototypes -Wstringop-overflow=4 \
35 kx -Wstringop-truncation -Wsuggest-attribute=cold \
35 kx -Wsuggest-attribute=const -Wsuggest-attribute=format \
35 kx -Wsuggest-attribute=malloc \
35 kx -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
35 kx -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
35 kx -Wvariadic-macros -Wvla -Wwrite-strings \
35 kx -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
35 kx -Wno-type-limits
35 kx #
35 kx # If your system has a "GMT offset" field in its "struct tm"s
35 kx # (or if you decide to add such a field in your system's "time.h" file),
35 kx # add the name to a define such as
35 kx # -DTM_GMTOFF=tm_gmtoff
35 kx # to the end of the "CFLAGS=" line. If not defined, the code attempts to
35 kx # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
35 kx # Similarly, if your system has a "zone abbreviation" field, define
35 kx # -DTM_ZONE=tm_zone
35 kx # and define NO_TM_ZONE to suppress any guessing. Although these two fields
35 kx # not required by POSIX, a future version of POSIX is planned to require them
35 kx # and they are widely available on GNU/Linux and BSD systems.
35 kx #
35 kx # The next batch of options control support for external variables
35 kx # exported by tzcode. In practice these variables are less useful
35 kx # than TM_GMTOFF and TM_ZONE. However, most of them are standardized.
35 kx # #
35 kx # # To omit or support the external variable "tzname", add one of:
35 kx # # -DHAVE_TZNAME=0 # do not support "tzname"
35 kx # # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library
35 kx # # -DHAVE_TZNAME=2 # support and define "tzname"
35 kx # # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later.
35 kx # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
35 kx # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
35 kx # # crashes when combined with some platforms' standard libraries,
35 kx # # presumably due to memory allocation issues.
35 kx # #
35 kx # # To omit or support the external variables "timezone" and "daylight", add
35 kx # # -DUSG_COMPAT=0 # do not support
35 kx # # -DUSG_COMPAT=1 # support, and variables are defined by system library
35 kx # # -DUSG_COMPAT=2 # support and define variables
35 kx # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
35 kx # # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
35 kx # # If not defined, the code attempts to guess USG_COMPAT from other macros.
35 kx # #
35 kx # # To support the external variable "altzone", add
35 kx # # -DALTZONE=0 # do not support
35 kx # # -DALTZONE=1 # support "altzone", which is defined by system library
35 kx # # -DALTZONE=2 # support and define "altzone"
35 kx # # to the end of the "CFLAGS=" line; although "altzone" appeared in
35 kx # # System V Release 3.1 it has not been standardized.
35 kx # # If not defined, the code attempts to guess ALTZONE from other macros.
35 kx #
35 kx # If you want functions that were inspired by early versions of X3J11's work,
35 kx # add
35 kx # -DSTD_INSPIRED
35 kx # to the end of the "CFLAGS=" line. This arranges for the following
35 kx # functions to be added to the time conversion library.
35 kx # "offtime" is like "gmtime" except that it accepts a second (long) argument
35 kx # that gives an offset to add to the time_t when converting it.
35 kx # "timelocal" is equivalent to "mktime".
35 kx # "timeoff" is like "timegm" except that it accepts a second (long) argument
35 kx # that gives an offset to use when converting to a time_t.
35 kx # "posix2time" and "time2posix" are described in an included manual page.
35 kx # X3J11's work does not describe any of these functions.
35 kx # These functions may well disappear in future releases of the time
35 kx # conversion package.
35 kx #
35 kx # If you don't want functions that were inspired by NetBSD, add
35 kx # -DNETBSD_INSPIRED=0
35 kx # to the end of the "CFLAGS=" line. Otherwise, the functions
35 kx # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
35 kx # time library, and if STD_INSPIRED is also defined to nonzero the functions
35 kx # "posix2time_z" and "time2posix_z" are added as well.
35 kx # The functions ending in "_z" (or "_rz") are like their unsuffixed
35 kx # (or suffixed-by-"_r") counterparts, except with an extra first
35 kx # argument of opaque type timezone_t that specifies the timezone.
35 kx # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
35 kx #
35 kx # If you want to allocate state structures in localtime, add
35 kx # -DALL_STATE
35 kx # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
35 kx #
35 kx # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
35 kx # out by the National Institute of Standards and Technology
35 kx # which claims to test C and Posix conformance. If you want to pass PCTS, add
35 kx # -DPCTS
35 kx # to the end of the "CFLAGS=" line.
35 kx #
35 kx # If you want strict compliance with XPG4 as of 1994-04-09, add
35 kx # -DXPG4_1994_04_09
35 kx # to the end of the "CFLAGS=" line. This causes "strftime" to always return
35 kx # 53 as a week number (rather than 52 or 53) for January days before
35 kx # January's first Monday when a "%V" format is used and January 1
35 kx # falls on a Friday, Saturday, or Sunday.
35 kx
35 kx CFLAGS=
35 kx
35 kx # Linker flags. Default to $(LFLAGS) for backwards compatibility
35 kx # to release 2012h and earlier.
35 kx
35 kx LDFLAGS= $(LFLAGS)
35 kx
35 kx # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
35 kx # submake command lines. The default is no leap seconds.
35 kx
35 kx LEAPSECONDS=
35 kx
35 kx # The zic command and its arguments.
35 kx
35 kx zic= ./zic
35 kx ZIC= $(zic) $(ZFLAGS)
35 kx
35 kx # To shrink the size of installed TZif files,
35 kx # append "-r @N" to omit data before N-seconds-after-the-Epoch.
35 kx # To grow the files and work around bugs in older applications,
35 kx # possibly at the expense of introducing bugs in newer ones,
35 kx # append "-b fat"; see ZIC_BLOAT_DEFAULT above.
35 kx # See the zic man page for more about -b and -r.
35 kx ZFLAGS=
35 kx
35 kx # How to use zic to install TZif files.
35 kx
35 kx ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
35 kx
35 kx # The name of a Posix-compliant 'awk' on your system.
35 kx # mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
35 kx # Also, it is better (though not essential) if 'awk' supports UTF-8,
35 kx # and unfortunately mawk and busybox awk do not support UTF-8.
35 kx # Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
35 kx AWK= awk
35 kx
35 kx # The full path name of a Posix-compliant shell, preferably one that supports
35 kx # the Korn shell's 'select' statement as an extension.
35 kx # These days, Bash is the most popular.
35 kx # It should be OK to set this to /bin/sh, on platforms where /bin/sh
35 kx # lacks 'select' or doesn't completely conform to Posix, but /bin/bash
35 kx # is typically nicer if it works.
35 kx KSHELL= /bin/bash
35 kx
35 kx # Name of curl <https://curl.haxx.se/>, used for HTML validation.
35 kx CURL= curl
35 kx
35 kx # Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
35 kx GPG= gpg
35 kx
35 kx # This expensive test requires USE_LTZ.
35 kx # To suppress it, define this macro to be empty.
35 kx CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
35 kx
35 kx # SAFE_CHAR is a regular expression that matches a safe character.
35 kx # Some parts of this distribution are limited to safe characters;
35 kx # others can use any UTF-8 character.
35 kx # For now, the safe characters are a safe subset of ASCII.
35 kx # The caller must set the shell variable 'sharp' to the character '#',
35 kx # since Makefile macros cannot contain '#'.
35 kx # TAB_CHAR is a single tab character, in single quotes.
35 kx TAB_CHAR= ' '
35 kx SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
35 kx SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
35 kx SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
35 kx SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
35 kx SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]'
35 kx
35 kx # These non-alphabetic, non-ASCII printable characters are Latin-1,
35 kx # and so are likely displayable even in editors like XEmacs 21
35 kx # that have limited display capabilities.
35 kx UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷
35 kx # Non-ASCII non-letters that OK_CHAR allows, as these characters are
35 kx # useful in commentary.
35 kx UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)
35 kx
35 kx # Put this in a bracket expression to match spaces.
35 kx s = [:space:]
35 kx
35 kx # OK_CHAR matches any character allowed in the distributed files.
35 kx # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
35 kx # multibyte letters are also allowed so that commentary can contain a
35 kx # few safe symbols and people's names and can quote non-English sources.
35 kx # Other non-letters are limited to ASCII renderings for the
35 kx # convenience of maintainers using XEmacs 21.5.34, which by default
35 kx # mishandles Unicode characters U+0100 and greater.
35 kx OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
35 kx
35 kx # SAFE_LINE matches a line of safe characters.
35 kx # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
35 kx # this is so that comments can contain non-ASCII characters.
35 kx # OK_LINE matches a line of OK characters.
35 kx SAFE_LINE= '^'$(SAFE_CHAR)'*$$'
35 kx SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
35 kx OK_LINE= '^'$(OK_CHAR)'*$$'
35 kx
35 kx # Flags to give 'tar' when making a distribution.
35 kx # Try to use flags appropriate for GNU tar.
35 kx GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
35 kx --numeric-owner --owner=0 --group=0 \
35 kx --mode=go+u,go-w --sort=name
35 kx TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
35 kx then echo $(GNUTARFLAGS); \
35 kx else :; \
35 kx fi`
35 kx
35 kx # Flags to give 'gzip' when making a distribution.
35 kx GZIPFLAGS= -9n
35 kx
35 kx # When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
35 kx # This makes it easier to see which Zone has been affected.
35 kx DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \
35 kx || echo ' -F^TZ=')
35 kx
35 kx ###############################################################################
35 kx
35 kx #MAKE= make
35 kx
35 kx cc= cc
35 kx CC= $(cc) -DTZDIR='"$(TZDIR)"'
35 kx
35 kx AR= ar
35 kx
35 kx # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
35 kx RANLIB= :
35 kx
35 kx TZCOBJS= zic.o
35 kx TZDOBJS= zdump.o localtime.o asctime.o strftime.o
35 kx DATEOBJS= date.o localtime.o strftime.o asctime.o
35 kx LIBSRCS= localtime.c asctime.c difftime.c strftime.c
35 kx LIBOBJS= localtime.o asctime.o difftime.o strftime.o
35 kx HEADERS= tzfile.h private.h
35 kx NONLIBSRCS= zic.c zdump.c
35 kx NEWUCBSRCS= date.c
35 kx SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
35 kx tzselect.ksh workman.sh
35 kx MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
35 kx tzfile.5 tzselect.8 zic.8 zdump.8
35 kx MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
35 kx time2posix.3.txt \
35 kx tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
35 kx date.1.txt
35 kx COMMON= calendars CONTRIBUTING LICENSE Makefile \
35 kx NEWS README SECURITY theory.html version
35 kx WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
35 kx CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
35 kx check_tz-how-to.html check_tz-link.html
35 kx DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
35 kx PRIMARY_YDATA= africa antarctica asia australasia \
35 kx europe northamerica southamerica
35 kx YDATA= $(PRIMARY_YDATA) etcetera
35 kx NDATA= factory
35 kx TDATA_TO_CHECK= $(YDATA) $(NDATA) backward
35 kx TDATA= $(YDATA) $(NDATA) $(BACKWARD)
35 kx ZONETABLES= zone1970.tab zone.tab
35 kx TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
35 kx LEAP_DEPS= leapseconds.awk leap-seconds.list
35 kx TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \
35 kx $(PACKRATDATA) $(PACKRATLIST)
35 kx DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
35 kx DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
35 kx leapseconds $(ZONETABLES)
35 kx AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \
35 kx ziguard.awk zishrink.awk
35 kx MISC= $(AWK_SCRIPTS)
35 kx TZS_YEAR= 2050
35 kx TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
35 kx TZS= to$(TZS_YEAR).tzs
35 kx TZS_NEW= to$(TZS_YEAR)new.tzs
35 kx TZS_DEPS= $(YDATA) asctime.c localtime.c \
35 kx private.h tzfile.h zdump.c zic.c
35 kx TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
35 kx # EIGHT_YARDS is just a yard short of the whole ENCHILADA.
35 kx EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
35 kx ENCHILADA = $(EIGHT_YARDS) $(TZS)
35 kx
35 kx # Consult these files when deciding whether to rebuild the 'version' file.
35 kx # This list is not the same as the output of 'git ls-files', since
35 kx # .gitignore is not distributed.
35 kx VERSION_DEPS= \
35 kx calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
35 kx africa antarctica asctime.c asia australasia \
35 kx backward backzone \
35 kx checklinks.awk checktab.awk \
35 kx date.1 date.c difftime.c \
35 kx etcetera europe factory iso3166.tab \
35 kx leap-seconds.list leapseconds.awk localtime.c \
35 kx newctime.3 newstrftime.3 newtzset.3 northamerica \
35 kx private.h southamerica strftime.c theory.html \
35 kx time2posix.3 tz-art.html tz-how-to.html tz-link.html \
35 kx tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
35 kx workman.sh zdump.8 zdump.c zic.8 zic.c \
35 kx ziguard.awk zishrink.awk \
35 kx zone.tab zone1970.tab
35 kx
35 kx # And for the benefit of csh users on systems that assume the user
35 kx # shell should be used to handle commands in Makefiles. . .
35 kx
35 kx SHELL= /bin/sh
35 kx
35 kx all: tzselect zic zdump libtz.a $(TABDATA) \
35 kx vanguard.zi main.zi rearguard.zi
35 kx
35 kx ALL: all date $(ENCHILADA)
35 kx
35 kx install: all $(DATA) $(REDO) $(MANS)
35 kx mkdir -p '$(DESTDIR)$(BINDIR)' \
35 kx '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
35 kx '$(DESTDIR)$(LIBDIR)' \
35 kx '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
35 kx '$(DESTDIR)$(MANDIR)/man8'
35 kx $(ZIC_INSTALL) -l $(LOCALTIME) \
35 kx `case '$(POSIXRULES)' in ?*) echo '-p';; esac \
35 kx ` $(POSIXRULES) \
35 kx -t '$(DESTDIR)$(TZDEFAULT)'
35 kx cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
35 kx cp tzselect '$(DESTDIR)$(BINDIR)/.'
35 kx cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
35 kx cp zic '$(DESTDIR)$(ZICDIR)/.'
35 kx cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
35 kx $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
35 kx cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
35 kx cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
35 kx cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
35 kx
35 kx INSTALL: ALL install date.1
35 kx mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
35 kx cp date '$(DESTDIR)$(BINDIR)/.'
35 kx cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
35 kx
35 kx # Calculate version number from git, if available.
35 kx # Otherwise, use $(VERSION) unless it is "unknown" and there is already
35 kx # a 'version' file, in which case reuse the existing 'version' contents
35 kx # and append "-dirty" if the contents do not already end in "-dirty".
35 kx version: $(VERSION_DEPS)
35 kx { (type git) >/dev/null 2>&1 && \
35 kx V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
35 kx --abbrev=7 --dirty` || \
35 kx if test '$(VERSION)' = unknown && V=`cat $@`; then \
35 kx case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
35 kx else \
35 kx V='$(VERSION)'; \
35 kx fi; } && \
35 kx printf '%s\n' "$$V" >$@.out
35 kx mv $@.out $@
35 kx
35 kx # These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
35 kx vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
35 kx $(AWK) \
35 kx -v DATAFORM=`expr $@ : '\(.*\).zi'` \
35 kx -v PACKRATDATA='$(PACKRATDATA)' \
35 kx -v PACKRATLIST='$(PACKRATLIST)' \
35 kx -f ziguard.awk \
35 kx $(TDATA) $(PACKRATDATA) >$@.out
35 kx mv $@.out $@
35 kx # This file has a version comment that attempts to capture any tailoring
35 kx # via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
35 kx tzdata.zi: $(DATAFORM).zi version zishrink.awk
35 kx version=`sed 1q version` && \
35 kx LC_ALL=C $(AWK) \
35 kx -v dataform='$(DATAFORM)' \
35 kx -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
35 kx -v redo='$(REDO)' \
35 kx -v version="$$version" \
35 kx -f zishrink.awk \
35 kx $(DATAFORM).zi >$@.out
35 kx mv $@.out $@
35 kx
35 kx version.h: version
35 kx VERSION=`cat version` && printf '%s\n' \
35 kx 'static char const PKGVERSION[]="($(PACKAGE)) ";' \
35 kx "static char const TZVERSION[]=\"$$VERSION\";" \
35 kx 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
35 kx >$@.out
35 kx mv $@.out $@
35 kx
35 kx zdump: $(TZDOBJS)
35 kx $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
35 kx
35 kx zic: $(TZCOBJS)
35 kx $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
35 kx
35 kx leapseconds: $(LEAP_DEPS)
35 kx $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
35 kx -f leapseconds.awk leap-seconds.list >$@.out
35 kx mv $@.out $@
35 kx
35 kx # Arguments to pass to submakes of install_data.
35 kx # They can be overridden by later submake arguments.
35 kx INSTALLARGS = \
35 kx BACKWARD='$(BACKWARD)' \
35 kx DESTDIR='$(DESTDIR)' \
35 kx LEAPSECONDS='$(LEAPSECONDS)' \
35 kx PACKRATDATA='$(PACKRATDATA)' \
35 kx PACKRATLIST='$(PACKRATLIST)' \
35 kx TZDEFAULT='$(TZDEFAULT)' \
35 kx TZDIR='$(TZDIR)' \
35 kx ZIC='$(ZIC)'
35 kx
35 kx INSTALL_DATA_DEPS = zic leapseconds tzdata.zi
35 kx
35 kx # 'make install_data' installs one set of TZif files.
35 kx install_data: $(INSTALL_DATA_DEPS)
35 kx $(ZIC_INSTALL) tzdata.zi
35 kx
35 kx posix_only: $(INSTALL_DATA_DEPS)
35 kx $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
35 kx
35 kx right_only: $(INSTALL_DATA_DEPS)
35 kx $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
35 kx install_data
35 kx
35 kx # In earlier versions of this makefile, the other two directories were
35 kx # subdirectories of $(TZDIR). However, this led to configuration errors.
35 kx # For example, with posix_right under the earlier scheme,
35 kx # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
35 kx # but gmtime without leap seconds, which led to problems with applications
35 kx # like sendmail that subtract gmtime from localtime.
35 kx # Therefore, the other two directories are now siblings of $(TZDIR).
35 kx # You must replace all of $(TZDIR) to switch from not using leap seconds
35 kx # to using them, or vice versa.
35 kx right_posix: right_only
35 kx rm -fr '$(DESTDIR)$(TZDIR)-leaps'
35 kx ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
35 kx $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
35 kx $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
35 kx
35 kx posix_right: posix_only
35 kx rm -fr '$(DESTDIR)$(TZDIR)-posix'
35 kx ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
35 kx $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
35 kx $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
35 kx
35 kx zones: $(REDO)
35 kx
35 kx # dummy.zd is not a real file; it is mentioned here only so that the
35 kx # top-level 'make' does not have a syntax error.
35 kx ZDS = dummy.zd
35 kx # Rule used only by submakes invoked by the $(TZS_NEW) rule.
35 kx # It is separate so that GNU 'make -j' can run instances in parallel.
35 kx $(ZDS): zdump
35 kx ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
35 kx >$@
35 kx
35 kx TZS_NEW_DEPS = tzdata.zi zdump zic
35 kx $(TZS_NEW): $(TZS_NEW_DEPS)
35 kx rm -fr tzs$(TZS_YEAR).dir
35 kx mkdir tzs$(TZS_YEAR).dir
35 kx $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
35 kx $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
35 kx tzdata.zi | LC_ALL=C sort >$@.out
35 kx wd=`pwd` && \
35 kx x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
35 kx tzdata.zi \
35 kx | LC_ALL=C sort -t . -k 2,2` && \
35 kx set x $$x && \
35 kx shift && \
35 kx ZDS=$$* && \
35 kx $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
35 kx ZDS="$$ZDS" $$ZDS && \
35 kx sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
35 kx rm -fr tzs$(TZS_YEAR).dir
35 kx mv $@.out $@
35 kx
35 kx # If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
35 kx # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
35 kx $(TZS):
35 kx touch $@
35 kx
35 kx force_tzs: $(TZS_NEW)
35 kx cp $(TZS_NEW) $(TZS)
35 kx
35 kx libtz.a: $(LIBOBJS)
35 kx rm -f $@
35 kx $(AR) -rc $@ $(LIBOBJS)
35 kx $(RANLIB) $@
35 kx
35 kx date: $(DATEOBJS)
35 kx $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
35 kx
35 kx tzselect: tzselect.ksh version
35 kx VERSION=`cat version` && sed \
35 kx -e 's|#!/bin/bash|#!$(KSHELL)|g' \
35 kx -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \
35 kx -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
35 kx -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
35 kx -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
35 kx -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
35 kx <$@.ksh >$@.out
35 kx chmod +x $@.out
35 kx mv $@.out $@
35 kx
35 kx check: check_back check_mild
35 kx check_mild: check_character_set check_white_space check_links \
35 kx check_name_lengths check_slashed_abbrs check_sorted \
35 kx check_tables check_web check_ziguard check_zishrink check_tzs
35 kx
35 kx check_character_set: $(ENCHILADA)
35 kx test ! '$(UTF8_LOCALE)' || \
35 kx ! printf 'A\304\200B\n' | \
35 kx LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
35 kx LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
35 kx sharp='#' && \
35 kx ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
35 kx $(MISC) $(SOURCES) $(WEB_PAGES) \
35 kx CONTRIBUTING LICENSE README SECURITY \
35 kx version tzdata.zi && \
35 kx ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
35 kx Makefile && \
35 kx ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
35 kx leapseconds zone.tab && \
35 kx ! grep -Env $(OK_LINE) $(ENCHILADA); \
35 kx }
35 kx touch $@
35 kx
35 kx check_white_space: $(ENCHILADA)
35 kx patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
35 kx ! grep -En "$$pat" \
35 kx $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
35 kx ! grep -n '[$s]$$' \
35 kx $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
35 kx touch $@
35 kx
35 kx PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
35 kx FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
35 kx
35 kx check_name_lengths: $(TDATA_TO_CHECK) backzone
35 kx ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
35 kx $(TDATA_TO_CHECK) backzone
35 kx touch $@
35 kx
35 kx PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
35 kx STDOFF = [-+]?[0-9:.]+
35 kx RULELESS_SAVE = (-|$(STDOFF)[sd]?)
35 kx RULELESS_SLASHED_ABBRS = \
35 kx $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
35 kx
35 kx check_slashed_abbrs: $(TDATA_TO_CHECK)
35 kx ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
35 kx touch $@
35 kx
35 kx CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
35 kx
35 kx check_sorted: backward backzone
35 kx $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
35 kx backward | LC_ALL=C sort -cu
35 kx $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
35 kx touch $@
35 kx
35 kx check_back: checklinks.awk $(TDATA_TO_CHECK)
35 kx $(AWK) \
35 kx -v DATAFORM=$(DATAFORM) \
35 kx -v backcheck=backward \
35 kx -f checklinks.awk $(TDATA_TO_CHECK)
35 kx touch $@
35 kx
35 kx check_links: checklinks.awk tzdata.zi
35 kx $(AWK) \
35 kx -v DATAFORM=$(DATAFORM) \
35 kx -f checklinks.awk tzdata.zi
35 kx touch $@
35 kx
35 kx check_tables: checktab.awk $(YDATA) backward $(ZONETABLES)
35 kx for tab in $(ZONETABLES); do \
35 kx test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
35 kx $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
35 kx || exit; \
35 kx done
35 kx touch $@
35 kx
35 kx check_tzs: $(TZS) $(TZS_NEW)
35 kx if test -s $(TZS); then \
35 kx $(DIFF_TZS) $(TZS) $(TZS_NEW); \
35 kx else \
35 kx cp $(TZS_NEW) $(TZS); \
35 kx fi
35 kx touch $@
35 kx
35 kx check_web: $(CHECK_WEB_PAGES)
35 kx check_theory.html: theory.html
35 kx check_tz-art.html: tz-art.html
35 kx check_tz-how-to.html: tz-how-to.html
35 kx check_tz-link.html: tz-link.html
35 kx check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
35 kx $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
35 kx -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
35 kx test ! -s $@.out || { cat $@.out; exit 1; }
35 kx mv $@.out $@
35 kx
35 kx check_ziguard: rearguard.zi vanguard.zi ziguard.awk
35 kx $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
35 kx diff -u rearguard.zi -
35 kx $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
35 kx diff -u vanguard.zi -
35 kx touch $@
35 kx
35 kx # Check that zishrink.awk does not alter the data, and that ziguard.awk
35 kx # preserves main-format data.
35 kx check_zishrink: check_zishrink_posix check_zishrink_right
35 kx check_zishrink_posix check_zishrink_right: \
35 kx zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
35 kx $(TDATA) $(DATAFORM).zi tzdata.zi
35 kx rm -fr $@.dir $@-t.dir $@-shrunk.dir
35 kx mkdir $@.dir $@-t.dir $@-shrunk.dir
35 kx case $@ in \
35 kx *_right) leap='-L leapseconds';; \
35 kx *) leap=;; \
35 kx esac && \
35 kx $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
35 kx $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
35 kx case $(DATAFORM),$(PACKRATLIST) in \
35 kx main,) \
35 kx $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
35 kx $(AWK) '/^Rule/' $(TDATA) | \
35 kx $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
35 kx diff -r $@.dir $@-t.dir;; \
35 kx esac
35 kx diff -r $@.dir $@-shrunk.dir
35 kx rm -fr $@.dir $@-t.dir $@-shrunk.dir
35 kx touch $@
35 kx
35 kx clean_misc:
35 kx rm -fr check_*.dir
35 kx rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
35 kx check_* core typecheck_* \
35 kx date tzselect version.h zdump zic libtz.a
35 kx clean: clean_misc
35 kx rm -fr *.dir tzdb-*/
35 kx rm -f *.zi $(TZS_NEW)
35 kx
35 kx maintainer-clean: clean
35 kx @echo 'This command is intended for maintainers to use; it'
35 kx @echo 'deletes files that may need special tools to rebuild.'
35 kx rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
35 kx
35 kx names:
35 kx @echo $(ENCHILADA)
35 kx
35 kx public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \
35 kx tarballs signatures
35 kx
35 kx date.1.txt: date.1
35 kx newctime.3.txt: newctime.3
35 kx newstrftime.3.txt: newstrftime.3
35 kx newtzset.3.txt: newtzset.3
35 kx time2posix.3.txt: time2posix.3
35 kx tzfile.5.txt: tzfile.5
35 kx tzselect.8.txt: tzselect.8
35 kx zdump.8.txt: zdump.8
35 kx zic.8.txt: zic.8
35 kx
35 kx $(MANTXTS): workman.sh
35 kx LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
35 kx mv $@.out $@
35 kx
35 kx # Set file timestamps deterministically if possible,
35 kx # so that tarballs containing the timestamps are reproducible.
35 kx #
35 kx # '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
35 kx # file DEST to the maximum of the timestamps of the files A B C ...,
35 kx # plus N if GNU ls and touch are available.
35 kx SET_TIMESTAMP_N = sh -c '\
35 kx n=$$0 dest=$$1; shift; \
35 kx touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \
35 kx if test $$n != 0 && \
35 kx lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \
35 kx set x $$lsout && \
35 kx touch -cmd @`expr $$7 + $$n` "$$dest"; \
35 kx else :; fi'
35 kx # If DEST depends on A B C ... in this Makefile, callers should use
35 kx # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
35 kx # downstream 'make' that considers equal timestamps to be out of date.
35 kx # POSIX allows this 'make' behavior, and HP-UX 'make' does it.
35 kx # If all that matters is that the timestamp be reproducible
35 kx # and plausible, use $(SET_TIMESTAMP).
35 kx SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
35 kx SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
35 kx
35 kx # Set the timestamps to those of the git repository, if available,
35 kx # and if the files have not changed since then.
35 kx # This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
35 kx # and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
35 kx # If git or GNU is absent, don't bother to sync with git timestamps.
35 kx # Also, set the timestamp of each prebuilt file like 'leapseconds'
35 kx # to be the maximum of the files it depends on.
35 kx set-timestamps.out: $(EIGHT_YARDS)
35 kx rm -f $@
35 kx if (type git) >/dev/null 2>&1 && \
35 kx files=`git ls-files $(EIGHT_YARDS)` && \
35 kx touch -md @1 test.out; then \
35 kx rm -f test.out && \
35 kx for file in $$files; do \
35 kx if git diff --quiet $$file; then \
35 kx time=`git log -1 --format='tformat:%ct' $$file` && \
35 kx touch -cmd @$$time $$file; \
35 kx else \
35 kx echo >&2 "$$file: warning: does not match repository"; \
35 kx fi || exit; \
35 kx done; \
35 kx fi
35 kx $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
35 kx for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
35 kx $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
35 kx exit; \
35 kx done
35 kx $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
35 kx $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
35 kx touch $@
35 kx set-tzs-timestamp.out: $(TZS)
35 kx $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
35 kx touch $@
35 kx
35 kx # The zics below ensure that each data file can stand on its own.
35 kx # We also do an all-files run to catch links to links.
35 kx
35 kx check_public: $(VERSION_DEPS)
35 kx rm -fr public.dir
35 kx mkdir public.dir
35 kx ln $(VERSION_DEPS) public.dir
35 kx cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
35 kx for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
35 kx public.dir/vanguard.zi public.dir/main.zi \
35 kx public.dir/rearguard.zi; \
35 kx do \
35 kx public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
35 kx done
35 kx public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
35 kx :
35 kx : Also check 'backzone' syntax.
35 kx rm public.dir/main.zi
35 kx cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
35 kx public.dir/zic -d public.dir/zoneinfo main.zi
35 kx rm public.dir/main.zi
35 kx cd public.dir && \
35 kx $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
35 kx public.dir/zic -d public.dir/zoneinfo main.zi
35 kx :
35 kx rm -fr public.dir
35 kx touch $@
35 kx
35 kx # Check that the code works under various alternative
35 kx # implementations of time_t.
35 kx check_time_t_alternatives: $(TIME_T_ALTERNATIVES)
35 kx $(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
35 kx $(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
35 kx rm -fr $@.dir
35 kx mkdir $@.dir
35 kx ln $(VERSION_DEPS) $@.dir
35 kx case $@ in \
35 kx int*32_t) range=-2147483648,2147483648;; \
35 kx u*) range=0,4294967296;; \
35 kx *) range=-4294967296,4294967296;; \
35 kx esac && \
35 kx wd=`pwd` && \
35 kx zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
35 kx if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
35 kx range_target=; \
35 kx else \
35 kx range_target=to$$range.tzs; \
35 kx fi && \
35 kx (cd $@.dir && \
35 kx $(MAKE) TOPDIR="$$wd/$@.dir" \
35 kx CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
35 kx REDO='$(REDO)' \
35 kx D=$$wd/$@.dir \
35 kx TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
35 kx install $$range_target) && \
35 kx test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
35 kx (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
35 kx $(MAKE) TOPDIR="$$wd/$@.dir" \
35 kx TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
35 kx D=$$wd/$@.dir \
35 kx to$$range.tzs) && \
35 kx $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
35 kx $@.dir/to$$range.tzs && \
35 kx if diff -q Makefile Makefile 2>/dev/null; then \
35 kx quiet_option='-q'; \
35 kx else \
35 kx quiet_option=''; \
35 kx fi && \
35 kx diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
35 kx $@.dir/etc && \
35 kx diff $$quiet_option -r \
35 kx $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
35 kx $@.dir/usr/share; \
35 kx }
35 kx touch $@
35 kx
35 kx TRADITIONAL_ASC = \
35 kx tzcode$(VERSION).tar.gz.asc \
35 kx tzdata$(VERSION).tar.gz.asc
35 kx REARGUARD_ASC = \
35 kx tzdata$(VERSION)-rearguard.tar.gz.asc
35 kx ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
35 kx tzdb-$(VERSION).tar.lz.asc
35 kx
35 kx tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
35 kx signatures rearguard_signatures traditional_signatures: \
35 kx version set-timestamps.out rearguard.zi vanguard.zi
35 kx VERSION=`cat version` && \
35 kx $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
35 kx
35 kx # These *_version rules are intended for use if VERSION is set by some
35 kx # other means. Ordinarily these rules are used only by the above
35 kx # non-_version rules, which set VERSION on the 'make' command line.
35 kx tarballs_version: traditional_tarballs_version rearguard_tarballs_version \
35 kx tzdb-$(VERSION).tar.lz
35 kx rearguard_tarballs_version: \
35 kx tzdata$(VERSION)-rearguard.tar.gz
35 kx traditional_tarballs_version: \
35 kx tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
35 kx tailored_tarballs_version: \
35 kx tzdata$(VERSION)-tailored.tar.gz
35 kx signatures_version: $(ALL_ASC)
35 kx rearguard_signatures_version: $(REARGUARD_ASC)
35 kx traditional_signatures_version: $(TRADITIONAL_ASC)
35 kx
35 kx tzcode$(VERSION).tar.gz: set-timestamps.out
35 kx LC_ALL=C && export LC_ALL && \
35 kx tar $(TARFLAGS) -cf - \
35 kx $(COMMON) $(DOCS) $(SOURCES) | \
35 kx gzip $(GZIPFLAGS) >$@.out
35 kx mv $@.out $@
35 kx
35 kx tzdata$(VERSION).tar.gz: set-timestamps.out
35 kx LC_ALL=C && export LC_ALL && \
35 kx tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
35 kx gzip $(GZIPFLAGS) >$@.out
35 kx mv $@.out $@
35 kx
35 kx # Create empty files with a reproducible timestamp.
35 kx CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
35 kx
35 kx # The obsolescent *rearguard* targets and related macros are present
35 kx # for backwards compatibility with tz releases 2018e through 2022a.
35 kx # They should go away eventually. To build rearguard tarballs you
35 kx # can instead use 'make DATAFORM=rearguard tailored_tarballs'.
35 kx tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
35 kx rm -fr $@.dir
35 kx mkdir $@.dir
35 kx ln $(TZDATA_DIST) $@.dir
35 kx cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
35 kx for f in $(TDATA) $(PACKRATDATA); do \
35 kx rearf=$@.dir/$$f; \
35 kx $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
35 kx $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
35 kx done
35 kx sed '1s/$$/-rearguard/' <version >$@.dir/version
35 kx : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
35 kx $(CREATE_EMPTY) $@.dir/pacificnew
35 kx touch -cmr version $@.dir/version
35 kx LC_ALL=C && export LC_ALL && \
35 kx (cd $@.dir && \
35 kx tar $(TARFLAGS) -cf - \
35 kx $(TZDATA_DIST) pacificnew | \
35 kx gzip $(GZIPFLAGS)) >$@.out
35 kx mv $@.out $@
35 kx
35 kx # Create a tailored tarball suitable for TZUpdater and compatible tools.
35 kx # For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
35 kx # useful for testing whether TZUpdater supports vanguard form.
35 kx # The generated tarball is not byte-for-byte equivalent to a hand-tailored
35 kx # traditional tarball, as data entries are put into 'etcetera' even if they
35 kx # came from some other source file. However, the effect should be the same
35 kx # for ordinary use, which reads all the source files.
35 kx tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
35 kx rm -fr $@.dir
35 kx mkdir $@.dir
35 kx : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
35 kx cd $@.dir && \
35 kx $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
35 kx `test $(DATAFORM) = vanguard || echo pacificnew`
35 kx (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
35 kx >$@.dir/etcetera
35 kx touch -cmr tzdata.zi $@.dir/etcetera
35 kx sed -n \
35 kx -e '/^# *version *\(.*\)/h' \
35 kx -e '/^# *ddeps */H' \
35 kx -e '$$!d' \
35 kx -e 'g' \
35 kx -e 's/^# *version *//' \
35 kx -e 's/\n# *ddeps */-/' \
35 kx -e 's/ /-/g' \
35 kx -e 'p' \
35 kx <tzdata.zi >$@.dir/version
35 kx touch -cmr version $@.dir/version
35 kx links= && \
35 kx for file in $(TZDATA_DIST); do \
35 kx test -f $@.dir/$$file || links="$$links $$file"; \
35 kx done && \
35 kx ln $$links $@.dir
35 kx LC_ALL=C && export LC_ALL && \
35 kx (cd $@.dir && \
35 kx tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out
35 kx mv $@.out $@
35 kx
35 kx tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
35 kx rm -fr tzdb-$(VERSION)
35 kx mkdir tzdb-$(VERSION)
35 kx ln $(ENCHILADA) tzdb-$(VERSION)
35 kx $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
35 kx LC_ALL=C && export LC_ALL && \
35 kx tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
35 kx mv $@.out $@
35 kx
35 kx tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
35 kx tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
35 kx tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
35 kx tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
35 kx $(ALL_ASC):
35 kx $(GPG) --armor --detach-sign $?
35 kx
35 kx TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
35 kx typecheck: typecheck_long_long typecheck_unsigned
35 kx typecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
35 kx rm -fr $@.dir
35 kx mkdir $@.dir
35 kx ln $(VERSION_DEPS) $@.dir
35 kx cd $@.dir && \
35 kx case $@ in \
35 kx *_long_long) i="long long";; \
35 kx *_unsigned ) i="unsigned" ;; \
35 kx esac && \
35 kx typecheck_cflags='' && \
35 kx $(MAKE) \
35 kx CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
35 kx TOPDIR="`pwd`" \
35 kx install
35 kx $@.dir/zdump -i -c 1970,1971 Europe/Rome
35 kx touch $@
35 kx
35 kx zonenames: tzdata.zi
35 kx @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
35 kx
35 kx asctime.o: private.h tzfile.h
35 kx date.o: private.h
35 kx difftime.o: private.h
35 kx localtime.o: private.h tzfile.h
35 kx strftime.o: private.h tzfile.h
35 kx zdump.o: version.h
35 kx zic.o: private.h tzfile.h version.h
35 kx
35 kx .PHONY: ALL INSTALL all
35 kx .PHONY: check check_mild check_time_t_alternatives
35 kx .PHONY: check_web check_zishrink
35 kx .PHONY: clean clean_misc dummy.zd force_tzs
35 kx .PHONY: install install_data maintainer-clean names
35 kx .PHONY: posix_only posix_right public
35 kx .PHONY: rearguard_signatures rearguard_signatures_version
35 kx .PHONY: rearguard_tarballs rearguard_tarballs_version
35 kx .PHONY: right_only right_posix signatures signatures_version
35 kx .PHONY: tarballs tarballs_version
35 kx .PHONY: traditional_signatures traditional_signatures_version
35 kx .PHONY: traditional_tarballs traditional_tarballs_version
35 kx .PHONY: tailored_tarballs tailored_tarballs_version
35 kx .PHONY: typecheck
35 kx .PHONY: zonenames zones
35 kx .PHONY: $(ZDS)