1339630Sphilip# Make and install tzdb code and data.
2339630Sphilip
3308265Sgjb# This file is in the public domain, so clarified as of
4308265Sgjb# 2009-05-17 by Arthur David Olson.
5308265Sgjb
6308265Sgjb# Package name for the code distribution.
7308265SgjbPACKAGE=	tzcode
8308265Sgjb
9308265Sgjb# Version number for the distribution, overridden in the 'tarballs' rule below.
10308265SgjbVERSION=	unknown
11308265Sgjb
12308265Sgjb# Email address for bug reports.
13308265SgjbBUGEMAIL=	tz@iana.org
14308265Sgjb
15345670Sphilip# DATAFORM selects the data format.
16345670Sphilip# Available formats represent essentially the same data, albeit
17345670Sphilip# possibly with minor discrepancies that users are not likely to notice.
18345670Sphilip# To get new features and the best data right away, use:
19331662Sphilip#	DATAFORM=	vanguard
20331662Sphilip# To wait a while before using new features, to give downstream users
21331662Sphilip# time to upgrade zic (the default), use:
22331662Sphilip#	DATAFORM=	main
23331662Sphilip# To wait even longer for new features, use:
24331662Sphilip#	DATAFORM=	rearguard
25366625Sphilip# Rearguard users might also want "ZFLAGS = -b fat"; see below.
26331662SphilipDATAFORM=		main
27331662Sphilip
28339630Sphilip# Change the line below for your timezone (after finding the one you want in
29339630Sphilip# one of the $(TDATA) source files, or adding it to a source file).
30339630Sphilip# Alternatively, if you discover you've got the wrong timezone, you can just
31366625Sphilip# 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
32308265Sgjb# Use the command
33308265Sgjb#	make zonenames
34308265Sgjb# to get a list of the values you can use for LOCALTIME.
35308265Sgjb
36308265SgjbLOCALTIME=	GMT
37308265Sgjb
38349598Sphilip# The POSIXRULES macro controls interpretation of nonstandard and obsolete
39349598Sphilip# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules.
40366625Sphilip# Such a setting uses the rules in a template file to determine
41366625Sphilip# "spring forward" and "fall back" days and times; the environment
42366625Sphilip# variable itself specifies UT offsets of standard and daylight saving time.
43349598Sphilip#
44366625Sphilip# If POSIXRULES is '-', no template is installed; this is the default.
45349598Sphilip#
46366625Sphilip# Any other value for POSIXRULES is obsolete and should not be relied on, as:
47349598Sphilip# * It does not work correctly in popular implementations such as GNU/Linux.
48349598Sphilip# * It does not work in the tzdb implementation for timestamps after 2037.
49349598Sphilip# * It is incompatible with 'zic -b slim' if POSIXRULES specifies transitions
50349598Sphilip#   at standard time or UT rather than at local time.
51349598Sphilip# In short, software should avoid ruleless settings like TZ='EET-2EEST'
52349598Sphilip# and so should not depend on the value of POSIXRULES.
53366625Sphilip#
54366625Sphilip# If, despite the above, you want a template for handling these settings,
55366625Sphilip# you can change the line below (after finding the timezone you want in the
56366625Sphilip# one of the $(TDATA) source files, or adding it to a source file).
57366625Sphilip# Alternatively, if you discover you've got the wrong timezone, you can just
58366625Sphilip# 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
59366625Sphilip# Use the command
60366625Sphilip#	make zonenames
61366625Sphilip# to get a list of the values you can use for POSIXRULES.
62308265Sgjb
63366625SphilipPOSIXRULES=	-
64308265Sgjb
65308265Sgjb# Also see TZDEFRULESTRING below, which takes effect only
66308265Sgjb# if the time zone files cannot be accessed.
67308265Sgjb
68308265Sgjb
69328475Sphilip# Installation locations.
70328475Sphilip#
71328475Sphilip# The defaults are suitable for Debian, except that if REDO is
72328475Sphilip# posix_right or right_posix then files that Debian puts under
73328475Sphilip# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
74328475Sphilip# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
75328475Sphilip# respectively.  Problems with the Debian approach are discussed in
76328475Sphilip# the commentary for the right_posix rule (below).
77308265Sgjb
78328475Sphilip# Destination directory, which can be used for staging.
79328475Sphilip# 'make DESTDIR=/stage install' installs under /stage (e.g., to
80328475Sphilip# /stage/etc/localtime instead of to /etc/localtime).  Files under
81328475Sphilip# /stage are not intended to work as-is, but can be copied by hand to
82328475Sphilip# the root directory later.  If DESTDIR is empty, 'make install' does
83328475Sphilip# not stage, but installs directly into production locations.
84328475SphilipDESTDIR =
85328475Sphilip
86328475Sphilip# Everything is installed into subdirectories of TOPDIR, and used there.
87328475Sphilip# TOPDIR should be empty (meaning the root directory),
88328475Sphilip# or a directory name that does not end in "/".
89328475Sphilip# TOPDIR should be empty or an absolute name unless you're just testing.
90328475SphilipTOPDIR =
91328475Sphilip
92339630Sphilip# The default local timezone is taken from the file TZDEFAULT.
93328475SphilipTZDEFAULT = $(TOPDIR)/etc/localtime
94328475Sphilip
95328475Sphilip# The subdirectory containing installed program and data files, and
96328475Sphilip# likewise for installed files that can be shared among architectures.
97328475Sphilip# These should be relative file names.
98328475SphilipUSRDIR = usr
99328475SphilipUSRSHAREDIR = $(USRDIR)/share
100328475Sphilip
101339630Sphilip# "Compiled" timezone information is placed in the "TZDIR" directory
102308265Sgjb# (and subdirectories).
103325159Sphilip# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
104308265SgjbTZDIR_BASENAME=	zoneinfo
105328475SphilipTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
106308265Sgjb
107328475Sphilip# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
108328475SphilipBINDIR = $(TOPDIR)/$(USRDIR)/bin
109308265Sgjb
110328475Sphilip# The "zdump" command goes in:
111328475SphilipZDUMPDIR = $(BINDIR)
112308265Sgjb
113328475Sphilip# The "zic" command goes in:
114328475SphilipZICDIR = $(TOPDIR)/$(USRDIR)/sbin
115308265Sgjb
116308265Sgjb# Manual pages go in subdirectories of. . .
117328475SphilipMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
118308265Sgjb
119308265Sgjb# Library functions are put in an archive in LIBDIR.
120328475SphilipLIBDIR = $(TOPDIR)/$(USRDIR)/lib
121308265Sgjb
122308265Sgjb
123339630Sphilip# Types to try, as an alternative to time_t.
124339630SphilipTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
125339630SphilipTIME_T_ALTERNATIVES_HEAD = int64_t
126339630SphilipTIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
127328475Sphilip
128345670Sphilip# What kind of TZif data files to generate.  (TZif is the binary time
129345670Sphilip# zone data format that zic generates; see Internet RFC 8536.)
130316349Sbapt# If you want only POSIX time, with time values interpreted as
131316349Sbapt# seconds since the epoch (not counting leap seconds), use
132308265Sgjb#	REDO=		posix_only
133325159Sphilip# below.  If you want only "right" time, with values interpreted
134316349Sbapt# as seconds since the epoch (counting leap seconds), use
135308265Sgjb#	REDO=		right_only
136308265Sgjb# below.  If you want both sets of data available, with leap seconds not
137308265Sgjb# counted normally, use
138308265Sgjb#	REDO=		posix_right
139308265Sgjb# below.  If you want both sets of data available, with leap seconds counted
140308265Sgjb# normally, use
141308265Sgjb#	REDO=		right_posix
142308265Sgjb# below.  POSIX mandates that leap seconds not be counted; for compatibility
143316349Sbapt# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
144316349Sbapt# leap smearing; this can work better than unsmeared "right" time with
145316349Sbapt# applications that are not leap second aware, and is closer to unsmeared
146316349Sbapt# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
147308265Sgjb
148308265SgjbREDO=		posix_right
149308265Sgjb
150360362Sphilip# Whether to put an "Expires" line in the leapseconds file.
151360362Sphilip# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
152360362Sphilip# The EXPIRES_LINE value matters only if REDO's value contains "right".
153360362Sphilip# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
154360362Sphilip# zic's support for the Expires line was introduced in tzdb 2020a,
155360362Sphilip# and EXPIRES_LINE defaults to 0 for now so that the leapseconds file
156360362Sphilip# can be given to older zic implementations.
157360362SphilipEXPIRES_LINE=	0
158360362Sphilip
159339630Sphilip# To install data in text form that has all the information of the TZif data,
160325159Sphilip# (optionally incorporating leap second information), use
161325159Sphilip#	TZDATA_TEXT=	tzdata.zi leapseconds
162325159Sphilip# To install text data without leap second information (e.g., because
163325159Sphilip# REDO='posix_only'), use
164325159Sphilip#	TZDATA_TEXT=	tzdata.zi
165325159Sphilip# To avoid installing text data, use
166325159Sphilip#	TZDATA_TEXT=
167325159Sphilip
168325159SphilipTZDATA_TEXT=	leapseconds tzdata.zi
169325159Sphilip
170325159Sphilip# For backward-compatibility links for old zone names, use
171328475Sphilip#	BACKWARD=	backward
172325159Sphilip# To omit these links, use
173325159Sphilip#	BACKWARD=
174325159Sphilip
175328475SphilipBACKWARD=	backward
176325159Sphilip
177308265Sgjb# If you want out-of-scope and often-wrong data from the file 'backzone', use
178308265Sgjb#	PACKRATDATA=	backzone
179308265Sgjb# To omit this data, use
180308265Sgjb#	PACKRATDATA=
181308265Sgjb
182308265SgjbPACKRATDATA=
183308265Sgjb
184325159Sphilip# The name of a locale using the UTF-8 encoding, used during self-tests.
185325159Sphilip# The tests are skipped if the name does not appear to work on this system.
186325159Sphilip
187325159SphilipUTF8_LOCALE=	en_US.utf8
188325159Sphilip
189308265Sgjb# Non-default libraries needed to link.
190308265SgjbLDLIBS=
191308265Sgjb
192325159Sphilip# Add the following to the end of the "CFLAGS=" line as needed to override
193325159Sphilip# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
194325159Sphilip#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
195325159Sphilip#	formats that generate only the last two digits of year numbers
196325159Sphilip#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
197325159Sphilip#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
198325159Sphilip#	than what POSIX specifies, assuming local time is UT.
199325159Sphilip#	For example, N is 252460800 on AmigaOS.
200308265Sgjb#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
201325159Sphilip#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
202308265Sgjb#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
203325159Sphilip#  -DHAVE_GENERIC=0 if _Generic does not work
204325159Sphilip#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
205325159Sphilip#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
206308265Sgjb#	ctime_r and asctime_r incompatibly with the POSIX standard
207308265Sgjb#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
208325159Sphilip#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
209308265Sgjb#  -DHAVE_LINK=0 if your system lacks a link function
210308265Sgjb#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
211308265Sgjb#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
212308265Sgjb#	localtime_rz can make zdump significantly faster, but is nonstandard.
213308265Sgjb#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
214308265Sgjb#	functions like 'link' or variables like 'tzname' required by POSIX
215325159Sphilip#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
216325159Sphilip#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
217325159Sphilip#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
218325159Sphilip#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
219308265Sgjb#  -DHAVE_STRDUP=0 if your system lacks the strdup function
220331662Sphilip#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
221308265Sgjb#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
222325159Sphilip#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
223325159Sphilip#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
224308265Sgjb#  -DHAVE_TZSET=0 if your system lacks a tzset function
225325159Sphilip#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
226325159Sphilip#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
227331662Sphilip#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
228331662Sphilip#	with external linkage, e.g., applications cannot define 'localtime'.
229325159Sphilip#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
230331662Sphilip#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
231331662Sphilip#	security implications and is not recommended for general use
232325159Sphilip#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
233308265Sgjb#	not needed by the main-program tz code, which is single-threaded.
234308265Sgjb#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
235308265Sgjb#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
236325159Sphilip#	This is intended for internal use only; it mangles external names.
237308265Sgjb#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
238308265Sgjb#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
239308265Sgjb#	the default is system-supplied, typically "/usr/lib/locale"
240308265Sgjb#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
241308265Sgjb#	DST transitions if the time zone files cannot be accessed
242325159Sphilip#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
243308265Sgjb#	other than simply getting garbage data
244308265Sgjb#  -DUSE_LTZ=0 to build zdump with the system time zone library
245308265Sgjb#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
246366625Sphilip#  -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
247366625Sphilip#	similarly for "slim".  Fat TZif files work around incompatibilities
248349598Sphilip#	and bugs in some TZif readers, notably readers that mishandle 64-bit
249349598Sphilip#	data in TZif files.  Slim TZif files are more efficient and do not
250349598Sphilip#	work around these incompatibilities and bugs.  If not given, the
251366625Sphilip#	default is "slim".
252308265Sgjb#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
253308265Sgjb#	(or some other number) to set the maximum time zone abbreviation length
254308265Sgjb#	that zic will accept without a warning (the default is 6)
255308265Sgjb#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
256325159Sphilip# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
257325159SphilipGCC_INSTRUMENT = \
258325159Sphilip  -fsanitize=undefined -fsanitize-address-use-after-scope \
259325159Sphilip  -fsanitize-undefined-trap-on-error -fstack-protector
260325159SphilipGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
261325159Sphilip  $(GCC_INSTRUMENT) \
262325159Sphilip  -Wall -Wextra \
263325159Sphilip  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
264333312Sphilip  -Wbad-function-cast -Wcast-align=strict -Wdate-time \
265325159Sphilip  -Wdeclaration-after-statement -Wdouble-promotion \
266325159Sphilip  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
267325159Sphilip  -Winit-self -Wjump-misses-init -Wlogical-op \
268325159Sphilip  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
269325159Sphilip  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
270333312Sphilip  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 \
271333312Sphilip  -Wstringop-truncation -Wsuggest-attribute=cold \
272325159Sphilip  -Wsuggest-attribute=const -Wsuggest-attribute=format \
273333312Sphilip  -Wsuggest-attribute=malloc \
274325159Sphilip  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
275325159Sphilip  -Wtrampolines -Wundef -Wuninitialized -Wunused \
276325159Sphilip  -Wvariadic-macros -Wvla -Wwrite-strings \
277325159Sphilip  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
278325159Sphilip  -Wno-type-limits -Wno-unused-parameter
279308265Sgjb#
280308265Sgjb# If your system has a "GMT offset" field in its "struct tm"s
281308265Sgjb# (or if you decide to add such a field in your system's "time.h" file),
282308265Sgjb# add the name to a define such as
283308265Sgjb#	-DTM_GMTOFF=tm_gmtoff
284308265Sgjb# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
285308265Sgjb# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
286308265Sgjb# Similarly, if your system has a "zone abbreviation" field, define
287308265Sgjb#	-DTM_ZONE=tm_zone
288308265Sgjb# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
289308265Sgjb# required by POSIX, but are widely available on GNU/Linux and BSD systems.
290308265Sgjb#
291325159Sphilip# The next batch of options control support for external variables
292325159Sphilip# exported by tzcode.  In practice these variables are less useful
293325159Sphilip# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
294325159Sphilip# #
295325159Sphilip# # To omit or support the external variable "tzname", add one of:
296360362Sphilip# #	-DHAVE_TZNAME=0 # do not support "tzname"
297360362Sphilip# #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
298360362Sphilip# #	-DHAVE_TZNAME=2 # support and define "tzname"
299325159Sphilip# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
300325159Sphilip# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
301325159Sphilip# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
302325159Sphilip# # crashes when combined with some platforms' standard libraries,
303325159Sphilip# # presumably due to memory allocation issues.
304325159Sphilip# #
305325159Sphilip# # To omit or support the external variables "timezone" and "daylight", add
306360362Sphilip# #	-DUSG_COMPAT=0 # do not support
307360362Sphilip# #	-DUSG_COMPAT=1 # support, and variables are defined by system library
308360362Sphilip# #	-DUSG_COMPAT=2 # support and define variables
309325159Sphilip# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
310325159Sphilip# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
311325159Sphilip# # If not defined, the code attempts to guess USG_COMPAT from other macros.
312325159Sphilip# #
313325159Sphilip# # To support the external variable "altzone", add
314360362Sphilip# #	-DALTZONE=0 # do not support
315360362Sphilip# #	-DALTZONE=1 # support "altzone", which is defined by system library
316360362Sphilip# #	-DALTZONE=2 # support and define "altzone"
317325159Sphilip# # to the end of the "CFLAGS=" line; although "altzone" appeared in
318325159Sphilip# # System V Release 3.1 it has not been standardized.
319360362Sphilip# # If not defined, the code attempts to guess ALTZONE from other macros.
320325159Sphilip#
321308265Sgjb# If you want functions that were inspired by early versions of X3J11's work,
322308265Sgjb# add
323308265Sgjb#	-DSTD_INSPIRED
324308265Sgjb# to the end of the "CFLAGS=" line.  This arranges for the functions
325366625Sphilip# "offtime", "timelocal", "timegm", "timeoff",
326308265Sgjb# "posix2time", and "time2posix" to be added to the time conversion library.
327308265Sgjb# "offtime" is like "gmtime" except that it accepts a second (long) argument
328308265Sgjb# that gives an offset to add to the time_t when converting it.
329308265Sgjb# "timelocal" is equivalent to "mktime".
330308265Sgjb# "timegm" is like "timelocal" except that it turns a struct tm into
331308265Sgjb# a time_t using UT (rather than local time as "timelocal" does).
332308265Sgjb# "timeoff" is like "timegm" except that it accepts a second (long) argument
333308265Sgjb# that gives an offset to use when converting to a time_t.
334308265Sgjb# "posix2time" and "time2posix" are described in an included manual page.
335308265Sgjb# X3J11's work does not describe any of these functions.
336308265Sgjb# These functions may well disappear in future releases of the time
337308265Sgjb# conversion package.
338308265Sgjb#
339308265Sgjb# If you don't want functions that were inspired by NetBSD, add
340308265Sgjb#	-DNETBSD_INSPIRED=0
341308265Sgjb# to the end of the "CFLAGS=" line.  Otherwise, the functions
342308265Sgjb# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
343308265Sgjb# time library, and if STD_INSPIRED is also defined the functions
344308265Sgjb# "posix2time_z" and "time2posix_z" are added as well.
345308265Sgjb# The functions ending in "_z" (or "_rz") are like their unsuffixed
346308265Sgjb# (or suffixed-by-"_r") counterparts, except with an extra first
347339630Sphilip# argument of opaque type timezone_t that specifies the timezone.
348308265Sgjb# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
349308265Sgjb#
350308265Sgjb# If you want to allocate state structures in localtime, add
351308265Sgjb#	-DALL_STATE
352308265Sgjb# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
353308265Sgjb#
354308265Sgjb# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
355308265Sgjb# out by the National Institute of Standards and Technology
356308265Sgjb# which claims to test C and Posix conformance.  If you want to pass PCTS, add
357308265Sgjb#	-DPCTS
358308265Sgjb# to the end of the "CFLAGS=" line.
359308265Sgjb#
360308265Sgjb# If you want strict compliance with XPG4 as of 1994-04-09, add
361308265Sgjb#	-DXPG4_1994_04_09
362308265Sgjb# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
363325159Sphilip# 53 as a week number (rather than 52 or 53) for January days before
364325159Sphilip# January's first Monday when a "%V" format is used and January 1
365308265Sgjb# falls on a Friday, Saturday, or Sunday.
366308265Sgjb
367308265SgjbCFLAGS=
368308265Sgjb
369308265Sgjb# Linker flags.  Default to $(LFLAGS) for backwards compatibility
370308265Sgjb# to release 2012h and earlier.
371308265Sgjb
372308265SgjbLDFLAGS=	$(LFLAGS)
373308265Sgjb
374308265Sgjb# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
375308265Sgjb# submake command lines.  The default is no leap seconds.
376308265Sgjb
377308265SgjbLEAPSECONDS=
378308265Sgjb
379308265Sgjb# The zic command and its arguments.
380308265Sgjb
381308265Sgjbzic=		./zic
382308265SgjbZIC=		$(zic) $(ZFLAGS)
383308265Sgjb
384345670Sphilip# To shrink the size of installed TZif files,
385345670Sphilip# append "-r @N" to omit data before N-seconds-after-the-Epoch.
386366625Sphilip# To grow the files and work around older application bugs, append "-b fat";
387349598Sphilip# see ZIC_BLOAT_DEFAULT above.
388349598Sphilip# See the zic man page for more about -b and -r.
389308265SgjbZFLAGS=
390308265Sgjb
391339630Sphilip# How to use zic to install TZif files.
392308265Sgjb
393328475SphilipZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
394308265Sgjb
395308265Sgjb# The name of a Posix-compliant 'awk' on your system.
396339630Sphilip# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core;
397339630Sphilip# on Ubuntu you can work around this with
398339630Sphilip#	AWK=		gawk
399308265SgjbAWK=		awk
400308265Sgjb
401308265Sgjb# The full path name of a Posix-compliant shell, preferably one that supports
402308265Sgjb# the Korn shell's 'select' statement as an extension.
403308265Sgjb# These days, Bash is the most popular.
404308265Sgjb# It should be OK to set this to /bin/sh, on platforms where /bin/sh
405308265Sgjb# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
406308265Sgjb# is typically nicer if it works.
407308265SgjbKSHELL=		/bin/bash
408308265Sgjb
409342668Sphilip# Name of curl <https://curl.haxx.se/>, used for HTML validation.
410342668SphilipCURL=		curl
411342668Sphilip
412349598Sphilip# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
413349598SphilipGPG=		gpg
414349598Sphilip
415308265Sgjb# This expensive test requires USE_LTZ.
416308265Sgjb# To suppress it, define this macro to be empty.
417308265SgjbCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
418308265Sgjb
419308265Sgjb# SAFE_CHAR is a regular expression that matches a safe character.
420308265Sgjb# Some parts of this distribution are limited to safe characters;
421308265Sgjb# others can use any UTF-8 character.
422308265Sgjb# For now, the safe characters are a safe subset of ASCII.
423308265Sgjb# The caller must set the shell variable 'sharp' to the character '#',
424308265Sgjb# since Makefile macros cannot contain '#'.
425308265Sgjb# TAB_CHAR is a single tab character, in single quotes.
426308265SgjbTAB_CHAR=	'	'
427308265SgjbSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
428308265SgjbSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
429308265SgjbSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
430308265SgjbSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
431308265SgjbSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
432308265Sgjb
433339630Sphilip# These characters are Latin-1, and so are likely to be displayable
434339630Sphilip# even in editors with limited character sets.
435339630SphilipUNUSUAL_OK_LATIN_1 = ��������������
436339630Sphilip# This IPA symbol is represented in Unicode as the composition of
437339630Sphilip# U+0075 and U+032F, and U+032F is not considered alphabetic by some
438339630Sphilip# grep implementations that do not grok composition.
439339630SphilipUNUSUAL_OK_IPA = u��
440331662Sphilip# Non-ASCII non-letters that OK_CHAR allows, as these characters are
441339630Sphilip# useful in commentary.
442339630SphilipUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
443331662Sphilip
444308265Sgjb# OK_CHAR matches any character allowed in the distributed files.
445331662Sphilip# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
446331662Sphilip# multibyte letters are also allowed so that commentary can contain a
447331662Sphilip# few safe symbols and people's names and can quote non-English sources.
448331662Sphilip# Other non-letters are limited to ASCII renderings for the
449331662Sphilip# convenience of maintainers using XEmacs 21.5.34, which by default
450331662Sphilip# mishandles Unicode characters U+0100 and greater.
451331662SphilipOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
452308265Sgjb
453308265Sgjb# SAFE_LINE matches a line of safe characters.
454308265Sgjb# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
455308265Sgjb# this is so that comments can contain non-ASCII characters.
456308265Sgjb# OK_LINE matches a line of OK characters.
457308265SgjbSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
458308265SgjbSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
459308265SgjbOK_LINE=	'^'$(OK_CHAR)'*$$'
460308265Sgjb
461308265Sgjb# Flags to give 'tar' when making a distribution.
462308265Sgjb# Try to use flags appropriate for GNU tar.
463308265SgjbGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
464308265SgjbTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
465308265Sgjb		 then echo $(GNUTARFLAGS); \
466308265Sgjb		 else :; \
467308265Sgjb		 fi`
468308265Sgjb
469308265Sgjb# Flags to give 'gzip' when making a distribution.
470308265SgjbGZIPFLAGS=	-9n
471308265Sgjb
472308265Sgjb###############################################################################
473308265Sgjb
474308265Sgjb#MAKE=		make
475308265Sgjb
476308265Sgjbcc=		cc
477328475SphilipCC=		$(cc) -DTZDIR='"$(TZDIR)"'
478308265Sgjb
479308265SgjbAR=		ar
480308265Sgjb
481308265Sgjb# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
482308265SgjbRANLIB=		:
483308265Sgjb
484308265SgjbTZCOBJS=	zic.o
485325159SphilipTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
486308265SgjbDATEOBJS=	date.o localtime.o strftime.o asctime.o
487360362SphilipLIBSRCS=	localtime.c asctime.c difftime.c strftime.c
488360362SphilipLIBOBJS=	localtime.o asctime.o difftime.o strftime.o
489308265SgjbHEADERS=	tzfile.h private.h
490308265SgjbNONLIBSRCS=	zic.c zdump.c
491360362SphilipNEWUCBSRCS=	date.c
492308265SgjbSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
493308265Sgjb			tzselect.ksh workman.sh
494308265SgjbMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
495308265Sgjb			tzfile.5 tzselect.8 zic.8 zdump.8
496308265SgjbMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
497308265Sgjb			time2posix.3.txt \
498308265Sgjb			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
499308265Sgjb			date.1.txt
500325159SphilipCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
501325159Sphilip			NEWS README theory.html version
502328475SphilipWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
503345670SphilipCHECK_WEB_PAGES=check_theory.html check_tz-art.html \
504345670Sphilip			check_tz-how-to.html check_tz-link.html
505308265SgjbDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
506308265SgjbPRIMARY_YDATA=	africa antarctica asia australasia \
507308265Sgjb		europe northamerica southamerica
508328475SphilipYDATA=		$(PRIMARY_YDATA) etcetera
509366625SphilipNDATA=		factory
510366625SphilipTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward
511328475SphilipTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
512308265SgjbZONETABLES=	zone1970.tab zone.tab
513325159SphilipTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
514308265SgjbLEAP_DEPS=	leapseconds.awk leap-seconds.list
515331662SphilipTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
516331662SphilipDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
517328475SphilipDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
518366625Sphilip			leapseconds $(ZONETABLES)
519331662SphilipAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
520331662Sphilip			ziguard.awk zishrink.awk
521308265SgjbMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
522308265SgjbTZS_YEAR=	2050
523339630SphilipTZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
524308265SgjbTZS=		to$(TZS_YEAR).tzs
525308265SgjbTZS_NEW=	to$(TZS_YEAR)new.tzs
526308265SgjbTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
527308265Sgjb			private.h tzfile.h zdump.c zic.c
528339630Sphilip# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
529339630SphilipEIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
530339630SphilipENCHILADA = $(EIGHT_YARDS) $(TZS)
531308265Sgjb
532308265Sgjb# Consult these files when deciding whether to rebuild the 'version' file.
533308265Sgjb# This list is not the same as the output of 'git ls-files', since
534308265Sgjb# .gitignore is not distributed.
535308265SgjbVERSION_DEPS= \
536325159Sphilip		calendars CONTRIBUTING LICENSE Makefile NEWS README \
537308265Sgjb		africa antarctica asctime.c asia australasia \
538308265Sgjb		backward backzone \
539308265Sgjb		checklinks.awk checktab.awk \
540308265Sgjb		date.1 date.c difftime.c \
541308265Sgjb		etcetera europe factory iso3166.tab \
542308265Sgjb		leap-seconds.list leapseconds.awk localtime.c \
543308265Sgjb		newctime.3 newstrftime.3 newtzset.3 northamerica \
544366625Sphilip		private.h southamerica strftime.c theory.html \
545328475Sphilip		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
546308265Sgjb		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
547366625Sphilip		workman.sh zdump.8 zdump.c zic.8 zic.c \
548333312Sphilip		ziguard.awk zishrink.awk \
549308265Sgjb		zone.tab zone1970.tab zoneinfo2tdf.pl
550308265Sgjb
551308265Sgjb# And for the benefit of csh users on systems that assume the user
552308265Sgjb# shell should be used to handle commands in Makefiles. . .
553308265Sgjb
554308265SgjbSHELL=		/bin/sh
555308265Sgjb
556366625Sphilipall:		tzselect zic zdump libtz.a $(TABDATA) \
557331662Sphilip		  vanguard.zi main.zi rearguard.zi
558308265Sgjb
559308265SgjbALL:		all date $(ENCHILADA)
560308265Sgjb
561308265Sgjbinstall:	all $(DATA) $(REDO) $(MANS)
562328475Sphilip		mkdir -p '$(DESTDIR)$(BINDIR)' \
563328475Sphilip			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
564328475Sphilip			'$(DESTDIR)$(LIBDIR)' \
565328475Sphilip			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
566328475Sphilip			'$(DESTDIR)$(MANDIR)/man8'
567349598Sphilip		$(ZIC_INSTALL) -l $(LOCALTIME) \
568349598Sphilip			`case '$(POSIXRULES)' in ?*) echo '-p';; esac \
569349598Sphilip			` $(POSIXRULES) \
570328475Sphilip			-t '$(DESTDIR)$(TZDEFAULT)'
571328475Sphilip		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
572328475Sphilip		cp tzselect '$(DESTDIR)$(BINDIR)/.'
573328475Sphilip		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
574328475Sphilip		cp zic '$(DESTDIR)$(ZICDIR)/.'
575328475Sphilip		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
576328475Sphilip		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
577328475Sphilip		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
578328475Sphilip		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
579328475Sphilip		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
580308265Sgjb
581308265SgjbINSTALL:	ALL install date.1
582328475Sphilip		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
583328475Sphilip		cp date '$(DESTDIR)$(BINDIR)/.'
584328475Sphilip		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
585308265Sgjb
586368822Sphilip# Calculate version number from git, if available.
587368822Sphilip# Otherwise, use $(VERSION) unless it is "unknown" and there is already
588368822Sphilip# a 'version' file, in which case reuse the existing 'version' contents
589368822Sphilip# and append "-dirty" if the contents do not already end in "-dirty".
590308265Sgjbversion:	$(VERSION_DEPS)
591308265Sgjb		{ (type git) >/dev/null 2>&1 && \
592308265Sgjb		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
593308265Sgjb				--abbrev=7 --dirty` || \
594368822Sphilip		  if test '$(VERSION)' = unknown && V=`cat $@`; then \
595368822Sphilip		    case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
596368822Sphilip		  else \
597368822Sphilip		    V='$(VERSION)'; \
598368822Sphilip		  fi; } && \
599308265Sgjb		printf '%s\n' "$$V" >$@.out
600308265Sgjb		mv $@.out $@
601308265Sgjb
602339630Sphilip# These files can be tailored by setting BACKWARD and PACKRATDATA.
603331662Sphilipvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
604333312Sphilip		$(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
605333312Sphilip		  $(TDATA) $(PACKRATDATA) >$@.out
606331662Sphilip		mv $@.out $@
607339630Sphilip# This file has a version comment that attempts to capture any tailoring
608339630Sphilip# via BACKWARD, DATAFORM, PACKRATDATA, and REDO.
609339630Sphiliptzdata.zi:	$(DATAFORM).zi version zishrink.awk
610328475Sphilip		version=`sed 1q version` && \
611339630Sphilip		  LC_ALL=C $(AWK) \
612339630Sphilip		    -v dataform='$(DATAFORM)' \
613339630Sphilip		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
614339630Sphilip		    -v redo='$(REDO)' \
615339630Sphilip		    -v version="$$version" \
616339630Sphilip		    -f zishrink.awk \
617331662Sphilip		    $(DATAFORM).zi >$@.out
618325159Sphilip		mv $@.out $@
619325159Sphilip
620308265Sgjbversion.h:	version
621308265Sgjb		VERSION=`cat version` && printf '%s\n' \
622308265Sgjb		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
623308265Sgjb		  "static char const TZVERSION[]=\"$$VERSION\";" \
624308265Sgjb		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
625308265Sgjb		  >$@.out
626308265Sgjb		mv $@.out $@
627308265Sgjb
628308265Sgjbzdump:		$(TZDOBJS)
629308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
630308265Sgjb
631308265Sgjbzic:		$(TZCOBJS)
632308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
633308265Sgjb
634308265Sgjbleapseconds:	$(LEAP_DEPS)
635360362Sphilip		$(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
636360362Sphilip		  -f leapseconds.awk leap-seconds.list >$@.out
637308265Sgjb		mv $@.out $@
638308265Sgjb
639308265Sgjb# Arguments to pass to submakes of install_data.
640308265Sgjb# They can be overridden by later submake arguments.
641308265SgjbINSTALLARGS = \
642328475Sphilip BACKWARD='$(BACKWARD)' \
643328475Sphilip DESTDIR='$(DESTDIR)' \
644308265Sgjb LEAPSECONDS='$(LEAPSECONDS)' \
645308265Sgjb PACKRATDATA='$(PACKRATDATA)' \
646328475Sphilip TZDEFAULT='$(TZDEFAULT)' \
647328475Sphilip TZDIR='$(TZDIR)' \
648308265Sgjb ZIC='$(ZIC)'
649308265Sgjb
650366625SphilipINSTALL_DATA_DEPS = zic leapseconds tzdata.zi
651339630Sphilip
652339630Sphilip# 'make install_data' installs one set of TZif files.
653339630Sphilipinstall_data: $(INSTALL_DATA_DEPS)
654325159Sphilip		$(ZIC_INSTALL) tzdata.zi
655308265Sgjb
656339630Sphilipposix_only: $(INSTALL_DATA_DEPS)
657308265Sgjb		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
658308265Sgjb
659339630Sphilipright_only: $(INSTALL_DATA_DEPS)
660308265Sgjb		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
661308265Sgjb			install_data
662308265Sgjb
663308265Sgjb# In earlier versions of this makefile, the other two directories were
664308265Sgjb# subdirectories of $(TZDIR).  However, this led to configuration errors.
665308265Sgjb# For example, with posix_right under the earlier scheme,
666308265Sgjb# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
667308265Sgjb# but gmtime without leap seconds, which led to problems with applications
668308265Sgjb# like sendmail that subtract gmtime from localtime.
669308265Sgjb# Therefore, the other two directories are now siblings of $(TZDIR).
670308265Sgjb# You must replace all of $(TZDIR) to switch from not using leap seconds
671308265Sgjb# to using them, or vice versa.
672308265Sgjbright_posix:	right_only
673328475Sphilip		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
674328475Sphilip		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
675328475Sphilip		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
676328475Sphilip		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
677308265Sgjb
678308265Sgjbposix_right:	posix_only
679328475Sphilip		rm -fr '$(DESTDIR)$(TZDIR)-posix'
680328475Sphilip		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
681328475Sphilip		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
682328475Sphilip		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
683308265Sgjb
684308265Sgjb# This obsolescent rule is present for backwards compatibility with
685308265Sgjb# tz releases 2014g through 2015g.  It should go away eventually.
686339630Sphilipposix_packrat: $(INSTALL_DATA_DEPS)
687308265Sgjb		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
688308265Sgjb
689308265Sgjbzones:		$(REDO)
690308265Sgjb
691331662Sphilip# dummy.zd is not a real file; it is mentioned here only so that the
692331662Sphilip# top-level 'make' does not have a syntax error.
693331662SphilipZDS = dummy.zd
694331662Sphilip# Rule used only by submakes invoked by the $(TZS_NEW) rule.
695331662Sphilip# It is separate so that GNU 'make -j' can run instances in parallel.
696331662Sphilip$(ZDS): zdump
697339630Sphilip		./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
698339630Sphilip		  >$@
699331662Sphilip
700339630SphilipTZS_NEW_DEPS = tzdata.zi zdump zic
701339630Sphilip$(TZS_NEW): $(TZS_NEW_DEPS)
702339630Sphilip		rm -fr tzs$(TZS_YEAR).dir
703339630Sphilip		mkdir tzs$(TZS_YEAR).dir
704339630Sphilip		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
705325159Sphilip		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
706325159Sphilip		   tzdata.zi | LC_ALL=C sort >$@.out
707308265Sgjb		wd=`pwd` && \
708339630Sphilip		x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
709339630Sphilip				tzdata.zi \
710331662Sphilip			| LC_ALL=C sort -t . -k 2,2` && \
711339630Sphilip		set x $$x && \
712331662Sphilip		shift && \
713331662Sphilip		ZDS=$$* && \
714339630Sphilip		$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
715339630Sphilip		  ZDS="$$ZDS" $$ZDS && \
716339630Sphilip		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
717339630Sphilip		rm -fr tzs$(TZS_YEAR).dir
718331662Sphilip		mv $@.out $@
719308265Sgjb
720339630Sphilip# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
721308265Sgjb# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
722308265Sgjb$(TZS):
723339630Sphilip		touch $@
724308265Sgjb
725308265Sgjbforce_tzs:	$(TZS_NEW)
726308265Sgjb		cp $(TZS_NEW) $(TZS)
727308265Sgjb
728308265Sgjblibtz.a:	$(LIBOBJS)
729309792Sbapt		rm -f $@
730309792Sbapt		$(AR) -rc $@ $(LIBOBJS)
731308265Sgjb		$(RANLIB) $@
732308265Sgjb
733308265Sgjbdate:		$(DATEOBJS)
734308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
735308265Sgjb
736308265Sgjbtzselect:	tzselect.ksh version
737308265Sgjb		VERSION=`cat version` && sed \
738308265Sgjb			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
739308265Sgjb			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
740308265Sgjb			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
741308265Sgjb			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
742308265Sgjb			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
743308265Sgjb			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
744308265Sgjb			<$@.ksh >$@.out
745308265Sgjb		chmod +x $@.out
746308265Sgjb		mv $@.out $@
747308265Sgjb
748325159Sphilipcheck:		check_character_set check_white_space check_links \
749325159Sphilip		  check_name_lengths check_sorted \
750325159Sphilip		  check_tables check_web check_zishrink check_tzs
751308265Sgjb
752308265Sgjbcheck_character_set: $(ENCHILADA)
753325159Sphilip	test ! '$(UTF8_LOCALE)' || \
754325159Sphilip	! printf 'A\304\200B\n' | \
755325159Sphilip	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
756325159Sphilip		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
757308265Sgjb		sharp='#' && \
758308265Sgjb		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
759308265Sgjb			$(MISC) $(SOURCES) $(WEB_PAGES) \
760331662Sphilip			CONTRIBUTING LICENSE README \
761325159Sphilip			version tzdata.zi && \
762339630Sphilip		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
763331662Sphilip			Makefile && \
764328475Sphilip		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
765366625Sphilip			leapseconds zone.tab && \
766325159Sphilip		! grep -Env $(OK_LINE) $(ENCHILADA); \
767325159Sphilip	}
768339630Sphilip	touch $@
769308265Sgjb
770308265Sgjbcheck_white_space: $(ENCHILADA)
771308265Sgjb		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
772339630Sphilip		! grep -En "$$pat" \
773339630Sphilip			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
774328475Sphilip		! grep -n '[[:space:]]$$' \
775328475Sphilip			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
776339630Sphilip		touch $@
777308265Sgjb
778325159SphilipPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
779325159SphilipFILE_NAME_COMPONENT_TOO_LONG = \
780325159Sphilip  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
781325159Sphilip
782328475Sphilipcheck_name_lengths: $(TDATA_TO_CHECK) backzone
783328475Sphilip		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
784328475Sphilip			$(TDATA_TO_CHECK) backzone
785339630Sphilip		touch $@
786325159Sphilip
787308265SgjbCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
788308265Sgjb
789308265Sgjbcheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
790308265Sgjb		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
791308265Sgjb		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
792339630Sphilip		touch $@
793308265Sgjb
794331662Sphilipcheck_links:	checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
795328475Sphilip		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
796325159Sphilip		$(AWK) -f checklinks.awk tzdata.zi
797339630Sphilip		touch $@
798308265Sgjb
799308265Sgjbcheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
800308265Sgjb		for tab in $(ZONETABLES); do \
801308265Sgjb		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
802308265Sgjb		    || exit; \
803308265Sgjb		done
804339630Sphilip		touch $@
805308265Sgjb
806308265Sgjbcheck_tzs:	$(TZS) $(TZS_NEW)
807339630Sphilip		if test -s $(TZS); then \
808339630Sphilip		  diff -u $(TZS) $(TZS_NEW); \
809339630Sphilip		else \
810339630Sphilip		  cp $(TZS_NEW) $(TZS); \
811339630Sphilip		fi
812339630Sphilip		touch $@
813308265Sgjb
814342668Sphilipcheck_web:	$(CHECK_WEB_PAGES)
815345670Sphilipcheck_theory.html: theory.html
816342668Sphilipcheck_tz-art.html: tz-art.html
817366625Sphilipcheck_tz-how-to.html: tz-how-to.html
818342668Sphilipcheck_tz-link.html: tz-link.html
819366625Sphilipcheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
820342668Sphilip		$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
821342668Sphilip		    -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
822342668Sphilip		  test ! -s $@.out || { cat $@.out; exit 1; }
823342668Sphilip		mv $@.out $@
824308265Sgjb
825331662Sphilip# Check that zishrink.awk does not alter the data, and that ziguard.awk
826331662Sphilip# preserves main-format data.
827339630Sphilipcheck_zishrink: check_zishrink_posix check_zishrink_right
828339630Sphilipcheck_zishrink_posix check_zishrink_right: \
829339630Sphilip  zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi
830339630Sphilip		rm -fr $@.dir $@-t.dir $@-shrunk.dir
831339630Sphilip		mkdir $@.dir $@-t.dir $@-shrunk.dir
832339630Sphilip		case $@ in \
833339630Sphilip		  *_right) leap='-L leapseconds';; \
834339630Sphilip		  *) leap=;; \
835339630Sphilip		esac && \
836339630Sphilip		  $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
837339630Sphilip		  $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
838331662Sphilip		  case $(DATAFORM) in \
839331662Sphilip		    main) \
840339630Sphilip		      $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
841331662Sphilip		      $(AWK) '/^Rule/' $(TDATA) | \
842339630Sphilip			$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
843339630Sphilip		      diff -r $@.dir $@-t.dir;; \
844339630Sphilip		  esac
845339630Sphilip		diff -r $@.dir $@-shrunk.dir
846339630Sphilip		rm -fr $@.dir $@-t.dir $@-shrunk.dir
847339630Sphilip		touch $@
848325159Sphilip
849308265Sgjbclean_misc:
850345670Sphilip		rm -fr check_*.dir
851339630Sphilip		rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
852339630Sphilip		  check_* core typecheck_* \
853366625Sphilip		  date tzselect version.h zdump zic libtz.a
854308265Sgjbclean:		clean_misc
855345670Sphilip		rm -fr *.dir tzdb-*/
856345670Sphilip		rm -f *.zi $(TZS_NEW)
857308265Sgjb
858308265Sgjbmaintainer-clean: clean
859308265Sgjb		@echo 'This command is intended for maintainers to use; it'
860308265Sgjb		@echo 'deletes files that may need special tools to rebuild.'
861308265Sgjb		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
862308265Sgjb
863308265Sgjbnames:
864308265Sgjb		@echo $(ENCHILADA)
865308265Sgjb
866308265Sgjbpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
867308265Sgjb		tarballs signatures
868308265Sgjb
869308265Sgjbdate.1.txt:	date.1
870308265Sgjbnewctime.3.txt:	newctime.3
871308265Sgjbnewstrftime.3.txt: newstrftime.3
872308265Sgjbnewtzset.3.txt:	newtzset.3
873308265Sgjbtime2posix.3.txt: time2posix.3
874308265Sgjbtzfile.5.txt:	tzfile.5
875308265Sgjbtzselect.8.txt:	tzselect.8
876308265Sgjbzdump.8.txt:	zdump.8
877308265Sgjbzic.8.txt:	zic.8
878308265Sgjb
879308265Sgjb$(MANTXTS):	workman.sh
880308265Sgjb		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
881308265Sgjb		mv $@.out $@
882308265Sgjb
883368822Sphilip# Set file timestamps deterministically if possible,
884368822Sphilip# so that tarballs containing the timestamps are reproducible.
885368822Sphilip#
886368822Sphilip# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
887368822Sphilip# file DEST to the maximum of the timestamps of the files A B C ...,
888368822Sphilip# plus N if GNU ls and touch are available.
889368822SphilipSET_TIMESTAMP_N = sh -c '\
890368822Sphilip  n=$$0 dest=$$1; shift; \
891368822Sphilip  touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \
892368822Sphilip  if test $$n != 0 && \
893368822Sphilip     lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \
894368822Sphilip    set x $$lsout && \
895368822Sphilip    touch -cmd @`expr $$7 + $$n` "$$dest"; \
896368822Sphilip  else :; fi'
897368822Sphilip# If DEST depends on A B C ... in this Makefile, callers should use
898368822Sphilip# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
899368822Sphilip# downstream 'make' that considers equal timestamps to be out of date.
900368822Sphilip# POSIX allows this 'make' behavior, and HP-UX 'make' does it.
901368822Sphilip# If all that matters is that the timestamp be reproducible
902368822Sphilip# and plausible, use $(SET_TIMESTAMP).
903368822SphilipSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
904368822SphilipSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
905368822Sphilip
906339630Sphilip# Set the timestamps to those of the git repository, if available,
907308265Sgjb# and if the files have not changed since then.
908368822Sphilip# This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
909368822Sphilip# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
910368822Sphilip# If git or GNU is absent, don't bother to sync with git timestamps.
911308265Sgjb# Also, set the timestamp of each prebuilt file like 'leapseconds'
912308265Sgjb# to be the maximum of the files it depends on.
913339630Sphilipset-timestamps.out: $(EIGHT_YARDS)
914308265Sgjb		rm -f $@
915308265Sgjb		if (type git) >/dev/null 2>&1 && \
916339630Sphilip		   files=`git ls-files $(EIGHT_YARDS)` && \
917308265Sgjb		   touch -md @1 test.out; then \
918308265Sgjb		  rm -f test.out && \
919308265Sgjb		  for file in $$files; do \
920308265Sgjb		    if git diff --quiet $$file; then \
921308265Sgjb		      time=`git log -1 --format='tformat:%ct' $$file` && \
922308265Sgjb		      touch -cmd @$$time $$file; \
923308265Sgjb		    else \
924308265Sgjb		      echo >&2 "$$file: warning: does not match repository"; \
925308265Sgjb		    fi || exit; \
926308265Sgjb		  done; \
927308265Sgjb		fi
928368822Sphilip		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
929308265Sgjb		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
930368822Sphilip		  $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
931308265Sgjb		    exit; \
932308265Sgjb		done
933368822Sphilip		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
934368822Sphilip		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
935308265Sgjb		touch $@
936339630Sphilipset-tzs-timestamp.out: $(TZS)
937368822Sphilip		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
938339630Sphilip		touch $@
939308265Sgjb
940308265Sgjb# The zics below ensure that each data file can stand on its own.
941308265Sgjb# We also do an all-files run to catch links to links.
942308265Sgjb
943339630Sphilipcheck_public: $(VERSION_DEPS)
944339630Sphilip		rm -fr public.dir
945339630Sphilip		mkdir public.dir
946339630Sphilip		ln $(VERSION_DEPS) public.dir
947339630Sphilip		cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
948368911Sphilip		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
949368911Sphilip		    public.dir/vanguard.zi public.dir/main.zi \
950368911Sphilip		    public.dir/rearguard.zi; \
951368911Sphilip		do \
952339630Sphilip		  public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
953308265Sgjb		done
954339630Sphilip		public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
955308265Sgjb		rm -fr public.dir
956339630Sphilip		touch $@
957308265Sgjb
958308265Sgjb# Check that the code works under various alternative
959308265Sgjb# implementations of time_t.
960339630Sphilipcheck_time_t_alternatives: $(TIME_T_ALTERNATIVES)
961339630Sphilip$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
962339630Sphilip$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
963339630Sphilip		rm -fr $@.dir
964339630Sphilip		mkdir $@.dir
965339630Sphilip		ln $(VERSION_DEPS) $@.dir
966339630Sphilip		case $@ in \
967339630Sphilip		  int32_t) range=-2147483648,2147483648;; \
968339630Sphilip		  u*) range=0,4294967296;; \
969339630Sphilip		  *) range=-4294967296,4294967296;; \
970339630Sphilip		esac && \
971339630Sphilip		wd=`pwd` && \
972339630Sphilip		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
973339630Sphilip		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
974339630Sphilip		  range_target=; \
975308265Sgjb		else \
976339630Sphilip		  range_target=to$$range.tzs; \
977308265Sgjb		fi && \
978339630Sphilip		(cd $@.dir && \
979339630Sphilip		  $(MAKE) TOPDIR="$$wd/$@.dir" \
980339630Sphilip		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
981308265Sgjb		    REDO='$(REDO)' \
982339630Sphilip			D=$$wd/$@.dir \
983339630Sphilip		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
984339630Sphilip		    install $$range_target) && \
985339630Sphilip		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
986339630Sphilip		  (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
987339630Sphilip		    $(MAKE) TOPDIR="$$wd/$@.dir" \
988339630Sphilip		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
989339630Sphilip			D=$$wd/$@.dir \
990339630Sphilip		      to$$range.tzs) && \
991339630Sphilip		  diff -u $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
992339630Sphilip			  $@.dir/to$$range.tzs && \
993339630Sphilip		  if diff -q Makefile Makefile 2>/dev/null; then \
994339630Sphilip		    quiet_option='-q'; \
995339630Sphilip		  else \
996339630Sphilip		    quiet_option=''; \
997339630Sphilip		  fi && \
998339630Sphilip		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
999339630Sphilip					   $@.dir/etc && \
1000339630Sphilip		    diff $$quiet_option -r \
1001339630Sphilip		      $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
1002339630Sphilip		      $@.dir/usr/share; \
1003339630Sphilip		}
1004339630Sphilip		touch $@
1005308265Sgjb
1006333312SphilipTRADITIONAL_ASC = \
1007333312Sphilip  tzcode$(VERSION).tar.gz.asc \
1008333312Sphilip  tzdata$(VERSION).tar.gz.asc
1009339630SphilipREARGUARD_ASC = \
1010339630Sphilip  tzdata$(VERSION)-rearguard.tar.gz.asc
1011339630SphilipALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
1012333312Sphilip  tzdb-$(VERSION).tar.lz.asc
1013333312Sphilip
1014339630Sphiliptarballs rearguard_tarballs traditional_tarballs \
1015339630Sphilipsignatures rearguard_signatures traditional_signatures: \
1016339630Sphilip  version set-timestamps.out rearguard.zi
1017308265Sgjb		VERSION=`cat version` && \
1018368822Sphilip		$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
1019308265Sgjb
1020331662Sphilip# These *_version rules are intended for use if VERSION is set by some
1021331662Sphilip# other means.  Ordinarily these rules are used only by the above
1022331662Sphilip# non-_version rules, which set VERSION on the 'make' command line.
1023339630Sphiliptarballs_version: traditional_tarballs_version rearguard_tarballs_version \
1024333312Sphilip  tzdb-$(VERSION).tar.lz
1025339630Sphiliprearguard_tarballs_version: \
1026339630Sphilip  tzdata$(VERSION)-rearguard.tar.gz
1027308265Sgjbtraditional_tarballs_version: \
1028308265Sgjb  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
1029333312Sphilipsignatures_version: $(ALL_ASC)
1030339630Sphiliprearguard_signatures_version: $(REARGUARD_ASC)
1031333312Sphiliptraditional_signatures_version: $(TRADITIONAL_ASC)
1032308265Sgjb
1033308265Sgjbtzcode$(VERSION).tar.gz: set-timestamps.out
1034308265Sgjb		LC_ALL=C && export LC_ALL && \
1035308265Sgjb		tar $(TARFLAGS) -cf - \
1036308265Sgjb		    $(COMMON) $(DOCS) $(SOURCES) | \
1037308265Sgjb		  gzip $(GZIPFLAGS) >$@.out
1038308265Sgjb		mv $@.out $@
1039308265Sgjb
1040308265Sgjbtzdata$(VERSION).tar.gz: set-timestamps.out
1041308265Sgjb		LC_ALL=C && export LC_ALL && \
1042308265Sgjb		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
1043308265Sgjb		  gzip $(GZIPFLAGS) >$@.out
1044308265Sgjb		mv $@.out $@
1045308265Sgjb
1046333312Sphiliptzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
1047333312Sphilip		rm -fr tzdata$(VERSION)-rearguard.dir
1048333312Sphilip		mkdir tzdata$(VERSION)-rearguard.dir
1049333312Sphilip		ln $(COMMON) $(DATA) $(MISC) tzdata$(VERSION)-rearguard.dir
1050333312Sphilip		cd tzdata$(VERSION)-rearguard.dir && \
1051333312Sphilip		  rm -f $(TDATA) $(PACKRATDATA) version
1052333312Sphilip		for f in $(TDATA) $(PACKRATDATA); do \
1053333312Sphilip		  rearf=tzdata$(VERSION)-rearguard.dir/$$f; \
1054333312Sphilip		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
1055368822Sphilip		  $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
1056333312Sphilip		done
1057333312Sphilip		sed '1s/$$/-rearguard/' \
1058333312Sphilip		  <version >tzdata$(VERSION)-rearguard.dir/version
1059366802Sphilip		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1060366957Sphilip		TZ=UTC0 touch -mt 202010122253.00 \
1061366802Sphilip		  tzdata$(VERSION)-rearguard.dir/pacificnew
1062333312Sphilip		touch -cmr version tzdata$(VERSION)-rearguard.dir/version
1063333312Sphilip		LC_ALL=C && export LC_ALL && \
1064333312Sphilip		  (cd tzdata$(VERSION)-rearguard.dir && \
1065366802Sphilip		   tar $(TARFLAGS) -cf - \
1066366802Sphilip			$(COMMON) $(DATA) $(MISC) pacificnew | \
1067333312Sphilip		     gzip $(GZIPFLAGS)) >$@.out
1068333312Sphilip		mv $@.out $@
1069333312Sphilip
1070339630Sphiliptzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
1071308265Sgjb		rm -fr tzdb-$(VERSION)
1072308265Sgjb		mkdir tzdb-$(VERSION)
1073308265Sgjb		ln $(ENCHILADA) tzdb-$(VERSION)
1074368822Sphilip		$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
1075308265Sgjb		LC_ALL=C && export LC_ALL && \
1076308265Sgjb		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
1077308265Sgjb		mv $@.out $@
1078308265Sgjb
1079308265Sgjbtzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
1080308265Sgjbtzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
1081333312Sphiliptzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
1082308265Sgjbtzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
1083333312Sphilip$(ALL_ASC):
1084349598Sphilip		$(GPG) --armor --detach-sign $?
1085308265Sgjb
1086339630SphilipTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
1087339630Sphiliptypecheck: typecheck_long_long typecheck_unsigned
1088339630Sphiliptypecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
1089339630Sphilip		rm -fr $@.dir
1090339630Sphilip		mkdir $@.dir
1091339630Sphilip		ln $(VERSION_DEPS) $@.dir
1092339630Sphilip		cd $@.dir && \
1093339630Sphilip		  case $@ in \
1094339630Sphilip		    *_long_long) i="long long";; \
1095339630Sphilip		    *_unsigned ) i="unsigned" ;; \
1096339630Sphilip		  esac && \
1097339630Sphilip		  typecheck_cflags='' && \
1098339630Sphilip		  $(MAKE) \
1099339630Sphilip		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
1100339630Sphilip		    TOPDIR="`pwd`" \
1101339630Sphilip		    install
1102339630Sphilip		$@.dir/zdump -i -c 1970,1971 Europe/Rome
1103339630Sphilip		touch $@
1104308265Sgjb
1105325159Sphilipzonenames:	tzdata.zi
1106325159Sphilip		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
1107308265Sgjb
1108308265Sgjbasctime.o:	private.h tzfile.h
1109308265Sgjbdate.o:		private.h
1110308265Sgjbdifftime.o:	private.h
1111308265Sgjblocaltime.o:	private.h tzfile.h
1112308265Sgjbstrftime.o:	private.h tzfile.h
1113308265Sgjbzdump.o:	version.h
1114308265Sgjbzic.o:		private.h tzfile.h version.h
1115308265Sgjb
1116308265Sgjb.PHONY: ALL INSTALL all
1117339630Sphilip.PHONY: check check_time_t_alternatives
1118342668Sphilip.PHONY: check_web check_zishrink
1119331662Sphilip.PHONY: clean clean_misc dummy.zd force_tzs
1120308265Sgjb.PHONY: install install_data maintainer-clean names
1121339630Sphilip.PHONY: posix_only posix_packrat posix_right public
1122339630Sphilip.PHONY: rearguard_signatures rearguard_signatures_version
1123339630Sphilip.PHONY: rearguard_tarballs rearguard_tarballs_version
1124339630Sphilip.PHONY: right_only right_posix signatures signatures_version
1125331662Sphilip.PHONY: tarballs tarballs_version
1126331662Sphilip.PHONY: traditional_signatures traditional_signatures_version
1127331662Sphilip.PHONY: traditional_tarballs traditional_tarballs_version
1128331662Sphilip.PHONY: typecheck
1129308265Sgjb.PHONY: zonenames zones
1130331662Sphilip.PHONY: $(ZDS)
1131