Makefile revision 349598
1339630Sphilip# Make and install tzdb code and data.
2339630Sphilip
3308265Sgjb# This file is in the public domain, so clarified as of
4308265Sgjb# 2009-05-17 by Arthur David Olson.
5308265Sgjb
6308265Sgjb# Package name for the code distribution.
7308265SgjbPACKAGE=	tzcode
8308265Sgjb
9308265Sgjb# Version number for the distribution, overridden in the 'tarballs' rule below.
10308265SgjbVERSION=	unknown
11308265Sgjb
12308265Sgjb# Email address for bug reports.
13308265SgjbBUGEMAIL=	tz@iana.org
14308265Sgjb
15345670Sphilip# DATAFORM selects the data format.
16345670Sphilip# Available formats represent essentially the same data, albeit
17345670Sphilip# possibly with minor discrepancies that users are not likely to notice.
18345670Sphilip# To get new features and the best data right away, use:
19331662Sphilip#	DATAFORM=	vanguard
20331662Sphilip# To wait a while before using new features, to give downstream users
21331662Sphilip# time to upgrade zic (the default), use:
22331662Sphilip#	DATAFORM=	main
23331662Sphilip# To wait even longer for new features, use:
24331662Sphilip#	DATAFORM=	rearguard
25331662SphilipDATAFORM=		main
26331662Sphilip
27339630Sphilip# Change the line below for your timezone (after finding the one you want in
28339630Sphilip# one of the $(TDATA) source files, or adding it to a source file).
29339630Sphilip# Alternatively, if you discover you've got the wrong timezone, you can just
30308265Sgjb#	zic -l rightzone
31308265Sgjb# to correct things.
32308265Sgjb# Use the command
33308265Sgjb#	make zonenames
34308265Sgjb# to get a list of the values you can use for LOCALTIME.
35308265Sgjb
36308265SgjbLOCALTIME=	GMT
37308265Sgjb
38349598Sphilip# The POSIXRULES macro controls interpretation of nonstandard and obsolete
39349598Sphilip# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules.
40349598Sphilip# In the reference implementation, if you want something other than Eastern
41349598Sphilip# United States time as a template for handling these settings, you can
42339630Sphilip# change the line below (after finding the timezone you want in the
43339630Sphilip# one of the $(TDATA) source files, or adding it to a source file).
44349598Sphilip# A setting like TZ='EET-2EEST' is supposed to use the rules in the
45345670Sphilip# template file to determine "spring forward" and "fall back" days and
46308265Sgjb# times; the environment variable itself specifies UT offsets of standard and
47331662Sphilip# daylight saving time.
48339630Sphilip# Alternatively, if you discover you've got the wrong timezone, you can just
49308265Sgjb#	zic -p rightzone
50308265Sgjb# to correct things.
51308265Sgjb# Use the command
52308265Sgjb#	make zonenames
53308265Sgjb# to get a list of the values you can use for POSIXRULES.
54349598Sphilip#
55349598Sphilip# If POSIXRULES is empty, no template is installed; this is the intended
56349598Sphilip# future default for POSIXRULES.
57349598Sphilip#
58349598Sphilip# Nonempty POSIXRULES is obsolete and should not be relied on, because:
59349598Sphilip# * It does not work correctly in popular implementations such as GNU/Linux.
60349598Sphilip# * It does not work in the tzdb implementation for timestamps after 2037.
61349598Sphilip# * It is incompatible with 'zic -b slim' if POSIXRULES specifies transitions
62349598Sphilip#   at standard time or UT rather than at local time.
63349598Sphilip# In short, software should avoid ruleless settings like TZ='EET-2EEST'
64349598Sphilip# and so should not depend on the value of POSIXRULES.
65308265Sgjb
66308265SgjbPOSIXRULES=	America/New_York
67308265Sgjb
68308265Sgjb# Also see TZDEFRULESTRING below, which takes effect only
69308265Sgjb# if the time zone files cannot be accessed.
70308265Sgjb
71308265Sgjb
72328475Sphilip# Installation locations.
73328475Sphilip#
74328475Sphilip# The defaults are suitable for Debian, except that if REDO is
75328475Sphilip# posix_right or right_posix then files that Debian puts under
76328475Sphilip# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
77328475Sphilip# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
78328475Sphilip# respectively.  Problems with the Debian approach are discussed in
79328475Sphilip# the commentary for the right_posix rule (below).
80308265Sgjb
81328475Sphilip# Destination directory, which can be used for staging.
82328475Sphilip# 'make DESTDIR=/stage install' installs under /stage (e.g., to
83328475Sphilip# /stage/etc/localtime instead of to /etc/localtime).  Files under
84328475Sphilip# /stage are not intended to work as-is, but can be copied by hand to
85328475Sphilip# the root directory later.  If DESTDIR is empty, 'make install' does
86328475Sphilip# not stage, but installs directly into production locations.
87328475SphilipDESTDIR =
88328475Sphilip
89328475Sphilip# Everything is installed into subdirectories of TOPDIR, and used there.
90328475Sphilip# TOPDIR should be empty (meaning the root directory),
91328475Sphilip# or a directory name that does not end in "/".
92328475Sphilip# TOPDIR should be empty or an absolute name unless you're just testing.
93328475SphilipTOPDIR =
94328475Sphilip
95339630Sphilip# The default local timezone is taken from the file TZDEFAULT.
96328475SphilipTZDEFAULT = $(TOPDIR)/etc/localtime
97328475Sphilip
98328475Sphilip# The subdirectory containing installed program and data files, and
99328475Sphilip# likewise for installed files that can be shared among architectures.
100328475Sphilip# These should be relative file names.
101328475SphilipUSRDIR = usr
102328475SphilipUSRSHAREDIR = $(USRDIR)/share
103328475Sphilip
104339630Sphilip# "Compiled" timezone information is placed in the "TZDIR" directory
105308265Sgjb# (and subdirectories).
106325159Sphilip# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
107308265SgjbTZDIR_BASENAME=	zoneinfo
108328475SphilipTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
109308265Sgjb
110328475Sphilip# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
111328475SphilipBINDIR = $(TOPDIR)/$(USRDIR)/bin
112308265Sgjb
113328475Sphilip# The "zdump" command goes in:
114328475SphilipZDUMPDIR = $(BINDIR)
115308265Sgjb
116328475Sphilip# The "zic" command goes in:
117328475SphilipZICDIR = $(TOPDIR)/$(USRDIR)/sbin
118308265Sgjb
119308265Sgjb# Manual pages go in subdirectories of. . .
120328475SphilipMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
121308265Sgjb
122308265Sgjb# Library functions are put in an archive in LIBDIR.
123328475SphilipLIBDIR = $(TOPDIR)/$(USRDIR)/lib
124308265Sgjb
125308265Sgjb
126339630Sphilip# Types to try, as an alternative to time_t.
127339630SphilipTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
128339630SphilipTIME_T_ALTERNATIVES_HEAD = int64_t
129339630SphilipTIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
130328475Sphilip
131345670Sphilip# What kind of TZif data files to generate.  (TZif is the binary time
132345670Sphilip# zone data format that zic generates; see Internet RFC 8536.)
133316349Sbapt# If you want only POSIX time, with time values interpreted as
134316349Sbapt# seconds since the epoch (not counting leap seconds), use
135308265Sgjb#	REDO=		posix_only
136325159Sphilip# below.  If you want only "right" time, with values interpreted
137316349Sbapt# as seconds since the epoch (counting leap seconds), use
138308265Sgjb#	REDO=		right_only
139308265Sgjb# below.  If you want both sets of data available, with leap seconds not
140308265Sgjb# counted normally, use
141308265Sgjb#	REDO=		posix_right
142308265Sgjb# below.  If you want both sets of data available, with leap seconds counted
143308265Sgjb# normally, use
144308265Sgjb#	REDO=		right_posix
145308265Sgjb# below.  POSIX mandates that leap seconds not be counted; for compatibility
146316349Sbapt# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
147316349Sbapt# leap smearing; this can work better than unsmeared "right" time with
148316349Sbapt# applications that are not leap second aware, and is closer to unsmeared
149316349Sbapt# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
150308265Sgjb
151308265SgjbREDO=		posix_right
152308265Sgjb
153339630Sphilip# To install data in text form that has all the information of the TZif data,
154325159Sphilip# (optionally incorporating leap second information), use
155325159Sphilip#	TZDATA_TEXT=	tzdata.zi leapseconds
156325159Sphilip# To install text data without leap second information (e.g., because
157325159Sphilip# REDO='posix_only'), use
158325159Sphilip#	TZDATA_TEXT=	tzdata.zi
159325159Sphilip# To avoid installing text data, use
160325159Sphilip#	TZDATA_TEXT=
161325159Sphilip
162325159SphilipTZDATA_TEXT=	leapseconds tzdata.zi
163325159Sphilip
164325159Sphilip# For backward-compatibility links for old zone names, use
165328475Sphilip#	BACKWARD=	backward
166328475Sphilip# If you also want the link US/Pacific-New, even though it is confusing
167328475Sphilip# and is planned to be removed from the database eventually, use
168325159Sphilip#	BACKWARD=	backward pacificnew
169325159Sphilip# To omit these links, use
170325159Sphilip#	BACKWARD=
171325159Sphilip
172328475SphilipBACKWARD=	backward
173325159Sphilip
174308265Sgjb# If you want out-of-scope and often-wrong data from the file 'backzone', use
175308265Sgjb#	PACKRATDATA=	backzone
176308265Sgjb# To omit this data, use
177308265Sgjb#	PACKRATDATA=
178308265Sgjb
179308265SgjbPACKRATDATA=
180308265Sgjb
181325159Sphilip# The name of a locale using the UTF-8 encoding, used during self-tests.
182325159Sphilip# The tests are skipped if the name does not appear to work on this system.
183325159Sphilip
184325159SphilipUTF8_LOCALE=	en_US.utf8
185325159Sphilip
186308265Sgjb# Since "." may not be in PATH...
187308265Sgjb
188308265SgjbYEARISTYPE=	./yearistype
189308265Sgjb
190308265Sgjb# Non-default libraries needed to link.
191308265SgjbLDLIBS=
192308265Sgjb
193325159Sphilip# Add the following to the end of the "CFLAGS=" line as needed to override
194325159Sphilip# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
195325159Sphilip#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
196325159Sphilip#	formats that generate only the last two digits of year numbers
197325159Sphilip#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
198325159Sphilip#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
199325159Sphilip#	than what POSIX specifies, assuming local time is UT.
200325159Sphilip#	For example, N is 252460800 on AmigaOS.
201308265Sgjb#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
202325159Sphilip#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
203308265Sgjb#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
204325159Sphilip#  -DHAVE_GENERIC=0 if _Generic does not work
205325159Sphilip#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
206325159Sphilip#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
207308265Sgjb#	ctime_r and asctime_r incompatibly with the POSIX standard
208308265Sgjb#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
209325159Sphilip#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
210308265Sgjb#  -DHAVE_LINK=0 if your system lacks a link function
211308265Sgjb#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
212308265Sgjb#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
213308265Sgjb#	localtime_rz can make zdump significantly faster, but is nonstandard.
214308265Sgjb#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
215308265Sgjb#	functions like 'link' or variables like 'tzname' required by POSIX
216325159Sphilip#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
217325159Sphilip#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
218325159Sphilip#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
219325159Sphilip#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
220308265Sgjb#  -DHAVE_STRDUP=0 if your system lacks the strdup function
221331662Sphilip#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
222308265Sgjb#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
223325159Sphilip#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
224325159Sphilip#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
225308265Sgjb#  -DHAVE_TZSET=0 if your system lacks a tzset function
226325159Sphilip#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
227325159Sphilip#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
228331662Sphilip#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
229331662Sphilip#	with external linkage, e.g., applications cannot define 'localtime'.
230325159Sphilip#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
231331662Sphilip#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
232331662Sphilip#	security implications and is not recommended for general use
233325159Sphilip#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
234308265Sgjb#	not needed by the main-program tz code, which is single-threaded.
235308265Sgjb#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
236308265Sgjb#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
237325159Sphilip#	This is intended for internal use only; it mangles external names.
238308265Sgjb#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
239308265Sgjb#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
240308265Sgjb#	the default is system-supplied, typically "/usr/lib/locale"
241308265Sgjb#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
242308265Sgjb#	DST transitions if the time zone files cannot be accessed
243325159Sphilip#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
244308265Sgjb#	other than simply getting garbage data
245308265Sgjb#  -DUSE_LTZ=0 to build zdump with the system time zone library
246308265Sgjb#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
247349598Sphilip#  -DZIC_BLOAT_DEFAULT=\"slim\" to default zic's -b option to "slim", and
248349598Sphilip#	similarly for "fat".  Fat TZif files work around incompatibilities
249349598Sphilip#	and bugs in some TZif readers, notably readers that mishandle 64-bit
250349598Sphilip#	data in TZif files.  Slim TZif files are more efficient and do not
251349598Sphilip#	work around these incompatibilities and bugs.  If not given, the
252349598Sphilip#	current default is "fat" but this is intended to change as readers
253349598Sphilip#	requiring fat files often mishandle timestamps after 2037 anyway.
254308265Sgjb#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
255308265Sgjb#	(or some other number) to set the maximum time zone abbreviation length
256308265Sgjb#	that zic will accept without a warning (the default is 6)
257308265Sgjb#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
258325159Sphilip# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
259325159SphilipGCC_INSTRUMENT = \
260325159Sphilip  -fsanitize=undefined -fsanitize-address-use-after-scope \
261325159Sphilip  -fsanitize-undefined-trap-on-error -fstack-protector
262325159SphilipGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
263325159Sphilip  $(GCC_INSTRUMENT) \
264325159Sphilip  -Wall -Wextra \
265325159Sphilip  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
266333312Sphilip  -Wbad-function-cast -Wcast-align=strict -Wdate-time \
267325159Sphilip  -Wdeclaration-after-statement -Wdouble-promotion \
268325159Sphilip  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
269325159Sphilip  -Winit-self -Wjump-misses-init -Wlogical-op \
270325159Sphilip  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
271325159Sphilip  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
272333312Sphilip  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 \
273333312Sphilip  -Wstringop-truncation -Wsuggest-attribute=cold \
274325159Sphilip  -Wsuggest-attribute=const -Wsuggest-attribute=format \
275333312Sphilip  -Wsuggest-attribute=malloc \
276325159Sphilip  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
277325159Sphilip  -Wtrampolines -Wundef -Wuninitialized -Wunused \
278325159Sphilip  -Wvariadic-macros -Wvla -Wwrite-strings \
279325159Sphilip  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
280325159Sphilip  -Wno-type-limits -Wno-unused-parameter
281308265Sgjb#
282308265Sgjb# If your system has a "GMT offset" field in its "struct tm"s
283308265Sgjb# (or if you decide to add such a field in your system's "time.h" file),
284308265Sgjb# add the name to a define such as
285308265Sgjb#	-DTM_GMTOFF=tm_gmtoff
286308265Sgjb# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
287308265Sgjb# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
288308265Sgjb# Similarly, if your system has a "zone abbreviation" field, define
289308265Sgjb#	-DTM_ZONE=tm_zone
290308265Sgjb# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
291308265Sgjb# required by POSIX, but are widely available on GNU/Linux and BSD systems.
292308265Sgjb#
293325159Sphilip# The next batch of options control support for external variables
294325159Sphilip# exported by tzcode.  In practice these variables are less useful
295325159Sphilip# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
296325159Sphilip# #
297325159Sphilip# # To omit or support the external variable "tzname", add one of:
298325159Sphilip# #	-DHAVE_TZNAME=0
299325159Sphilip# #	-DHAVE_TZNAME=1
300325159Sphilip# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
301325159Sphilip# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
302325159Sphilip# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
303325159Sphilip# # crashes when combined with some platforms' standard libraries,
304325159Sphilip# # presumably due to memory allocation issues.
305325159Sphilip# #
306325159Sphilip# # To omit or support the external variables "timezone" and "daylight", add
307325159Sphilip# #	-DUSG_COMPAT=0
308325159Sphilip# #	-DUSG_COMPAT=1
309325159Sphilip# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
310325159Sphilip# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
311325159Sphilip# # If not defined, the code attempts to guess USG_COMPAT from other macros.
312325159Sphilip# #
313325159Sphilip# # To support the external variable "altzone", add
314325159Sphilip# #	-DALTZONE
315325159Sphilip# # to the end of the "CFLAGS=" line; although "altzone" appeared in
316325159Sphilip# # System V Release 3.1 it has not been standardized.
317325159Sphilip#
318308265Sgjb# If you want functions that were inspired by early versions of X3J11's work,
319308265Sgjb# add
320308265Sgjb#	-DSTD_INSPIRED
321308265Sgjb# to the end of the "CFLAGS=" line.  This arranges for the functions
322308265Sgjb# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
323308265Sgjb# "posix2time", and "time2posix" to be added to the time conversion library.
324308265Sgjb# "tzsetwall" is like "tzset" except that it arranges for local wall clock
325339630Sphilip# time (rather than the timezone specified in the TZ environment variable)
326308265Sgjb# to be used.
327308265Sgjb# "offtime" is like "gmtime" except that it accepts a second (long) argument
328308265Sgjb# that gives an offset to add to the time_t when converting it.
329308265Sgjb# "timelocal" is equivalent to "mktime".
330308265Sgjb# "timegm" is like "timelocal" except that it turns a struct tm into
331308265Sgjb# a time_t using UT (rather than local time as "timelocal" does).
332308265Sgjb# "timeoff" is like "timegm" except that it accepts a second (long) argument
333308265Sgjb# that gives an offset to use when converting to a time_t.
334308265Sgjb# "posix2time" and "time2posix" are described in an included manual page.
335308265Sgjb# X3J11's work does not describe any of these functions.
336308265Sgjb# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
337308265Sgjb# These functions may well disappear in future releases of the time
338308265Sgjb# conversion package.
339308265Sgjb#
340308265Sgjb# If you don't want functions that were inspired by NetBSD, add
341308265Sgjb#	-DNETBSD_INSPIRED=0
342308265Sgjb# to the end of the "CFLAGS=" line.  Otherwise, the functions
343308265Sgjb# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
344308265Sgjb# time library, and if STD_INSPIRED is also defined the functions
345308265Sgjb# "posix2time_z" and "time2posix_z" are added as well.
346308265Sgjb# The functions ending in "_z" (or "_rz") are like their unsuffixed
347308265Sgjb# (or suffixed-by-"_r") counterparts, except with an extra first
348339630Sphilip# argument of opaque type timezone_t that specifies the timezone.
349308265Sgjb# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
350308265Sgjb#
351308265Sgjb# If you want to allocate state structures in localtime, add
352308265Sgjb#	-DALL_STATE
353308265Sgjb# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
354308265Sgjb#
355308265Sgjb# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
356308265Sgjb# out by the National Institute of Standards and Technology
357308265Sgjb# which claims to test C and Posix conformance.  If you want to pass PCTS, add
358308265Sgjb#	-DPCTS
359308265Sgjb# to the end of the "CFLAGS=" line.
360308265Sgjb#
361308265Sgjb# If you want strict compliance with XPG4 as of 1994-04-09, add
362308265Sgjb#	-DXPG4_1994_04_09
363308265Sgjb# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
364325159Sphilip# 53 as a week number (rather than 52 or 53) for January days before
365325159Sphilip# January's first Monday when a "%V" format is used and January 1
366308265Sgjb# falls on a Friday, Saturday, or Sunday.
367308265Sgjb
368308265SgjbCFLAGS=
369308265Sgjb
370308265Sgjb# Linker flags.  Default to $(LFLAGS) for backwards compatibility
371308265Sgjb# to release 2012h and earlier.
372308265Sgjb
373308265SgjbLDFLAGS=	$(LFLAGS)
374308265Sgjb
375308265Sgjb# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
376308265Sgjb# submake command lines.  The default is no leap seconds.
377308265Sgjb
378308265SgjbLEAPSECONDS=
379308265Sgjb
380308265Sgjb# The zic command and its arguments.
381308265Sgjb
382308265Sgjbzic=		./zic
383308265SgjbZIC=		$(zic) $(ZFLAGS)
384308265Sgjb
385345670Sphilip# To shrink the size of installed TZif files,
386345670Sphilip# append "-r @N" to omit data before N-seconds-after-the-Epoch.
387349598Sphilip# You can also append "-b slim" if that is not already the default;
388349598Sphilip# see ZIC_BLOAT_DEFAULT above.
389349598Sphilip# See the zic man page for more about -b and -r.
390308265SgjbZFLAGS=
391308265Sgjb
392339630Sphilip# How to use zic to install TZif files.
393308265Sgjb
394328475SphilipZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
395308265Sgjb
396308265Sgjb# The name of a Posix-compliant 'awk' on your system.
397339630Sphilip# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core;
398339630Sphilip# on Ubuntu you can work around this with
399339630Sphilip#	AWK=		gawk
400308265SgjbAWK=		awk
401308265Sgjb
402308265Sgjb# The full path name of a Posix-compliant shell, preferably one that supports
403308265Sgjb# the Korn shell's 'select' statement as an extension.
404308265Sgjb# These days, Bash is the most popular.
405308265Sgjb# It should be OK to set this to /bin/sh, on platforms where /bin/sh
406308265Sgjb# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
407308265Sgjb# is typically nicer if it works.
408308265SgjbKSHELL=		/bin/bash
409308265Sgjb
410342668Sphilip# Name of curl <https://curl.haxx.se/>, used for HTML validation.
411342668SphilipCURL=		curl
412342668Sphilip
413349598Sphilip# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
414349598SphilipGPG=		gpg
415349598Sphilip
416308265Sgjb# The path where SGML DTDs are kept and the catalog file(s) to use when
417342668Sphilip# validating HTML 4.01.  The default should work on both Debian and Red Hat.
418308265SgjbSGML_TOPDIR= /usr
419308265SgjbSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
420308265SgjbSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
421308265SgjbSGML_CATALOG_FILES= \
422308265Sgjb  $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat:$(SGML_TOPDIR)/share/sgml/html/4.01/HTML4.cat
423308265Sgjb
424342668Sphilip# The name, arguments and environment of a program to validate HTML 4.01.
425308265Sgjb# See <http://openjade.sourceforge.net/doc/> for a validator, and
426308265Sgjb# <https://validator.w3.org/source/> for a validation library.
427325159Sphilip# Set VALIDATE=':' if you do not have such a program.
428308265SgjbVALIDATE = nsgmls
429308265SgjbVALIDATE_FLAGS = -s -B -wall -wno-unused-param
430308265SgjbVALIDATE_ENV = \
431328475Sphilip  SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \
432328475Sphilip  SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \
433308265Sgjb  SP_CHARSET_FIXED=YES \
434308265Sgjb  SP_ENCODING=UTF-8
435308265Sgjb
436308265Sgjb# This expensive test requires USE_LTZ.
437308265Sgjb# To suppress it, define this macro to be empty.
438308265SgjbCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
439308265Sgjb
440308265Sgjb# SAFE_CHAR is a regular expression that matches a safe character.
441308265Sgjb# Some parts of this distribution are limited to safe characters;
442308265Sgjb# others can use any UTF-8 character.
443308265Sgjb# For now, the safe characters are a safe subset of ASCII.
444308265Sgjb# The caller must set the shell variable 'sharp' to the character '#',
445308265Sgjb# since Makefile macros cannot contain '#'.
446308265Sgjb# TAB_CHAR is a single tab character, in single quotes.
447308265SgjbTAB_CHAR=	'	'
448308265SgjbSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
449308265SgjbSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
450308265SgjbSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
451308265SgjbSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
452308265SgjbSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
453308265Sgjb
454339630Sphilip# These characters are Latin-1, and so are likely to be displayable
455339630Sphilip# even in editors with limited character sets.
456339630SphilipUNUSUAL_OK_LATIN_1 = ��������������
457339630Sphilip# This IPA symbol is represented in Unicode as the composition of
458339630Sphilip# U+0075 and U+032F, and U+032F is not considered alphabetic by some
459339630Sphilip# grep implementations that do not grok composition.
460339630SphilipUNUSUAL_OK_IPA = u��
461331662Sphilip# Non-ASCII non-letters that OK_CHAR allows, as these characters are
462339630Sphilip# useful in commentary.
463339630SphilipUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
464331662Sphilip
465308265Sgjb# OK_CHAR matches any character allowed in the distributed files.
466331662Sphilip# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
467331662Sphilip# multibyte letters are also allowed so that commentary can contain a
468331662Sphilip# few safe symbols and people's names and can quote non-English sources.
469331662Sphilip# Other non-letters are limited to ASCII renderings for the
470331662Sphilip# convenience of maintainers using XEmacs 21.5.34, which by default
471331662Sphilip# mishandles Unicode characters U+0100 and greater.
472331662SphilipOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
473308265Sgjb
474308265Sgjb# SAFE_LINE matches a line of safe characters.
475308265Sgjb# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
476308265Sgjb# this is so that comments can contain non-ASCII characters.
477308265Sgjb# OK_LINE matches a line of OK characters.
478308265SgjbSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
479308265SgjbSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
480308265SgjbOK_LINE=	'^'$(OK_CHAR)'*$$'
481308265Sgjb
482308265Sgjb# Flags to give 'tar' when making a distribution.
483308265Sgjb# Try to use flags appropriate for GNU tar.
484308265SgjbGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
485308265SgjbTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
486308265Sgjb		 then echo $(GNUTARFLAGS); \
487308265Sgjb		 else :; \
488308265Sgjb		 fi`
489308265Sgjb
490308265Sgjb# Flags to give 'gzip' when making a distribution.
491308265SgjbGZIPFLAGS=	-9n
492308265Sgjb
493308265Sgjb###############################################################################
494308265Sgjb
495308265Sgjb#MAKE=		make
496308265Sgjb
497308265Sgjbcc=		cc
498328475SphilipCC=		$(cc) -DTZDIR='"$(TZDIR)"'
499308265Sgjb
500308265SgjbAR=		ar
501308265Sgjb
502308265Sgjb# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
503308265SgjbRANLIB=		:
504308265Sgjb
505308265SgjbTZCOBJS=	zic.o
506325159SphilipTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
507308265SgjbDATEOBJS=	date.o localtime.o strftime.o asctime.o
508308265SgjbLIBSRCS=	localtime.c asctime.c difftime.c
509308265SgjbLIBOBJS=	localtime.o asctime.o difftime.o
510308265SgjbHEADERS=	tzfile.h private.h
511308265SgjbNONLIBSRCS=	zic.c zdump.c
512308265SgjbNEWUCBSRCS=	date.c strftime.c
513308265SgjbSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
514308265Sgjb			tzselect.ksh workman.sh
515308265SgjbMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
516308265Sgjb			tzfile.5 tzselect.8 zic.8 zdump.8
517308265SgjbMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
518308265Sgjb			time2posix.3.txt \
519308265Sgjb			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
520308265Sgjb			date.1.txt
521325159SphilipCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
522325159Sphilip			NEWS README theory.html version
523328475SphilipWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
524345670SphilipCHECK_WEB_PAGES=check_theory.html check_tz-art.html \
525345670Sphilip			check_tz-how-to.html check_tz-link.html
526308265SgjbDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
527308265SgjbPRIMARY_YDATA=	africa antarctica asia australasia \
528308265Sgjb		europe northamerica southamerica
529328475SphilipYDATA=		$(PRIMARY_YDATA) etcetera
530308265SgjbNDATA=		systemv factory
531328475SphilipTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward pacificnew
532328475SphilipTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
533308265SgjbZONETABLES=	zone1970.tab zone.tab
534325159SphilipTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
535308265SgjbLEAP_DEPS=	leapseconds.awk leap-seconds.list
536331662SphilipTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
537331662SphilipDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
538328475SphilipDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
539325159Sphilip			leapseconds yearistype.sh $(ZONETABLES)
540331662SphilipAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
541331662Sphilip			ziguard.awk zishrink.awk
542308265SgjbMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
543308265SgjbTZS_YEAR=	2050
544339630SphilipTZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
545308265SgjbTZS=		to$(TZS_YEAR).tzs
546308265SgjbTZS_NEW=	to$(TZS_YEAR)new.tzs
547308265SgjbTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
548308265Sgjb			private.h tzfile.h zdump.c zic.c
549339630Sphilip# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
550339630SphilipEIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
551339630SphilipENCHILADA = $(EIGHT_YARDS) $(TZS)
552308265Sgjb
553308265Sgjb# Consult these files when deciding whether to rebuild the 'version' file.
554308265Sgjb# This list is not the same as the output of 'git ls-files', since
555308265Sgjb# .gitignore is not distributed.
556308265SgjbVERSION_DEPS= \
557325159Sphilip		calendars CONTRIBUTING LICENSE Makefile NEWS README \
558308265Sgjb		africa antarctica asctime.c asia australasia \
559308265Sgjb		backward backzone \
560308265Sgjb		checklinks.awk checktab.awk \
561308265Sgjb		date.1 date.c difftime.c \
562308265Sgjb		etcetera europe factory iso3166.tab \
563308265Sgjb		leap-seconds.list leapseconds.awk localtime.c \
564308265Sgjb		newctime.3 newstrftime.3 newtzset.3 northamerica \
565308265Sgjb		pacificnew private.h \
566325159Sphilip		southamerica strftime.c systemv theory.html \
567328475Sphilip		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
568308265Sgjb		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
569308265Sgjb		workman.sh yearistype.sh \
570308265Sgjb		zdump.8 zdump.c zic.8 zic.c \
571333312Sphilip		ziguard.awk zishrink.awk \
572308265Sgjb		zone.tab zone1970.tab zoneinfo2tdf.pl
573308265Sgjb
574308265Sgjb# And for the benefit of csh users on systems that assume the user
575308265Sgjb# shell should be used to handle commands in Makefiles. . .
576308265Sgjb
577308265SgjbSHELL=		/bin/sh
578308265Sgjb
579331662Sphilipall:		tzselect yearistype zic zdump libtz.a $(TABDATA) \
580331662Sphilip		  vanguard.zi main.zi rearguard.zi
581308265Sgjb
582308265SgjbALL:		all date $(ENCHILADA)
583308265Sgjb
584308265Sgjbinstall:	all $(DATA) $(REDO) $(MANS)
585328475Sphilip		mkdir -p '$(DESTDIR)$(BINDIR)' \
586328475Sphilip			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
587328475Sphilip			'$(DESTDIR)$(LIBDIR)' \
588328475Sphilip			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
589328475Sphilip			'$(DESTDIR)$(MANDIR)/man8'
590349598Sphilip		$(ZIC_INSTALL) -l $(LOCALTIME) \
591349598Sphilip			`case '$(POSIXRULES)' in ?*) echo '-p';; esac \
592349598Sphilip			` $(POSIXRULES) \
593328475Sphilip			-t '$(DESTDIR)$(TZDEFAULT)'
594328475Sphilip		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
595328475Sphilip		cp tzselect '$(DESTDIR)$(BINDIR)/.'
596328475Sphilip		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
597328475Sphilip		cp zic '$(DESTDIR)$(ZICDIR)/.'
598328475Sphilip		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
599328475Sphilip		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
600328475Sphilip		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
601328475Sphilip		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
602328475Sphilip		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
603308265Sgjb
604308265SgjbINSTALL:	ALL install date.1
605328475Sphilip		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
606328475Sphilip		cp date '$(DESTDIR)$(BINDIR)/.'
607328475Sphilip		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
608308265Sgjb
609308265Sgjbversion:	$(VERSION_DEPS)
610308265Sgjb		{ (type git) >/dev/null 2>&1 && \
611308265Sgjb		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
612308265Sgjb				--abbrev=7 --dirty` || \
613328475Sphilip		  V='$(VERSION)'; } && \
614308265Sgjb		printf '%s\n' "$$V" >$@.out
615308265Sgjb		mv $@.out $@
616308265Sgjb
617339630Sphilip# These files can be tailored by setting BACKWARD and PACKRATDATA.
618331662Sphilipvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
619333312Sphilip		$(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
620333312Sphilip		  $(TDATA) $(PACKRATDATA) >$@.out
621331662Sphilip		mv $@.out $@
622339630Sphilip# This file has a version comment that attempts to capture any tailoring
623339630Sphilip# via BACKWARD, DATAFORM, PACKRATDATA, and REDO.
624339630Sphiliptzdata.zi:	$(DATAFORM).zi version zishrink.awk
625328475Sphilip		version=`sed 1q version` && \
626339630Sphilip		  LC_ALL=C $(AWK) \
627339630Sphilip		    -v dataform='$(DATAFORM)' \
628339630Sphilip		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
629339630Sphilip		    -v redo='$(REDO)' \
630339630Sphilip		    -v version="$$version" \
631339630Sphilip		    -f zishrink.awk \
632331662Sphilip		    $(DATAFORM).zi >$@.out
633325159Sphilip		mv $@.out $@
634325159Sphilip
635308265Sgjbversion.h:	version
636308265Sgjb		VERSION=`cat version` && printf '%s\n' \
637308265Sgjb		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
638308265Sgjb		  "static char const TZVERSION[]=\"$$VERSION\";" \
639308265Sgjb		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
640308265Sgjb		  >$@.out
641308265Sgjb		mv $@.out $@
642308265Sgjb
643308265Sgjbzdump:		$(TZDOBJS)
644308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
645308265Sgjb
646308265Sgjbzic:		$(TZCOBJS)
647308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
648308265Sgjb
649308265Sgjbyearistype:	yearistype.sh
650308265Sgjb		cp yearistype.sh yearistype
651308265Sgjb		chmod +x yearistype
652308265Sgjb
653308265Sgjbleapseconds:	$(LEAP_DEPS)
654308265Sgjb		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
655308265Sgjb		mv $@.out $@
656308265Sgjb
657308265Sgjb# Arguments to pass to submakes of install_data.
658308265Sgjb# They can be overridden by later submake arguments.
659308265SgjbINSTALLARGS = \
660328475Sphilip BACKWARD='$(BACKWARD)' \
661328475Sphilip DESTDIR='$(DESTDIR)' \
662308265Sgjb LEAPSECONDS='$(LEAPSECONDS)' \
663308265Sgjb PACKRATDATA='$(PACKRATDATA)' \
664328475Sphilip TZDEFAULT='$(TZDEFAULT)' \
665328475Sphilip TZDIR='$(TZDIR)' \
666328475Sphilip YEARISTYPE='$(YEARISTYPE)' \
667308265Sgjb ZIC='$(ZIC)'
668308265Sgjb
669339630SphilipINSTALL_DATA_DEPS = zic leapseconds yearistype tzdata.zi
670339630Sphilip
671339630Sphilip# 'make install_data' installs one set of TZif files.
672339630Sphilipinstall_data: $(INSTALL_DATA_DEPS)
673325159Sphilip		$(ZIC_INSTALL) tzdata.zi
674308265Sgjb
675339630Sphilipposix_only: $(INSTALL_DATA_DEPS)
676308265Sgjb		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
677308265Sgjb
678339630Sphilipright_only: $(INSTALL_DATA_DEPS)
679308265Sgjb		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
680308265Sgjb			install_data
681308265Sgjb
682308265Sgjb# In earlier versions of this makefile, the other two directories were
683308265Sgjb# subdirectories of $(TZDIR).  However, this led to configuration errors.
684308265Sgjb# For example, with posix_right under the earlier scheme,
685308265Sgjb# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
686308265Sgjb# but gmtime without leap seconds, which led to problems with applications
687308265Sgjb# like sendmail that subtract gmtime from localtime.
688308265Sgjb# Therefore, the other two directories are now siblings of $(TZDIR).
689308265Sgjb# You must replace all of $(TZDIR) to switch from not using leap seconds
690308265Sgjb# to using them, or vice versa.
691308265Sgjbright_posix:	right_only
692328475Sphilip		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
693328475Sphilip		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
694328475Sphilip		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
695328475Sphilip		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
696308265Sgjb
697308265Sgjbposix_right:	posix_only
698328475Sphilip		rm -fr '$(DESTDIR)$(TZDIR)-posix'
699328475Sphilip		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
700328475Sphilip		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
701328475Sphilip		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
702308265Sgjb
703308265Sgjb# This obsolescent rule is present for backwards compatibility with
704308265Sgjb# tz releases 2014g through 2015g.  It should go away eventually.
705339630Sphilipposix_packrat: $(INSTALL_DATA_DEPS)
706308265Sgjb		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
707308265Sgjb
708308265Sgjbzones:		$(REDO)
709308265Sgjb
710331662Sphilip# dummy.zd is not a real file; it is mentioned here only so that the
711331662Sphilip# top-level 'make' does not have a syntax error.
712331662SphilipZDS = dummy.zd
713331662Sphilip# Rule used only by submakes invoked by the $(TZS_NEW) rule.
714331662Sphilip# It is separate so that GNU 'make -j' can run instances in parallel.
715331662Sphilip$(ZDS): zdump
716339630Sphilip		./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
717339630Sphilip		  >$@
718331662Sphilip
719339630SphilipTZS_NEW_DEPS = tzdata.zi zdump zic
720339630Sphilip$(TZS_NEW): $(TZS_NEW_DEPS)
721339630Sphilip		rm -fr tzs$(TZS_YEAR).dir
722339630Sphilip		mkdir tzs$(TZS_YEAR).dir
723339630Sphilip		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
724325159Sphilip		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
725325159Sphilip		   tzdata.zi | LC_ALL=C sort >$@.out
726308265Sgjb		wd=`pwd` && \
727339630Sphilip		x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
728339630Sphilip				tzdata.zi \
729331662Sphilip			| LC_ALL=C sort -t . -k 2,2` && \
730339630Sphilip		set x $$x && \
731331662Sphilip		shift && \
732331662Sphilip		ZDS=$$* && \
733339630Sphilip		$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
734339630Sphilip		  ZDS="$$ZDS" $$ZDS && \
735339630Sphilip		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
736339630Sphilip		rm -fr tzs$(TZS_YEAR).dir
737331662Sphilip		mv $@.out $@
738308265Sgjb
739339630Sphilip# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
740308265Sgjb# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
741308265Sgjb$(TZS):
742339630Sphilip		touch $@
743308265Sgjb
744308265Sgjbforce_tzs:	$(TZS_NEW)
745308265Sgjb		cp $(TZS_NEW) $(TZS)
746308265Sgjb
747308265Sgjblibtz.a:	$(LIBOBJS)
748309792Sbapt		rm -f $@
749309792Sbapt		$(AR) -rc $@ $(LIBOBJS)
750308265Sgjb		$(RANLIB) $@
751308265Sgjb
752308265Sgjbdate:		$(DATEOBJS)
753308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
754308265Sgjb
755308265Sgjbtzselect:	tzselect.ksh version
756308265Sgjb		VERSION=`cat version` && sed \
757308265Sgjb			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
758308265Sgjb			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
759308265Sgjb			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
760308265Sgjb			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
761308265Sgjb			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
762308265Sgjb			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
763308265Sgjb			<$@.ksh >$@.out
764308265Sgjb		chmod +x $@.out
765308265Sgjb		mv $@.out $@
766308265Sgjb
767325159Sphilipcheck:		check_character_set check_white_space check_links \
768325159Sphilip		  check_name_lengths check_sorted \
769325159Sphilip		  check_tables check_web check_zishrink check_tzs
770308265Sgjb
771308265Sgjbcheck_character_set: $(ENCHILADA)
772325159Sphilip	test ! '$(UTF8_LOCALE)' || \
773325159Sphilip	! printf 'A\304\200B\n' | \
774325159Sphilip	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
775325159Sphilip		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
776308265Sgjb		sharp='#' && \
777308265Sgjb		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
778308265Sgjb			$(MISC) $(SOURCES) $(WEB_PAGES) \
779331662Sphilip			CONTRIBUTING LICENSE README \
780325159Sphilip			version tzdata.zi && \
781339630Sphilip		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
782331662Sphilip			Makefile && \
783328475Sphilip		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
784308265Sgjb			leapseconds yearistype.sh zone.tab && \
785325159Sphilip		! grep -Env $(OK_LINE) $(ENCHILADA); \
786325159Sphilip	}
787339630Sphilip	touch $@
788308265Sgjb
789308265Sgjbcheck_white_space: $(ENCHILADA)
790308265Sgjb		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
791339630Sphilip		! grep -En "$$pat" \
792339630Sphilip			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
793328475Sphilip		! grep -n '[[:space:]]$$' \
794328475Sphilip			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
795339630Sphilip		touch $@
796308265Sgjb
797325159SphilipPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
798325159SphilipFILE_NAME_COMPONENT_TOO_LONG = \
799325159Sphilip  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
800325159Sphilip
801328475Sphilipcheck_name_lengths: $(TDATA_TO_CHECK) backzone
802328475Sphilip		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
803328475Sphilip			$(TDATA_TO_CHECK) backzone
804339630Sphilip		touch $@
805325159Sphilip
806308265SgjbCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
807308265Sgjb
808308265Sgjbcheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
809308265Sgjb		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
810308265Sgjb		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
811339630Sphilip		touch $@
812308265Sgjb
813331662Sphilipcheck_links:	checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
814328475Sphilip		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
815325159Sphilip		$(AWK) -f checklinks.awk tzdata.zi
816339630Sphilip		touch $@
817308265Sgjb
818308265Sgjbcheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
819308265Sgjb		for tab in $(ZONETABLES); do \
820308265Sgjb		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
821308265Sgjb		    || exit; \
822308265Sgjb		done
823339630Sphilip		touch $@
824308265Sgjb
825308265Sgjbcheck_tzs:	$(TZS) $(TZS_NEW)
826339630Sphilip		if test -s $(TZS); then \
827339630Sphilip		  diff -u $(TZS) $(TZS_NEW); \
828339630Sphilip		else \
829339630Sphilip		  cp $(TZS_NEW) $(TZS); \
830339630Sphilip		fi
831339630Sphilip		touch $@
832308265Sgjb
833342668Sphilipcheck_web:	$(CHECK_WEB_PAGES)
834345670Sphilipcheck_theory.html: theory.html
835342668Sphilipcheck_tz-art.html: tz-art.html
836342668Sphilipcheck_tz-link.html: tz-link.html
837345670Sphilipcheck_theory.html check_tz-art.html check_tz-link.html:
838342668Sphilip		$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
839342668Sphilip		    -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
840342668Sphilip		  test ! -s $@.out || { cat $@.out; exit 1; }
841342668Sphilip		mv $@.out $@
842342668Sphilipcheck_tz-how-to.html: tz-how-to.html
843325159Sphilip		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
844339630Sphilip		touch $@
845308265Sgjb
846331662Sphilip# Check that zishrink.awk does not alter the data, and that ziguard.awk
847331662Sphilip# preserves main-format data.
848339630Sphilipcheck_zishrink: check_zishrink_posix check_zishrink_right
849339630Sphilipcheck_zishrink_posix check_zishrink_right: \
850339630Sphilip  zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi
851339630Sphilip		rm -fr $@.dir $@-t.dir $@-shrunk.dir
852339630Sphilip		mkdir $@.dir $@-t.dir $@-shrunk.dir
853339630Sphilip		case $@ in \
854339630Sphilip		  *_right) leap='-L leapseconds';; \
855339630Sphilip		  *) leap=;; \
856339630Sphilip		esac && \
857339630Sphilip		  $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
858339630Sphilip		  $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
859331662Sphilip		  case $(DATAFORM) in \
860331662Sphilip		    main) \
861339630Sphilip		      $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
862331662Sphilip		      $(AWK) '/^Rule/' $(TDATA) | \
863339630Sphilip			$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
864339630Sphilip		      diff -r $@.dir $@-t.dir;; \
865339630Sphilip		  esac
866339630Sphilip		diff -r $@.dir $@-shrunk.dir
867339630Sphilip		rm -fr $@.dir $@-t.dir $@-shrunk.dir
868339630Sphilip		touch $@
869325159Sphilip
870308265Sgjbclean_misc:
871345670Sphilip		rm -fr check_*.dir
872339630Sphilip		rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
873339630Sphilip		  check_* core typecheck_* \
874308265Sgjb		  date tzselect version.h zdump zic yearistype libtz.a
875308265Sgjbclean:		clean_misc
876345670Sphilip		rm -fr *.dir tzdb-*/
877345670Sphilip		rm -f *.zi $(TZS_NEW)
878308265Sgjb
879308265Sgjbmaintainer-clean: clean
880308265Sgjb		@echo 'This command is intended for maintainers to use; it'
881308265Sgjb		@echo 'deletes files that may need special tools to rebuild.'
882308265Sgjb		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
883308265Sgjb
884308265Sgjbnames:
885308265Sgjb		@echo $(ENCHILADA)
886308265Sgjb
887308265Sgjbpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
888308265Sgjb		tarballs signatures
889308265Sgjb
890308265Sgjbdate.1.txt:	date.1
891308265Sgjbnewctime.3.txt:	newctime.3
892308265Sgjbnewstrftime.3.txt: newstrftime.3
893308265Sgjbnewtzset.3.txt:	newtzset.3
894308265Sgjbtime2posix.3.txt: time2posix.3
895308265Sgjbtzfile.5.txt:	tzfile.5
896308265Sgjbtzselect.8.txt:	tzselect.8
897308265Sgjbzdump.8.txt:	zdump.8
898308265Sgjbzic.8.txt:	zic.8
899308265Sgjb
900308265Sgjb$(MANTXTS):	workman.sh
901308265Sgjb		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
902308265Sgjb		mv $@.out $@
903308265Sgjb
904339630Sphilip# Set the timestamps to those of the git repository, if available,
905308265Sgjb# and if the files have not changed since then.
906308265Sgjb# This uses GNU 'touch' syntax 'touch -d@N FILE',
907308265Sgjb# where N is the number of seconds since 1970.
908308265Sgjb# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
909308265Sgjb# Also, set the timestamp of each prebuilt file like 'leapseconds'
910308265Sgjb# to be the maximum of the files it depends on.
911339630Sphilipset-timestamps.out: $(EIGHT_YARDS)
912308265Sgjb		rm -f $@
913308265Sgjb		if (type git) >/dev/null 2>&1 && \
914339630Sphilip		   files=`git ls-files $(EIGHT_YARDS)` && \
915308265Sgjb		   touch -md @1 test.out; then \
916308265Sgjb		  rm -f test.out && \
917308265Sgjb		  for file in $$files; do \
918308265Sgjb		    if git diff --quiet $$file; then \
919308265Sgjb		      time=`git log -1 --format='tformat:%ct' $$file` && \
920308265Sgjb		      touch -cmd @$$time $$file; \
921308265Sgjb		    else \
922308265Sgjb		      echo >&2 "$$file: warning: does not match repository"; \
923308265Sgjb		    fi || exit; \
924308265Sgjb		  done; \
925308265Sgjb		fi
926308265Sgjb		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
927308265Sgjb		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
928308265Sgjb		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
929308265Sgjb		    exit; \
930308265Sgjb		done
931325159Sphilip		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
932308265Sgjb		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
933308265Sgjb		touch $@
934339630Sphilipset-tzs-timestamp.out: $(TZS)
935339630Sphilip		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
936339630Sphilip		touch $@
937308265Sgjb
938308265Sgjb# The zics below ensure that each data file can stand on its own.
939308265Sgjb# We also do an all-files run to catch links to links.
940308265Sgjb
941339630Sphilipcheck_public: $(VERSION_DEPS)
942339630Sphilip		rm -fr public.dir
943339630Sphilip		mkdir public.dir
944339630Sphilip		ln $(VERSION_DEPS) public.dir
945339630Sphilip		cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
946339630Sphilip		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi; do \
947339630Sphilip		  public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
948308265Sgjb		done
949339630Sphilip		public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
950308265Sgjb		rm -fr public.dir
951339630Sphilip		touch $@
952308265Sgjb
953308265Sgjb# Check that the code works under various alternative
954308265Sgjb# implementations of time_t.
955339630Sphilipcheck_time_t_alternatives: $(TIME_T_ALTERNATIVES)
956339630Sphilip$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
957339630Sphilip$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
958339630Sphilip		rm -fr $@.dir
959339630Sphilip		mkdir $@.dir
960339630Sphilip		ln $(VERSION_DEPS) $@.dir
961339630Sphilip		case $@ in \
962339630Sphilip		  int32_t) range=-2147483648,2147483648;; \
963339630Sphilip		  u*) range=0,4294967296;; \
964339630Sphilip		  *) range=-4294967296,4294967296;; \
965339630Sphilip		esac && \
966339630Sphilip		wd=`pwd` && \
967339630Sphilip		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
968339630Sphilip		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
969339630Sphilip		  range_target=; \
970308265Sgjb		else \
971339630Sphilip		  range_target=to$$range.tzs; \
972308265Sgjb		fi && \
973339630Sphilip		(cd $@.dir && \
974339630Sphilip		  $(MAKE) TOPDIR="$$wd/$@.dir" \
975339630Sphilip		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
976308265Sgjb		    REDO='$(REDO)' \
977339630Sphilip			D=$$wd/$@.dir \
978339630Sphilip		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
979339630Sphilip		    install $$range_target) && \
980339630Sphilip		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
981339630Sphilip		  (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
982339630Sphilip		    $(MAKE) TOPDIR="$$wd/$@.dir" \
983339630Sphilip		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
984339630Sphilip			D=$$wd/$@.dir \
985339630Sphilip		      to$$range.tzs) && \
986339630Sphilip		  diff -u $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
987339630Sphilip			  $@.dir/to$$range.tzs && \
988339630Sphilip		  if diff -q Makefile Makefile 2>/dev/null; then \
989339630Sphilip		    quiet_option='-q'; \
990339630Sphilip		  else \
991339630Sphilip		    quiet_option=''; \
992339630Sphilip		  fi && \
993339630Sphilip		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
994339630Sphilip					   $@.dir/etc && \
995339630Sphilip		    diff $$quiet_option -r \
996339630Sphilip		      $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
997339630Sphilip		      $@.dir/usr/share; \
998339630Sphilip		}
999339630Sphilip		touch $@
1000308265Sgjb
1001333312SphilipTRADITIONAL_ASC = \
1002333312Sphilip  tzcode$(VERSION).tar.gz.asc \
1003333312Sphilip  tzdata$(VERSION).tar.gz.asc
1004339630SphilipREARGUARD_ASC = \
1005339630Sphilip  tzdata$(VERSION)-rearguard.tar.gz.asc
1006339630SphilipALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
1007333312Sphilip  tzdb-$(VERSION).tar.lz.asc
1008333312Sphilip
1009339630Sphiliptarballs rearguard_tarballs traditional_tarballs \
1010339630Sphilipsignatures rearguard_signatures traditional_signatures: \
1011339630Sphilip  version set-timestamps.out rearguard.zi
1012308265Sgjb		VERSION=`cat version` && \
1013308265Sgjb		$(MAKE) VERSION="$$VERSION" $@_version
1014308265Sgjb
1015331662Sphilip# These *_version rules are intended for use if VERSION is set by some
1016331662Sphilip# other means.  Ordinarily these rules are used only by the above
1017331662Sphilip# non-_version rules, which set VERSION on the 'make' command line.
1018339630Sphiliptarballs_version: traditional_tarballs_version rearguard_tarballs_version \
1019333312Sphilip  tzdb-$(VERSION).tar.lz
1020339630Sphiliprearguard_tarballs_version: \
1021339630Sphilip  tzdata$(VERSION)-rearguard.tar.gz
1022308265Sgjbtraditional_tarballs_version: \
1023308265Sgjb  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
1024333312Sphilipsignatures_version: $(ALL_ASC)
1025339630Sphiliprearguard_signatures_version: $(REARGUARD_ASC)
1026333312Sphiliptraditional_signatures_version: $(TRADITIONAL_ASC)
1027308265Sgjb
1028308265Sgjbtzcode$(VERSION).tar.gz: set-timestamps.out
1029308265Sgjb		LC_ALL=C && export LC_ALL && \
1030308265Sgjb		tar $(TARFLAGS) -cf - \
1031308265Sgjb		    $(COMMON) $(DOCS) $(SOURCES) | \
1032308265Sgjb		  gzip $(GZIPFLAGS) >$@.out
1033308265Sgjb		mv $@.out $@
1034308265Sgjb
1035308265Sgjbtzdata$(VERSION).tar.gz: set-timestamps.out
1036308265Sgjb		LC_ALL=C && export LC_ALL && \
1037308265Sgjb		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
1038308265Sgjb		  gzip $(GZIPFLAGS) >$@.out
1039308265Sgjb		mv $@.out $@
1040308265Sgjb
1041333312Sphiliptzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
1042333312Sphilip		rm -fr tzdata$(VERSION)-rearguard.dir
1043333312Sphilip		mkdir tzdata$(VERSION)-rearguard.dir
1044333312Sphilip		ln $(COMMON) $(DATA) $(MISC) tzdata$(VERSION)-rearguard.dir
1045333312Sphilip		cd tzdata$(VERSION)-rearguard.dir && \
1046333312Sphilip		  rm -f $(TDATA) $(PACKRATDATA) version
1047333312Sphilip		for f in $(TDATA) $(PACKRATDATA); do \
1048333312Sphilip		  rearf=tzdata$(VERSION)-rearguard.dir/$$f; \
1049333312Sphilip		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
1050333312Sphilip		  touch -cmr `ls -t ziguard.awk $$f` $$rearf || exit; \
1051333312Sphilip		done
1052333312Sphilip		sed '1s/$$/-rearguard/' \
1053333312Sphilip		  <version >tzdata$(VERSION)-rearguard.dir/version
1054333312Sphilip		touch -cmr version tzdata$(VERSION)-rearguard.dir/version
1055333312Sphilip		LC_ALL=C && export LC_ALL && \
1056333312Sphilip		  (cd tzdata$(VERSION)-rearguard.dir && \
1057333312Sphilip		   tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
1058333312Sphilip		     gzip $(GZIPFLAGS)) >$@.out
1059333312Sphilip		mv $@.out $@
1060333312Sphilip
1061339630Sphiliptzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
1062308265Sgjb		rm -fr tzdb-$(VERSION)
1063308265Sgjb		mkdir tzdb-$(VERSION)
1064308265Sgjb		ln $(ENCHILADA) tzdb-$(VERSION)
1065308265Sgjb		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
1066308265Sgjb		LC_ALL=C && export LC_ALL && \
1067308265Sgjb		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
1068308265Sgjb		mv $@.out $@
1069308265Sgjb
1070308265Sgjbtzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
1071308265Sgjbtzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
1072333312Sphiliptzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
1073308265Sgjbtzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
1074333312Sphilip$(ALL_ASC):
1075349598Sphilip		$(GPG) --armor --detach-sign $?
1076308265Sgjb
1077339630SphilipTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
1078339630Sphiliptypecheck: typecheck_long_long typecheck_unsigned
1079339630Sphiliptypecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
1080339630Sphilip		rm -fr $@.dir
1081339630Sphilip		mkdir $@.dir
1082339630Sphilip		ln $(VERSION_DEPS) $@.dir
1083339630Sphilip		cd $@.dir && \
1084339630Sphilip		  case $@ in \
1085339630Sphilip		    *_long_long) i="long long";; \
1086339630Sphilip		    *_unsigned ) i="unsigned" ;; \
1087339630Sphilip		  esac && \
1088339630Sphilip		  typecheck_cflags='' && \
1089339630Sphilip		  $(MAKE) \
1090339630Sphilip		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
1091339630Sphilip		    TOPDIR="`pwd`" \
1092339630Sphilip		    install
1093339630Sphilip		$@.dir/zdump -i -c 1970,1971 Europe/Rome
1094339630Sphilip		touch $@
1095308265Sgjb
1096325159Sphilipzonenames:	tzdata.zi
1097325159Sphilip		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
1098308265Sgjb
1099308265Sgjbasctime.o:	private.h tzfile.h
1100308265Sgjbdate.o:		private.h
1101308265Sgjbdifftime.o:	private.h
1102308265Sgjblocaltime.o:	private.h tzfile.h
1103308265Sgjbstrftime.o:	private.h tzfile.h
1104308265Sgjbzdump.o:	version.h
1105308265Sgjbzic.o:		private.h tzfile.h version.h
1106308265Sgjb
1107308265Sgjb.KEEP_STATE:
1108308265Sgjb
1109308265Sgjb.PHONY: ALL INSTALL all
1110339630Sphilip.PHONY: check check_time_t_alternatives
1111342668Sphilip.PHONY: check_web check_zishrink
1112331662Sphilip.PHONY: clean clean_misc dummy.zd force_tzs
1113308265Sgjb.PHONY: install install_data maintainer-clean names
1114339630Sphilip.PHONY: posix_only posix_packrat posix_right public
1115339630Sphilip.PHONY: rearguard_signatures rearguard_signatures_version
1116339630Sphilip.PHONY: rearguard_tarballs rearguard_tarballs_version
1117339630Sphilip.PHONY: right_only right_posix signatures signatures_version
1118331662Sphilip.PHONY: tarballs tarballs_version
1119331662Sphilip.PHONY: traditional_signatures traditional_signatures_version
1120331662Sphilip.PHONY: traditional_tarballs traditional_tarballs_version
1121331662Sphilip.PHONY: typecheck
1122308265Sgjb.PHONY: zonenames zones
1123331662Sphilip.PHONY: $(ZDS)
1124