14616d0f9Sopenharmony_ci# Make and install tzdb code and data.
24616d0f9Sopenharmony_ci# This file is in the public domain, so clarified as of
34616d0f9Sopenharmony_ci# 2009-05-17 by Arthur David Olson.
44616d0f9Sopenharmony_ci# Request POSIX conformance; this must be the first non-comment line.
54616d0f9Sopenharmony_ci.POSIX:
64616d0f9Sopenharmony_ci# On older platforms you may need to scrounge for a POSIX-conforming 'make'.
74616d0f9Sopenharmony_ci# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or
84616d0f9Sopenharmony_ci# /usr/xpg4/bin/make, not /usr/ccs/bin/make.
94616d0f9Sopenharmony_ci
104616d0f9Sopenharmony_ci# To affect how this Makefile works, you can run a shell script like this:
114616d0f9Sopenharmony_ci#
124616d0f9Sopenharmony_ci#	#!/bin/sh
134616d0f9Sopenharmony_ci#	make CC='gcc -std=gnu11' "$@"
144616d0f9Sopenharmony_ci#
154616d0f9Sopenharmony_ci# This example script is appropriate for a pre-2017 GNU/Linux system
164616d0f9Sopenharmony_ci# where a non-default setting is needed to support this package's use of C99.
174616d0f9Sopenharmony_ci#
184616d0f9Sopenharmony_ci# Alternatively, you can simply edit this Makefile to tailor the following
194616d0f9Sopenharmony_ci# macro definitions.
204616d0f9Sopenharmony_ci
214616d0f9Sopenharmony_ci###############################################################################
224616d0f9Sopenharmony_ci# Start of macros that one plausibly might want to tailor.
234616d0f9Sopenharmony_ci
244616d0f9Sopenharmony_ci# Package name for the code distribution.
254616d0f9Sopenharmony_ciPACKAGE=	tzcode
264616d0f9Sopenharmony_ci
274616d0f9Sopenharmony_ci# Version number for the distribution, overridden in the 'tarballs' rule below.
284616d0f9Sopenharmony_ciVERSION=	unknown
294616d0f9Sopenharmony_ci
304616d0f9Sopenharmony_ci# Email address for bug reports.
314616d0f9Sopenharmony_ciBUGEMAIL=	tz@iana.org
324616d0f9Sopenharmony_ci
334616d0f9Sopenharmony_ci# DATAFORM selects the data format.
344616d0f9Sopenharmony_ci# Available formats represent essentially the same data, albeit
354616d0f9Sopenharmony_ci# possibly with minor discrepancies that users are not likely to notice.
364616d0f9Sopenharmony_ci# To get new features and the best data right away, use:
374616d0f9Sopenharmony_ci#	DATAFORM=	vanguard
384616d0f9Sopenharmony_ci# To wait a while before using new features, to give downstream users
394616d0f9Sopenharmony_ci# time to upgrade zic (the default), use:
404616d0f9Sopenharmony_ci#	DATAFORM=	main
414616d0f9Sopenharmony_ci# To wait even longer for new features, use:
424616d0f9Sopenharmony_ci#	DATAFORM=	rearguard
434616d0f9Sopenharmony_ci# Rearguard users might also want "ZFLAGS = -b fat"; see below.
444616d0f9Sopenharmony_ciDATAFORM=		main
454616d0f9Sopenharmony_ci
464616d0f9Sopenharmony_ci# Change the line below for your timezone (after finding the one you want in
474616d0f9Sopenharmony_ci# one of the $(TDATA) source files, or adding it to a source file).
484616d0f9Sopenharmony_ci# Alternatively, if you discover you've got the wrong timezone, you can just
494616d0f9Sopenharmony_ci# 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
504616d0f9Sopenharmony_ci# Use the command
514616d0f9Sopenharmony_ci#	make zonenames
524616d0f9Sopenharmony_ci# to get a list of the values you can use for LOCALTIME.
534616d0f9Sopenharmony_ci
544616d0f9Sopenharmony_ciLOCALTIME=	Factory
554616d0f9Sopenharmony_ci
564616d0f9Sopenharmony_ci# The POSIXRULES macro controls interpretation of POSIX-2017.1-like TZ
574616d0f9Sopenharmony_ci# settings like TZ='EET-2EEST' that lack DST transition rules.
584616d0f9Sopenharmony_ci# If POSIXRULES is '-', no template is installed; this is the default.
594616d0f9Sopenharmony_ci# Any other value for POSIXRULES is obsolete and should not be relied on, as:
604616d0f9Sopenharmony_ci# * It does not work correctly in popular implementations such as GNU/Linux.
614616d0f9Sopenharmony_ci# * It does not work even in tzcode, except for historical timestamps
624616d0f9Sopenharmony_ci#   that precede the last explicit transition in the POSIXRULES file.
634616d0f9Sopenharmony_ci#   Hence it typically does not work for current and future timestamps.
644616d0f9Sopenharmony_ci# If, despite the above, you want a template for handling these settings,
654616d0f9Sopenharmony_ci# you can change the line below (after finding the timezone you want in the
664616d0f9Sopenharmony_ci# one of the $(TDATA) source files, or adding it to a source file).
674616d0f9Sopenharmony_ci# Alternatively, if you discover you've got the wrong timezone, you can just
684616d0f9Sopenharmony_ci# 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
694616d0f9Sopenharmony_ci# Use the command
704616d0f9Sopenharmony_ci#	make zonenames
714616d0f9Sopenharmony_ci# to get a list of the values you can use for POSIXRULES.
724616d0f9Sopenharmony_ci
734616d0f9Sopenharmony_ciPOSIXRULES=	-
744616d0f9Sopenharmony_ci
754616d0f9Sopenharmony_ci# Also see TZDEFRULESTRING below, which takes effect only
764616d0f9Sopenharmony_ci# if POSIXRULES is '-' or if the template file cannot be accessed.
774616d0f9Sopenharmony_ci
784616d0f9Sopenharmony_ci
794616d0f9Sopenharmony_ci# Installation locations.
804616d0f9Sopenharmony_ci#
814616d0f9Sopenharmony_ci# The defaults are suitable for Debian, except that if REDO is
824616d0f9Sopenharmony_ci# posix_right or right_posix then files that Debian puts under
834616d0f9Sopenharmony_ci# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
844616d0f9Sopenharmony_ci# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
854616d0f9Sopenharmony_ci# respectively.  Problems with the Debian approach are discussed in
864616d0f9Sopenharmony_ci# the commentary for the right_posix rule (below).
874616d0f9Sopenharmony_ci
884616d0f9Sopenharmony_ci# Destination directory, which can be used for staging.
894616d0f9Sopenharmony_ci# 'make DESTDIR=/stage install' installs under /stage (e.g., to
904616d0f9Sopenharmony_ci# /stage/etc/localtime instead of to /etc/localtime).  Files under
914616d0f9Sopenharmony_ci# /stage are not intended to work as-is, but can be copied by hand to
924616d0f9Sopenharmony_ci# the root directory later.  If DESTDIR is empty, 'make install' does
934616d0f9Sopenharmony_ci# not stage, but installs directly into production locations.
944616d0f9Sopenharmony_ciDESTDIR =
954616d0f9Sopenharmony_ci
964616d0f9Sopenharmony_ci# Everything is installed into subdirectories of TOPDIR, and used there.
974616d0f9Sopenharmony_ci# TOPDIR should be empty (meaning the root directory),
984616d0f9Sopenharmony_ci# or a directory name that does not end in "/".
994616d0f9Sopenharmony_ci# TOPDIR should be empty or an absolute name unless you're just testing.
1004616d0f9Sopenharmony_ciTOPDIR =
1014616d0f9Sopenharmony_ci
1024616d0f9Sopenharmony_ci# The default local timezone is taken from the file TZDEFAULT.
1034616d0f9Sopenharmony_ciTZDEFAULT = $(TOPDIR)/etc/localtime
1044616d0f9Sopenharmony_ci
1054616d0f9Sopenharmony_ci# The subdirectory containing installed program and data files, and
1064616d0f9Sopenharmony_ci# likewise for installed files that can be shared among architectures.
1074616d0f9Sopenharmony_ci# These should be relative file names.
1084616d0f9Sopenharmony_ciUSRDIR = usr
1094616d0f9Sopenharmony_ciUSRSHAREDIR = $(USRDIR)/share
1104616d0f9Sopenharmony_ci
1114616d0f9Sopenharmony_ci# "Compiled" timezone information is placed in the "TZDIR" directory
1124616d0f9Sopenharmony_ci# (and subdirectories).
1134616d0f9Sopenharmony_ci# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
1144616d0f9Sopenharmony_ciTZDIR_BASENAME=	zoneinfo
1154616d0f9Sopenharmony_ciTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
1164616d0f9Sopenharmony_ci
1174616d0f9Sopenharmony_ci# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
1184616d0f9Sopenharmony_ciBINDIR = $(TOPDIR)/$(USRDIR)/bin
1194616d0f9Sopenharmony_ci
1204616d0f9Sopenharmony_ci# The "zdump" command goes in:
1214616d0f9Sopenharmony_ciZDUMPDIR = $(BINDIR)
1224616d0f9Sopenharmony_ci
1234616d0f9Sopenharmony_ci# The "zic" command goes in:
1244616d0f9Sopenharmony_ciZICDIR = $(TOPDIR)/$(USRDIR)/sbin
1254616d0f9Sopenharmony_ci
1264616d0f9Sopenharmony_ci# Manual pages go in subdirectories of. . .
1274616d0f9Sopenharmony_ciMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
1284616d0f9Sopenharmony_ci
1294616d0f9Sopenharmony_ci# Library functions are put in an archive in LIBDIR.
1304616d0f9Sopenharmony_ciLIBDIR = $(TOPDIR)/$(USRDIR)/lib
1314616d0f9Sopenharmony_ci
1324616d0f9Sopenharmony_ci
1334616d0f9Sopenharmony_ci# Types to try, as an alternative to time_t.
1344616d0f9Sopenharmony_ciTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
1354616d0f9Sopenharmony_ciTIME_T_ALTERNATIVES_HEAD = int_least64_t
1364616d0f9Sopenharmony_ciTIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
1374616d0f9Sopenharmony_ci
1384616d0f9Sopenharmony_ci# What kind of TZif data files to generate.  (TZif is the binary time
1394616d0f9Sopenharmony_ci# zone data format that zic generates; see Internet RFC 8536.)
1404616d0f9Sopenharmony_ci# If you want only POSIX time, with time values interpreted as
1414616d0f9Sopenharmony_ci# seconds since the epoch (not counting leap seconds), use
1424616d0f9Sopenharmony_ci#	REDO=		posix_only
1434616d0f9Sopenharmony_ci# below.  If you want only "right" time, with values interpreted
1444616d0f9Sopenharmony_ci# as seconds since the epoch (counting leap seconds), use
1454616d0f9Sopenharmony_ci#	REDO=		right_only
1464616d0f9Sopenharmony_ci# below.  If you want both sets of data available, with leap seconds not
1474616d0f9Sopenharmony_ci# counted normally, use
1484616d0f9Sopenharmony_ci#	REDO=		posix_right
1494616d0f9Sopenharmony_ci# below.  If you want both sets of data available, with leap seconds counted
1504616d0f9Sopenharmony_ci# normally, use
1514616d0f9Sopenharmony_ci#	REDO=		right_posix
1524616d0f9Sopenharmony_ci# below.  POSIX mandates that leap seconds not be counted; for compatibility
1534616d0f9Sopenharmony_ci# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
1544616d0f9Sopenharmony_ci# leap smearing; this can work better than unsmeared "right" time with
1554616d0f9Sopenharmony_ci# applications that are not leap second aware, and is closer to unsmeared
1564616d0f9Sopenharmony_ci# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
1574616d0f9Sopenharmony_ci
1584616d0f9Sopenharmony_ciREDO=		posix_right
1594616d0f9Sopenharmony_ci
1604616d0f9Sopenharmony_ci# Whether to put an "Expires" line in the leapseconds file.
1614616d0f9Sopenharmony_ci# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
1624616d0f9Sopenharmony_ci# The EXPIRES_LINE value matters only if REDO's value contains "right".
1634616d0f9Sopenharmony_ci# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
1644616d0f9Sopenharmony_ci# zic's support for the Expires line was introduced in tzdb 2020a,
1654616d0f9Sopenharmony_ci# and was modified in tzdb 2021b to generate version 4 TZif files.
1664616d0f9Sopenharmony_ci# EXPIRES_LINE defaults to 0 for now so that the leapseconds file
1674616d0f9Sopenharmony_ci# can be given to pre-2020a zic implementations and so that TZif files
1684616d0f9Sopenharmony_ci# built by newer zic implementations can be read by pre-2021b libraries.
1694616d0f9Sopenharmony_ciEXPIRES_LINE=	0
1704616d0f9Sopenharmony_ci
1714616d0f9Sopenharmony_ci# To install data in text form that has all the information of the TZif data,
1724616d0f9Sopenharmony_ci# (optionally incorporating leap second information), use
1734616d0f9Sopenharmony_ci#	TZDATA_TEXT=	tzdata.zi leapseconds
1744616d0f9Sopenharmony_ci# To install text data without leap second information (e.g., because
1754616d0f9Sopenharmony_ci# REDO='posix_only'), use
1764616d0f9Sopenharmony_ci#	TZDATA_TEXT=	tzdata.zi
1774616d0f9Sopenharmony_ci# To avoid installing text data, use
1784616d0f9Sopenharmony_ci#	TZDATA_TEXT=
1794616d0f9Sopenharmony_ci
1804616d0f9Sopenharmony_ciTZDATA_TEXT=	leapseconds tzdata.zi
1814616d0f9Sopenharmony_ci
1824616d0f9Sopenharmony_ci# For backward-compatibility links for old zone names, use
1834616d0f9Sopenharmony_ci#	BACKWARD=	backward
1844616d0f9Sopenharmony_ci# To omit these links, use
1854616d0f9Sopenharmony_ci#	BACKWARD=
1864616d0f9Sopenharmony_ci
1874616d0f9Sopenharmony_ciBACKWARD=	backward
1884616d0f9Sopenharmony_ci
1894616d0f9Sopenharmony_ci# If you want out-of-scope and often-wrong data from the file 'backzone',
1904616d0f9Sopenharmony_ci# but only for entries listed in the backward-compatibility file zone.tab, use
1914616d0f9Sopenharmony_ci#	PACKRATDATA=	backzone
1924616d0f9Sopenharmony_ci#	PACKRATLIST=	zone.tab
1934616d0f9Sopenharmony_ci# If you want all the 'backzone' data, use
1944616d0f9Sopenharmony_ci#	PACKRATDATA=	backzone
1954616d0f9Sopenharmony_ci#	PACKRATLIST=
1964616d0f9Sopenharmony_ci# To omit this data, use
1974616d0f9Sopenharmony_ci#	PACKRATDATA=
1984616d0f9Sopenharmony_ci#	PACKRATLIST=
1994616d0f9Sopenharmony_ci
2004616d0f9Sopenharmony_ciPACKRATDATA=
2014616d0f9Sopenharmony_ciPACKRATLIST=
2024616d0f9Sopenharmony_ci
2034616d0f9Sopenharmony_ci# The name of a locale using the UTF-8 encoding, used during self-tests.
2044616d0f9Sopenharmony_ci# The tests are skipped if the name does not appear to work on this system.
2054616d0f9Sopenharmony_ci
2064616d0f9Sopenharmony_ciUTF8_LOCALE=	en_US.utf8
2074616d0f9Sopenharmony_ci
2084616d0f9Sopenharmony_ci# Non-default libraries needed to link.
2094616d0f9Sopenharmony_ci# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
2104616d0f9Sopenharmony_ciLDLIBS=
2114616d0f9Sopenharmony_ci
2124616d0f9Sopenharmony_ci# Add the following to an uncommented "CFLAGS=" line as needed
2134616d0f9Sopenharmony_ci# to override defaults specified in the source code or by the system.
2144616d0f9Sopenharmony_ci# "-DFOO" is equivalent to "-DFOO=1".
2154616d0f9Sopenharmony_ci#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
2164616d0f9Sopenharmony_ci#	formats that generate only the last two digits of year numbers
2174616d0f9Sopenharmony_ci#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
2184616d0f9Sopenharmony_ci#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
2194616d0f9Sopenharmony_ci#	than what POSIX specifies, assuming local time is UT.
2204616d0f9Sopenharmony_ci#	For example, N is 252460800 on AmigaOS.
2214616d0f9Sopenharmony_ci#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
2224616d0f9Sopenharmony_ci#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
2234616d0f9Sopenharmony_ci#  -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
2244616d0f9Sopenharmony_ci#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
2254616d0f9Sopenharmony_ci#  -DHAVE__GENERIC=0 if _Generic does not work*
2264616d0f9Sopenharmony_ci#  -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
2274616d0f9Sopenharmony_ci#	-DHAVE_GETRANDOM=0 to avoid using getrandom
2284616d0f9Sopenharmony_ci#  -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
2294616d0f9Sopenharmony_ci#	where LDLIBS also needs to contain -lintl on some hosts;
2304616d0f9Sopenharmony_ci#	-DHAVE_GETTEXT=0 to avoid using gettext
2314616d0f9Sopenharmony_ci#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
2324616d0f9Sopenharmony_ci#	ctime_r and asctime_r incompatibly with the POSIX standard
2334616d0f9Sopenharmony_ci#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
2344616d0f9Sopenharmony_ci#  -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
2354616d0f9Sopenharmony_ci#  -DHAVE_LINK=0 if your system lacks a link function
2364616d0f9Sopenharmony_ci#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
2374616d0f9Sopenharmony_ci#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
2384616d0f9Sopenharmony_ci#	localtime_rz can make zdump significantly faster, but is nonstandard.
2394616d0f9Sopenharmony_ci#  -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
2404616d0f9Sopenharmony_ci#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
2414616d0f9Sopenharmony_ci#	functions like 'link' or variables like 'tzname' required by POSIX
2424616d0f9Sopenharmony_ci#  -DHAVE_SETENV=0 if your system lacks the setenv function
2434616d0f9Sopenharmony_ci#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+
2444616d0f9Sopenharmony_ci#  -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like
2454616d0f9Sopenharmony_ci#	__builtin_add_overflow work*
2464616d0f9Sopenharmony_ci#  -DHAVE_STDINT_H=0 if <stdint.h> does not work*+
2474616d0f9Sopenharmony_ci#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
2484616d0f9Sopenharmony_ci#  -DHAVE_STRDUP=0 if your system lacks the strdup function
2494616d0f9Sopenharmony_ci#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function+
2504616d0f9Sopenharmony_ci#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
2514616d0f9Sopenharmony_ci#  -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
2524616d0f9Sopenharmony_ci#  -DHAVE_TZSET=0 if your system lacks a tzset function
2534616d0f9Sopenharmony_ci#  -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
2544616d0f9Sopenharmony_ci#  -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
2554616d0f9Sopenharmony_ci#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
2564616d0f9Sopenharmony_ci#  -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
2574616d0f9Sopenharmony_ci#	Typically it is better to use a later standard.  For example,
2584616d0f9Sopenharmony_ci#	with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
2594616d0f9Sopenharmony_ci#	Even with -DPORT_TO_C89, the code needs at least one C99
2604616d0f9Sopenharmony_ci#	feature (integers at least 64 bits wide) and maybe more.
2614616d0f9Sopenharmony_ci#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
2624616d0f9Sopenharmony_ci#	with external linkage, e.g., applications cannot define 'localtime'.
2634616d0f9Sopenharmony_ci#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
2644616d0f9Sopenharmony_ci#  -DSUPPORT_C89 if the tzcode library should support C89 callers+
2654616d0f9Sopenharmony_ci#	However, this might trigger latent bugs in C99-or-later callers.
2664616d0f9Sopenharmony_ci#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
2674616d0f9Sopenharmony_ci#	security implications and is not recommended for general use
2684616d0f9Sopenharmony_ci#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
2694616d0f9Sopenharmony_ci#	not needed by the main-program tz code, which is single-threaded.
2704616d0f9Sopenharmony_ci#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
2714616d0f9Sopenharmony_ci#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
2724616d0f9Sopenharmony_ci#	This is intended for internal use only; it mangles external names.
2734616d0f9Sopenharmony_ci#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
2744616d0f9Sopenharmony_ci#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
2754616d0f9Sopenharmony_ci#	the default is system-supplied, typically "/usr/lib/locale"
2764616d0f9Sopenharmony_ci#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
2774616d0f9Sopenharmony_ci#	DST transitions for POSIX.1-2017-style TZ strings lacking them,
2784616d0f9Sopenharmony_ci#	in the usual case where POSIXRULES is '-'.  If not specified,
2794616d0f9Sopenharmony_ci#	TZDEFRULESTRING defaults to US rules for future DST transitions.
2804616d0f9Sopenharmony_ci#	This mishandles some past timestamps, as US DST rules have changed.
2814616d0f9Sopenharmony_ci#	It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
2824616d0f9Sopenharmony_ci#	as Europe and US DST rules differ.
2834616d0f9Sopenharmony_ci#  -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
2844616d0f9Sopenharmony_ci#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
2854616d0f9Sopenharmony_ci#	other than simply getting garbage data
2864616d0f9Sopenharmony_ci#  -DUSE_LTZ=0 to build zdump with the system time zone library
2874616d0f9Sopenharmony_ci#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
2884616d0f9Sopenharmony_ci#  -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
2894616d0f9Sopenharmony_ci#	similarly for "slim".  Fat TZif files work around incompatibilities
2904616d0f9Sopenharmony_ci#	and bugs in some TZif readers, notably older ones that
2914616d0f9Sopenharmony_ci#	ignore or otherwise mishandle 64-bit data in TZif files;
2924616d0f9Sopenharmony_ci#	however, fat TZif files may trigger bugs in newer TZif readers.
2934616d0f9Sopenharmony_ci#	Slim TZif files are more efficient, and are the default.
2944616d0f9Sopenharmony_ci#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
2954616d0f9Sopenharmony_ci#	(or some other number) to set the maximum time zone abbreviation length
2964616d0f9Sopenharmony_ci#	that zic will accept without a warning (the default is 6)
2974616d0f9Sopenharmony_ci#  -g to generate symbolic debugging info
2984616d0f9Sopenharmony_ci#  -Idir to include from directory 'dir'
2994616d0f9Sopenharmony_ci#  -O0 to disable optimization; other -O options to enable more optimization
3004616d0f9Sopenharmony_ci#  -Uname to remove any definition of the macro 'name'
3014616d0f9Sopenharmony_ci#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
3024616d0f9Sopenharmony_ci#
3034616d0f9Sopenharmony_ci# * Options marked "*" can be omitted if your compiler is C23 compatible.
3044616d0f9Sopenharmony_ci# * Options marked "+" are obsolescent and are planned to be removed
3054616d0f9Sopenharmony_ci#   once the code assumes C99 or later, say in the year 2029.
3064616d0f9Sopenharmony_ci#
3074616d0f9Sopenharmony_ci# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
3084616d0f9Sopenharmony_ciGCC_INSTRUMENT = \
3094616d0f9Sopenharmony_ci  -fsanitize=undefined -fsanitize-address-use-after-scope \
3104616d0f9Sopenharmony_ci  -fsanitize-undefined-trap-on-error -fstack-protector
3114616d0f9Sopenharmony_ci# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
3124616d0f9Sopenharmony_ciGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
3134616d0f9Sopenharmony_ci  $(GCC_INSTRUMENT) \
3144616d0f9Sopenharmony_ci  -Wall -Wextra \
3154616d0f9Sopenharmony_ci  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
3164616d0f9Sopenharmony_ci  -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
3174616d0f9Sopenharmony_ci  -Wdeclaration-after-statement -Wdouble-promotion \
3184616d0f9Sopenharmony_ci  -Wduplicated-branches -Wduplicated-cond \
3194616d0f9Sopenharmony_ci  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
3204616d0f9Sopenharmony_ci  -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
3214616d0f9Sopenharmony_ci  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
3224616d0f9Sopenharmony_ci  -Wnull-dereference \
3234616d0f9Sopenharmony_ci  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
3244616d0f9Sopenharmony_ci  -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
3254616d0f9Sopenharmony_ci  -Wstrict-prototypes -Wstringop-overflow=4 \
3264616d0f9Sopenharmony_ci  -Wstringop-truncation -Wsuggest-attribute=cold \
3274616d0f9Sopenharmony_ci  -Wsuggest-attribute=const -Wsuggest-attribute=format \
3284616d0f9Sopenharmony_ci  -Wsuggest-attribute=malloc \
3294616d0f9Sopenharmony_ci  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
3304616d0f9Sopenharmony_ci  -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
3314616d0f9Sopenharmony_ci  -Wvariadic-macros -Wvla -Wwrite-strings \
3324616d0f9Sopenharmony_ci  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
3334616d0f9Sopenharmony_ci  -Wno-type-limits
3344616d0f9Sopenharmony_ci#
3354616d0f9Sopenharmony_ci# If your system has a "GMT offset" field in its "struct tm"s
3364616d0f9Sopenharmony_ci# (or if you decide to add such a field in your system's "time.h" file),
3374616d0f9Sopenharmony_ci# add the name to a define such as
3384616d0f9Sopenharmony_ci#	-DTM_GMTOFF=tm_gmtoff
3394616d0f9Sopenharmony_ci# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
3404616d0f9Sopenharmony_ci# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
3414616d0f9Sopenharmony_ci# Similarly, if your system has a "zone abbreviation" field, define
3424616d0f9Sopenharmony_ci#	-DTM_ZONE=tm_zone
3434616d0f9Sopenharmony_ci# and define NO_TM_ZONE to suppress any guessing.
3444616d0f9Sopenharmony_ci# Although these two fields are not required by POSIX.1-2017,
3454616d0f9Sopenharmony_ci# POSIX 202x/D4 requires them and they are widely available
3464616d0f9Sopenharmony_ci# on GNU/Linux and BSD systems.
3474616d0f9Sopenharmony_ci#
3484616d0f9Sopenharmony_ci# The next batch of options control support for external variables
3494616d0f9Sopenharmony_ci# exported by tzcode.  In practice these variables are less useful
3504616d0f9Sopenharmony_ci# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
3514616d0f9Sopenharmony_ci# #
3524616d0f9Sopenharmony_ci# # To omit or support the external variable "tzname", add one of:
3534616d0f9Sopenharmony_ci# #	-DHAVE_TZNAME=0 # do not support "tzname"
3544616d0f9Sopenharmony_ci# #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
3554616d0f9Sopenharmony_ci# #	-DHAVE_TZNAME=2 # support and define "tzname"
3564616d0f9Sopenharmony_ci# # to the "CFLAGS=" line.  "tzname" is required by POSIX.1-1988 and later.
3574616d0f9Sopenharmony_ci# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
3584616d0f9Sopenharmony_ci# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
3594616d0f9Sopenharmony_ci# # crashes when combined with some platforms' standard libraries,
3604616d0f9Sopenharmony_ci# # presumably due to memory allocation issues.
3614616d0f9Sopenharmony_ci# #
3624616d0f9Sopenharmony_ci# # To omit or support the external variables "timezone" and "daylight", add
3634616d0f9Sopenharmony_ci# #	-DUSG_COMPAT=0 # do not support
3644616d0f9Sopenharmony_ci# #	-DUSG_COMPAT=1 # support, and variables are defined by system library
3654616d0f9Sopenharmony_ci# #	-DUSG_COMPAT=2 # support and define variables
3664616d0f9Sopenharmony_ci# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix
3674616d0f9Sopenharmony_ci# # Systems Group code and are required by POSIX.1-2008 and later (with XSI).
3684616d0f9Sopenharmony_ci# # If not defined, the code attempts to guess USG_COMPAT from other macros.
3694616d0f9Sopenharmony_ci# #
3704616d0f9Sopenharmony_ci# # To support the external variable "altzone", add
3714616d0f9Sopenharmony_ci# #	-DALTZONE=0 # do not support
3724616d0f9Sopenharmony_ci# #	-DALTZONE=1 # support "altzone", which is defined by system library
3734616d0f9Sopenharmony_ci# #	-DALTZONE=2 # support and define "altzone"
3744616d0f9Sopenharmony_ci# # to the end of the "CFLAGS=" line; although "altzone" appeared in
3754616d0f9Sopenharmony_ci# # System V Release 3.1 it has not been standardized.
3764616d0f9Sopenharmony_ci# # If not defined, the code attempts to guess ALTZONE from other macros.
3774616d0f9Sopenharmony_ci#
3784616d0f9Sopenharmony_ci# If you want functions that were inspired by early versions of X3J11's work,
3794616d0f9Sopenharmony_ci# add
3804616d0f9Sopenharmony_ci#	-DSTD_INSPIRED
3814616d0f9Sopenharmony_ci# to the end of the "CFLAGS=" line.  This arranges for the following
3824616d0f9Sopenharmony_ci# functions to be added to the time conversion library.
3834616d0f9Sopenharmony_ci# "offtime" is like "gmtime" except that it accepts a second (long) argument
3844616d0f9Sopenharmony_ci# that gives an offset to add to the time_t when converting it.
3854616d0f9Sopenharmony_ci# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone.
3864616d0f9Sopenharmony_ci# "timelocal" is nearly equivalent to "mktime".
3874616d0f9Sopenharmony_ci# "timeoff" is like "timegm" except that it accepts a second (long) argument
3884616d0f9Sopenharmony_ci# that gives an offset to use when converting to a time_t.
3894616d0f9Sopenharmony_ci# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone.
3904616d0f9Sopenharmony_ci# "posix2time" and "time2posix" are described in an included manual page.
3914616d0f9Sopenharmony_ci# X3J11's work does not describe any of these functions.
3924616d0f9Sopenharmony_ci# These functions may well disappear in future releases of the time
3934616d0f9Sopenharmony_ci# conversion package.
3944616d0f9Sopenharmony_ci#
3954616d0f9Sopenharmony_ci# If you don't want functions that were inspired by NetBSD, add
3964616d0f9Sopenharmony_ci#	-DNETBSD_INSPIRED=0
3974616d0f9Sopenharmony_ci# to the end of the "CFLAGS=" line.  Otherwise, the functions
3984616d0f9Sopenharmony_ci# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
3994616d0f9Sopenharmony_ci# time library, and if STD_INSPIRED is also defined to nonzero the functions
4004616d0f9Sopenharmony_ci# "posix2time_z" and "time2posix_z" are added as well.
4014616d0f9Sopenharmony_ci# The functions ending in "_z" (or "_rz") are like their unsuffixed
4024616d0f9Sopenharmony_ci# (or suffixed-by-"_r") counterparts, except with an extra first
4034616d0f9Sopenharmony_ci# argument of opaque type timezone_t that specifies the timezone.
4044616d0f9Sopenharmony_ci# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
4054616d0f9Sopenharmony_ci#
4064616d0f9Sopenharmony_ci# If you want to allocate state structures in localtime, add
4074616d0f9Sopenharmony_ci#	-DALL_STATE
4084616d0f9Sopenharmony_ci# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
4094616d0f9Sopenharmony_ci#
4104616d0f9Sopenharmony_ci# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
4114616d0f9Sopenharmony_ci# out by the National Institute of Standards and Technology
4124616d0f9Sopenharmony_ci# which claims to test C and POSIX conformance.  If you want to pass PCTS, add
4134616d0f9Sopenharmony_ci#	-DPCTS
4144616d0f9Sopenharmony_ci# to the end of the "CFLAGS=" line.
4154616d0f9Sopenharmony_ci#
4164616d0f9Sopenharmony_ci# If you want strict compliance with XPG4 as of 1994-04-09, add
4174616d0f9Sopenharmony_ci#	-DXPG4_1994_04_09
4184616d0f9Sopenharmony_ci# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
4194616d0f9Sopenharmony_ci# 53 as a week number (rather than 52 or 53) for January days before
4204616d0f9Sopenharmony_ci# January's first Monday when a "%V" format is used and January 1
4214616d0f9Sopenharmony_ci# falls on a Friday, Saturday, or Sunday.
4224616d0f9Sopenharmony_ci#
4234616d0f9Sopenharmony_ci# POSIX says CFLAGS defaults to "-O 1".
4244616d0f9Sopenharmony_ci# Uncomment the following line and edit its contents as needed.
4254616d0f9Sopenharmony_ci
4264616d0f9Sopenharmony_ci#CFLAGS= -O 1
4274616d0f9Sopenharmony_ci
4284616d0f9Sopenharmony_ci
4294616d0f9Sopenharmony_ci# The name of a POSIX-like library archiver, its flags, C compiler,
4304616d0f9Sopenharmony_ci# linker flags, and 'make' utility.  Ordinarily the defaults suffice.
4314616d0f9Sopenharmony_ci# The commented-out values are the defaults specified by POSIX.1-202x/D4.
4324616d0f9Sopenharmony_ci#AR = ar
4334616d0f9Sopenharmony_ci#ARFLAGS = -rv
4344616d0f9Sopenharmony_ci#CC = c17
4354616d0f9Sopenharmony_ci#LDFLAGS =
4364616d0f9Sopenharmony_ci#MAKE = make
4374616d0f9Sopenharmony_ci
4384616d0f9Sopenharmony_ci# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
4394616d0f9Sopenharmony_ci# submake command lines.  The default is no leap seconds.
4404616d0f9Sopenharmony_ci
4414616d0f9Sopenharmony_ciLEAPSECONDS=
4424616d0f9Sopenharmony_ci
4434616d0f9Sopenharmony_ci# Where to fetch leap-seconds.list from.
4444616d0f9Sopenharmony_cileaplist_URI = \
4454616d0f9Sopenharmony_ci  https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
4464616d0f9Sopenharmony_ci# The file is generated by the IERS Earth Orientation Centre, in Paris.
4474616d0f9Sopenharmony_cileaplist_TZ = Europe/Paris
4484616d0f9Sopenharmony_ci
4494616d0f9Sopenharmony_ci# The zic command and its arguments.
4504616d0f9Sopenharmony_ci
4514616d0f9Sopenharmony_cizic=		./zic
4524616d0f9Sopenharmony_ciZIC=		$(zic) $(ZFLAGS)
4534616d0f9Sopenharmony_ci
4544616d0f9Sopenharmony_ci# To shrink the size of installed TZif files,
4554616d0f9Sopenharmony_ci# append "-r @N" to omit data before N-seconds-after-the-Epoch.
4564616d0f9Sopenharmony_ci# To grow the files and work around bugs in older applications,
4574616d0f9Sopenharmony_ci# possibly at the expense of introducing bugs in newer ones,
4584616d0f9Sopenharmony_ci# append "-b fat"; see ZIC_BLOAT_DEFAULT above.
4594616d0f9Sopenharmony_ci# See the zic man page for more about -b and -r.
4604616d0f9Sopenharmony_ciZFLAGS=
4614616d0f9Sopenharmony_ci
4624616d0f9Sopenharmony_ci# How to use zic to install TZif files.
4634616d0f9Sopenharmony_ci
4644616d0f9Sopenharmony_ciZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
4654616d0f9Sopenharmony_ci
4664616d0f9Sopenharmony_ci# The name of a POSIX-compliant 'awk' on your system.
4674616d0f9Sopenharmony_ci# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
4684616d0f9Sopenharmony_ci# Also, it is better (though not essential) if 'awk' supports UTF-8,
4694616d0f9Sopenharmony_ci# and unfortunately mawk and busybox awk do not support UTF-8.
4704616d0f9Sopenharmony_ci# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
4714616d0f9Sopenharmony_ciAWK=		awk
4724616d0f9Sopenharmony_ci
4734616d0f9Sopenharmony_ci# The full path name of a POSIX-compliant shell, preferably one that supports
4744616d0f9Sopenharmony_ci# the Korn shell's 'select' statement as an extension.
4754616d0f9Sopenharmony_ci# These days, Bash is the most popular.
4764616d0f9Sopenharmony_ci# It should be OK to set this to /bin/sh, on platforms where /bin/sh
4774616d0f9Sopenharmony_ci# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash
4784616d0f9Sopenharmony_ci# is typically nicer if it works.
4794616d0f9Sopenharmony_ciKSHELL=		/bin/bash
4804616d0f9Sopenharmony_ci
4814616d0f9Sopenharmony_ci# Name of curl <https://curl.haxx.se/>, used for HTML validation
4824616d0f9Sopenharmony_ci# and to fetch leap-seconds.list from upstream.
4834616d0f9Sopenharmony_ciCURL=		curl
4844616d0f9Sopenharmony_ci
4854616d0f9Sopenharmony_ci# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
4864616d0f9Sopenharmony_ciGPG=		gpg
4874616d0f9Sopenharmony_ci
4884616d0f9Sopenharmony_ci# This expensive test requires USE_LTZ.
4894616d0f9Sopenharmony_ci# To suppress it, define this macro to be empty.
4904616d0f9Sopenharmony_ciCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
4914616d0f9Sopenharmony_ci
4924616d0f9Sopenharmony_ci# SAFE_CHAR is a regular expression that matches a safe character.
4934616d0f9Sopenharmony_ci# Some parts of this distribution are limited to safe characters;
4944616d0f9Sopenharmony_ci# others can use any UTF-8 character.
4954616d0f9Sopenharmony_ci# For now, the safe characters are a safe subset of ASCII.
4964616d0f9Sopenharmony_ci# The caller must set the shell variable 'sharp' to the character '#',
4974616d0f9Sopenharmony_ci# since Makefile macros cannot contain '#'.
4984616d0f9Sopenharmony_ci# TAB_CHAR is a single tab character, in single quotes.
4994616d0f9Sopenharmony_ciTAB_CHAR=	'	'
5004616d0f9Sopenharmony_ciSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
5014616d0f9Sopenharmony_ciSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
5024616d0f9Sopenharmony_ciSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
5034616d0f9Sopenharmony_ciSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
5044616d0f9Sopenharmony_ciSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
5054616d0f9Sopenharmony_ci
5064616d0f9Sopenharmony_ci# These non-alphabetic, non-ASCII printable characters are Latin-1,
5074616d0f9Sopenharmony_ci# and so are likely displayable even in editors like XEmacs 21
5084616d0f9Sopenharmony_ci# that have limited display capabilities.
5094616d0f9Sopenharmony_ciUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷
5104616d0f9Sopenharmony_ci# Non-ASCII non-letters that OK_CHAR allows, as these characters are
5114616d0f9Sopenharmony_ci# useful in commentary.
5124616d0f9Sopenharmony_ciUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)
5134616d0f9Sopenharmony_ci
5144616d0f9Sopenharmony_ci# Put this in a bracket expression to match spaces.
5154616d0f9Sopenharmony_cis = [:space:]
5164616d0f9Sopenharmony_ci
5174616d0f9Sopenharmony_ci# OK_CHAR matches any character allowed in the distributed files.
5184616d0f9Sopenharmony_ci# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
5194616d0f9Sopenharmony_ci# multibyte letters are also allowed so that commentary can contain a
5204616d0f9Sopenharmony_ci# few safe symbols and people's names and can quote non-English sources.
5214616d0f9Sopenharmony_ci# Other non-letters are limited to ASCII renderings for the
5224616d0f9Sopenharmony_ci# convenience of maintainers using XEmacs 21.5.34, which by default
5234616d0f9Sopenharmony_ci# mishandles Unicode characters U+0100 and greater.
5244616d0f9Sopenharmony_ciOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
5254616d0f9Sopenharmony_ci
5264616d0f9Sopenharmony_ci# SAFE_LINE matches a line of safe characters.
5274616d0f9Sopenharmony_ci# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
5284616d0f9Sopenharmony_ci# this is so that comments can contain non-ASCII characters.
5294616d0f9Sopenharmony_ci# OK_LINE matches a line of OK characters.
5304616d0f9Sopenharmony_ciSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
5314616d0f9Sopenharmony_ciSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
5324616d0f9Sopenharmony_ciOK_LINE=	'^'$(OK_CHAR)'*$$'
5334616d0f9Sopenharmony_ci
5344616d0f9Sopenharmony_ci# Flags to give 'tar' when making a distribution.
5354616d0f9Sopenharmony_ci# Try to use flags appropriate for GNU tar.
5364616d0f9Sopenharmony_ciGNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
5374616d0f9Sopenharmony_ci  --numeric-owner --owner=0 --group=0 \
5384616d0f9Sopenharmony_ci  --mode=go+u,go-w --sort=name
5394616d0f9Sopenharmony_ciTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
5404616d0f9Sopenharmony_ci		 then echo $(GNUTARFLAGS); \
5414616d0f9Sopenharmony_ci		 else :; \
5424616d0f9Sopenharmony_ci		 fi`
5434616d0f9Sopenharmony_ci
5444616d0f9Sopenharmony_ci# Flags to give 'gzip' when making a distribution.
5454616d0f9Sopenharmony_ciGZIPFLAGS=	-9n
5464616d0f9Sopenharmony_ci
5474616d0f9Sopenharmony_ci# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
5484616d0f9Sopenharmony_ci# This makes it easier to see which Zone has been affected.
5494616d0f9Sopenharmony_ciDIFF_TZS=	 diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \
5504616d0f9Sopenharmony_ci			   || echo ' -F^TZ=')
5514616d0f9Sopenharmony_ci
5524616d0f9Sopenharmony_ci# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
5534616d0f9Sopenharmony_ciRANLIB=		:
5544616d0f9Sopenharmony_ci
5554616d0f9Sopenharmony_ci# POSIX prohibits defining or using SHELL.  However, csh users on systems
5564616d0f9Sopenharmony_ci# that use the user shell for Makefile commands may need to define SHELL.
5574616d0f9Sopenharmony_ci#SHELL=		/bin/sh
5584616d0f9Sopenharmony_ci
5594616d0f9Sopenharmony_ci# End of macros that one plausibly might want to tailor.
5604616d0f9Sopenharmony_ci###############################################################################
5614616d0f9Sopenharmony_ci
5624616d0f9Sopenharmony_ci
5634616d0f9Sopenharmony_ciTZCOBJS=	zic.o
5644616d0f9Sopenharmony_ciTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
5654616d0f9Sopenharmony_ciDATEOBJS=	date.o localtime.o strftime.o asctime.o
5664616d0f9Sopenharmony_ciLIBSRCS=	localtime.c asctime.c difftime.c strftime.c
5674616d0f9Sopenharmony_ciLIBOBJS=	localtime.o asctime.o difftime.o strftime.o
5684616d0f9Sopenharmony_ciHEADERS=	tzfile.h private.h
5694616d0f9Sopenharmony_ciNONLIBSRCS=	zic.c zdump.c
5704616d0f9Sopenharmony_ciNEWUCBSRCS=	date.c
5714616d0f9Sopenharmony_ciSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
5724616d0f9Sopenharmony_ci			tzselect.ksh workman.sh
5734616d0f9Sopenharmony_ciMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
5744616d0f9Sopenharmony_ci			tzfile.5 tzselect.8 zic.8 zdump.8
5754616d0f9Sopenharmony_ciMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
5764616d0f9Sopenharmony_ci			time2posix.3.txt \
5774616d0f9Sopenharmony_ci			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
5784616d0f9Sopenharmony_ci			date.1.txt
5794616d0f9Sopenharmony_ciCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
5804616d0f9Sopenharmony_ci			NEWS README SECURITY theory.html version
5814616d0f9Sopenharmony_ciWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
5824616d0f9Sopenharmony_ciCHECK_WEB_PAGES=check_theory.html check_tz-art.html \
5834616d0f9Sopenharmony_ci			check_tz-how-to.html check_tz-link.html
5844616d0f9Sopenharmony_ciDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
5854616d0f9Sopenharmony_ciPRIMARY_YDATA=	africa antarctica asia australasia \
5864616d0f9Sopenharmony_ci		europe northamerica southamerica
5874616d0f9Sopenharmony_ciYDATA=		$(PRIMARY_YDATA) etcetera
5884616d0f9Sopenharmony_ciNDATA=		factory
5894616d0f9Sopenharmony_ciTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward
5904616d0f9Sopenharmony_ciTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
5914616d0f9Sopenharmony_ciZONETABLES=	zone.tab zone1970.tab zonenow.tab
5924616d0f9Sopenharmony_ciTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
5934616d0f9Sopenharmony_ciLEAP_DEPS=	leapseconds.awk leap-seconds.list
5944616d0f9Sopenharmony_ciTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) \
5954616d0f9Sopenharmony_ci		  $(PACKRATDATA) $(PACKRATLIST)
5964616d0f9Sopenharmony_ciDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
5974616d0f9Sopenharmony_ciDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
5984616d0f9Sopenharmony_ci			leapseconds $(ZONETABLES)
5994616d0f9Sopenharmony_ciAWK_SCRIPTS=	checklinks.awk checknow.awk checktab.awk leapseconds.awk \
6004616d0f9Sopenharmony_ci			ziguard.awk zishrink.awk
6014616d0f9Sopenharmony_ciMISC=		$(AWK_SCRIPTS)
6024616d0f9Sopenharmony_ciTZS_YEAR=	2050
6034616d0f9Sopenharmony_ciTZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
6044616d0f9Sopenharmony_ciTZS=		to$(TZS_YEAR).tzs
6054616d0f9Sopenharmony_ciTZS_NEW=	to$(TZS_YEAR)new.tzs
6064616d0f9Sopenharmony_ciTZS_DEPS=	$(YDATA) asctime.c localtime.c \
6074616d0f9Sopenharmony_ci			private.h tzfile.h zdump.c zic.c
6084616d0f9Sopenharmony_ciTZDATA_DIST = $(COMMON) $(DATA) $(MISC)
6094616d0f9Sopenharmony_ci# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
6104616d0f9Sopenharmony_ciEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
6114616d0f9Sopenharmony_ciENCHILADA = $(EIGHT_YARDS) $(TZS)
6124616d0f9Sopenharmony_ci
6134616d0f9Sopenharmony_ci# Consult these files when deciding whether to rebuild the 'version' file.
6144616d0f9Sopenharmony_ci# This list is not the same as the output of 'git ls-files', since
6154616d0f9Sopenharmony_ci# .gitignore is not distributed.
6164616d0f9Sopenharmony_ciVERSION_DEPS= \
6174616d0f9Sopenharmony_ci		calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
6184616d0f9Sopenharmony_ci		africa antarctica asctime.c asia australasia \
6194616d0f9Sopenharmony_ci		backward backzone \
6204616d0f9Sopenharmony_ci		checklinks.awk checknow.awk checktab.awk \
6214616d0f9Sopenharmony_ci		date.1 date.c difftime.c \
6224616d0f9Sopenharmony_ci		etcetera europe factory iso3166.tab \
6234616d0f9Sopenharmony_ci		leap-seconds.list leapseconds.awk localtime.c \
6244616d0f9Sopenharmony_ci		newctime.3 newstrftime.3 newtzset.3 northamerica \
6254616d0f9Sopenharmony_ci		private.h southamerica strftime.c theory.html \
6264616d0f9Sopenharmony_ci		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
6274616d0f9Sopenharmony_ci		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
6284616d0f9Sopenharmony_ci		workman.sh zdump.8 zdump.c zic.8 zic.c \
6294616d0f9Sopenharmony_ci		ziguard.awk zishrink.awk \
6304616d0f9Sopenharmony_ci		zone.tab zone1970.tab zonenow.tab
6314616d0f9Sopenharmony_ci
6324616d0f9Sopenharmony_ciall:		tzselect zic zdump libtz.a $(TABDATA) \
6334616d0f9Sopenharmony_ci		  vanguard.zi main.zi rearguard.zi
6344616d0f9Sopenharmony_ci
6354616d0f9Sopenharmony_ciALL:		all date $(ENCHILADA)
6364616d0f9Sopenharmony_ci
6374616d0f9Sopenharmony_ciinstall:	all $(DATA) $(REDO) $(MANS)
6384616d0f9Sopenharmony_ci		mkdir -p '$(DESTDIR)$(BINDIR)' \
6394616d0f9Sopenharmony_ci			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
6404616d0f9Sopenharmony_ci			'$(DESTDIR)$(LIBDIR)' \
6414616d0f9Sopenharmony_ci			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
6424616d0f9Sopenharmony_ci			'$(DESTDIR)$(MANDIR)/man8'
6434616d0f9Sopenharmony_ci		$(ZIC_INSTALL) -l $(LOCALTIME) \
6444616d0f9Sopenharmony_ci			`case '$(POSIXRULES)' in ?*) echo '-p';; esac \
6454616d0f9Sopenharmony_ci			` $(POSIXRULES) \
6464616d0f9Sopenharmony_ci			-t '$(DESTDIR)$(TZDEFAULT)'
6474616d0f9Sopenharmony_ci		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
6484616d0f9Sopenharmony_ci		cp tzselect '$(DESTDIR)$(BINDIR)/.'
6494616d0f9Sopenharmony_ci		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
6504616d0f9Sopenharmony_ci		cp zic '$(DESTDIR)$(ZICDIR)/.'
6514616d0f9Sopenharmony_ci		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
6524616d0f9Sopenharmony_ci		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
6534616d0f9Sopenharmony_ci		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
6544616d0f9Sopenharmony_ci		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
6554616d0f9Sopenharmony_ci		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
6564616d0f9Sopenharmony_ci
6574616d0f9Sopenharmony_ciINSTALL:	ALL install date.1
6584616d0f9Sopenharmony_ci		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
6594616d0f9Sopenharmony_ci		cp date '$(DESTDIR)$(BINDIR)/.'
6604616d0f9Sopenharmony_ci		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
6614616d0f9Sopenharmony_ci
6624616d0f9Sopenharmony_ci# Calculate version number from git, if available.
6634616d0f9Sopenharmony_ci# Otherwise, use $(VERSION) unless it is "unknown" and there is already
6644616d0f9Sopenharmony_ci# a 'version' file, in which case reuse the existing 'version' contents
6654616d0f9Sopenharmony_ci# and append "-dirty" if the contents do not already end in "-dirty".
6664616d0f9Sopenharmony_civersion:	$(VERSION_DEPS)
6674616d0f9Sopenharmony_ci		{ (type git) >/dev/null 2>&1 && \
6684616d0f9Sopenharmony_ci		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
6694616d0f9Sopenharmony_ci				--abbrev=7 --dirty` || \
6704616d0f9Sopenharmony_ci		  if test '$(VERSION)' = unknown && V=`cat $@`; then \
6714616d0f9Sopenharmony_ci		    case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
6724616d0f9Sopenharmony_ci		  else \
6734616d0f9Sopenharmony_ci		    V='$(VERSION)'; \
6744616d0f9Sopenharmony_ci		  fi; } && \
6754616d0f9Sopenharmony_ci		printf '%s\n' "$$V" >$@.out
6764616d0f9Sopenharmony_ci		mv $@.out $@
6774616d0f9Sopenharmony_ci
6784616d0f9Sopenharmony_ci# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
6794616d0f9Sopenharmony_civanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
6804616d0f9Sopenharmony_ci		$(AWK) \
6814616d0f9Sopenharmony_ci		  -v DATAFORM=`expr $@ : '\(.*\).zi'` \
6824616d0f9Sopenharmony_ci		  -v PACKRATDATA='$(PACKRATDATA)' \
6834616d0f9Sopenharmony_ci		  -v PACKRATLIST='$(PACKRATLIST)' \
6844616d0f9Sopenharmony_ci		  -f ziguard.awk \
6854616d0f9Sopenharmony_ci		  $(TDATA) $(PACKRATDATA) >$@.out
6864616d0f9Sopenharmony_ci		mv $@.out $@
6874616d0f9Sopenharmony_ci# This file has a version comment that attempts to capture any tailoring
6884616d0f9Sopenharmony_ci# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
6894616d0f9Sopenharmony_citzdata.zi:	$(DATAFORM).zi version zishrink.awk
6904616d0f9Sopenharmony_ci		version=`sed 1q version` && \
6914616d0f9Sopenharmony_ci		  LC_ALL=C $(AWK) \
6924616d0f9Sopenharmony_ci		    -v dataform='$(DATAFORM)' \
6934616d0f9Sopenharmony_ci		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
6944616d0f9Sopenharmony_ci		    -v redo='$(REDO)' \
6954616d0f9Sopenharmony_ci		    -v version="$$version" \
6964616d0f9Sopenharmony_ci		    -f zishrink.awk \
6974616d0f9Sopenharmony_ci		    $(DATAFORM).zi >$@.out
6984616d0f9Sopenharmony_ci		mv $@.out $@
6994616d0f9Sopenharmony_ci
7004616d0f9Sopenharmony_citzdir.h:
7014616d0f9Sopenharmony_ci		printf '%s\n' >$@.out \
7024616d0f9Sopenharmony_ci		  '#ifndef TZDEFAULT' \
7034616d0f9Sopenharmony_ci		  '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \
7044616d0f9Sopenharmony_ci		  '#endif' \
7054616d0f9Sopenharmony_ci		  '#ifndef TZDIR' \
7064616d0f9Sopenharmony_ci		  '# define TZDIR "$(TZDIR)" /* TZif directory */' \
7074616d0f9Sopenharmony_ci		  '#endif'
7084616d0f9Sopenharmony_ci		mv $@.out $@
7094616d0f9Sopenharmony_ci
7104616d0f9Sopenharmony_civersion.h:	version
7114616d0f9Sopenharmony_ci		VERSION=`cat version` && printf '%s\n' \
7124616d0f9Sopenharmony_ci		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
7134616d0f9Sopenharmony_ci		  "static char const TZVERSION[]=\"$$VERSION\";" \
7144616d0f9Sopenharmony_ci		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
7154616d0f9Sopenharmony_ci		  >$@.out
7164616d0f9Sopenharmony_ci		mv $@.out $@
7174616d0f9Sopenharmony_ci
7184616d0f9Sopenharmony_cizdump:		$(TZDOBJS)
7194616d0f9Sopenharmony_ci		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
7204616d0f9Sopenharmony_ci
7214616d0f9Sopenharmony_cizic:		$(TZCOBJS)
7224616d0f9Sopenharmony_ci		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
7234616d0f9Sopenharmony_ci
7244616d0f9Sopenharmony_cileapseconds:	$(LEAP_DEPS)
7254616d0f9Sopenharmony_ci		$(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
7264616d0f9Sopenharmony_ci		  -f leapseconds.awk leap-seconds.list >$@.out
7274616d0f9Sopenharmony_ci		mv $@.out $@
7284616d0f9Sopenharmony_ci
7294616d0f9Sopenharmony_ci# Awk script to extract a Git-style author from leap-seconds.list comments.
7304616d0f9Sopenharmony_ciEXTRACT_AUTHOR = \
7314616d0f9Sopenharmony_ci  author_line { sub(/^.[[:space:]]*/, ""); \
7324616d0f9Sopenharmony_ci      sub(/:[[:space:]]*/, " <"); \
7334616d0f9Sopenharmony_ci      printf "%s>\n", $$0; \
7344616d0f9Sopenharmony_ci      success = 1; \
7354616d0f9Sopenharmony_ci      exit \
7364616d0f9Sopenharmony_ci  } \
7374616d0f9Sopenharmony_ci  /Questions or comments to:/ { author_line = 1 } \
7384616d0f9Sopenharmony_ci  END { exit !success }
7394616d0f9Sopenharmony_ci
7404616d0f9Sopenharmony_ci# Fetch leap-seconds.list from upstream.
7414616d0f9Sopenharmony_cifetch-leap-seconds.list:
7424616d0f9Sopenharmony_ci		$(CURL) -OR $(leaplist_URI)
7434616d0f9Sopenharmony_ci
7444616d0f9Sopenharmony_ci# Fetch leap-seconds.list from upstream and commit it to the local repository.
7454616d0f9Sopenharmony_cicommit-leap-seconds.list: fetch-leap-seconds.list
7464616d0f9Sopenharmony_ci		author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \
7474616d0f9Sopenharmony_ci		date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \
7484616d0f9Sopenharmony_ci		git commit --author="$$author" --date="$$date" -m'make $@' \
7494616d0f9Sopenharmony_ci		  leap-seconds.list
7504616d0f9Sopenharmony_ci
7514616d0f9Sopenharmony_ci# Arguments to pass to submakes of install_data.
7524616d0f9Sopenharmony_ci# They can be overridden by later submake arguments.
7534616d0f9Sopenharmony_ciINSTALLARGS = \
7544616d0f9Sopenharmony_ci BACKWARD='$(BACKWARD)' \
7554616d0f9Sopenharmony_ci DESTDIR='$(DESTDIR)' \
7564616d0f9Sopenharmony_ci LEAPSECONDS='$(LEAPSECONDS)' \
7574616d0f9Sopenharmony_ci PACKRATDATA='$(PACKRATDATA)' \
7584616d0f9Sopenharmony_ci PACKRATLIST='$(PACKRATLIST)' \
7594616d0f9Sopenharmony_ci TZDEFAULT='$(TZDEFAULT)' \
7604616d0f9Sopenharmony_ci TZDIR='$(TZDIR)' \
7614616d0f9Sopenharmony_ci ZIC='$(ZIC)'
7624616d0f9Sopenharmony_ci
7634616d0f9Sopenharmony_ciINSTALL_DATA_DEPS = zic leapseconds tzdata.zi
7644616d0f9Sopenharmony_ci
7654616d0f9Sopenharmony_ci# 'make install_data' installs one set of TZif files.
7664616d0f9Sopenharmony_ciinstall_data: $(INSTALL_DATA_DEPS)
7674616d0f9Sopenharmony_ci		$(ZIC_INSTALL) tzdata.zi
7684616d0f9Sopenharmony_ci
7694616d0f9Sopenharmony_ciposix_only: $(INSTALL_DATA_DEPS)
7704616d0f9Sopenharmony_ci		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
7714616d0f9Sopenharmony_ci
7724616d0f9Sopenharmony_ciright_only: $(INSTALL_DATA_DEPS)
7734616d0f9Sopenharmony_ci		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
7744616d0f9Sopenharmony_ci			install_data
7754616d0f9Sopenharmony_ci
7764616d0f9Sopenharmony_ci# In earlier versions of this makefile, the other two directories were
7774616d0f9Sopenharmony_ci# subdirectories of $(TZDIR).  However, this led to configuration errors.
7784616d0f9Sopenharmony_ci# For example, with posix_right under the earlier scheme,
7794616d0f9Sopenharmony_ci# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
7804616d0f9Sopenharmony_ci# but gmtime without leap seconds, which led to problems with applications
7814616d0f9Sopenharmony_ci# like sendmail that subtract gmtime from localtime.
7824616d0f9Sopenharmony_ci# Therefore, the other two directories are now siblings of $(TZDIR).
7834616d0f9Sopenharmony_ci# You must replace all of $(TZDIR) to switch from not using leap seconds
7844616d0f9Sopenharmony_ci# to using them, or vice versa.
7854616d0f9Sopenharmony_ciright_posix:	right_only
7864616d0f9Sopenharmony_ci		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
7874616d0f9Sopenharmony_ci		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
7884616d0f9Sopenharmony_ci		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
7894616d0f9Sopenharmony_ci		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
7904616d0f9Sopenharmony_ci
7914616d0f9Sopenharmony_ciposix_right:	posix_only
7924616d0f9Sopenharmony_ci		rm -fr '$(DESTDIR)$(TZDIR)-posix'
7934616d0f9Sopenharmony_ci		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
7944616d0f9Sopenharmony_ci		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
7954616d0f9Sopenharmony_ci		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
7964616d0f9Sopenharmony_ci
7974616d0f9Sopenharmony_cizones:		$(REDO)
7984616d0f9Sopenharmony_ci
7994616d0f9Sopenharmony_ci# dummy.zd is not a real file; it is mentioned here only so that the
8004616d0f9Sopenharmony_ci# top-level 'make' does not have a syntax error.
8014616d0f9Sopenharmony_ciZDS = dummy.zd
8024616d0f9Sopenharmony_ci# Rule used only by submakes invoked by the $(TZS_NEW) rule.
8034616d0f9Sopenharmony_ci# It is separate so that GNU 'make -j' can run instances in parallel.
8044616d0f9Sopenharmony_ci$(ZDS): zdump
8054616d0f9Sopenharmony_ci		./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
8064616d0f9Sopenharmony_ci		  >$@
8074616d0f9Sopenharmony_ci
8084616d0f9Sopenharmony_ciTZS_NEW_DEPS = tzdata.zi zdump zic
8094616d0f9Sopenharmony_ci$(TZS_NEW): $(TZS_NEW_DEPS)
8104616d0f9Sopenharmony_ci		rm -fr tzs$(TZS_YEAR).dir
8114616d0f9Sopenharmony_ci		mkdir tzs$(TZS_YEAR).dir
8124616d0f9Sopenharmony_ci		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
8134616d0f9Sopenharmony_ci		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
8144616d0f9Sopenharmony_ci		   tzdata.zi | LC_ALL=C sort >$@.out
8154616d0f9Sopenharmony_ci		wd=`pwd` && \
8164616d0f9Sopenharmony_ci		x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
8174616d0f9Sopenharmony_ci				tzdata.zi \
8184616d0f9Sopenharmony_ci			| LC_ALL=C sort -t . -k 2,2` && \
8194616d0f9Sopenharmony_ci		set x $$x && \
8204616d0f9Sopenharmony_ci		shift && \
8214616d0f9Sopenharmony_ci		ZDS=$$* && \
8224616d0f9Sopenharmony_ci		$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
8234616d0f9Sopenharmony_ci		  ZDS="$$ZDS" $$ZDS && \
8244616d0f9Sopenharmony_ci		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
8254616d0f9Sopenharmony_ci		rm -fr tzs$(TZS_YEAR).dir
8264616d0f9Sopenharmony_ci		mv $@.out $@
8274616d0f9Sopenharmony_ci
8284616d0f9Sopenharmony_ci# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
8294616d0f9Sopenharmony_ci# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
8304616d0f9Sopenharmony_ci$(TZS):
8314616d0f9Sopenharmony_ci		touch $@
8324616d0f9Sopenharmony_ci
8334616d0f9Sopenharmony_ciforce_tzs:	$(TZS_NEW)
8344616d0f9Sopenharmony_ci		cp $(TZS_NEW) $(TZS)
8354616d0f9Sopenharmony_ci
8364616d0f9Sopenharmony_cilibtz.a:	$(LIBOBJS)
8374616d0f9Sopenharmony_ci		rm -f $@
8384616d0f9Sopenharmony_ci		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
8394616d0f9Sopenharmony_ci		$(RANLIB) $@
8404616d0f9Sopenharmony_ci
8414616d0f9Sopenharmony_cidate:		$(DATEOBJS)
8424616d0f9Sopenharmony_ci		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
8434616d0f9Sopenharmony_ci
8444616d0f9Sopenharmony_citzselect:	tzselect.ksh version
8454616d0f9Sopenharmony_ci		VERSION=`cat version` && sed \
8464616d0f9Sopenharmony_ci		  -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
8474616d0f9Sopenharmony_ci		  -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
8484616d0f9Sopenharmony_ci		  -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
8494616d0f9Sopenharmony_ci		  -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \
8504616d0f9Sopenharmony_ci		  -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \
8514616d0f9Sopenharmony_ci		  -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \
8524616d0f9Sopenharmony_ci		  <$@.ksh >$@.out
8534616d0f9Sopenharmony_ci		chmod +x $@.out
8544616d0f9Sopenharmony_ci		mv $@.out $@
8554616d0f9Sopenharmony_ci
8564616d0f9Sopenharmony_cicheck: check_back check_mild
8574616d0f9Sopenharmony_cicheck_mild:	check_character_set check_white_space check_links \
8584616d0f9Sopenharmony_ci		  check_name_lengths check_now \
8594616d0f9Sopenharmony_ci		  check_slashed_abbrs check_sorted \
8604616d0f9Sopenharmony_ci		  check_tables check_web check_ziguard check_zishrink check_tzs
8614616d0f9Sopenharmony_ci
8624616d0f9Sopenharmony_ci# True if UTF8_LOCALE does not work;
8634616d0f9Sopenharmony_ci# otherwise, false but with LC_ALL set to $(UTF8_LOCALE).
8644616d0f9Sopenharmony_ciUTF8_LOCALE_MISSING = \
8654616d0f9Sopenharmony_ci  { test ! '$(UTF8_LOCALE)' \
8664616d0f9Sopenharmony_ci    || ! printf 'A\304\200B\n' \
8674616d0f9Sopenharmony_ci         | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
8684616d0f9Sopenharmony_ci    || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; }
8694616d0f9Sopenharmony_ci
8704616d0f9Sopenharmony_cicheck_character_set: $(ENCHILADA)
8714616d0f9Sopenharmony_ci	$(UTF8_LOCALE_MISSING) || { \
8724616d0f9Sopenharmony_ci		sharp='#' && \
8734616d0f9Sopenharmony_ci		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
8744616d0f9Sopenharmony_ci			$(MISC) $(SOURCES) $(WEB_PAGES) \
8754616d0f9Sopenharmony_ci			CONTRIBUTING LICENSE README SECURITY \
8764616d0f9Sopenharmony_ci			version tzdata.zi && \
8774616d0f9Sopenharmony_ci		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
8784616d0f9Sopenharmony_ci			Makefile && \
8794616d0f9Sopenharmony_ci		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
8804616d0f9Sopenharmony_ci			leapseconds zone.tab && \
8814616d0f9Sopenharmony_ci		! grep -Env $(OK_LINE) $(ENCHILADA); \
8824616d0f9Sopenharmony_ci	}
8834616d0f9Sopenharmony_ci	touch $@
8844616d0f9Sopenharmony_ci
8854616d0f9Sopenharmony_cicheck_white_space: $(ENCHILADA)
8864616d0f9Sopenharmony_ci	$(UTF8_LOCALE_MISSING) || { \
8874616d0f9Sopenharmony_ci		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
8884616d0f9Sopenharmony_ci		! grep -En "$$pat|[$s]\$$" \
8894616d0f9Sopenharmony_ci			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \
8904616d0f9Sopenharmony_ci	}
8914616d0f9Sopenharmony_ci	touch $@
8924616d0f9Sopenharmony_ci
8934616d0f9Sopenharmony_ciPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
8944616d0f9Sopenharmony_ciFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
8954616d0f9Sopenharmony_ci
8964616d0f9Sopenharmony_cicheck_name_lengths: $(TDATA_TO_CHECK) backzone
8974616d0f9Sopenharmony_ci		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
8984616d0f9Sopenharmony_ci			$(TDATA_TO_CHECK) backzone
8994616d0f9Sopenharmony_ci		touch $@
9004616d0f9Sopenharmony_ci
9014616d0f9Sopenharmony_ciPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
9024616d0f9Sopenharmony_ciSTDOFF = [-+]?[0-9:.]+
9034616d0f9Sopenharmony_ciRULELESS_SAVE = (-|$(STDOFF)[sd]?)
9044616d0f9Sopenharmony_ciRULELESS_SLASHED_ABBRS = \
9054616d0f9Sopenharmony_ci  $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
9064616d0f9Sopenharmony_ci
9074616d0f9Sopenharmony_cicheck_slashed_abbrs: $(TDATA_TO_CHECK)
9084616d0f9Sopenharmony_ci		! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
9094616d0f9Sopenharmony_ci		touch $@
9104616d0f9Sopenharmony_ci
9114616d0f9Sopenharmony_ciCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
9124616d0f9Sopenharmony_ci
9134616d0f9Sopenharmony_cicheck_sorted: backward backzone
9144616d0f9Sopenharmony_ci		$(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
9154616d0f9Sopenharmony_ci		  backward | LC_ALL=C sort -cu
9164616d0f9Sopenharmony_ci		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
9174616d0f9Sopenharmony_ci		touch $@
9184616d0f9Sopenharmony_ci
9194616d0f9Sopenharmony_cicheck_back:	checklinks.awk $(TDATA_TO_CHECK)
9204616d0f9Sopenharmony_ci		$(AWK) \
9214616d0f9Sopenharmony_ci		  -v DATAFORM=$(DATAFORM) \
9224616d0f9Sopenharmony_ci		  -v backcheck=backward \
9234616d0f9Sopenharmony_ci		  -f checklinks.awk $(TDATA_TO_CHECK)
9244616d0f9Sopenharmony_ci		touch $@
9254616d0f9Sopenharmony_ci
9264616d0f9Sopenharmony_cicheck_links:	checklinks.awk tzdata.zi
9274616d0f9Sopenharmony_ci		$(AWK) \
9284616d0f9Sopenharmony_ci		  -v DATAFORM=$(DATAFORM) \
9294616d0f9Sopenharmony_ci		  -f checklinks.awk tzdata.zi
9304616d0f9Sopenharmony_ci		touch $@
9314616d0f9Sopenharmony_ci
9324616d0f9Sopenharmony_ci# Check timestamps from now through 28 years from now, to make sure
9334616d0f9Sopenharmony_ci# that zonenow.tab contains all sequences of planned timestamps,
9344616d0f9Sopenharmony_ci# without any duplicate sequences.  In theory this might require
9354616d0f9Sopenharmony_ci# 2800 years but that would take a long time to check.
9364616d0f9Sopenharmony_ciCHECK_NOW_TIMESTAMP = `./date +%s`
9374616d0f9Sopenharmony_ciCHECK_NOW_FUTURE_YEARS = 28
9384616d0f9Sopenharmony_ciCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60
9394616d0f9Sopenharmony_cicheck_now:	checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
9404616d0f9Sopenharmony_ci		rm -fr $@.dir
9414616d0f9Sopenharmony_ci		mkdir $@.dir
9424616d0f9Sopenharmony_ci		./zic -d $@.dir tzdata.zi
9434616d0f9Sopenharmony_ci		now=$(CHECK_NOW_TIMESTAMP) && \
9444616d0f9Sopenharmony_ci		  future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \
9454616d0f9Sopenharmony_ci		  ./zdump -i -t $$now,$$future \
9464616d0f9Sopenharmony_ci		     $$(find $$PWD/$@.dir/????*/ -type f) \
9474616d0f9Sopenharmony_ci		     >$@.dir/zdump.tab
9484616d0f9Sopenharmony_ci		$(AWK) \
9494616d0f9Sopenharmony_ci		  -v zdump_table=$@.dir/zdump.tab \
9504616d0f9Sopenharmony_ci		  -f checknow.awk zonenow.tab
9514616d0f9Sopenharmony_ci		rm -fr $@.dir
9524616d0f9Sopenharmony_ci		touch $@
9534616d0f9Sopenharmony_ci
9544616d0f9Sopenharmony_cicheck_tables:	checktab.awk $(YDATA) backward zone.tab zone1970.tab
9554616d0f9Sopenharmony_ci		for tab in $(ZONETABLES); do \
9564616d0f9Sopenharmony_ci		  test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
9574616d0f9Sopenharmony_ci		  $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
9584616d0f9Sopenharmony_ci		    || exit; \
9594616d0f9Sopenharmony_ci		done
9604616d0f9Sopenharmony_ci		touch $@
9614616d0f9Sopenharmony_ci
9624616d0f9Sopenharmony_cicheck_tzs:	$(TZS) $(TZS_NEW)
9634616d0f9Sopenharmony_ci		if test -s $(TZS); then \
9644616d0f9Sopenharmony_ci		  $(DIFF_TZS) $(TZS) $(TZS_NEW); \
9654616d0f9Sopenharmony_ci		else \
9664616d0f9Sopenharmony_ci		  cp $(TZS_NEW) $(TZS); \
9674616d0f9Sopenharmony_ci		fi
9684616d0f9Sopenharmony_ci		touch $@
9694616d0f9Sopenharmony_ci
9704616d0f9Sopenharmony_cicheck_web:	$(CHECK_WEB_PAGES)
9714616d0f9Sopenharmony_cicheck_theory.html: theory.html
9724616d0f9Sopenharmony_cicheck_tz-art.html: tz-art.html
9734616d0f9Sopenharmony_cicheck_tz-how-to.html: tz-how-to.html
9744616d0f9Sopenharmony_cicheck_tz-link.html: tz-link.html
9754616d0f9Sopenharmony_cicheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
9764616d0f9Sopenharmony_ci		$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
9774616d0f9Sopenharmony_ci		    -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
9784616d0f9Sopenharmony_ci		  test ! -s $@.out || { cat $@.out; exit 1; }
9794616d0f9Sopenharmony_ci		mv $@.out $@
9804616d0f9Sopenharmony_ci
9814616d0f9Sopenharmony_cicheck_ziguard: rearguard.zi vanguard.zi ziguard.awk
9824616d0f9Sopenharmony_ci		$(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
9834616d0f9Sopenharmony_ci		  diff -u rearguard.zi -
9844616d0f9Sopenharmony_ci		$(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
9854616d0f9Sopenharmony_ci		  diff -u vanguard.zi -
9864616d0f9Sopenharmony_ci		touch $@
9874616d0f9Sopenharmony_ci
9884616d0f9Sopenharmony_ci# Check that zishrink.awk does not alter the data, and that ziguard.awk
9894616d0f9Sopenharmony_ci# preserves main-format data.
9904616d0f9Sopenharmony_cicheck_zishrink: check_zishrink_posix check_zishrink_right
9914616d0f9Sopenharmony_cicheck_zishrink_posix check_zishrink_right: \
9924616d0f9Sopenharmony_ci  zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
9934616d0f9Sopenharmony_ci  $(TDATA) $(DATAFORM).zi tzdata.zi
9944616d0f9Sopenharmony_ci		rm -fr $@.dir $@-t.dir $@-shrunk.dir
9954616d0f9Sopenharmony_ci		mkdir $@.dir $@-t.dir $@-shrunk.dir
9964616d0f9Sopenharmony_ci		case $@ in \
9974616d0f9Sopenharmony_ci		  *_right) leap='-L leapseconds';; \
9984616d0f9Sopenharmony_ci		  *) leap=;; \
9994616d0f9Sopenharmony_ci		esac && \
10004616d0f9Sopenharmony_ci		  $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
10014616d0f9Sopenharmony_ci		  $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
10024616d0f9Sopenharmony_ci		  case $(DATAFORM),$(PACKRATLIST) in \
10034616d0f9Sopenharmony_ci		    main,) \
10044616d0f9Sopenharmony_ci		      $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
10054616d0f9Sopenharmony_ci		      $(AWK) '/^Rule/' $(TDATA) | \
10064616d0f9Sopenharmony_ci			$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
10074616d0f9Sopenharmony_ci		      diff -r $@.dir $@-t.dir;; \
10084616d0f9Sopenharmony_ci		  esac
10094616d0f9Sopenharmony_ci		diff -r $@.dir $@-shrunk.dir
10104616d0f9Sopenharmony_ci		rm -fr $@.dir $@-t.dir $@-shrunk.dir
10114616d0f9Sopenharmony_ci		touch $@
10124616d0f9Sopenharmony_ci
10134616d0f9Sopenharmony_ciclean_misc:
10144616d0f9Sopenharmony_ci		rm -fr check_*.dir typecheck_*.dir
10154616d0f9Sopenharmony_ci		rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
10164616d0f9Sopenharmony_ci		  check_* core typecheck_* \
10174616d0f9Sopenharmony_ci		  date tzdir.h tzselect version.h zdump zic libtz.a
10184616d0f9Sopenharmony_ciclean:		clean_misc
10194616d0f9Sopenharmony_ci		rm -fr *.dir tzdb-*/
10204616d0f9Sopenharmony_ci		rm -f *.zi $(TZS_NEW)
10214616d0f9Sopenharmony_ci
10224616d0f9Sopenharmony_cimaintainer-clean: clean
10234616d0f9Sopenharmony_ci		@echo 'This command is intended for maintainers to use; it'
10244616d0f9Sopenharmony_ci		@echo 'deletes files that may need special tools to rebuild.'
10254616d0f9Sopenharmony_ci		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
10264616d0f9Sopenharmony_ci
10274616d0f9Sopenharmony_cinames:
10284616d0f9Sopenharmony_ci		@echo $(ENCHILADA)
10294616d0f9Sopenharmony_ci
10304616d0f9Sopenharmony_cipublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
10314616d0f9Sopenharmony_ci		tarballs signatures
10324616d0f9Sopenharmony_ci
10334616d0f9Sopenharmony_cidate.1.txt:	date.1
10344616d0f9Sopenharmony_cinewctime.3.txt:	newctime.3
10354616d0f9Sopenharmony_cinewstrftime.3.txt: newstrftime.3
10364616d0f9Sopenharmony_cinewtzset.3.txt:	newtzset.3
10374616d0f9Sopenharmony_citime2posix.3.txt: time2posix.3
10384616d0f9Sopenharmony_citzfile.5.txt:	tzfile.5
10394616d0f9Sopenharmony_citzselect.8.txt:	tzselect.8
10404616d0f9Sopenharmony_cizdump.8.txt:	zdump.8
10414616d0f9Sopenharmony_cizic.8.txt:	zic.8
10424616d0f9Sopenharmony_ci
10434616d0f9Sopenharmony_ci$(MANTXTS):	workman.sh
10444616d0f9Sopenharmony_ci		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
10454616d0f9Sopenharmony_ci		mv $@.out $@
10464616d0f9Sopenharmony_ci
10474616d0f9Sopenharmony_ci# Set file timestamps deterministically if possible,
10484616d0f9Sopenharmony_ci# so that tarballs containing the timestamps are reproducible.
10494616d0f9Sopenharmony_ci#
10504616d0f9Sopenharmony_ci# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
10514616d0f9Sopenharmony_ci# file DEST to the maximum of the timestamps of the files A B C ...,
10524616d0f9Sopenharmony_ci# plus N if GNU ls and touch are available.
10534616d0f9Sopenharmony_ciSET_TIMESTAMP_N = sh -c '\
10544616d0f9Sopenharmony_ci  n=$$0 dest=$$1; shift; \
10554616d0f9Sopenharmony_ci  <"$$dest" && \
10564616d0f9Sopenharmony_ci  if test $$n != 0 && \
10574616d0f9Sopenharmony_ci     lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \
10584616d0f9Sopenharmony_ci    set x $$lsout && \
10594616d0f9Sopenharmony_ci    timestamp=`expr $$7 + $$n` && \
10604616d0f9Sopenharmony_ci    echo "+ touch -md @$$timestamp $$dest" && \
10614616d0f9Sopenharmony_ci    touch -md @$$timestamp "$$dest"; \
10624616d0f9Sopenharmony_ci  else \
10634616d0f9Sopenharmony_ci    newest=`ls -t "$$@" | sed 1q` && \
10644616d0f9Sopenharmony_ci    echo "+ touch -mr $$newest $$dest" && \
10654616d0f9Sopenharmony_ci    touch -mr "$$newest" "$$dest"; \
10664616d0f9Sopenharmony_ci  fi'
10674616d0f9Sopenharmony_ci# If DEST depends on A B C ... in this Makefile, callers should use
10684616d0f9Sopenharmony_ci# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
10694616d0f9Sopenharmony_ci# downstream 'make' that considers equal timestamps to be out of date.
10704616d0f9Sopenharmony_ci# POSIX allows this 'make' behavior, and HP-UX 'make' does it.
10714616d0f9Sopenharmony_ci# If all that matters is that the timestamp be reproducible
10724616d0f9Sopenharmony_ci# and plausible, use $(SET_TIMESTAMP).
10734616d0f9Sopenharmony_ciSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
10744616d0f9Sopenharmony_ciSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
10754616d0f9Sopenharmony_ci
10764616d0f9Sopenharmony_ci# Set the timestamps to those of the git repository, if available,
10774616d0f9Sopenharmony_ci# and if the files have not changed since then.
10784616d0f9Sopenharmony_ci# This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
10794616d0f9Sopenharmony_ci# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
10804616d0f9Sopenharmony_ci# If git or GNU is absent, don't bother to sync with git timestamps.
10814616d0f9Sopenharmony_ci# Also, set the timestamp of each prebuilt file like 'leapseconds'
10824616d0f9Sopenharmony_ci# to be the maximum of the files it depends on.
10834616d0f9Sopenharmony_ciset-timestamps.out: $(EIGHT_YARDS)
10844616d0f9Sopenharmony_ci		rm -f $@
10854616d0f9Sopenharmony_ci		if (type git) >/dev/null 2>&1 && \
10864616d0f9Sopenharmony_ci		   files=`git ls-files $(EIGHT_YARDS)` && \
10874616d0f9Sopenharmony_ci		   touch -md @1 test.out; then \
10884616d0f9Sopenharmony_ci		  rm -f test.out && \
10894616d0f9Sopenharmony_ci		  for file in $$files; do \
10904616d0f9Sopenharmony_ci		    if git diff --quiet $$file; then \
10914616d0f9Sopenharmony_ci		      time=`TZ=UTC0 git log -1 \
10924616d0f9Sopenharmony_ci			--format='tformat:%cd' \
10934616d0f9Sopenharmony_ci			--date='format:%Y-%m-%dT%H:%M:%SZ' \
10944616d0f9Sopenharmony_ci			$$file` && \
10954616d0f9Sopenharmony_ci		      echo "+ touch -md $$time $$file" && \
10964616d0f9Sopenharmony_ci		      touch -md $$time $$file; \
10974616d0f9Sopenharmony_ci		    else \
10984616d0f9Sopenharmony_ci		      echo >&2 "$$file: warning: does not match repository"; \
10994616d0f9Sopenharmony_ci		    fi || exit; \
11004616d0f9Sopenharmony_ci		  done; \
11014616d0f9Sopenharmony_ci		fi
11024616d0f9Sopenharmony_ci		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
11034616d0f9Sopenharmony_ci		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
11044616d0f9Sopenharmony_ci		  $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
11054616d0f9Sopenharmony_ci		    exit; \
11064616d0f9Sopenharmony_ci		done
11074616d0f9Sopenharmony_ci		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
11084616d0f9Sopenharmony_ci		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
11094616d0f9Sopenharmony_ci		touch $@
11104616d0f9Sopenharmony_ciset-tzs-timestamp.out: $(TZS)
11114616d0f9Sopenharmony_ci		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
11124616d0f9Sopenharmony_ci		touch $@
11134616d0f9Sopenharmony_ci
11144616d0f9Sopenharmony_ci# The zics below ensure that each data file can stand on its own.
11154616d0f9Sopenharmony_ci# We also do an all-files run to catch links to links.
11164616d0f9Sopenharmony_ci
11174616d0f9Sopenharmony_cicheck_public: $(VERSION_DEPS)
11184616d0f9Sopenharmony_ci		rm -fr public.dir
11194616d0f9Sopenharmony_ci		mkdir public.dir
11204616d0f9Sopenharmony_ci		ln $(VERSION_DEPS) public.dir
11214616d0f9Sopenharmony_ci		cd public.dir \
11224616d0f9Sopenharmony_ci		  && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL
11234616d0f9Sopenharmony_ci		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
11244616d0f9Sopenharmony_ci		    public.dir/vanguard.zi public.dir/main.zi \
11254616d0f9Sopenharmony_ci		    public.dir/rearguard.zi; \
11264616d0f9Sopenharmony_ci		do \
11274616d0f9Sopenharmony_ci		  public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
11284616d0f9Sopenharmony_ci		done
11294616d0f9Sopenharmony_ci		public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
11304616d0f9Sopenharmony_ci		:
11314616d0f9Sopenharmony_ci		: Also check 'backzone' syntax.
11324616d0f9Sopenharmony_ci		rm public.dir/main.zi
11334616d0f9Sopenharmony_ci		cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
11344616d0f9Sopenharmony_ci		public.dir/zic -d public.dir/zoneinfo main.zi
11354616d0f9Sopenharmony_ci		rm public.dir/main.zi
11364616d0f9Sopenharmony_ci		cd public.dir && \
11374616d0f9Sopenharmony_ci		  $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
11384616d0f9Sopenharmony_ci		public.dir/zic -d public.dir/zoneinfo main.zi
11394616d0f9Sopenharmony_ci		:
11404616d0f9Sopenharmony_ci		rm -fr public.dir
11414616d0f9Sopenharmony_ci		touch $@
11424616d0f9Sopenharmony_ci
11434616d0f9Sopenharmony_ci# Check that the code works under various alternative
11444616d0f9Sopenharmony_ci# implementations of time_t.
11454616d0f9Sopenharmony_cicheck_time_t_alternatives: $(TIME_T_ALTERNATIVES)
11464616d0f9Sopenharmony_ci$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
11474616d0f9Sopenharmony_ci$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
11484616d0f9Sopenharmony_ci		rm -fr $@.dir
11494616d0f9Sopenharmony_ci		mkdir $@.dir
11504616d0f9Sopenharmony_ci		ln $(VERSION_DEPS) $@.dir
11514616d0f9Sopenharmony_ci		case $@ in \
11524616d0f9Sopenharmony_ci		  int*32_t) range=-2147483648,2147483648;; \
11534616d0f9Sopenharmony_ci		  u*) range=0,4294967296;; \
11544616d0f9Sopenharmony_ci		  *) range=-4294967296,4294967296;; \
11554616d0f9Sopenharmony_ci		esac && \
11564616d0f9Sopenharmony_ci		wd=`pwd` && \
11574616d0f9Sopenharmony_ci		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
11584616d0f9Sopenharmony_ci		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
11594616d0f9Sopenharmony_ci		  range_target=; \
11604616d0f9Sopenharmony_ci		else \
11614616d0f9Sopenharmony_ci		  range_target=to$$range.tzs; \
11624616d0f9Sopenharmony_ci		fi && \
11634616d0f9Sopenharmony_ci		(cd $@.dir && \
11644616d0f9Sopenharmony_ci		  $(MAKE) TOPDIR="$$wd/$@.dir" \
11654616d0f9Sopenharmony_ci		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
11664616d0f9Sopenharmony_ci		    REDO='$(REDO)' \
11674616d0f9Sopenharmony_ci			D=$$wd/$@.dir \
11684616d0f9Sopenharmony_ci		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
11694616d0f9Sopenharmony_ci		    install $$range_target) && \
11704616d0f9Sopenharmony_ci		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
11714616d0f9Sopenharmony_ci		  (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
11724616d0f9Sopenharmony_ci		    $(MAKE) TOPDIR="$$wd/$@.dir" \
11734616d0f9Sopenharmony_ci		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
11744616d0f9Sopenharmony_ci			D=$$wd/$@.dir \
11754616d0f9Sopenharmony_ci		      to$$range.tzs) && \
11764616d0f9Sopenharmony_ci		  $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
11774616d0f9Sopenharmony_ci			  $@.dir/to$$range.tzs && \
11784616d0f9Sopenharmony_ci		  if diff -q Makefile Makefile 2>/dev/null; then \
11794616d0f9Sopenharmony_ci		    quiet_option='-q'; \
11804616d0f9Sopenharmony_ci		  else \
11814616d0f9Sopenharmony_ci		    quiet_option=''; \
11824616d0f9Sopenharmony_ci		  fi && \
11834616d0f9Sopenharmony_ci		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
11844616d0f9Sopenharmony_ci					   $@.dir/etc && \
11854616d0f9Sopenharmony_ci		    diff $$quiet_option -r \
11864616d0f9Sopenharmony_ci		      $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
11874616d0f9Sopenharmony_ci		      $@.dir/usr/share; \
11884616d0f9Sopenharmony_ci		}
11894616d0f9Sopenharmony_ci		touch $@
11904616d0f9Sopenharmony_ci
11914616d0f9Sopenharmony_ciTRADITIONAL_ASC = \
11924616d0f9Sopenharmony_ci  tzcode$(VERSION).tar.gz.asc \
11934616d0f9Sopenharmony_ci  tzdata$(VERSION).tar.gz.asc
11944616d0f9Sopenharmony_ciREARGUARD_ASC = \
11954616d0f9Sopenharmony_ci  tzdata$(VERSION)-rearguard.tar.gz.asc
11964616d0f9Sopenharmony_ciALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
11974616d0f9Sopenharmony_ci  tzdb-$(VERSION).tar.lz.asc
11984616d0f9Sopenharmony_ci
11994616d0f9Sopenharmony_citarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
12004616d0f9Sopenharmony_cisignatures rearguard_signatures traditional_signatures: \
12014616d0f9Sopenharmony_ci  version set-timestamps.out rearguard.zi vanguard.zi
12024616d0f9Sopenharmony_ci		VERSION=`cat version` && \
12034616d0f9Sopenharmony_ci		$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
12044616d0f9Sopenharmony_ci
12054616d0f9Sopenharmony_ci# These *_version rules are intended for use if VERSION is set by some
12064616d0f9Sopenharmony_ci# other means.  Ordinarily these rules are used only by the above
12074616d0f9Sopenharmony_ci# non-_version rules, which set VERSION on the 'make' command line.
12084616d0f9Sopenharmony_citarballs_version: traditional_tarballs_version rearguard_tarballs_version \
12094616d0f9Sopenharmony_ci  tzdb-$(VERSION).tar.lz
12104616d0f9Sopenharmony_cirearguard_tarballs_version: \
12114616d0f9Sopenharmony_ci  tzdata$(VERSION)-rearguard.tar.gz
12124616d0f9Sopenharmony_citraditional_tarballs_version: \
12134616d0f9Sopenharmony_ci  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
12144616d0f9Sopenharmony_citailored_tarballs_version: \
12154616d0f9Sopenharmony_ci  tzdata$(VERSION)-tailored.tar.gz
12164616d0f9Sopenharmony_cisignatures_version: $(ALL_ASC)
12174616d0f9Sopenharmony_cirearguard_signatures_version: $(REARGUARD_ASC)
12184616d0f9Sopenharmony_citraditional_signatures_version: $(TRADITIONAL_ASC)
12194616d0f9Sopenharmony_ci
12204616d0f9Sopenharmony_citzcode$(VERSION).tar.gz: set-timestamps.out
12214616d0f9Sopenharmony_ci		LC_ALL=C && export LC_ALL && \
12224616d0f9Sopenharmony_ci		tar $(TARFLAGS) -cf - \
12234616d0f9Sopenharmony_ci		    $(COMMON) $(DOCS) $(SOURCES) | \
12244616d0f9Sopenharmony_ci		  gzip $(GZIPFLAGS) >$@.out
12254616d0f9Sopenharmony_ci		mv $@.out $@
12264616d0f9Sopenharmony_ci
12274616d0f9Sopenharmony_citzdata$(VERSION).tar.gz: set-timestamps.out
12284616d0f9Sopenharmony_ci		LC_ALL=C && export LC_ALL && \
12294616d0f9Sopenharmony_ci		tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
12304616d0f9Sopenharmony_ci		  gzip $(GZIPFLAGS) >$@.out
12314616d0f9Sopenharmony_ci		mv $@.out $@
12324616d0f9Sopenharmony_ci
12334616d0f9Sopenharmony_ci# Create empty files with a reproducible timestamp.
12344616d0f9Sopenharmony_ciCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
12354616d0f9Sopenharmony_ci
12364616d0f9Sopenharmony_ci# The obsolescent *rearguard* targets and related macros are present
12374616d0f9Sopenharmony_ci# for backwards compatibility with tz releases 2018e through 2022a.
12384616d0f9Sopenharmony_ci# They should go away eventually.  To build rearguard tarballs you
12394616d0f9Sopenharmony_ci# can instead use 'make DATAFORM=rearguard tailored_tarballs'.
12404616d0f9Sopenharmony_citzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
12414616d0f9Sopenharmony_ci		rm -fr $@.dir
12424616d0f9Sopenharmony_ci		mkdir $@.dir
12434616d0f9Sopenharmony_ci		ln $(TZDATA_DIST) $@.dir
12444616d0f9Sopenharmony_ci		cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
12454616d0f9Sopenharmony_ci		for f in $(TDATA) $(PACKRATDATA); do \
12464616d0f9Sopenharmony_ci		  rearf=$@.dir/$$f; \
12474616d0f9Sopenharmony_ci		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
12484616d0f9Sopenharmony_ci		  $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
12494616d0f9Sopenharmony_ci		done
12504616d0f9Sopenharmony_ci		sed '1s/$$/-rearguard/' <version >$@.dir/version
12514616d0f9Sopenharmony_ci		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
12524616d0f9Sopenharmony_ci		$(CREATE_EMPTY) $@.dir/pacificnew
12534616d0f9Sopenharmony_ci		touch -mr version $@.dir/version
12544616d0f9Sopenharmony_ci		LC_ALL=C && export LC_ALL && \
12554616d0f9Sopenharmony_ci		  (cd $@.dir && \
12564616d0f9Sopenharmony_ci		   tar $(TARFLAGS) -cf - \
12574616d0f9Sopenharmony_ci			$(TZDATA_DIST) pacificnew | \
12584616d0f9Sopenharmony_ci		     gzip $(GZIPFLAGS)) >$@.out
12594616d0f9Sopenharmony_ci		mv $@.out $@
12604616d0f9Sopenharmony_ci
12614616d0f9Sopenharmony_ci# Create a tailored tarball suitable for TZUpdater and compatible tools.
12624616d0f9Sopenharmony_ci# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
12634616d0f9Sopenharmony_ci# useful for testing whether TZUpdater supports vanguard form.
12644616d0f9Sopenharmony_ci# The generated tarball is not byte-for-byte equivalent to a hand-tailored
12654616d0f9Sopenharmony_ci# traditional tarball, as data entries are put into 'etcetera' even if they
12664616d0f9Sopenharmony_ci# came from some other source file.  However, the effect should be the same
12674616d0f9Sopenharmony_ci# for ordinary use, which reads all the source files.
12684616d0f9Sopenharmony_citzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
12694616d0f9Sopenharmony_ci		rm -fr $@.dir
12704616d0f9Sopenharmony_ci		mkdir $@.dir
12714616d0f9Sopenharmony_ci		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
12724616d0f9Sopenharmony_ci		cd $@.dir && \
12734616d0f9Sopenharmony_ci		  $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
12744616d0f9Sopenharmony_ci		  `test $(DATAFORM) = vanguard || echo pacificnew`
12754616d0f9Sopenharmony_ci		(grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
12764616d0f9Sopenharmony_ci		  >$@.dir/etcetera
12774616d0f9Sopenharmony_ci		touch -mr tzdata.zi $@.dir/etcetera
12784616d0f9Sopenharmony_ci		sed -n \
12794616d0f9Sopenharmony_ci		  -e '/^# *version  *\(.*\)/h' \
12804616d0f9Sopenharmony_ci		  -e '/^# *ddeps  */H' \
12814616d0f9Sopenharmony_ci		  -e '$$!d' \
12824616d0f9Sopenharmony_ci		  -e 'g' \
12834616d0f9Sopenharmony_ci		  -e 's/^# *version  *//' \
12844616d0f9Sopenharmony_ci		  -e 's/\n# *ddeps  */-/' \
12854616d0f9Sopenharmony_ci		  -e 's/ /-/g' \
12864616d0f9Sopenharmony_ci		  -e 'p' \
12874616d0f9Sopenharmony_ci		  <tzdata.zi >$@.dir/version
12884616d0f9Sopenharmony_ci		touch -mr version $@.dir/version
12894616d0f9Sopenharmony_ci		links= && \
12904616d0f9Sopenharmony_ci		  for file in $(TZDATA_DIST); do \
12914616d0f9Sopenharmony_ci		    test -f $@.dir/$$file || links="$$links $$file"; \
12924616d0f9Sopenharmony_ci		  done && \
12934616d0f9Sopenharmony_ci		  ln $$links $@.dir
12944616d0f9Sopenharmony_ci		LC_ALL=C && export LC_ALL && \
12954616d0f9Sopenharmony_ci		  (cd $@.dir && \
12964616d0f9Sopenharmony_ci		   tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out
12974616d0f9Sopenharmony_ci		mv $@.out $@
12984616d0f9Sopenharmony_ci
12994616d0f9Sopenharmony_citzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
13004616d0f9Sopenharmony_ci		rm -fr tzdb-$(VERSION)
13014616d0f9Sopenharmony_ci		mkdir tzdb-$(VERSION)
13024616d0f9Sopenharmony_ci		ln $(ENCHILADA) tzdb-$(VERSION)
13034616d0f9Sopenharmony_ci		$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
13044616d0f9Sopenharmony_ci		LC_ALL=C && export LC_ALL && \
13054616d0f9Sopenharmony_ci		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
13064616d0f9Sopenharmony_ci		mv $@.out $@
13074616d0f9Sopenharmony_ci
13084616d0f9Sopenharmony_citzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
13094616d0f9Sopenharmony_citzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
13104616d0f9Sopenharmony_citzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
13114616d0f9Sopenharmony_citzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
13124616d0f9Sopenharmony_ci$(ALL_ASC):
13134616d0f9Sopenharmony_ci		$(GPG) --armor --detach-sign $?
13144616d0f9Sopenharmony_ci
13154616d0f9Sopenharmony_ciTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
13164616d0f9Sopenharmony_citypecheck: typecheck_long_long typecheck_unsigned
13174616d0f9Sopenharmony_citypecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
13184616d0f9Sopenharmony_ci		rm -fr $@.dir
13194616d0f9Sopenharmony_ci		mkdir $@.dir
13204616d0f9Sopenharmony_ci		ln $(VERSION_DEPS) $@.dir
13214616d0f9Sopenharmony_ci		cd $@.dir && \
13224616d0f9Sopenharmony_ci		  case $@ in \
13234616d0f9Sopenharmony_ci		    *_long_long) i="long long";; \
13244616d0f9Sopenharmony_ci		    *_unsigned ) i="unsigned" ;; \
13254616d0f9Sopenharmony_ci		  esac && \
13264616d0f9Sopenharmony_ci		  typecheck_cflags='' && \
13274616d0f9Sopenharmony_ci		  $(MAKE) \
13284616d0f9Sopenharmony_ci		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
13294616d0f9Sopenharmony_ci		    TOPDIR="`pwd`" \
13304616d0f9Sopenharmony_ci		    install
13314616d0f9Sopenharmony_ci		$@.dir/zdump -i -c 1970,1971 Europe/Rome
13324616d0f9Sopenharmony_ci		touch $@
13334616d0f9Sopenharmony_ci
13344616d0f9Sopenharmony_cizonenames:	tzdata.zi
13354616d0f9Sopenharmony_ci		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
13364616d0f9Sopenharmony_ci
13374616d0f9Sopenharmony_ciasctime.o:	private.h tzfile.h
13384616d0f9Sopenharmony_cidate.o:		private.h
13394616d0f9Sopenharmony_cidifftime.o:	private.h
13404616d0f9Sopenharmony_cilocaltime.o:	private.h tzfile.h tzdir.h
13414616d0f9Sopenharmony_cistrftime.o:	private.h tzfile.h
13424616d0f9Sopenharmony_cizdump.o:	version.h
13434616d0f9Sopenharmony_cizic.o:		private.h tzfile.h tzdir.h version.h
13444616d0f9Sopenharmony_ci
13454616d0f9Sopenharmony_ci.PHONY: ALL INSTALL all
13464616d0f9Sopenharmony_ci.PHONY: check check_mild check_time_t_alternatives
13474616d0f9Sopenharmony_ci.PHONY: check_web check_zishrink
13484616d0f9Sopenharmony_ci.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd
13494616d0f9Sopenharmony_ci.PHONY: fetch-leap-seconds.list force_tzs
13504616d0f9Sopenharmony_ci.PHONY: install install_data maintainer-clean names
13514616d0f9Sopenharmony_ci.PHONY: posix_only posix_right public
13524616d0f9Sopenharmony_ci.PHONY: rearguard_signatures rearguard_signatures_version
13534616d0f9Sopenharmony_ci.PHONY: rearguard_tarballs rearguard_tarballs_version
13544616d0f9Sopenharmony_ci.PHONY: right_only right_posix signatures signatures_version
13554616d0f9Sopenharmony_ci.PHONY: tarballs tarballs_version
13564616d0f9Sopenharmony_ci.PHONY: traditional_signatures traditional_signatures_version
13574616d0f9Sopenharmony_ci.PHONY: traditional_tarballs traditional_tarballs_version
13584616d0f9Sopenharmony_ci.PHONY: tailored_tarballs tailored_tarballs_version
13594616d0f9Sopenharmony_ci.PHONY: typecheck
13604616d0f9Sopenharmony_ci.PHONY: zonenames zones
13614616d0f9Sopenharmony_ci.PHONY: $(ZDS)
1362