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