xref: /freebsd/contrib/tzcode/Makefile (revision a979394afeb5c20fc58c5f5b005d51eb8f92f666)
1bc421551SDag-Erling Smørgrav# Make and install tzdb code and data.
2bc421551SDag-Erling Smørgrav# This file is in the public domain, so clarified as of
3bc421551SDag-Erling Smørgrav# 2009-05-17 by Arthur David Olson.
446c59934SDag-Erling Smørgrav# Request POSIX conformance; this must be the first non-comment line.
546c59934SDag-Erling Smørgrav.POSIX:
6*a979394aSDag-Erling Smørgrav# On older platforms you may need to scrounge for POSIX conformance.
7*a979394aSDag-Erling Smørgrav# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007),
8*a979394aSDag-Erling Smørgrav# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'.
946c59934SDag-Erling Smørgrav
1046c59934SDag-Erling Smørgrav# To affect how this Makefile works, you can run a shell script like this:
1146c59934SDag-Erling Smørgrav#
1246c59934SDag-Erling Smørgrav#	#!/bin/sh
13*a979394aSDag-Erling Smørgrav#	make CC='gcc -std=gnu23' "$@"
1446c59934SDag-Erling Smørgrav#
15*a979394aSDag-Erling Smørgrav# This example script is appropriate for a circa 2024 GNU/Linux system
16*a979394aSDag-Erling Smørgrav# where a non-default setting enables this package's optional use of C23.
1746c59934SDag-Erling Smørgrav#
1846c59934SDag-Erling Smørgrav# Alternatively, you can simply edit this Makefile to tailor the following
1946c59934SDag-Erling Smørgrav# macro definitions.
2046c59934SDag-Erling Smørgrav
2146c59934SDag-Erling Smørgrav###############################################################################
2246c59934SDag-Erling Smørgrav# Start of macros that one plausibly might want to tailor.
23bc421551SDag-Erling Smørgrav
24bc421551SDag-Erling Smørgrav# Package name for the code distribution.
25bc421551SDag-Erling SmørgravPACKAGE=	tzcode
26bc421551SDag-Erling Smørgrav
27bc421551SDag-Erling Smørgrav# Version number for the distribution, overridden in the 'tarballs' rule below.
28bc421551SDag-Erling SmørgravVERSION=	unknown
29bc421551SDag-Erling Smørgrav
30bc421551SDag-Erling Smørgrav# Email address for bug reports.
31bc421551SDag-Erling SmørgravBUGEMAIL=	tz@iana.org
32bc421551SDag-Erling Smørgrav
33bc421551SDag-Erling Smørgrav# DATAFORM selects the data format.
34bc421551SDag-Erling Smørgrav# Available formats represent essentially the same data, albeit
35bc421551SDag-Erling Smørgrav# possibly with minor discrepancies that users are not likely to notice.
36bc421551SDag-Erling Smørgrav# To get new features and the best data right away, use:
37bc421551SDag-Erling Smørgrav#	DATAFORM=	vanguard
38bc421551SDag-Erling Smørgrav# To wait a while before using new features, to give downstream users
39bc421551SDag-Erling Smørgrav# time to upgrade zic (the default), use:
40bc421551SDag-Erling Smørgrav#	DATAFORM=	main
41bc421551SDag-Erling Smørgrav# To wait even longer for new features, use:
42bc421551SDag-Erling Smørgrav#	DATAFORM=	rearguard
43bc421551SDag-Erling Smørgrav# Rearguard users might also want "ZFLAGS = -b fat"; see below.
44bc421551SDag-Erling SmørgravDATAFORM=		main
45bc421551SDag-Erling Smørgrav
46bc421551SDag-Erling Smørgrav# Change the line below for your timezone (after finding the one you want in
47bc421551SDag-Erling Smørgrav# one of the $(TDATA) source files, or adding it to a source file).
48bc421551SDag-Erling Smørgrav# Alternatively, if you discover you've got the wrong timezone, you can just
49bc421551SDag-Erling Smørgrav# 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
50bc421551SDag-Erling Smørgrav# Use the command
51bc421551SDag-Erling Smørgrav#	make zonenames
52bc421551SDag-Erling Smørgrav# to get a list of the values you can use for LOCALTIME.
53bc421551SDag-Erling Smørgrav
54bc421551SDag-Erling SmørgravLOCALTIME=	Factory
55bc421551SDag-Erling Smørgrav
56*a979394aSDag-Erling Smørgrav# The POSIXRULES macro controls interpretation of POSIX-like TZ
5775411d15SDag-Erling Smørgrav# settings like TZ='EET-2EEST' that lack DST transition rules.
58bc421551SDag-Erling Smørgrav# If POSIXRULES is '-', no template is installed; this is the default.
59bc421551SDag-Erling Smørgrav# Any other value for POSIXRULES is obsolete and should not be relied on, as:
60bc421551SDag-Erling Smørgrav# * It does not work correctly in popular implementations such as GNU/Linux.
61bc421551SDag-Erling Smørgrav# * It does not work even in tzcode, except for historical timestamps
62bc421551SDag-Erling Smørgrav#   that precede the last explicit transition in the POSIXRULES file.
63bc421551SDag-Erling Smørgrav#   Hence it typically does not work for current and future timestamps.
64bc421551SDag-Erling Smørgrav# If, despite the above, you want a template for handling these settings,
65bc421551SDag-Erling Smørgrav# you can change the line below (after finding the timezone you want in the
66bc421551SDag-Erling Smørgrav# one of the $(TDATA) source files, or adding it to a source file).
67bc421551SDag-Erling Smørgrav# Alternatively, if you discover you've got the wrong timezone, you can just
68bc421551SDag-Erling Smørgrav# 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
69bc421551SDag-Erling Smørgrav# Use the command
70bc421551SDag-Erling Smørgrav#	make zonenames
71bc421551SDag-Erling Smørgrav# to get a list of the values you can use for POSIXRULES.
72bc421551SDag-Erling Smørgrav
73bc421551SDag-Erling SmørgravPOSIXRULES=	-
74bc421551SDag-Erling Smørgrav
75bc421551SDag-Erling Smørgrav# Also see TZDEFRULESTRING below, which takes effect only
7675411d15SDag-Erling Smørgrav# if POSIXRULES is '-' or if the template file cannot be accessed.
77bc421551SDag-Erling Smørgrav
78bc421551SDag-Erling Smørgrav
79bc421551SDag-Erling Smørgrav# Installation locations.
80bc421551SDag-Erling Smørgrav#
81bc421551SDag-Erling Smørgrav# The defaults are suitable for Debian, except that if REDO is
82bc421551SDag-Erling Smørgrav# posix_right or right_posix then files that Debian puts under
83bc421551SDag-Erling Smørgrav# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
84bc421551SDag-Erling Smørgrav# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
85bc421551SDag-Erling Smørgrav# respectively.  Problems with the Debian approach are discussed in
86bc421551SDag-Erling Smørgrav# the commentary for the right_posix rule (below).
87bc421551SDag-Erling Smørgrav
88bc421551SDag-Erling Smørgrav# Destination directory, which can be used for staging.
89bc421551SDag-Erling Smørgrav# 'make DESTDIR=/stage install' installs under /stage (e.g., to
90bc421551SDag-Erling Smørgrav# /stage/etc/localtime instead of to /etc/localtime).  Files under
91bc421551SDag-Erling Smørgrav# /stage are not intended to work as-is, but can be copied by hand to
92bc421551SDag-Erling Smørgrav# the root directory later.  If DESTDIR is empty, 'make install' does
93bc421551SDag-Erling Smørgrav# not stage, but installs directly into production locations.
94bc421551SDag-Erling SmørgravDESTDIR =
95bc421551SDag-Erling Smørgrav
96bc421551SDag-Erling Smørgrav# Everything is installed into subdirectories of TOPDIR, and used there.
97bc421551SDag-Erling Smørgrav# TOPDIR should be empty (meaning the root directory),
98bc421551SDag-Erling Smørgrav# or a directory name that does not end in "/".
99bc421551SDag-Erling Smørgrav# TOPDIR should be empty or an absolute name unless you're just testing.
100bc421551SDag-Erling SmørgravTOPDIR =
101bc421551SDag-Erling Smørgrav
102bc421551SDag-Erling Smørgrav# The default local timezone is taken from the file TZDEFAULT.
103bc421551SDag-Erling SmørgravTZDEFAULT = $(TOPDIR)/etc/localtime
104bc421551SDag-Erling Smørgrav
105bc421551SDag-Erling Smørgrav# The subdirectory containing installed program and data files, and
106bc421551SDag-Erling Smørgrav# likewise for installed files that can be shared among architectures.
107bc421551SDag-Erling Smørgrav# These should be relative file names.
108bc421551SDag-Erling SmørgravUSRDIR = usr
109bc421551SDag-Erling SmørgravUSRSHAREDIR = $(USRDIR)/share
110bc421551SDag-Erling Smørgrav
111bc421551SDag-Erling Smørgrav# "Compiled" timezone information is placed in the "TZDIR" directory
112bc421551SDag-Erling Smørgrav# (and subdirectories).
113bc421551SDag-Erling Smørgrav# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
114bc421551SDag-Erling SmørgravTZDIR_BASENAME=	zoneinfo
115bc421551SDag-Erling SmørgravTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
116bc421551SDag-Erling Smørgrav
117bc421551SDag-Erling Smørgrav# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
118bc421551SDag-Erling SmørgravBINDIR = $(TOPDIR)/$(USRDIR)/bin
119bc421551SDag-Erling Smørgrav
120bc421551SDag-Erling Smørgrav# The "zdump" command goes in:
121bc421551SDag-Erling SmørgravZDUMPDIR = $(BINDIR)
122bc421551SDag-Erling Smørgrav
123bc421551SDag-Erling Smørgrav# The "zic" command goes in:
124bc421551SDag-Erling SmørgravZICDIR = $(TOPDIR)/$(USRDIR)/sbin
125bc421551SDag-Erling Smørgrav
126bc421551SDag-Erling Smørgrav# Manual pages go in subdirectories of. . .
127bc421551SDag-Erling SmørgravMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
128bc421551SDag-Erling Smørgrav
129bc421551SDag-Erling Smørgrav# Library functions are put in an archive in LIBDIR.
130bc421551SDag-Erling SmørgravLIBDIR = $(TOPDIR)/$(USRDIR)/lib
131bc421551SDag-Erling Smørgrav
132bc421551SDag-Erling Smørgrav
133bc421551SDag-Erling Smørgrav# Types to try, as an alternative to time_t.
134bc421551SDag-Erling SmørgravTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
135*a979394aSDag-Erling SmørgravTIME_T_ALTERNATIVES_HEAD = int_least64_t.ck
136*a979394aSDag-Erling SmørgravTIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \
137*a979394aSDag-Erling Smørgrav  uint_least64_t.ck
138bc421551SDag-Erling Smørgrav
139bc421551SDag-Erling Smørgrav# What kind of TZif data files to generate.  (TZif is the binary time
140bc421551SDag-Erling Smørgrav# zone data format that zic generates; see Internet RFC 8536.)
141bc421551SDag-Erling Smørgrav# If you want only POSIX time, with time values interpreted as
142bc421551SDag-Erling Smørgrav# seconds since the epoch (not counting leap seconds), use
143bc421551SDag-Erling Smørgrav#	REDO=		posix_only
144bc421551SDag-Erling Smørgrav# below.  If you want only "right" time, with values interpreted
145bc421551SDag-Erling Smørgrav# as seconds since the epoch (counting leap seconds), use
146bc421551SDag-Erling Smørgrav#	REDO=		right_only
147bc421551SDag-Erling Smørgrav# below.  If you want both sets of data available, with leap seconds not
148bc421551SDag-Erling Smørgrav# counted normally, use
149bc421551SDag-Erling Smørgrav#	REDO=		posix_right
150bc421551SDag-Erling Smørgrav# below.  If you want both sets of data available, with leap seconds counted
151bc421551SDag-Erling Smørgrav# normally, use
152bc421551SDag-Erling Smørgrav#	REDO=		right_posix
153bc421551SDag-Erling Smørgrav# below.  POSIX mandates that leap seconds not be counted; for compatibility
154bc421551SDag-Erling Smørgrav# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
155bc421551SDag-Erling Smørgrav# leap smearing; this can work better than unsmeared "right" time with
156bc421551SDag-Erling Smørgrav# applications that are not leap second aware, and is closer to unsmeared
157bc421551SDag-Erling Smørgrav# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
158bc421551SDag-Erling Smørgrav
159bc421551SDag-Erling SmørgravREDO=		posix_right
160bc421551SDag-Erling Smørgrav
161bc421551SDag-Erling Smørgrav# Whether to put an "Expires" line in the leapseconds file.
162bc421551SDag-Erling Smørgrav# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
163bc421551SDag-Erling Smørgrav# The EXPIRES_LINE value matters only if REDO's value contains "right".
164bc421551SDag-Erling Smørgrav# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
165bc421551SDag-Erling Smørgrav# zic's support for the Expires line was introduced in tzdb 2020a,
166bc421551SDag-Erling Smørgrav# and was modified in tzdb 2021b to generate version 4 TZif files.
167bc421551SDag-Erling Smørgrav# EXPIRES_LINE defaults to 0 for now so that the leapseconds file
168bc421551SDag-Erling Smørgrav# can be given to pre-2020a zic implementations and so that TZif files
169bc421551SDag-Erling Smørgrav# built by newer zic implementations can be read by pre-2021b libraries.
170bc421551SDag-Erling SmørgravEXPIRES_LINE=	0
171bc421551SDag-Erling Smørgrav
172bc421551SDag-Erling Smørgrav# To install data in text form that has all the information of the TZif data,
173bc421551SDag-Erling Smørgrav# (optionally incorporating leap second information), use
174bc421551SDag-Erling Smørgrav#	TZDATA_TEXT=	tzdata.zi leapseconds
175bc421551SDag-Erling Smørgrav# To install text data without leap second information (e.g., because
176bc421551SDag-Erling Smørgrav# REDO='posix_only'), use
177bc421551SDag-Erling Smørgrav#	TZDATA_TEXT=	tzdata.zi
178bc421551SDag-Erling Smørgrav# To avoid installing text data, use
179bc421551SDag-Erling Smørgrav#	TZDATA_TEXT=
180bc421551SDag-Erling Smørgrav
181bc421551SDag-Erling SmørgravTZDATA_TEXT=	leapseconds tzdata.zi
182bc421551SDag-Erling Smørgrav
183bc421551SDag-Erling Smørgrav# For backward-compatibility links for old zone names, use
184bc421551SDag-Erling Smørgrav#	BACKWARD=	backward
185bc421551SDag-Erling Smørgrav# To omit these links, use
186bc421551SDag-Erling Smørgrav#	BACKWARD=
187bc421551SDag-Erling Smørgrav
188bc421551SDag-Erling SmørgravBACKWARD=	backward
189bc421551SDag-Erling Smørgrav
190bc421551SDag-Erling Smørgrav# If you want out-of-scope and often-wrong data from the file 'backzone',
191bc421551SDag-Erling Smørgrav# but only for entries listed in the backward-compatibility file zone.tab, use
192bc421551SDag-Erling Smørgrav#	PACKRATDATA=	backzone
193bc421551SDag-Erling Smørgrav#	PACKRATLIST=	zone.tab
194bc421551SDag-Erling Smørgrav# If you want all the 'backzone' data, use
195bc421551SDag-Erling Smørgrav#	PACKRATDATA=	backzone
196bc421551SDag-Erling Smørgrav#	PACKRATLIST=
197bc421551SDag-Erling Smørgrav# To omit this data, use
198bc421551SDag-Erling Smørgrav#	PACKRATDATA=
199bc421551SDag-Erling Smørgrav#	PACKRATLIST=
200bc421551SDag-Erling Smørgrav
201bc421551SDag-Erling SmørgravPACKRATDATA=
202bc421551SDag-Erling SmørgravPACKRATLIST=
203bc421551SDag-Erling Smørgrav
204bc421551SDag-Erling Smørgrav# The name of a locale using the UTF-8 encoding, used during self-tests.
205bc421551SDag-Erling Smørgrav# The tests are skipped if the name does not appear to work on this system.
206bc421551SDag-Erling Smørgrav
207bc421551SDag-Erling SmørgravUTF8_LOCALE=	en_US.utf8
208bc421551SDag-Erling Smørgrav
209bc421551SDag-Erling Smørgrav# Non-default libraries needed to link.
210bc421551SDag-Erling Smørgrav# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
211bc421551SDag-Erling SmørgravLDLIBS=
212bc421551SDag-Erling Smørgrav
21346c59934SDag-Erling Smørgrav# Add the following to an uncommented "CFLAGS=" line as needed
21446c59934SDag-Erling Smørgrav# to override defaults specified in the source code or by the system.
21546c59934SDag-Erling Smørgrav# "-DFOO" is equivalent to "-DFOO=1".
216bc421551SDag-Erling Smørgrav#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
217bc421551SDag-Erling Smørgrav#	formats that generate only the last two digits of year numbers
218bc421551SDag-Erling Smørgrav#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
219bc421551SDag-Erling Smørgrav#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
220bc421551SDag-Erling Smørgrav#	than what POSIX specifies, assuming local time is UT.
221bc421551SDag-Erling Smørgrav#	For example, N is 252460800 on AmigaOS.
222bc421551SDag-Erling Smørgrav#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
223*a979394aSDag-Erling Smørgrav#	on POSIX platforms predating POSIX.1-2024
224bc421551SDag-Erling Smørgrav#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
225bc421551SDag-Erling Smørgrav#  -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
226bc421551SDag-Erling Smørgrav#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
22775411d15SDag-Erling Smørgrav#  -DHAVE__GENERIC=0 if _Generic does not work*
228bc421551SDag-Erling Smørgrav#  -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
229bc421551SDag-Erling Smørgrav#	-DHAVE_GETRANDOM=0 to avoid using getrandom
230bc421551SDag-Erling Smørgrav#  -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
231bc421551SDag-Erling Smørgrav#	where LDLIBS also needs to contain -lintl on some hosts;
232bc421551SDag-Erling Smørgrav#	-DHAVE_GETTEXT=0 to avoid using gettext
233bc421551SDag-Erling Smørgrav#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
234*a979394aSDag-Erling Smørgrav#	ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier
235bc421551SDag-Erling Smørgrav#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
23675411d15SDag-Erling Smørgrav#  -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
237bc421551SDag-Erling Smørgrav#  -DHAVE_LINK=0 if your system lacks a link function
238bc421551SDag-Erling Smørgrav#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
239bc421551SDag-Erling Smørgrav#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
240bc421551SDag-Erling Smørgrav#	localtime_rz can make zdump significantly faster, but is nonstandard.
241bc421551SDag-Erling Smørgrav#  -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
242bc421551SDag-Erling Smørgrav#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
243bc421551SDag-Erling Smørgrav#	functions like 'link' or variables like 'tzname' required by POSIX
244bc421551SDag-Erling Smørgrav#  -DHAVE_SETENV=0 if your system lacks the setenv function
24575411d15SDag-Erling Smørgrav#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+
246bc421551SDag-Erling Smørgrav#  -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like
247bc421551SDag-Erling Smørgrav#	__builtin_add_overflow work*
24875411d15SDag-Erling Smørgrav#  -DHAVE_STDINT_H=0 if <stdint.h> does not work*+
249bc421551SDag-Erling Smørgrav#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
250bc421551SDag-Erling Smørgrav#  -DHAVE_STRDUP=0 if your system lacks the strdup function
25175411d15SDag-Erling Smørgrav#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function+
252bc421551SDag-Erling Smørgrav#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
253bc421551SDag-Erling Smørgrav#  -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
254bc421551SDag-Erling Smørgrav#  -DHAVE_TZSET=0 if your system lacks a tzset function
255bc421551SDag-Erling Smørgrav#  -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
256bc421551SDag-Erling Smørgrav#  -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
257bc421551SDag-Erling Smørgrav#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
25846c59934SDag-Erling Smørgrav#  -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
25946c59934SDag-Erling Smørgrav#	Typically it is better to use a later standard.  For example,
26046c59934SDag-Erling Smørgrav#	with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
26146c59934SDag-Erling Smørgrav#	Even with -DPORT_TO_C89, the code needs at least one C99
26246c59934SDag-Erling Smørgrav#	feature (integers at least 64 bits wide) and maybe more.
263bc421551SDag-Erling Smørgrav#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
264bc421551SDag-Erling Smørgrav#	with external linkage, e.g., applications cannot define 'localtime'.
265bc421551SDag-Erling Smørgrav#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
266*a979394aSDag-Erling Smørgrav#  -DSUPPORT_C89=0 if the tzcode library should not support C89 callers
267*a979394aSDag-Erling Smørgrav#	Although -DSUPPORT_C89=0 might work around latent bugs in callers,
268*a979394aSDag-Erling Smørgrav#	it does not conform to POSIX.
269*a979394aSDag-Erling Smørgrav#  -DSUPPORT_POSIX2008 if the library should support older POSIX callers+
270*a979394aSDag-Erling Smørgrav#	However, this might cause problems in POSIX.1-2024-or-later callers.
271bc421551SDag-Erling Smørgrav#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
272bc421551SDag-Erling Smørgrav#	security implications and is not recommended for general use
273bc421551SDag-Erling Smørgrav#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
274bc421551SDag-Erling Smørgrav#	not needed by the main-program tz code, which is single-threaded.
275bc421551SDag-Erling Smørgrav#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
276bc421551SDag-Erling Smørgrav#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
277bc421551SDag-Erling Smørgrav#	This is intended for internal use only; it mangles external names.
278bc421551SDag-Erling Smørgrav#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
279bc421551SDag-Erling Smørgrav#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
280bc421551SDag-Erling Smørgrav#	the default is system-supplied, typically "/usr/lib/locale"
281bc421551SDag-Erling Smørgrav#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
282*a979394aSDag-Erling Smørgrav#	DST transitions for proleptic format TZ strings lacking them,
28375411d15SDag-Erling Smørgrav#	in the usual case where POSIXRULES is '-'.  If not specified,
28475411d15SDag-Erling Smørgrav#	TZDEFRULESTRING defaults to US rules for future DST transitions.
28575411d15SDag-Erling Smørgrav#	This mishandles some past timestamps, as US DST rules have changed.
28675411d15SDag-Erling Smørgrav#	It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
28775411d15SDag-Erling Smørgrav#	as Europe and US DST rules differ.
28875411d15SDag-Erling Smørgrav#  -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
289bc421551SDag-Erling Smørgrav#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
290bc421551SDag-Erling Smørgrav#	other than simply getting garbage data
291bc421551SDag-Erling Smørgrav#  -DUSE_LTZ=0 to build zdump with the system time zone library
292bc421551SDag-Erling Smørgrav#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
293bc421551SDag-Erling Smørgrav#  -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
294bc421551SDag-Erling Smørgrav#	similarly for "slim".  Fat TZif files work around incompatibilities
295bc421551SDag-Erling Smørgrav#	and bugs in some TZif readers, notably older ones that
296bc421551SDag-Erling Smørgrav#	ignore or otherwise mishandle 64-bit data in TZif files;
297bc421551SDag-Erling Smørgrav#	however, fat TZif files may trigger bugs in newer TZif readers.
298bc421551SDag-Erling Smørgrav#	Slim TZif files are more efficient, and are the default.
299bc421551SDag-Erling Smørgrav#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
300bc421551SDag-Erling Smørgrav#	(or some other number) to set the maximum time zone abbreviation length
301bc421551SDag-Erling Smørgrav#	that zic will accept without a warning (the default is 6)
30246c59934SDag-Erling Smørgrav#  -g to generate symbolic debugging info
30346c59934SDag-Erling Smørgrav#  -Idir to include from directory 'dir'
30446c59934SDag-Erling Smørgrav#  -O0 to disable optimization; other -O options to enable more optimization
30546c59934SDag-Erling Smørgrav#  -Uname to remove any definition of the macro 'name'
306bc421551SDag-Erling Smørgrav#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
307bc421551SDag-Erling Smørgrav#
308bc421551SDag-Erling Smørgrav# * Options marked "*" can be omitted if your compiler is C23 compatible.
30975411d15SDag-Erling Smørgrav# * Options marked "+" are obsolescent and are planned to be removed
310*a979394aSDag-Erling Smørgrav#   once the code assumes C99 or later (say in the year 2029)
311*a979394aSDag-Erling Smørgrav#   and POSIX.1-2024 or later (say in the year 2034).
312bc421551SDag-Erling Smørgrav#
313bc421551SDag-Erling Smørgrav# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
314bc421551SDag-Erling SmørgravGCC_INSTRUMENT = \
315bc421551SDag-Erling Smørgrav  -fsanitize=undefined -fsanitize-address-use-after-scope \
316bc421551SDag-Erling Smørgrav  -fsanitize-undefined-trap-on-error -fstack-protector
317bc421551SDag-Erling Smørgrav# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
318*a979394aSDag-Erling SmørgravGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \
319bc421551SDag-Erling Smørgrav  $(GCC_INSTRUMENT) \
320bc421551SDag-Erling Smørgrav  -Wall -Wextra \
321bc421551SDag-Erling Smørgrav  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
322bc421551SDag-Erling Smørgrav  -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
323bc421551SDag-Erling Smørgrav  -Wdeclaration-after-statement -Wdouble-promotion \
324*a979394aSDag-Erling Smørgrav  -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \
325bc421551SDag-Erling Smørgrav  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
326bc421551SDag-Erling Smørgrav  -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
327*a979394aSDag-Erling Smørgrav  -Wmissing-declarations -Wmissing-prototypes \
328*a979394aSDag-Erling Smørgrav  -Wmissing-variable-declarations -Wnested-externs \
329bc421551SDag-Erling Smørgrav  -Wnull-dereference \
330bc421551SDag-Erling Smørgrav  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
331bc421551SDag-Erling Smørgrav  -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
332bc421551SDag-Erling Smørgrav  -Wstrict-prototypes -Wstringop-overflow=4 \
333bc421551SDag-Erling Smørgrav  -Wstringop-truncation -Wsuggest-attribute=cold \
334bc421551SDag-Erling Smørgrav  -Wsuggest-attribute=const -Wsuggest-attribute=format \
335bc421551SDag-Erling Smørgrav  -Wsuggest-attribute=malloc \
336bc421551SDag-Erling Smørgrav  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
337*a979394aSDag-Erling Smørgrav  -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \
338bc421551SDag-Erling Smørgrav  -Wvariadic-macros -Wvla -Wwrite-strings \
339*a979394aSDag-Erling Smørgrav  -Wno-format-nonliteral -Wno-sign-compare
340bc421551SDag-Erling Smørgrav#
341bc421551SDag-Erling Smørgrav# If your system has a "GMT offset" field in its "struct tm"s
342bc421551SDag-Erling Smørgrav# (or if you decide to add such a field in your system's "time.h" file),
343bc421551SDag-Erling Smørgrav# add the name to a define such as
344bc421551SDag-Erling Smørgrav#	-DTM_GMTOFF=tm_gmtoff
345bc421551SDag-Erling Smørgrav# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
346bc421551SDag-Erling Smørgrav# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
347bc421551SDag-Erling Smørgrav# Similarly, if your system has a "zone abbreviation" field, define
348bc421551SDag-Erling Smørgrav#	-DTM_ZONE=tm_zone
34946c59934SDag-Erling Smørgrav# and define NO_TM_ZONE to suppress any guessing.
350*a979394aSDag-Erling Smørgrav# Although POSIX.1-2024 requires these fields and they are widely available
351*a979394aSDag-Erling Smørgrav# on GNU/Linux and BSD systems, some older systems lack them.
352bc421551SDag-Erling Smørgrav#
353bc421551SDag-Erling Smørgrav# The next batch of options control support for external variables
354bc421551SDag-Erling Smørgrav# exported by tzcode.  In practice these variables are less useful
355bc421551SDag-Erling Smørgrav# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
356bc421551SDag-Erling Smørgrav# #
357bc421551SDag-Erling Smørgrav# # To omit or support the external variable "tzname", add one of:
358bc421551SDag-Erling Smørgrav# #	-DHAVE_TZNAME=0 # do not support "tzname"
359bc421551SDag-Erling Smørgrav# #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
360bc421551SDag-Erling Smørgrav# #	-DHAVE_TZNAME=2 # support and define "tzname"
361*a979394aSDag-Erling Smørgrav# # to the "CFLAGS=" line.  Although "tzname" is required by POSIX.1-1988
362*a979394aSDag-Erling Smørgrav# # and later, its contents are unspecified if you use a geographical TZ
363*a979394aSDag-Erling Smørgrav# # and the variable is planned to be removed in a future POSIX edition.
364bc421551SDag-Erling Smørgrav# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
365bc421551SDag-Erling Smørgrav# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
366bc421551SDag-Erling Smørgrav# # crashes when combined with some platforms' standard libraries,
367bc421551SDag-Erling Smørgrav# # presumably due to memory allocation issues.
368bc421551SDag-Erling Smørgrav# #
369bc421551SDag-Erling Smørgrav# # To omit or support the external variables "timezone" and "daylight", add
370bc421551SDag-Erling Smørgrav# #	-DUSG_COMPAT=0 # do not support
371bc421551SDag-Erling Smørgrav# #	-DUSG_COMPAT=1 # support, and variables are defined by system library
372bc421551SDag-Erling Smørgrav# #	-DUSG_COMPAT=2 # support and define variables
37346c59934SDag-Erling Smørgrav# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix
374*a979394aSDag-Erling Smørgrav# # Systems Group code and are required by POSIX.1-2008 and later (with XSI),
375*a979394aSDag-Erling Smørgrav# # although their contents are unspecified if you use a geographical TZ
376*a979394aSDag-Erling Smørgrav# # and the variables are planned to be removed in a future edition of POSIX.
377bc421551SDag-Erling Smørgrav# # If not defined, the code attempts to guess USG_COMPAT from other macros.
378bc421551SDag-Erling Smørgrav# #
379bc421551SDag-Erling Smørgrav# # To support the external variable "altzone", add
380bc421551SDag-Erling Smørgrav# #	-DALTZONE=0 # do not support
381bc421551SDag-Erling Smørgrav# #	-DALTZONE=1 # support "altzone", which is defined by system library
382bc421551SDag-Erling Smørgrav# #	-DALTZONE=2 # support and define "altzone"
383bc421551SDag-Erling Smørgrav# # to the end of the "CFLAGS=" line; although "altzone" appeared in
384bc421551SDag-Erling Smørgrav# # System V Release 3.1 it has not been standardized.
385bc421551SDag-Erling Smørgrav# # If not defined, the code attempts to guess ALTZONE from other macros.
386bc421551SDag-Erling Smørgrav#
387bc421551SDag-Erling Smørgrav# If you want functions that were inspired by early versions of X3J11's work,
388bc421551SDag-Erling Smørgrav# add
389bc421551SDag-Erling Smørgrav#	-DSTD_INSPIRED
390bc421551SDag-Erling Smørgrav# to the end of the "CFLAGS=" line.  This arranges for the following
391bc421551SDag-Erling Smørgrav# functions to be added to the time conversion library.
392bc421551SDag-Erling Smørgrav# "offtime" is like "gmtime" except that it accepts a second (long) argument
393bc421551SDag-Erling Smørgrav# that gives an offset to add to the time_t when converting it.
39446c59934SDag-Erling Smørgrav# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone.
39546c59934SDag-Erling Smørgrav# "timelocal" is nearly equivalent to "mktime".
396bc421551SDag-Erling Smørgrav# "timeoff" is like "timegm" except that it accepts a second (long) argument
397bc421551SDag-Erling Smørgrav# that gives an offset to use when converting to a time_t.
39846c59934SDag-Erling Smørgrav# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone.
399bc421551SDag-Erling Smørgrav# "posix2time" and "time2posix" are described in an included manual page.
400bc421551SDag-Erling Smørgrav# X3J11's work does not describe any of these functions.
401bc421551SDag-Erling Smørgrav# These functions may well disappear in future releases of the time
402bc421551SDag-Erling Smørgrav# conversion package.
403bc421551SDag-Erling Smørgrav#
404bc421551SDag-Erling Smørgrav# If you don't want functions that were inspired by NetBSD, add
405bc421551SDag-Erling Smørgrav#	-DNETBSD_INSPIRED=0
406bc421551SDag-Erling Smørgrav# to the end of the "CFLAGS=" line.  Otherwise, the functions
407bc421551SDag-Erling Smørgrav# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
40875411d15SDag-Erling Smørgrav# time library, and if STD_INSPIRED is also defined to nonzero the functions
409bc421551SDag-Erling Smørgrav# "posix2time_z" and "time2posix_z" are added as well.
410bc421551SDag-Erling Smørgrav# The functions ending in "_z" (or "_rz") are like their unsuffixed
411bc421551SDag-Erling Smørgrav# (or suffixed-by-"_r") counterparts, except with an extra first
412bc421551SDag-Erling Smørgrav# argument of opaque type timezone_t that specifies the timezone.
413bc421551SDag-Erling Smørgrav# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
414bc421551SDag-Erling Smørgrav#
415bc421551SDag-Erling Smørgrav# If you want to allocate state structures in localtime, add
416bc421551SDag-Erling Smørgrav#	-DALL_STATE
417bc421551SDag-Erling Smørgrav# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
418bc421551SDag-Erling Smørgrav#
419bc421551SDag-Erling Smørgrav# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
420bc421551SDag-Erling Smørgrav# out by the National Institute of Standards and Technology
42146c59934SDag-Erling Smørgrav# which claims to test C and POSIX conformance.  If you want to pass PCTS, add
422bc421551SDag-Erling Smørgrav#	-DPCTS
423bc421551SDag-Erling Smørgrav# to the end of the "CFLAGS=" line.
424bc421551SDag-Erling Smørgrav#
425bc421551SDag-Erling Smørgrav# If you want strict compliance with XPG4 as of 1994-04-09, add
426bc421551SDag-Erling Smørgrav#	-DXPG4_1994_04_09
427bc421551SDag-Erling Smørgrav# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
428bc421551SDag-Erling Smørgrav# 53 as a week number (rather than 52 or 53) for January days before
429bc421551SDag-Erling Smørgrav# January's first Monday when a "%V" format is used and January 1
430bc421551SDag-Erling Smørgrav# falls on a Friday, Saturday, or Sunday.
43146c59934SDag-Erling Smørgrav#
43246c59934SDag-Erling Smørgrav# POSIX says CFLAGS defaults to "-O 1".
43346c59934SDag-Erling Smørgrav# Uncomment the following line and edit its contents as needed.
434bc421551SDag-Erling Smørgrav
43546c59934SDag-Erling Smørgrav#CFLAGS= -O 1
436bc421551SDag-Erling Smørgrav
437bc421551SDag-Erling Smørgrav
43846c59934SDag-Erling Smørgrav# The name of a POSIX-like library archiver, its flags, C compiler,
43946c59934SDag-Erling Smørgrav# linker flags, and 'make' utility.  Ordinarily the defaults suffice.
440*a979394aSDag-Erling Smørgrav# The commented-out values are the defaults specified by POSIX.1-2024.
44146c59934SDag-Erling Smørgrav#AR = ar
44246c59934SDag-Erling Smørgrav#ARFLAGS = -rv
44346c59934SDag-Erling Smørgrav#CC = c17
44446c59934SDag-Erling Smørgrav#LDFLAGS =
44546c59934SDag-Erling Smørgrav#MAKE = make
446bc421551SDag-Erling Smørgrav
44746c59934SDag-Erling Smørgrav# Where to fetch leap-seconds.list from.
44846c59934SDag-Erling Smørgravleaplist_URI = \
44946c59934SDag-Erling Smørgrav  https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
45046c59934SDag-Erling Smørgrav# The file is generated by the IERS Earth Orientation Centre, in Paris.
45146c59934SDag-Erling Smørgravleaplist_TZ = Europe/Paris
45246c59934SDag-Erling Smørgrav
453bc421551SDag-Erling Smørgrav# The zic command and its arguments.
454bc421551SDag-Erling Smørgrav
455bc421551SDag-Erling Smørgravzic=		./zic
456bc421551SDag-Erling SmørgravZIC=		$(zic) $(ZFLAGS)
457bc421551SDag-Erling Smørgrav
458bc421551SDag-Erling Smørgrav# To shrink the size of installed TZif files,
459bc421551SDag-Erling Smørgrav# append "-r @N" to omit data before N-seconds-after-the-Epoch.
460bc421551SDag-Erling Smørgrav# To grow the files and work around bugs in older applications,
461bc421551SDag-Erling Smørgrav# possibly at the expense of introducing bugs in newer ones,
462bc421551SDag-Erling Smørgrav# append "-b fat"; see ZIC_BLOAT_DEFAULT above.
463bc421551SDag-Erling Smørgrav# See the zic man page for more about -b and -r.
464bc421551SDag-Erling SmørgravZFLAGS=
465bc421551SDag-Erling Smørgrav
466bc421551SDag-Erling Smørgrav# How to use zic to install TZif files.
467bc421551SDag-Erling Smørgrav
468*a979394aSDag-Erling SmørgravZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)'
469bc421551SDag-Erling Smørgrav
47046c59934SDag-Erling Smørgrav# The name of a POSIX-compliant 'awk' on your system.
471bc421551SDag-Erling Smørgrav# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
472bc421551SDag-Erling Smørgrav# Also, it is better (though not essential) if 'awk' supports UTF-8,
473bc421551SDag-Erling Smørgrav# and unfortunately mawk and busybox awk do not support UTF-8.
474bc421551SDag-Erling Smørgrav# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
475bc421551SDag-Erling SmørgravAWK=		awk
476bc421551SDag-Erling Smørgrav
47746c59934SDag-Erling Smørgrav# The full path name of a POSIX-compliant shell, preferably one that supports
478bc421551SDag-Erling Smørgrav# the Korn shell's 'select' statement as an extension.
479bc421551SDag-Erling Smørgrav# These days, Bash is the most popular.
480bc421551SDag-Erling Smørgrav# It should be OK to set this to /bin/sh, on platforms where /bin/sh
48146c59934SDag-Erling Smørgrav# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash
482bc421551SDag-Erling Smørgrav# is typically nicer if it works.
483bc421551SDag-Erling SmørgravKSHELL=		/bin/bash
484bc421551SDag-Erling Smørgrav
48546c59934SDag-Erling Smørgrav# Name of curl <https://curl.haxx.se/>, used for HTML validation
48646c59934SDag-Erling Smørgrav# and to fetch leap-seconds.list from upstream.
487*a979394aSDag-Erling Smørgrav# Set CURL=: to disable use of the Internet.
488bc421551SDag-Erling SmørgravCURL=		curl
489bc421551SDag-Erling Smørgrav
490bc421551SDag-Erling Smørgrav# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
491bc421551SDag-Erling SmørgravGPG=		gpg
492bc421551SDag-Erling Smørgrav
493bc421551SDag-Erling Smørgrav# This expensive test requires USE_LTZ.
494bc421551SDag-Erling Smørgrav# To suppress it, define this macro to be empty.
495bc421551SDag-Erling SmørgravCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
496bc421551SDag-Erling Smørgrav
497bc421551SDag-Erling Smørgrav# SAFE_CHAR is a regular expression that matches a safe character.
498bc421551SDag-Erling Smørgrav# Some parts of this distribution are limited to safe characters;
499bc421551SDag-Erling Smørgrav# others can use any UTF-8 character.
500bc421551SDag-Erling Smørgrav# For now, the safe characters are a safe subset of ASCII.
501bc421551SDag-Erling Smørgrav# The caller must set the shell variable 'sharp' to the character '#',
502bc421551SDag-Erling Smørgrav# since Makefile macros cannot contain '#'.
503bc421551SDag-Erling Smørgrav# TAB_CHAR is a single tab character, in single quotes.
504bc421551SDag-Erling SmørgravTAB_CHAR=	'	'
505bc421551SDag-Erling SmørgravSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
506bc421551SDag-Erling SmørgravSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
507bc421551SDag-Erling SmørgravSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
508bc421551SDag-Erling SmørgravSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
509bc421551SDag-Erling SmørgravSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
510bc421551SDag-Erling Smørgrav
51175411d15SDag-Erling Smørgrav# These non-alphabetic, non-ASCII printable characters are Latin-1,
51275411d15SDag-Erling Smørgrav# and so are likely displayable even in editors like XEmacs 21
51375411d15SDag-Erling Smørgrav# that have limited display capabilities.
51475411d15SDag-Erling SmørgravUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷
515bc421551SDag-Erling Smørgrav# Non-ASCII non-letters that OK_CHAR allows, as these characters are
516bc421551SDag-Erling Smørgrav# useful in commentary.
51775411d15SDag-Erling SmørgravUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)
518bc421551SDag-Erling Smørgrav
519bc421551SDag-Erling Smørgrav# Put this in a bracket expression to match spaces.
520bc421551SDag-Erling Smørgravs = [:space:]
521bc421551SDag-Erling Smørgrav
522bc421551SDag-Erling Smørgrav# OK_CHAR matches any character allowed in the distributed files.
523bc421551SDag-Erling Smørgrav# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
524bc421551SDag-Erling Smørgrav# multibyte letters are also allowed so that commentary can contain a
525bc421551SDag-Erling Smørgrav# few safe symbols and people's names and can quote non-English sources.
526bc421551SDag-Erling Smørgrav# Other non-letters are limited to ASCII renderings for the
527bc421551SDag-Erling Smørgrav# convenience of maintainers using XEmacs 21.5.34, which by default
528bc421551SDag-Erling Smørgrav# mishandles Unicode characters U+0100 and greater.
529bc421551SDag-Erling SmørgravOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
530bc421551SDag-Erling Smørgrav
531bc421551SDag-Erling Smørgrav# SAFE_LINE matches a line of safe characters.
532bc421551SDag-Erling Smørgrav# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
533bc421551SDag-Erling Smørgrav# this is so that comments can contain non-ASCII characters.
534bc421551SDag-Erling Smørgrav# OK_LINE matches a line of OK characters.
535bc421551SDag-Erling SmørgravSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
536bc421551SDag-Erling SmørgravSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
537bc421551SDag-Erling SmørgravOK_LINE=	'^'$(OK_CHAR)'*$$'
538bc421551SDag-Erling Smørgrav
539bc421551SDag-Erling Smørgrav# Flags to give 'tar' when making a distribution.
540bc421551SDag-Erling Smørgrav# Try to use flags appropriate for GNU tar.
541*a979394aSDag-Erling SmørgravGNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \
542bc421551SDag-Erling Smørgrav  --numeric-owner --owner=0 --group=0 \
543bc421551SDag-Erling Smørgrav  --mode=go+u,go-w --sort=name
544*a979394aSDag-Erling SmørgravSETUP_TAR= \
545*a979394aSDag-Erling Smørgrav  export LC_ALL=C && \
546*a979394aSDag-Erling Smørgrav  if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \
547*a979394aSDag-Erling Smørgrav    TAR='tar $(GNUTARFLAGS)'; \
548*a979394aSDag-Erling Smørgrav  else \
549*a979394aSDag-Erling Smørgrav    TAR=tar; \
550*a979394aSDag-Erling Smørgrav  fi
551bc421551SDag-Erling Smørgrav
552bc421551SDag-Erling Smørgrav# Flags to give 'gzip' when making a distribution.
553bc421551SDag-Erling SmørgravGZIPFLAGS=	-9n
554bc421551SDag-Erling Smørgrav
555bc421551SDag-Erling Smørgrav# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
556bc421551SDag-Erling Smørgrav# This makes it easier to see which Zone has been affected.
557*a979394aSDag-Erling SmørgravSETUP_DIFF_TZS = \
558*a979394aSDag-Erling Smørgrav  if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \
559*a979394aSDag-Erling Smørgrav    DIFF_TZS='diff -u -F^TZ='; \
560*a979394aSDag-Erling Smørgrav  else \
561*a979394aSDag-Erling Smørgrav    DIFF_TZS='diff -u'; \
562*a979394aSDag-Erling Smørgrav  fi
563bc421551SDag-Erling Smørgrav
564bc421551SDag-Erling Smørgrav# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
565bc421551SDag-Erling SmørgravRANLIB=		:
566bc421551SDag-Erling Smørgrav
56746c59934SDag-Erling Smørgrav# POSIX prohibits defining or using SHELL.  However, csh users on systems
56846c59934SDag-Erling Smørgrav# that use the user shell for Makefile commands may need to define SHELL.
56946c59934SDag-Erling Smørgrav#SHELL=		/bin/sh
57046c59934SDag-Erling Smørgrav
57146c59934SDag-Erling Smørgrav# End of macros that one plausibly might want to tailor.
57246c59934SDag-Erling Smørgrav###############################################################################
57346c59934SDag-Erling Smørgrav
57446c59934SDag-Erling Smørgrav
575bc421551SDag-Erling SmørgravTZCOBJS=	zic.o
576*a979394aSDag-Erling SmørgravTZDOBJS=	zdump.o localtime.o strftime.o
577*a979394aSDag-Erling SmørgravDATEOBJS=	date.o localtime.o strftime.o
578bc421551SDag-Erling SmørgravLIBSRCS=	localtime.c asctime.c difftime.c strftime.c
579bc421551SDag-Erling SmørgravLIBOBJS=	localtime.o asctime.o difftime.o strftime.o
580bc421551SDag-Erling SmørgravHEADERS=	tzfile.h private.h
581bc421551SDag-Erling SmørgravNONLIBSRCS=	zic.c zdump.c
582bc421551SDag-Erling SmørgravNEWUCBSRCS=	date.c
583bc421551SDag-Erling SmørgravSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
584bc421551SDag-Erling Smørgrav			tzselect.ksh workman.sh
585bc421551SDag-Erling SmørgravMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
586bc421551SDag-Erling Smørgrav			tzfile.5 tzselect.8 zic.8 zdump.8
587bc421551SDag-Erling SmørgravMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
588bc421551SDag-Erling Smørgrav			time2posix.3.txt \
589bc421551SDag-Erling Smørgrav			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
590bc421551SDag-Erling Smørgrav			date.1.txt
591bc421551SDag-Erling SmørgravCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
592bc421551SDag-Erling Smørgrav			NEWS README SECURITY theory.html version
593bc421551SDag-Erling SmørgravWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
594*a979394aSDag-Erling SmørgravCHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck
595bc421551SDag-Erling SmørgravDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
596bc421551SDag-Erling SmørgravPRIMARY_YDATA=	africa antarctica asia australasia \
597bc421551SDag-Erling Smørgrav		europe northamerica southamerica
598bc421551SDag-Erling SmørgravYDATA=		$(PRIMARY_YDATA) etcetera
599bc421551SDag-Erling SmørgravNDATA=		factory
600bc421551SDag-Erling SmørgravTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward
601bc421551SDag-Erling SmørgravTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
60246c59934SDag-Erling SmørgravZONETABLES=	zone.tab zone1970.tab zonenow.tab
603bc421551SDag-Erling SmørgravTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
604bc421551SDag-Erling SmørgravLEAP_DEPS=	leapseconds.awk leap-seconds.list
605bc421551SDag-Erling SmørgravTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) \
606bc421551SDag-Erling Smørgrav		  $(PACKRATDATA) $(PACKRATLIST)
607bc421551SDag-Erling SmørgravDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
608bc421551SDag-Erling SmørgravDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
609bc421551SDag-Erling Smørgrav			leapseconds $(ZONETABLES)
61046c59934SDag-Erling SmørgravAWK_SCRIPTS=	checklinks.awk checknow.awk checktab.awk leapseconds.awk \
611bc421551SDag-Erling Smørgrav			ziguard.awk zishrink.awk
612bc421551SDag-Erling SmørgravMISC=		$(AWK_SCRIPTS)
613bc421551SDag-Erling SmørgravTZS_YEAR=	2050
614bc421551SDag-Erling SmørgravTZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
615bc421551SDag-Erling SmørgravTZS=		to$(TZS_YEAR).tzs
616bc421551SDag-Erling SmørgravTZS_NEW=	to$(TZS_YEAR)new.tzs
617bc421551SDag-Erling SmørgravTZS_DEPS=	$(YDATA) asctime.c localtime.c \
618bc421551SDag-Erling Smørgrav			private.h tzfile.h zdump.c zic.c
619bc421551SDag-Erling SmørgravTZDATA_DIST = $(COMMON) $(DATA) $(MISC)
620bc421551SDag-Erling Smørgrav# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
621bc421551SDag-Erling SmørgravEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
622bc421551SDag-Erling SmørgravENCHILADA = $(EIGHT_YARDS) $(TZS)
623bc421551SDag-Erling Smørgrav
624bc421551SDag-Erling Smørgrav# Consult these files when deciding whether to rebuild the 'version' file.
625bc421551SDag-Erling Smørgrav# This list is not the same as the output of 'git ls-files', since
626bc421551SDag-Erling Smørgrav# .gitignore is not distributed.
627bc421551SDag-Erling SmørgravVERSION_DEPS= \
628bc421551SDag-Erling Smørgrav		calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
629bc421551SDag-Erling Smørgrav		africa antarctica asctime.c asia australasia \
630bc421551SDag-Erling Smørgrav		backward backzone \
63146c59934SDag-Erling Smørgrav		checklinks.awk checknow.awk checktab.awk \
632bc421551SDag-Erling Smørgrav		date.1 date.c difftime.c \
633bc421551SDag-Erling Smørgrav		etcetera europe factory iso3166.tab \
634bc421551SDag-Erling Smørgrav		leap-seconds.list leapseconds.awk localtime.c \
635bc421551SDag-Erling Smørgrav		newctime.3 newstrftime.3 newtzset.3 northamerica \
636bc421551SDag-Erling Smørgrav		private.h southamerica strftime.c theory.html \
637bc421551SDag-Erling Smørgrav		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
638bc421551SDag-Erling Smørgrav		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
639bc421551SDag-Erling Smørgrav		workman.sh zdump.8 zdump.c zic.8 zic.c \
640bc421551SDag-Erling Smørgrav		ziguard.awk zishrink.awk \
64146c59934SDag-Erling Smørgrav		zone.tab zone1970.tab zonenow.tab
642bc421551SDag-Erling Smørgrav
643bc421551SDag-Erling Smørgravall:		tzselect zic zdump libtz.a $(TABDATA) \
644bc421551SDag-Erling Smørgrav		  vanguard.zi main.zi rearguard.zi
645bc421551SDag-Erling Smørgrav
646bc421551SDag-Erling SmørgravALL:		all date $(ENCHILADA)
647bc421551SDag-Erling Smørgrav
648bc421551SDag-Erling Smørgravinstall:	all $(DATA) $(REDO) $(MANS)
649bc421551SDag-Erling Smørgrav		mkdir -p '$(DESTDIR)$(BINDIR)' \
650bc421551SDag-Erling Smørgrav			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
651bc421551SDag-Erling Smørgrav			'$(DESTDIR)$(LIBDIR)' \
652bc421551SDag-Erling Smørgrav			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
653bc421551SDag-Erling Smørgrav			'$(DESTDIR)$(MANDIR)/man8'
654bc421551SDag-Erling Smørgrav		$(ZIC_INSTALL) -l $(LOCALTIME) \
655*a979394aSDag-Erling Smørgrav			-p $(POSIXRULES) \
656bc421551SDag-Erling Smørgrav			-t '$(DESTDIR)$(TZDEFAULT)'
657bc421551SDag-Erling Smørgrav		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
658bc421551SDag-Erling Smørgrav		cp tzselect '$(DESTDIR)$(BINDIR)/.'
659bc421551SDag-Erling Smørgrav		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
660bc421551SDag-Erling Smørgrav		cp zic '$(DESTDIR)$(ZICDIR)/.'
661bc421551SDag-Erling Smørgrav		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
662bc421551SDag-Erling Smørgrav		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
663bc421551SDag-Erling Smørgrav		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
664bc421551SDag-Erling Smørgrav		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
665bc421551SDag-Erling Smørgrav		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
666bc421551SDag-Erling Smørgrav
667bc421551SDag-Erling SmørgravINSTALL:	ALL install date.1
668bc421551SDag-Erling Smørgrav		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
669bc421551SDag-Erling Smørgrav		cp date '$(DESTDIR)$(BINDIR)/.'
670bc421551SDag-Erling Smørgrav		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
671bc421551SDag-Erling Smørgrav
672bc421551SDag-Erling Smørgrav# Calculate version number from git, if available.
673bc421551SDag-Erling Smørgrav# Otherwise, use $(VERSION) unless it is "unknown" and there is already
674bc421551SDag-Erling Smørgrav# a 'version' file, in which case reuse the existing 'version' contents
675bc421551SDag-Erling Smørgrav# and append "-dirty" if the contents do not already end in "-dirty".
676bc421551SDag-Erling Smørgravversion:	$(VERSION_DEPS)
677bc421551SDag-Erling Smørgrav		{ (type git) >/dev/null 2>&1 && \
678*a979394aSDag-Erling Smørgrav		  V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
679*a979394aSDag-Erling Smørgrav				--abbrev=7 --dirty) || \
680*a979394aSDag-Erling Smørgrav		  if test '$(VERSION)' = unknown && read -r V <$@; then \
681*a979394aSDag-Erling Smørgrav		    V=$${V%-dirty}-dirty; \
682bc421551SDag-Erling Smørgrav		  else \
683bc421551SDag-Erling Smørgrav		    V='$(VERSION)'; \
684bc421551SDag-Erling Smørgrav		  fi; } && \
685bc421551SDag-Erling Smørgrav		printf '%s\n' "$$V" >$@.out
686bc421551SDag-Erling Smørgrav		mv $@.out $@
687bc421551SDag-Erling Smørgrav
688bc421551SDag-Erling Smørgrav# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
689bc421551SDag-Erling Smørgravvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
690bc421551SDag-Erling Smørgrav		$(AWK) \
691*a979394aSDag-Erling Smørgrav		  -v DATAFORM=$(@:.zi=) \
692bc421551SDag-Erling Smørgrav		  -v PACKRATDATA='$(PACKRATDATA)' \
693bc421551SDag-Erling Smørgrav		  -v PACKRATLIST='$(PACKRATLIST)' \
694bc421551SDag-Erling Smørgrav		  -f ziguard.awk \
695bc421551SDag-Erling Smørgrav		  $(TDATA) $(PACKRATDATA) >$@.out
696bc421551SDag-Erling Smørgrav		mv $@.out $@
697bc421551SDag-Erling Smørgrav# This file has a version comment that attempts to capture any tailoring
698bc421551SDag-Erling Smørgrav# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
699bc421551SDag-Erling Smørgravtzdata.zi:	$(DATAFORM).zi version zishrink.awk
700*a979394aSDag-Erling Smørgrav		read -r version <version && \
701bc421551SDag-Erling Smørgrav		  LC_ALL=C $(AWK) \
702bc421551SDag-Erling Smørgrav		    -v dataform='$(DATAFORM)' \
703bc421551SDag-Erling Smørgrav		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
704bc421551SDag-Erling Smørgrav		    -v redo='$(REDO)' \
705bc421551SDag-Erling Smørgrav		    -v version="$$version" \
706bc421551SDag-Erling Smørgrav		    -f zishrink.awk \
707bc421551SDag-Erling Smørgrav		    $(DATAFORM).zi >$@.out
708bc421551SDag-Erling Smørgrav		mv $@.out $@
709bc421551SDag-Erling Smørgrav
71046c59934SDag-Erling Smørgravtzdir.h:
71146c59934SDag-Erling Smørgrav		printf '%s\n' >$@.out \
71246c59934SDag-Erling Smørgrav		  '#ifndef TZDEFAULT' \
71346c59934SDag-Erling Smørgrav		  '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \
71446c59934SDag-Erling Smørgrav		  '#endif' \
71546c59934SDag-Erling Smørgrav		  '#ifndef TZDIR' \
71646c59934SDag-Erling Smørgrav		  '# define TZDIR "$(TZDIR)" /* TZif directory */' \
71746c59934SDag-Erling Smørgrav		  '#endif'
71846c59934SDag-Erling Smørgrav		mv $@.out $@
71946c59934SDag-Erling Smørgrav
720bc421551SDag-Erling Smørgravversion.h:	version
721*a979394aSDag-Erling Smørgrav		read -r VERSION <version && printf '%s\n' \
722bc421551SDag-Erling Smørgrav		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
723bc421551SDag-Erling Smørgrav		  "static char const TZVERSION[]=\"$$VERSION\";" \
724bc421551SDag-Erling Smørgrav		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
725bc421551SDag-Erling Smørgrav		  >$@.out
726bc421551SDag-Erling Smørgrav		mv $@.out $@
727bc421551SDag-Erling Smørgrav
728bc421551SDag-Erling Smørgravzdump:		$(TZDOBJS)
729bc421551SDag-Erling Smørgrav		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
730bc421551SDag-Erling Smørgrav
731bc421551SDag-Erling Smørgravzic:		$(TZCOBJS)
732bc421551SDag-Erling Smørgrav		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
733bc421551SDag-Erling Smørgrav
734bc421551SDag-Erling Smørgravleapseconds:	$(LEAP_DEPS)
735bc421551SDag-Erling Smørgrav		$(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
736bc421551SDag-Erling Smørgrav		  -f leapseconds.awk leap-seconds.list >$@.out
737bc421551SDag-Erling Smørgrav		mv $@.out $@
738bc421551SDag-Erling Smørgrav
73946c59934SDag-Erling Smørgrav# Awk script to extract a Git-style author from leap-seconds.list comments.
74046c59934SDag-Erling SmørgravEXTRACT_AUTHOR = \
74146c59934SDag-Erling Smørgrav  author_line { sub(/^.[[:space:]]*/, ""); \
74246c59934SDag-Erling Smørgrav      sub(/:[[:space:]]*/, " <"); \
74346c59934SDag-Erling Smørgrav      printf "%s>\n", $$0; \
74446c59934SDag-Erling Smørgrav      success = 1; \
74546c59934SDag-Erling Smørgrav      exit \
74646c59934SDag-Erling Smørgrav  } \
74746c59934SDag-Erling Smørgrav  /Questions or comments to:/ { author_line = 1 } \
74846c59934SDag-Erling Smørgrav  END { exit !success }
74946c59934SDag-Erling Smørgrav
75046c59934SDag-Erling Smørgrav# Fetch leap-seconds.list from upstream.
75146c59934SDag-Erling Smørgravfetch-leap-seconds.list:
75246c59934SDag-Erling Smørgrav		$(CURL) -OR $(leaplist_URI)
75346c59934SDag-Erling Smørgrav
75446c59934SDag-Erling Smørgrav# Fetch leap-seconds.list from upstream and commit it to the local repository.
75546c59934SDag-Erling Smørgravcommit-leap-seconds.list: fetch-leap-seconds.list
75646c59934SDag-Erling Smørgrav		author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \
75746c59934SDag-Erling Smørgrav		date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \
75846c59934SDag-Erling Smørgrav		git commit --author="$$author" --date="$$date" -m'make $@' \
75946c59934SDag-Erling Smørgrav		  leap-seconds.list
76046c59934SDag-Erling Smørgrav
761*a979394aSDag-Erling Smørgrav# Arguments to pass to submakes.
762bc421551SDag-Erling Smørgrav# They can be overridden by later submake arguments.
763bc421551SDag-Erling SmørgravINSTALLARGS = \
764bc421551SDag-Erling Smørgrav BACKWARD='$(BACKWARD)' \
765bc421551SDag-Erling Smørgrav DESTDIR='$(DESTDIR)' \
766bc421551SDag-Erling Smørgrav PACKRATDATA='$(PACKRATDATA)' \
767bc421551SDag-Erling Smørgrav PACKRATLIST='$(PACKRATLIST)' \
768bc421551SDag-Erling Smørgrav TZDEFAULT='$(TZDEFAULT)' \
769bc421551SDag-Erling Smørgrav TZDIR='$(TZDIR)' \
770bc421551SDag-Erling Smørgrav ZIC='$(ZIC)'
771bc421551SDag-Erling Smørgrav
772bc421551SDag-Erling SmørgravINSTALL_DATA_DEPS = zic leapseconds tzdata.zi
773bc421551SDag-Erling Smørgrav
774*a979394aSDag-Erling Smørgravposix_only: $(INSTALL_DATA_DEPS)
775bc421551SDag-Erling Smørgrav		$(ZIC_INSTALL) tzdata.zi
776bc421551SDag-Erling Smørgrav
777bc421551SDag-Erling Smørgravright_only: $(INSTALL_DATA_DEPS)
778*a979394aSDag-Erling Smørgrav		$(ZIC_INSTALL) -L leapseconds tzdata.zi
779bc421551SDag-Erling Smørgrav
780bc421551SDag-Erling Smørgrav# In earlier versions of this makefile, the other two directories were
781bc421551SDag-Erling Smørgrav# subdirectories of $(TZDIR).  However, this led to configuration errors.
782bc421551SDag-Erling Smørgrav# For example, with posix_right under the earlier scheme,
783bc421551SDag-Erling Smørgrav# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
784bc421551SDag-Erling Smørgrav# but gmtime without leap seconds, which led to problems with applications
785bc421551SDag-Erling Smørgrav# like sendmail that subtract gmtime from localtime.
786bc421551SDag-Erling Smørgrav# Therefore, the other two directories are now siblings of $(TZDIR).
787bc421551SDag-Erling Smørgrav# You must replace all of $(TZDIR) to switch from not using leap seconds
788bc421551SDag-Erling Smørgrav# to using them, or vice versa.
789bc421551SDag-Erling Smørgravright_posix:	right_only
790bc421551SDag-Erling Smørgrav		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
791bc421551SDag-Erling Smørgrav		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
792bc421551SDag-Erling Smørgrav		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
793bc421551SDag-Erling Smørgrav		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
794bc421551SDag-Erling Smørgrav
795bc421551SDag-Erling Smørgravposix_right:	posix_only
796bc421551SDag-Erling Smørgrav		rm -fr '$(DESTDIR)$(TZDIR)-posix'
797bc421551SDag-Erling Smørgrav		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
798bc421551SDag-Erling Smørgrav		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
799bc421551SDag-Erling Smørgrav		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
800bc421551SDag-Erling Smørgrav
801bc421551SDag-Erling Smørgravzones:		$(REDO)
802bc421551SDag-Erling Smørgrav
803bc421551SDag-Erling Smørgrav# dummy.zd is not a real file; it is mentioned here only so that the
804bc421551SDag-Erling Smørgrav# top-level 'make' does not have a syntax error.
805bc421551SDag-Erling SmørgravZDS = dummy.zd
806bc421551SDag-Erling Smørgrav# Rule used only by submakes invoked by the $(TZS_NEW) rule.
807bc421551SDag-Erling Smørgrav# It is separate so that GNU 'make -j' can run instances in parallel.
808bc421551SDag-Erling Smørgrav$(ZDS): zdump
809*a979394aSDag-Erling Smørgrav		./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@
810bc421551SDag-Erling Smørgrav
811bc421551SDag-Erling SmørgravTZS_NEW_DEPS = tzdata.zi zdump zic
812bc421551SDag-Erling Smørgrav$(TZS_NEW): $(TZS_NEW_DEPS)
813bc421551SDag-Erling Smørgrav		rm -fr tzs$(TZS_YEAR).dir
814bc421551SDag-Erling Smørgrav		mkdir tzs$(TZS_YEAR).dir
815bc421551SDag-Erling Smørgrav		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
816bc421551SDag-Erling Smørgrav		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
817bc421551SDag-Erling Smørgrav		   tzdata.zi | LC_ALL=C sort >$@.out
818*a979394aSDag-Erling Smørgrav		x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
819bc421551SDag-Erling Smørgrav				tzdata.zi \
820*a979394aSDag-Erling Smørgrav		     | LC_ALL=C sort -t . -k 2,2) && \
821bc421551SDag-Erling Smørgrav		set x $$x && \
822bc421551SDag-Erling Smørgrav		shift && \
823bc421551SDag-Erling Smørgrav		ZDS=$$* && \
824*a979394aSDag-Erling Smørgrav		$(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
825bc421551SDag-Erling Smørgrav		  ZDS="$$ZDS" $$ZDS && \
826bc421551SDag-Erling Smørgrav		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
827bc421551SDag-Erling Smørgrav		rm -fr tzs$(TZS_YEAR).dir
828bc421551SDag-Erling Smørgrav		mv $@.out $@
829bc421551SDag-Erling Smørgrav
830*a979394aSDag-Erling Smørgrav# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the
831bc421551SDag-Erling Smørgrav# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
832bc421551SDag-Erling Smørgrav$(TZS):
833bc421551SDag-Erling Smørgrav		touch $@
834bc421551SDag-Erling Smørgrav
835bc421551SDag-Erling Smørgravforce_tzs:	$(TZS_NEW)
836bc421551SDag-Erling Smørgrav		cp $(TZS_NEW) $(TZS)
837bc421551SDag-Erling Smørgrav
838bc421551SDag-Erling Smørgravlibtz.a:	$(LIBOBJS)
839bc421551SDag-Erling Smørgrav		rm -f $@
84046c59934SDag-Erling Smørgrav		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
841bc421551SDag-Erling Smørgrav		$(RANLIB) $@
842bc421551SDag-Erling Smørgrav
843bc421551SDag-Erling Smørgravdate:		$(DATEOBJS)
844bc421551SDag-Erling Smørgrav		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
845bc421551SDag-Erling Smørgrav
846bc421551SDag-Erling Smørgravtzselect:	tzselect.ksh version
847*a979394aSDag-Erling Smørgrav		read -r VERSION <version && sed \
84846c59934SDag-Erling Smørgrav		  -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
84946c59934SDag-Erling Smørgrav		  -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
85046c59934SDag-Erling Smørgrav		  -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
85146c59934SDag-Erling Smørgrav		  -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \
85246c59934SDag-Erling Smørgrav		  -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \
85346c59934SDag-Erling Smørgrav		  -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \
854bc421551SDag-Erling Smørgrav		  <$@.ksh >$@.out
855bc421551SDag-Erling Smørgrav		chmod +x $@.out
856bc421551SDag-Erling Smørgrav		mv $@.out $@
857bc421551SDag-Erling Smørgrav
858*a979394aSDag-Erling Smørgravcheck: check_mild back.ck
859*a979394aSDag-Erling Smørgravcheck_mild: check_web check_zishrink \
860*a979394aSDag-Erling Smørgrav  character-set.ck white-space.ck links.ck mainguard.ck \
861*a979394aSDag-Erling Smørgrav  name-lengths.ck now.ck slashed-abbrs.ck sorted.ck \
862*a979394aSDag-Erling Smørgrav  tables.ck ziguard.ck tzs.ck
863bc421551SDag-Erling Smørgrav
86446c59934SDag-Erling Smørgrav# True if UTF8_LOCALE does not work;
86546c59934SDag-Erling Smørgrav# otherwise, false but with LC_ALL set to $(UTF8_LOCALE).
86646c59934SDag-Erling SmørgravUTF8_LOCALE_MISSING = \
86746c59934SDag-Erling Smørgrav  { test ! '$(UTF8_LOCALE)' \
86846c59934SDag-Erling Smørgrav    || ! printf 'A\304\200B\n' \
86946c59934SDag-Erling Smørgrav         | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
870*a979394aSDag-Erling Smørgrav    || { export LC_ALL='$(UTF8_LOCALE)'; false; }; }
87146c59934SDag-Erling Smørgrav
872*a979394aSDag-Erling Smørgravcharacter-set.ck: $(ENCHILADA)
87346c59934SDag-Erling Smørgrav	$(UTF8_LOCALE_MISSING) || { \
874bc421551SDag-Erling Smørgrav		sharp='#' && \
875bc421551SDag-Erling Smørgrav		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
876bc421551SDag-Erling Smørgrav			$(MISC) $(SOURCES) $(WEB_PAGES) \
877bc421551SDag-Erling Smørgrav			CONTRIBUTING LICENSE README SECURITY \
878bc421551SDag-Erling Smørgrav			version tzdata.zi && \
879bc421551SDag-Erling Smørgrav		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
880bc421551SDag-Erling Smørgrav			Makefile && \
881bc421551SDag-Erling Smørgrav		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
882bc421551SDag-Erling Smørgrav			leapseconds zone.tab && \
883bc421551SDag-Erling Smørgrav		! grep -Env $(OK_LINE) $(ENCHILADA); \
884bc421551SDag-Erling Smørgrav	}
885bc421551SDag-Erling Smørgrav	touch $@
886bc421551SDag-Erling Smørgrav
887*a979394aSDag-Erling Smørgravwhite-space.ck: $(ENCHILADA)
88846c59934SDag-Erling Smørgrav	$(UTF8_LOCALE_MISSING) || { \
889*a979394aSDag-Erling Smørgrav		enchilada='$(ENCHILADA)' && \
890*a979394aSDag-Erling Smørgrav		patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \
89146c59934SDag-Erling Smørgrav		! grep -En "$$pat|[$s]\$$" \
892*a979394aSDag-Erling Smørgrav		    $${enchilada%leap-seconds.list*} \
893*a979394aSDag-Erling Smørgrav		    $${enchilada#*leap-seconds.list}; \
89446c59934SDag-Erling Smørgrav	}
895bc421551SDag-Erling Smørgrav	touch $@
896bc421551SDag-Erling Smørgrav
897bc421551SDag-Erling SmørgravPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
898bc421551SDag-Erling SmørgravFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
899bc421551SDag-Erling Smørgrav
900*a979394aSDag-Erling Smørgravname-lengths.ck: $(TDATA_TO_CHECK) backzone
901*a979394aSDag-Erling Smørgrav		:;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
902bc421551SDag-Erling Smørgrav			$(TDATA_TO_CHECK) backzone
903bc421551SDag-Erling Smørgrav		touch $@
904bc421551SDag-Erling Smørgrav
905*a979394aSDag-Erling Smørgravmainguard.ck: main.zi
906*a979394aSDag-Erling Smørgrav		test '$(PACKRATLIST)' || \
907*a979394aSDag-Erling Smørgrav		  cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi
908*a979394aSDag-Erling Smørgrav		touch $@
909*a979394aSDag-Erling Smørgrav
910bc421551SDag-Erling SmørgravPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
911bc421551SDag-Erling SmørgravSTDOFF = [-+]?[0-9:.]+
912bc421551SDag-Erling SmørgravRULELESS_SAVE = (-|$(STDOFF)[sd]?)
913bc421551SDag-Erling SmørgravRULELESS_SLASHED_ABBRS = \
914bc421551SDag-Erling Smørgrav  $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
915bc421551SDag-Erling Smørgrav
916*a979394aSDag-Erling Smørgravslashed-abbrs.ck: $(TDATA_TO_CHECK)
917*a979394aSDag-Erling Smørgrav		:;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
918bc421551SDag-Erling Smørgrav		touch $@
919bc421551SDag-Erling Smørgrav
920bc421551SDag-Erling SmørgravCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
921bc421551SDag-Erling Smørgrav
922*a979394aSDag-Erling Smørgravsorted.ck: backward backzone
923bc421551SDag-Erling Smørgrav		$(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
924bc421551SDag-Erling Smørgrav		  backward | LC_ALL=C sort -cu
925*a979394aSDag-Erling Smørgrav		$(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu
926bc421551SDag-Erling Smørgrav		touch $@
927bc421551SDag-Erling Smørgrav
928*a979394aSDag-Erling Smørgravback.ck: checklinks.awk $(TDATA_TO_CHECK)
929bc421551SDag-Erling Smørgrav		$(AWK) \
930bc421551SDag-Erling Smørgrav		  -v DATAFORM=$(DATAFORM) \
931bc421551SDag-Erling Smørgrav		  -v backcheck=backward \
932bc421551SDag-Erling Smørgrav		  -f checklinks.awk $(TDATA_TO_CHECK)
933bc421551SDag-Erling Smørgrav		touch $@
934bc421551SDag-Erling Smørgrav
935*a979394aSDag-Erling Smørgravlinks.ck: checklinks.awk tzdata.zi
936bc421551SDag-Erling Smørgrav		$(AWK) \
937bc421551SDag-Erling Smørgrav		  -v DATAFORM=$(DATAFORM) \
938bc421551SDag-Erling Smørgrav		  -f checklinks.awk tzdata.zi
939bc421551SDag-Erling Smørgrav		touch $@
940bc421551SDag-Erling Smørgrav
94146c59934SDag-Erling Smørgrav# Check timestamps from now through 28 years from now, to make sure
94246c59934SDag-Erling Smørgrav# that zonenow.tab contains all sequences of planned timestamps,
94346c59934SDag-Erling Smørgrav# without any duplicate sequences.  In theory this might require
944*a979394aSDag-Erling Smørgrav# 2800+ years but that would take a long time to check.
945*a979394aSDag-Erling SmørgravCHECK_NOW_TIMESTAMP = $$(./date +%s)
94646c59934SDag-Erling SmørgravCHECK_NOW_FUTURE_YEARS = 28
947*a979394aSDag-Erling SmørgravCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) * 366 * 24 * 60 * 60
948*a979394aSDag-Erling Smørgravnow.ck: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
949*a979394aSDag-Erling Smørgrav		rm -fr $@d
950*a979394aSDag-Erling Smørgrav		mkdir $@d
951*a979394aSDag-Erling Smørgrav		./zic -d $@d tzdata.zi
95246c59934SDag-Erling Smørgrav		now=$(CHECK_NOW_TIMESTAMP) && \
953*a979394aSDag-Erling Smørgrav		  future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \
95446c59934SDag-Erling Smørgrav		  ./zdump -i -t $$now,$$future \
955*a979394aSDag-Erling Smørgrav		     $$(find "$$PWD/$@d"/????*/ -type f) \
956*a979394aSDag-Erling Smørgrav		     >$@d/zdump-now.tab && \
957*a979394aSDag-Erling Smørgrav		  ./zdump -i -t 0,$$future \
958*a979394aSDag-Erling Smørgrav		     $$(find "$$PWD/$@d" -name Etc -prune \
959*a979394aSDag-Erling Smørgrav			  -o -type f ! -name '*.tab' -print) \
960*a979394aSDag-Erling Smørgrav		     >$@d/zdump-1970.tab
96146c59934SDag-Erling Smørgrav		$(AWK) \
962*a979394aSDag-Erling Smørgrav		  -v zdump_table=$@d/zdump-now.tab \
96346c59934SDag-Erling Smørgrav		  -f checknow.awk zonenow.tab
964*a979394aSDag-Erling Smørgrav		$(AWK) \
965*a979394aSDag-Erling Smørgrav		  'BEGIN {print "-\t-\tUTC"} /^Zone/ {print "-\t-\t" $$2}' \
966*a979394aSDag-Erling Smørgrav		  $(PRIMARY_YDATA) backward factory | \
967*a979394aSDag-Erling Smørgrav		 $(AWK) \
968*a979394aSDag-Erling Smørgrav		   -v zdump_table=$@d/zdump-1970.tab \
969*a979394aSDag-Erling Smørgrav		   -f checknow.awk
970*a979394aSDag-Erling Smørgrav		rm -fr $@d
97146c59934SDag-Erling Smørgrav		touch $@
97246c59934SDag-Erling Smørgrav
973*a979394aSDag-Erling Smørgravtables.ck: checktab.awk $(YDATA) backward zone.tab zone1970.tab
974bc421551SDag-Erling Smørgrav		for tab in $(ZONETABLES); do \
975bc421551SDag-Erling Smørgrav		  test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
976bc421551SDag-Erling Smørgrav		  $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
977bc421551SDag-Erling Smørgrav		    || exit; \
978bc421551SDag-Erling Smørgrav		done
979bc421551SDag-Erling Smørgrav		touch $@
980bc421551SDag-Erling Smørgrav
981*a979394aSDag-Erling Smørgravtzs.ck: $(TZS) $(TZS_NEW)
982bc421551SDag-Erling Smørgrav		if test -s $(TZS); then \
983*a979394aSDag-Erling Smørgrav		  $(SETUP_DIFF_TZS) && $$DIFF_TZS $(TZS) $(TZS_NEW); \
984bc421551SDag-Erling Smørgrav		else \
985bc421551SDag-Erling Smørgrav		  cp $(TZS_NEW) $(TZS); \
986bc421551SDag-Erling Smørgrav		fi
987bc421551SDag-Erling Smørgrav		touch $@
988bc421551SDag-Erling Smørgrav
989bc421551SDag-Erling Smørgravcheck_web:	$(CHECK_WEB_PAGES)
990*a979394aSDag-Erling Smørgrav.SUFFIXES: .ck .html
991*a979394aSDag-Erling Smørgrav.html.ck:
992*a979394aSDag-Erling Smørgrav		{ ! ($(CURL) --version) >/dev/null 2>&1 || \
993bc421551SDag-Erling Smørgrav		    $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
994*a979394aSDag-Erling Smørgrav		          -F file=@$<; } >$@.out && \
995bc421551SDag-Erling Smørgrav		  test ! -s $@.out || { cat $@.out; exit 1; }
996bc421551SDag-Erling Smørgrav		mv $@.out $@
997bc421551SDag-Erling Smørgrav
998*a979394aSDag-Erling Smørgravziguard.ck: rearguard.zi vanguard.zi ziguard.awk
999bc421551SDag-Erling Smørgrav		$(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
1000bc421551SDag-Erling Smørgrav		  diff -u rearguard.zi -
1001bc421551SDag-Erling Smørgrav		$(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
1002bc421551SDag-Erling Smørgrav		  diff -u vanguard.zi -
1003bc421551SDag-Erling Smørgrav		touch $@
1004bc421551SDag-Erling Smørgrav
1005bc421551SDag-Erling Smørgrav# Check that zishrink.awk does not alter the data, and that ziguard.awk
1006bc421551SDag-Erling Smørgrav# preserves main-format data.
1007*a979394aSDag-Erling Smørgravcheck_zishrink: zishrink-posix.ck zishrink-right.ck
1008*a979394aSDag-Erling Smørgravzishrink-posix.ck zishrink-right.ck: \
1009bc421551SDag-Erling Smørgrav  zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
1010bc421551SDag-Erling Smørgrav  $(TDATA) $(DATAFORM).zi tzdata.zi
1011*a979394aSDag-Erling Smørgrav		rm -fr $@d t-$@d shrunk-$@d
1012*a979394aSDag-Erling Smørgrav		mkdir $@d t-$@d shrunk-$@d
1013bc421551SDag-Erling Smørgrav		case $@ in \
1014*a979394aSDag-Erling Smørgrav		  *right*) leap='-L leapseconds';; \
1015bc421551SDag-Erling Smørgrav		  *) leap=;; \
1016bc421551SDag-Erling Smørgrav		esac && \
1017*a979394aSDag-Erling Smørgrav		  $(ZIC) $$leap -d $@d $(DATAFORM).zi && \
1018*a979394aSDag-Erling Smørgrav		  $(ZIC) $$leap -d shrunk-$@d tzdata.zi && \
1019bc421551SDag-Erling Smørgrav		  case $(DATAFORM),$(PACKRATLIST) in \
1020bc421551SDag-Erling Smørgrav		    main,) \
1021*a979394aSDag-Erling Smørgrav		      $(ZIC) $$leap -d t-$@d $(TDATA) && \
1022bc421551SDag-Erling Smørgrav		      $(AWK) '/^Rule/' $(TDATA) | \
1023*a979394aSDag-Erling Smørgrav			$(ZIC) $$leap -d t-$@d - $(PACKRATDATA) && \
1024*a979394aSDag-Erling Smørgrav		      diff -r $@d t-$@d;; \
1025bc421551SDag-Erling Smørgrav		  esac
1026*a979394aSDag-Erling Smørgrav		diff -r $@d shrunk-$@d
1027*a979394aSDag-Erling Smørgrav		rm -fr $@d t-$@d shrunk-$@d
1028bc421551SDag-Erling Smørgrav		touch $@
1029bc421551SDag-Erling Smørgrav
1030bc421551SDag-Erling Smørgravclean_misc:
1031*a979394aSDag-Erling Smørgrav		rm -fr *.ckd *.dir
1032*a979394aSDag-Erling Smørgrav		rm -f *.ck *.core *.o *.out core core.* \
103346c59934SDag-Erling Smørgrav		  date tzdir.h tzselect version.h zdump zic libtz.a
1034bc421551SDag-Erling Smørgravclean:		clean_misc
1035*a979394aSDag-Erling Smørgrav		rm -fr tzdb-*/
1036bc421551SDag-Erling Smørgrav		rm -f *.zi $(TZS_NEW)
1037bc421551SDag-Erling Smørgrav
1038bc421551SDag-Erling Smørgravmaintainer-clean: clean
1039bc421551SDag-Erling Smørgrav		@echo 'This command is intended for maintainers to use; it'
1040bc421551SDag-Erling Smørgrav		@echo 'deletes files that may need special tools to rebuild.'
1041bc421551SDag-Erling Smørgrav		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
1042bc421551SDag-Erling Smørgrav
1043bc421551SDag-Erling Smørgravnames:
1044bc421551SDag-Erling Smørgrav		@echo $(ENCHILADA)
1045bc421551SDag-Erling Smørgrav
1046*a979394aSDag-Erling Smørgravpublic: check public.ck $(CHECK_TIME_T_ALTERNATIVES) \
1047bc421551SDag-Erling Smørgrav		tarballs signatures
1048bc421551SDag-Erling Smørgrav
1049bc421551SDag-Erling Smørgravdate.1.txt:	date.1
1050bc421551SDag-Erling Smørgravnewctime.3.txt:	newctime.3
1051bc421551SDag-Erling Smørgravnewstrftime.3.txt: newstrftime.3
1052bc421551SDag-Erling Smørgravnewtzset.3.txt:	newtzset.3
1053bc421551SDag-Erling Smørgravtime2posix.3.txt: time2posix.3
1054bc421551SDag-Erling Smørgravtzfile.5.txt:	tzfile.5
1055bc421551SDag-Erling Smørgravtzselect.8.txt:	tzselect.8
1056bc421551SDag-Erling Smørgravzdump.8.txt:	zdump.8
1057bc421551SDag-Erling Smørgravzic.8.txt:	zic.8
1058bc421551SDag-Erling Smørgrav
1059bc421551SDag-Erling Smørgrav$(MANTXTS):	workman.sh
1060*a979394aSDag-Erling Smørgrav		LC_ALL=C sh workman.sh $(@:.txt=) >$@.out
1061bc421551SDag-Erling Smørgrav		mv $@.out $@
1062bc421551SDag-Erling Smørgrav
1063bc421551SDag-Erling Smørgrav# Set file timestamps deterministically if possible,
1064bc421551SDag-Erling Smørgrav# so that tarballs containing the timestamps are reproducible.
1065bc421551SDag-Erling Smørgrav#
1066bc421551SDag-Erling Smørgrav# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
1067bc421551SDag-Erling Smørgrav# file DEST to the maximum of the timestamps of the files A B C ...,
1068bc421551SDag-Erling Smørgrav# plus N if GNU ls and touch are available.
1069bc421551SDag-Erling SmørgravSET_TIMESTAMP_N = sh -c '\
1070bc421551SDag-Erling Smørgrav  n=$$0 dest=$$1; shift; \
107146c59934SDag-Erling Smørgrav  <"$$dest" && \
1072bc421551SDag-Erling Smørgrav  if test $$n != 0 && \
1073*a979394aSDag-Erling Smørgrav     lsout=$$(ls -nt --time-style="+%s" "$$@" 2>/dev/null); then \
1074bc421551SDag-Erling Smørgrav    set x $$lsout && \
1075*a979394aSDag-Erling Smørgrav    timestamp=$$(($$7 + $$n)) && \
107646c59934SDag-Erling Smørgrav    echo "+ touch -md @$$timestamp $$dest" && \
107746c59934SDag-Erling Smørgrav    touch -md @$$timestamp "$$dest"; \
107846c59934SDag-Erling Smørgrav  else \
1079*a979394aSDag-Erling Smørgrav    newest=$$(ls -t "$$@" | sed 1q) && \
108046c59934SDag-Erling Smørgrav    echo "+ touch -mr $$newest $$dest" && \
108146c59934SDag-Erling Smørgrav    touch -mr "$$newest" "$$dest"; \
108246c59934SDag-Erling Smørgrav  fi'
1083bc421551SDag-Erling Smørgrav# If DEST depends on A B C ... in this Makefile, callers should use
1084bc421551SDag-Erling Smørgrav# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
1085bc421551SDag-Erling Smørgrav# downstream 'make' that considers equal timestamps to be out of date.
1086bc421551SDag-Erling Smørgrav# POSIX allows this 'make' behavior, and HP-UX 'make' does it.
1087bc421551SDag-Erling Smørgrav# If all that matters is that the timestamp be reproducible
1088bc421551SDag-Erling Smørgrav# and plausible, use $(SET_TIMESTAMP).
1089bc421551SDag-Erling SmørgravSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
1090bc421551SDag-Erling SmørgravSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
1091bc421551SDag-Erling Smørgrav
1092bc421551SDag-Erling Smørgrav# Set the timestamps to those of the git repository, if available,
1093bc421551SDag-Erling Smørgrav# and if the files have not changed since then.
1094bc421551SDag-Erling Smørgrav# This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
1095bc421551SDag-Erling Smørgrav# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
1096bc421551SDag-Erling Smørgrav# If git or GNU is absent, don't bother to sync with git timestamps.
1097bc421551SDag-Erling Smørgrav# Also, set the timestamp of each prebuilt file like 'leapseconds'
1098bc421551SDag-Erling Smørgrav# to be the maximum of the files it depends on.
1099bc421551SDag-Erling Smørgravset-timestamps.out: $(EIGHT_YARDS)
1100bc421551SDag-Erling Smørgrav		rm -f $@
1101bc421551SDag-Erling Smørgrav		if (type git) >/dev/null 2>&1 && \
1102*a979394aSDag-Erling Smørgrav		   files=$$(git ls-files $(EIGHT_YARDS)) && \
1103bc421551SDag-Erling Smørgrav		   touch -md @1 test.out; then \
1104bc421551SDag-Erling Smørgrav		  rm -f test.out && \
1105bc421551SDag-Erling Smørgrav		  for file in $$files; do \
1106bc421551SDag-Erling Smørgrav		    if git diff --quiet $$file; then \
1107*a979394aSDag-Erling Smørgrav		      time=$$(TZ=UTC0 git log -1 \
110846c59934SDag-Erling Smørgrav			--format='tformat:%cd' \
110946c59934SDag-Erling Smørgrav			--date='format:%Y-%m-%dT%H:%M:%SZ' \
1110*a979394aSDag-Erling Smørgrav			$$file) && \
111146c59934SDag-Erling Smørgrav		      echo "+ touch -md $$time $$file" && \
111246c59934SDag-Erling Smørgrav		      touch -md $$time $$file; \
1113bc421551SDag-Erling Smørgrav		    else \
1114bc421551SDag-Erling Smørgrav		      echo >&2 "$$file: warning: does not match repository"; \
1115bc421551SDag-Erling Smørgrav		    fi || exit; \
1116bc421551SDag-Erling Smørgrav		  done; \
1117bc421551SDag-Erling Smørgrav		fi
1118bc421551SDag-Erling Smørgrav		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
1119*a979394aSDag-Erling Smørgrav		for file in $(MANTXTS); do \
1120*a979394aSDag-Erling Smørgrav		  $(SET_TIMESTAMP_DEP) $$file $${file%.txt} workman.sh || \
1121bc421551SDag-Erling Smørgrav		    exit; \
1122bc421551SDag-Erling Smørgrav		done
1123bc421551SDag-Erling Smørgrav		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
1124bc421551SDag-Erling Smørgrav		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
1125bc421551SDag-Erling Smørgrav		touch $@
1126bc421551SDag-Erling Smørgravset-tzs-timestamp.out: $(TZS)
1127bc421551SDag-Erling Smørgrav		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
1128bc421551SDag-Erling Smørgrav		touch $@
1129bc421551SDag-Erling Smørgrav
1130bc421551SDag-Erling Smørgrav# The zics below ensure that each data file can stand on its own.
1131bc421551SDag-Erling Smørgrav# We also do an all-files run to catch links to links.
1132bc421551SDag-Erling Smørgrav
1133*a979394aSDag-Erling Smørgravpublic.ck: $(VERSION_DEPS)
1134*a979394aSDag-Erling Smørgrav		rm -fr $@d
1135*a979394aSDag-Erling Smørgrav		mkdir $@d
1136*a979394aSDag-Erling Smørgrav		ln $(VERSION_DEPS) $@d
1137*a979394aSDag-Erling Smørgrav		cd $@d \
113846c59934SDag-Erling Smørgrav		  && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL
1139*a979394aSDag-Erling Smørgrav		for i in $(TDATA_TO_CHECK) \
1140*a979394aSDag-Erling Smørgrav		    tzdata.zi vanguard.zi main.zi rearguard.zi; \
1141bc421551SDag-Erling Smørgrav		do \
1142*a979394aSDag-Erling Smørgrav		  $@d/zic -v -d $@d/zoneinfo $@d/$$i || exit; \
1143bc421551SDag-Erling Smørgrav		done
1144*a979394aSDag-Erling Smørgrav		$@d/zic -v -d $@d/zoneinfo-all $(TDATA_TO_CHECK)
1145bc421551SDag-Erling Smørgrav		:
1146bc421551SDag-Erling Smørgrav		: Also check 'backzone' syntax.
1147*a979394aSDag-Erling Smørgrav		rm $@d/main.zi
1148*a979394aSDag-Erling Smørgrav		cd $@d && $(MAKE) PACKRATDATA=backzone main.zi
1149*a979394aSDag-Erling Smørgrav		$@d/zic -d $@d/zoneinfo main.zi
1150*a979394aSDag-Erling Smørgrav		rm $@d/main.zi
1151*a979394aSDag-Erling Smørgrav		cd $@d && \
1152bc421551SDag-Erling Smørgrav		  $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
1153*a979394aSDag-Erling Smørgrav		$@d/zic -d $@d/zoneinfo main.zi
1154bc421551SDag-Erling Smørgrav		:
1155*a979394aSDag-Erling Smørgrav		rm -fr $@d
1156bc421551SDag-Erling Smørgrav		touch $@
1157bc421551SDag-Erling Smørgrav
1158bc421551SDag-Erling Smørgrav# Check that the code works under various alternative
1159bc421551SDag-Erling Smørgrav# implementations of time_t.
1160bc421551SDag-Erling Smørgravcheck_time_t_alternatives: $(TIME_T_ALTERNATIVES)
1161bc421551SDag-Erling Smørgrav$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
1162bc421551SDag-Erling Smørgrav$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
1163*a979394aSDag-Erling Smørgrav		rm -fr $@d
1164*a979394aSDag-Erling Smørgrav		mkdir $@d
1165*a979394aSDag-Erling Smørgrav		ln $(VERSION_DEPS) $@d
1166bc421551SDag-Erling Smørgrav		case $@ in \
1167*a979394aSDag-Erling Smørgrav		  *32_t*) range=-2147483648,2147483648;; \
1168bc421551SDag-Erling Smørgrav		  u*) range=0,4294967296;; \
1169bc421551SDag-Erling Smørgrav		  *) range=-4294967296,4294967296;; \
1170bc421551SDag-Erling Smørgrav		esac && \
1171*a979394aSDag-Erling Smørgrav		wd=$$PWD && \
1172*a979394aSDag-Erling Smørgrav		zones=$$($(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab) && \
1173bc421551SDag-Erling Smørgrav		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
1174bc421551SDag-Erling Smørgrav		  range_target=; \
1175bc421551SDag-Erling Smørgrav		else \
1176bc421551SDag-Erling Smørgrav		  range_target=to$$range.tzs; \
1177bc421551SDag-Erling Smørgrav		fi && \
1178*a979394aSDag-Erling Smørgrav		(cd $@d && \
1179*a979394aSDag-Erling Smørgrav		  $(MAKE) TOPDIR="$$wd/$@d" \
1180*a979394aSDag-Erling Smørgrav		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$(@:.ck=)'" \
1181bc421551SDag-Erling Smørgrav		    REDO='$(REDO)' \
1182*a979394aSDag-Erling Smørgrav		    D="$$wd/$@d" \
1183bc421551SDag-Erling Smørgrav		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
1184bc421551SDag-Erling Smørgrav		    install $$range_target) && \
1185bc421551SDag-Erling Smørgrav		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
1186*a979394aSDag-Erling Smørgrav		  (cd $(TIME_T_ALTERNATIVES_HEAD)d && \
1187*a979394aSDag-Erling Smørgrav		    $(MAKE) TOPDIR="$$wd/$@d" \
1188bc421551SDag-Erling Smørgrav		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
1189*a979394aSDag-Erling Smørgrav		      D="$$wd/$@d" \
1190bc421551SDag-Erling Smørgrav		      to$$range.tzs) && \
1191*a979394aSDag-Erling Smørgrav		  $(SETUP_DIFF_TZS) && \
1192*a979394aSDag-Erling Smørgrav		  $$DIFF_TZS $(TIME_T_ALTERNATIVES_HEAD)d/to$$range.tzs \
1193*a979394aSDag-Erling Smørgrav			  $@d/to$$range.tzs && \
1194bc421551SDag-Erling Smørgrav		  if diff -q Makefile Makefile 2>/dev/null; then \
1195bc421551SDag-Erling Smørgrav		    quiet_option='-q'; \
1196bc421551SDag-Erling Smørgrav		  else \
1197bc421551SDag-Erling Smørgrav		    quiet_option=''; \
1198bc421551SDag-Erling Smørgrav		  fi && \
1199*a979394aSDag-Erling Smørgrav		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD)d/etc \
1200*a979394aSDag-Erling Smørgrav					   $@d/etc && \
1201bc421551SDag-Erling Smørgrav		    diff $$quiet_option -r \
1202*a979394aSDag-Erling Smørgrav		      $(TIME_T_ALTERNATIVES_HEAD)d/usr/share \
1203*a979394aSDag-Erling Smørgrav		      $@d/usr/share; \
1204bc421551SDag-Erling Smørgrav		}
1205bc421551SDag-Erling Smørgrav		touch $@
1206bc421551SDag-Erling Smørgrav
1207bc421551SDag-Erling SmørgravTRADITIONAL_ASC = \
1208bc421551SDag-Erling Smørgrav  tzcode$(VERSION).tar.gz.asc \
1209bc421551SDag-Erling Smørgrav  tzdata$(VERSION).tar.gz.asc
1210bc421551SDag-Erling SmørgravREARGUARD_ASC = \
1211bc421551SDag-Erling Smørgrav  tzdata$(VERSION)-rearguard.tar.gz.asc
1212bc421551SDag-Erling SmørgravALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
1213bc421551SDag-Erling Smørgrav  tzdb-$(VERSION).tar.lz.asc
1214bc421551SDag-Erling Smørgrav
1215bc421551SDag-Erling Smørgravtarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
1216bc421551SDag-Erling Smørgravsignatures rearguard_signatures traditional_signatures: \
1217bc421551SDag-Erling Smørgrav  version set-timestamps.out rearguard.zi vanguard.zi
1218*a979394aSDag-Erling Smørgrav		read -r VERSION <version && \
1219bc421551SDag-Erling Smørgrav		$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
1220bc421551SDag-Erling Smørgrav
1221bc421551SDag-Erling Smørgrav# These *_version rules are intended for use if VERSION is set by some
1222bc421551SDag-Erling Smørgrav# other means.  Ordinarily these rules are used only by the above
1223bc421551SDag-Erling Smørgrav# non-_version rules, which set VERSION on the 'make' command line.
1224bc421551SDag-Erling Smørgravtarballs_version: traditional_tarballs_version rearguard_tarballs_version \
1225bc421551SDag-Erling Smørgrav  tzdb-$(VERSION).tar.lz
1226bc421551SDag-Erling Smørgravrearguard_tarballs_version: \
1227bc421551SDag-Erling Smørgrav  tzdata$(VERSION)-rearguard.tar.gz
1228bc421551SDag-Erling Smørgravtraditional_tarballs_version: \
1229bc421551SDag-Erling Smørgrav  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
1230bc421551SDag-Erling Smørgravtailored_tarballs_version: \
1231bc421551SDag-Erling Smørgrav  tzdata$(VERSION)-tailored.tar.gz
1232bc421551SDag-Erling Smørgravsignatures_version: $(ALL_ASC)
1233bc421551SDag-Erling Smørgravrearguard_signatures_version: $(REARGUARD_ASC)
1234bc421551SDag-Erling Smørgravtraditional_signatures_version: $(TRADITIONAL_ASC)
1235bc421551SDag-Erling Smørgrav
1236bc421551SDag-Erling Smørgravtzcode$(VERSION).tar.gz: set-timestamps.out
1237*a979394aSDag-Erling Smørgrav		$(SETUP_TAR) && \
1238*a979394aSDag-Erling Smørgrav		$$TAR -cf - \
1239bc421551SDag-Erling Smørgrav		    $(COMMON) $(DOCS) $(SOURCES) | \
1240bc421551SDag-Erling Smørgrav		  gzip $(GZIPFLAGS) >$@.out
1241bc421551SDag-Erling Smørgrav		mv $@.out $@
1242bc421551SDag-Erling Smørgrav
1243bc421551SDag-Erling Smørgravtzdata$(VERSION).tar.gz: set-timestamps.out
1244*a979394aSDag-Erling Smørgrav		$(SETUP_TAR) && \
1245*a979394aSDag-Erling Smørgrav		$$TAR -cf - $(TZDATA_DIST) | \
1246bc421551SDag-Erling Smørgrav		  gzip $(GZIPFLAGS) >$@.out
1247bc421551SDag-Erling Smørgrav		mv $@.out $@
1248bc421551SDag-Erling Smørgrav
1249bc421551SDag-Erling Smørgrav# Create empty files with a reproducible timestamp.
1250bc421551SDag-Erling SmørgravCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
1251bc421551SDag-Erling Smørgrav
1252bc421551SDag-Erling Smørgrav# The obsolescent *rearguard* targets and related macros are present
1253bc421551SDag-Erling Smørgrav# for backwards compatibility with tz releases 2018e through 2022a.
1254bc421551SDag-Erling Smørgrav# They should go away eventually.  To build rearguard tarballs you
1255bc421551SDag-Erling Smørgrav# can instead use 'make DATAFORM=rearguard tailored_tarballs'.
1256bc421551SDag-Erling Smørgravtzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
1257bc421551SDag-Erling Smørgrav		rm -fr $@.dir
1258bc421551SDag-Erling Smørgrav		mkdir $@.dir
1259bc421551SDag-Erling Smørgrav		ln $(TZDATA_DIST) $@.dir
1260bc421551SDag-Erling Smørgrav		cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
1261bc421551SDag-Erling Smørgrav		for f in $(TDATA) $(PACKRATDATA); do \
1262bc421551SDag-Erling Smørgrav		  rearf=$@.dir/$$f; \
1263bc421551SDag-Erling Smørgrav		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
1264bc421551SDag-Erling Smørgrav		  $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
1265bc421551SDag-Erling Smørgrav		done
1266bc421551SDag-Erling Smørgrav		sed '1s/$$/-rearguard/' <version >$@.dir/version
1267bc421551SDag-Erling Smørgrav		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1268bc421551SDag-Erling Smørgrav		$(CREATE_EMPTY) $@.dir/pacificnew
126946c59934SDag-Erling Smørgrav		touch -mr version $@.dir/version
1270*a979394aSDag-Erling Smørgrav		$(SETUP_TAR) && \
1271bc421551SDag-Erling Smørgrav		  (cd $@.dir && \
1272*a979394aSDag-Erling Smørgrav		   $$TAR -cf - \
1273bc421551SDag-Erling Smørgrav			$(TZDATA_DIST) pacificnew | \
1274bc421551SDag-Erling Smørgrav		     gzip $(GZIPFLAGS)) >$@.out
1275bc421551SDag-Erling Smørgrav		mv $@.out $@
1276bc421551SDag-Erling Smørgrav
1277bc421551SDag-Erling Smørgrav# Create a tailored tarball suitable for TZUpdater and compatible tools.
1278bc421551SDag-Erling Smørgrav# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
1279bc421551SDag-Erling Smørgrav# useful for testing whether TZUpdater supports vanguard form.
1280bc421551SDag-Erling Smørgrav# The generated tarball is not byte-for-byte equivalent to a hand-tailored
1281bc421551SDag-Erling Smørgrav# traditional tarball, as data entries are put into 'etcetera' even if they
1282bc421551SDag-Erling Smørgrav# came from some other source file.  However, the effect should be the same
1283bc421551SDag-Erling Smørgrav# for ordinary use, which reads all the source files.
1284bc421551SDag-Erling Smørgravtzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
1285bc421551SDag-Erling Smørgrav		rm -fr $@.dir
1286bc421551SDag-Erling Smørgrav		mkdir $@.dir
1287bc421551SDag-Erling Smørgrav		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1288*a979394aSDag-Erling Smørgrav		if test $(DATAFORM) = vanguard; then \
1289*a979394aSDag-Erling Smørgrav		  pacificnew=; \
1290*a979394aSDag-Erling Smørgrav		else \
1291*a979394aSDag-Erling Smørgrav		  pacificnew=pacificnew; \
1292*a979394aSDag-Erling Smørgrav		fi && \
1293bc421551SDag-Erling Smørgrav		cd $@.dir && \
1294bc421551SDag-Erling Smørgrav		  $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
1295*a979394aSDag-Erling Smørgrav		  $$pacificnew
1296bc421551SDag-Erling Smørgrav		(grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
1297bc421551SDag-Erling Smørgrav		  >$@.dir/etcetera
129846c59934SDag-Erling Smørgrav		touch -mr tzdata.zi $@.dir/etcetera
1299bc421551SDag-Erling Smørgrav		sed -n \
1300bc421551SDag-Erling Smørgrav		  -e '/^# *version  *\(.*\)/h' \
1301bc421551SDag-Erling Smørgrav		  -e '/^# *ddeps  */H' \
1302bc421551SDag-Erling Smørgrav		  -e '$$!d' \
1303bc421551SDag-Erling Smørgrav		  -e 'g' \
1304bc421551SDag-Erling Smørgrav		  -e 's/^# *version  *//' \
1305bc421551SDag-Erling Smørgrav		  -e 's/\n# *ddeps  */-/' \
1306bc421551SDag-Erling Smørgrav		  -e 's/ /-/g' \
1307bc421551SDag-Erling Smørgrav		  -e 'p' \
1308bc421551SDag-Erling Smørgrav		  <tzdata.zi >$@.dir/version
130946c59934SDag-Erling Smørgrav		touch -mr version $@.dir/version
1310bc421551SDag-Erling Smørgrav		links= && \
1311bc421551SDag-Erling Smørgrav		  for file in $(TZDATA_DIST); do \
1312bc421551SDag-Erling Smørgrav		    test -f $@.dir/$$file || links="$$links $$file"; \
1313bc421551SDag-Erling Smørgrav		  done && \
1314bc421551SDag-Erling Smørgrav		  ln $$links $@.dir
1315*a979394aSDag-Erling Smørgrav		$(SETUP_TAR) && \
1316bc421551SDag-Erling Smørgrav		  (cd $@.dir && \
1317*a979394aSDag-Erling Smørgrav		   $$TAR -cf - * | gzip $(GZIPFLAGS)) >$@.out
1318bc421551SDag-Erling Smørgrav		mv $@.out $@
1319bc421551SDag-Erling Smørgrav
1320bc421551SDag-Erling Smørgravtzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
1321bc421551SDag-Erling Smørgrav		rm -fr tzdb-$(VERSION)
1322bc421551SDag-Erling Smørgrav		mkdir tzdb-$(VERSION)
1323bc421551SDag-Erling Smørgrav		ln $(ENCHILADA) tzdb-$(VERSION)
1324bc421551SDag-Erling Smørgrav		$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
1325*a979394aSDag-Erling Smørgrav		$(SETUP_TAR) && \
1326*a979394aSDag-Erling Smørgrav		$$TAR -cf - tzdb-$(VERSION) | lzip -9 >$@.out
1327bc421551SDag-Erling Smørgrav		mv $@.out $@
1328bc421551SDag-Erling Smørgrav
1329bc421551SDag-Erling Smørgravtzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
1330bc421551SDag-Erling Smørgravtzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
1331bc421551SDag-Erling Smørgravtzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
1332bc421551SDag-Erling Smørgravtzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
1333bc421551SDag-Erling Smørgrav$(ALL_ASC):
1334bc421551SDag-Erling Smørgrav		$(GPG) --armor --detach-sign $?
1335bc421551SDag-Erling Smørgrav
1336bc421551SDag-Erling SmørgravTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
1337*a979394aSDag-Erling Smørgravtypecheck: long-long.ck unsigned.ck
1338*a979394aSDag-Erling Smørgravlong-long.ck unsigned.ck: $(VERSION_DEPS)
1339*a979394aSDag-Erling Smørgrav		rm -fr $@d
1340*a979394aSDag-Erling Smørgrav		mkdir $@d
1341*a979394aSDag-Erling Smørgrav		ln $(VERSION_DEPS) $@d
1342*a979394aSDag-Erling Smørgrav		cd $@d && \
1343bc421551SDag-Erling Smørgrav		  case $@ in \
1344*a979394aSDag-Erling Smørgrav		    long-long.*) i="long long";; \
1345*a979394aSDag-Erling Smørgrav		    unsigned.* ) i="unsigned" ;; \
1346bc421551SDag-Erling Smørgrav		  esac && \
1347bc421551SDag-Erling Smørgrav		  $(MAKE) \
1348bc421551SDag-Erling Smørgrav		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
1349*a979394aSDag-Erling Smørgrav		    TOPDIR="$$PWD" \
1350bc421551SDag-Erling Smørgrav		    install
1351*a979394aSDag-Erling Smørgrav		$@d/zdump -i -c 1970,1971 Europe/Rome
1352bc421551SDag-Erling Smørgrav		touch $@
1353bc421551SDag-Erling Smørgrav
1354bc421551SDag-Erling Smørgravzonenames:	tzdata.zi
1355bc421551SDag-Erling Smørgrav		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
1356bc421551SDag-Erling Smørgrav
1357bc421551SDag-Erling Smørgravasctime.o:	private.h tzfile.h
1358bc421551SDag-Erling Smørgravdate.o:		private.h
1359bc421551SDag-Erling Smørgravdifftime.o:	private.h
136046c59934SDag-Erling Smørgravlocaltime.o:	private.h tzfile.h tzdir.h
1361bc421551SDag-Erling Smørgravstrftime.o:	private.h tzfile.h
1362bc421551SDag-Erling Smørgravzdump.o:	version.h
136346c59934SDag-Erling Smørgravzic.o:		private.h tzfile.h tzdir.h version.h
1364bc421551SDag-Erling Smørgrav
1365bc421551SDag-Erling Smørgrav.PHONY: ALL INSTALL all
1366bc421551SDag-Erling Smørgrav.PHONY: check check_mild check_time_t_alternatives
1367bc421551SDag-Erling Smørgrav.PHONY: check_web check_zishrink
136846c59934SDag-Erling Smørgrav.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd
136946c59934SDag-Erling Smørgrav.PHONY: fetch-leap-seconds.list force_tzs
1370*a979394aSDag-Erling Smørgrav.PHONY: install maintainer-clean names
1371bc421551SDag-Erling Smørgrav.PHONY: posix_only posix_right public
1372bc421551SDag-Erling Smørgrav.PHONY: rearguard_signatures rearguard_signatures_version
1373bc421551SDag-Erling Smørgrav.PHONY: rearguard_tarballs rearguard_tarballs_version
1374bc421551SDag-Erling Smørgrav.PHONY: right_only right_posix signatures signatures_version
1375bc421551SDag-Erling Smørgrav.PHONY: tarballs tarballs_version
1376bc421551SDag-Erling Smørgrav.PHONY: traditional_signatures traditional_signatures_version
1377bc421551SDag-Erling Smørgrav.PHONY: traditional_tarballs traditional_tarballs_version
1378bc421551SDag-Erling Smørgrav.PHONY: tailored_tarballs tailored_tarballs_version
1379bc421551SDag-Erling Smørgrav.PHONY: typecheck
1380bc421551SDag-Erling Smørgrav.PHONY: zonenames zones
1381bc421551SDag-Erling Smørgrav.PHONY: $(ZDS)
1382