Makefile revision 331663
1308265Sgjb# This file is in the public domain, so clarified as of
2308265Sgjb# 2009-05-17 by Arthur David Olson.
3308265Sgjb
4308265Sgjb# Package name for the code distribution.
5308265SgjbPACKAGE=	tzcode
6308265Sgjb
7308265Sgjb# Version number for the distribution, overridden in the 'tarballs' rule below.
8308265SgjbVERSION=	unknown
9308265Sgjb
10308265Sgjb# Email address for bug reports.
11308265SgjbBUGEMAIL=	tz@iana.org
12308265Sgjb
13331663Sphilip# Choose source data features.  To get new features right away, use:
14331663Sphilip#	DATAFORM=	vanguard
15331663Sphilip# To wait a while before using new features, to give downstream users
16331663Sphilip# time to upgrade zic (the default), use:
17331663Sphilip#	DATAFORM=	main
18331663Sphilip# To wait even longer for new features, use:
19331663Sphilip#	DATAFORM=	rearguard
20331663SphilipDATAFORM=		main
21331663Sphilip
22308265Sgjb# Change the line below for your time zone (after finding the zone you want in
23308265Sgjb# the time zone files, or adding it to a time zone file).
24308265Sgjb# Alternately, if you discover you've got the wrong time zone, you can just
25308265Sgjb#	zic -l rightzone
26308265Sgjb# to correct things.
27308265Sgjb# Use the command
28308265Sgjb#	make zonenames
29308265Sgjb# to get a list of the values you can use for LOCALTIME.
30308265Sgjb
31308265SgjbLOCALTIME=	GMT
32308265Sgjb
33308265Sgjb# If you want something other than Eastern United States time as a template
34308265Sgjb# for handling POSIX-style time zone environment variables,
35308265Sgjb# change the line below (after finding the zone you want in the
36308265Sgjb# time zone files, or adding it to a time zone file).
37331663Sphilip# When a POSIX-style environment variable is handled, the rules in the
38308265Sgjb# template file are used to determine "spring forward" and "fall back" days and
39308265Sgjb# times; the environment variable itself specifies UT offsets of standard and
40331663Sphilip# daylight saving time.
41308265Sgjb# Alternately, if you discover you've got the wrong time zone, you can just
42308265Sgjb#	zic -p rightzone
43308265Sgjb# to correct things.
44308265Sgjb# Use the command
45308265Sgjb#	make zonenames
46308265Sgjb# to get a list of the values you can use for POSIXRULES.
47308265Sgjb# If you want POSIX compatibility, use "America/New_York".
48308265Sgjb
49308265SgjbPOSIXRULES=	America/New_York
50308265Sgjb
51308265Sgjb# Also see TZDEFRULESTRING below, which takes effect only
52308265Sgjb# if the time zone files cannot be accessed.
53308265Sgjb
54308265Sgjb
55328476Sphilip# Installation locations.
56328476Sphilip#
57328476Sphilip# The defaults are suitable for Debian, except that if REDO is
58328476Sphilip# posix_right or right_posix then files that Debian puts under
59328476Sphilip# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
60328476Sphilip# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
61328476Sphilip# respectively.  Problems with the Debian approach are discussed in
62328476Sphilip# the commentary for the right_posix rule (below).
63308265Sgjb
64328476Sphilip# Destination directory, which can be used for staging.
65328476Sphilip# 'make DESTDIR=/stage install' installs under /stage (e.g., to
66328476Sphilip# /stage/etc/localtime instead of to /etc/localtime).  Files under
67328476Sphilip# /stage are not intended to work as-is, but can be copied by hand to
68328476Sphilip# the root directory later.  If DESTDIR is empty, 'make install' does
69328476Sphilip# not stage, but installs directly into production locations.
70328476SphilipDESTDIR =
71328476Sphilip
72328476Sphilip# Everything is installed into subdirectories of TOPDIR, and used there.
73328476Sphilip# TOPDIR should be empty (meaning the root directory),
74328476Sphilip# or a directory name that does not end in "/".
75328476Sphilip# TOPDIR should be empty or an absolute name unless you're just testing.
76328476SphilipTOPDIR =
77328476Sphilip
78328476Sphilip# The default local time zone is taken from the file TZDEFAULT.
79328476SphilipTZDEFAULT = $(TOPDIR)/etc/localtime
80328476Sphilip
81328476Sphilip# The subdirectory containing installed program and data files, and
82328476Sphilip# likewise for installed files that can be shared among architectures.
83328476Sphilip# These should be relative file names.
84328476SphilipUSRDIR = usr
85328476SphilipUSRSHAREDIR = $(USRDIR)/share
86328476Sphilip
87308265Sgjb# "Compiled" time zone information is placed in the "TZDIR" directory
88308265Sgjb# (and subdirectories).
89325160Sphilip# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
90308265SgjbTZDIR_BASENAME=	zoneinfo
91328476SphilipTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
92308265Sgjb
93328476Sphilip# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
94328476SphilipBINDIR = $(TOPDIR)/$(USRDIR)/bin
95308265Sgjb
96328476Sphilip# The "zdump" command goes in:
97328476SphilipZDUMPDIR = $(BINDIR)
98308265Sgjb
99328476Sphilip# The "zic" command goes in:
100328476SphilipZICDIR = $(TOPDIR)/$(USRDIR)/sbin
101308265Sgjb
102308265Sgjb# Manual pages go in subdirectories of. . .
103328476SphilipMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
104308265Sgjb
105308265Sgjb# Library functions are put in an archive in LIBDIR.
106328476SphilipLIBDIR = $(TOPDIR)/$(USRDIR)/lib
107308265Sgjb
108308265Sgjb
109328476Sphilip# Types to try, as an alternative to time_t.  int64_t should be first.
110328476SphilipTIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
111328476Sphilip
112316350Sbapt# If you want only POSIX time, with time values interpreted as
113316350Sbapt# seconds since the epoch (not counting leap seconds), use
114308265Sgjb#	REDO=		posix_only
115325160Sphilip# below.  If you want only "right" time, with values interpreted
116316350Sbapt# as seconds since the epoch (counting leap seconds), use
117308265Sgjb#	REDO=		right_only
118308265Sgjb# below.  If you want both sets of data available, with leap seconds not
119308265Sgjb# counted normally, use
120308265Sgjb#	REDO=		posix_right
121308265Sgjb# below.  If you want both sets of data available, with leap seconds counted
122308265Sgjb# normally, use
123308265Sgjb#	REDO=		right_posix
124308265Sgjb# below.  POSIX mandates that leap seconds not be counted; for compatibility
125316350Sbapt# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
126316350Sbapt# leap smearing; this can work better than unsmeared "right" time with
127316350Sbapt# applications that are not leap second aware, and is closer to unsmeared
128316350Sbapt# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
129308265Sgjb
130308265SgjbREDO=		posix_right
131308265Sgjb
132325160Sphilip# To install data in text form that has all the information of the binary data,
133325160Sphilip# (optionally incorporating leap second information), use
134325160Sphilip#	TZDATA_TEXT=	tzdata.zi leapseconds
135325160Sphilip# To install text data without leap second information (e.g., because
136325160Sphilip# REDO='posix_only'), use
137325160Sphilip#	TZDATA_TEXT=	tzdata.zi
138325160Sphilip# To avoid installing text data, use
139325160Sphilip#	TZDATA_TEXT=
140325160Sphilip
141325160SphilipTZDATA_TEXT=	leapseconds tzdata.zi
142325160Sphilip
143325160Sphilip# For backward-compatibility links for old zone names, use
144328476Sphilip#	BACKWARD=	backward
145328476Sphilip# If you also want the link US/Pacific-New, even though it is confusing
146328476Sphilip# and is planned to be removed from the database eventually, use
147325160Sphilip#	BACKWARD=	backward pacificnew
148325160Sphilip# To omit these links, use
149325160Sphilip#	BACKWARD=
150325160Sphilip
151328476SphilipBACKWARD=	backward
152325160Sphilip
153308265Sgjb# If you want out-of-scope and often-wrong data from the file 'backzone', use
154308265Sgjb#	PACKRATDATA=	backzone
155308265Sgjb# To omit this data, use
156308265Sgjb#	PACKRATDATA=
157308265Sgjb
158308265SgjbPACKRATDATA=
159308265Sgjb
160325160Sphilip# The name of a locale using the UTF-8 encoding, used during self-tests.
161325160Sphilip# The tests are skipped if the name does not appear to work on this system.
162325160Sphilip
163325160SphilipUTF8_LOCALE=	en_US.utf8
164325160Sphilip
165308265Sgjb# Since "." may not be in PATH...
166308265Sgjb
167308265SgjbYEARISTYPE=	./yearistype
168308265Sgjb
169308265Sgjb# Non-default libraries needed to link.
170308265SgjbLDLIBS=
171308265Sgjb
172325160Sphilip# Add the following to the end of the "CFLAGS=" line as needed to override
173325160Sphilip# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
174308265Sgjb#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
175325160Sphilip#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
176325160Sphilip#	formats that generate only the last two digits of year numbers
177325160Sphilip#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
178325160Sphilip#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
179325160Sphilip#	than what POSIX specifies, assuming local time is UT.
180325160Sphilip#	For example, N is 252460800 on AmigaOS.
181308265Sgjb#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
182325160Sphilip#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
183308265Sgjb#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
184325160Sphilip#  -DHAVE_GENERIC=0 if _Generic does not work
185325160Sphilip#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
186325160Sphilip#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
187308265Sgjb#	ctime_r and asctime_r incompatibly with the POSIX standard
188308265Sgjb#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
189325160Sphilip#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
190308265Sgjb#  -DHAVE_LINK=0 if your system lacks a link function
191308265Sgjb#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
192308265Sgjb#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
193308265Sgjb#	localtime_rz can make zdump significantly faster, but is nonstandard.
194308265Sgjb#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
195308265Sgjb#	functions like 'link' or variables like 'tzname' required by POSIX
196325160Sphilip#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
197325160Sphilip#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
198325160Sphilip#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
199325160Sphilip#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
200308265Sgjb#  -DHAVE_STRDUP=0 if your system lacks the strdup function
201331663Sphilip#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
202308265Sgjb#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
203325160Sphilip#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
204325160Sphilip#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
205308265Sgjb#  -DHAVE_TZSET=0 if your system lacks a tzset function
206325160Sphilip#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
207325160Sphilip#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
208331663Sphilip#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
209331663Sphilip#	with external linkage, e.g., applications cannot define 'localtime'.
210325160Sphilip#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
211331663Sphilip#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
212331663Sphilip#	security implications and is not recommended for general use
213325160Sphilip#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
214308265Sgjb#	not needed by the main-program tz code, which is single-threaded.
215308265Sgjb#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
216308265Sgjb#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
217325160Sphilip#	This is intended for internal use only; it mangles external names.
218308265Sgjb#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
219308265Sgjb#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
220308265Sgjb#	the default is system-supplied, typically "/usr/lib/locale"
221308265Sgjb#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
222308265Sgjb#	DST transitions if the time zone files cannot be accessed
223325160Sphilip#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
224308265Sgjb#	other than simply getting garbage data
225308265Sgjb#  -DUSE_LTZ=0 to build zdump with the system time zone library
226308265Sgjb#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
227308265Sgjb#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
228308265Sgjb#	(or some other number) to set the maximum time zone abbreviation length
229308265Sgjb#	that zic will accept without a warning (the default is 6)
230308265Sgjb#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
231325160Sphilip# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
232325160SphilipGCC_INSTRUMENT = \
233325160Sphilip  -fsanitize=undefined -fsanitize-address-use-after-scope \
234325160Sphilip  -fsanitize-undefined-trap-on-error -fstack-protector
235325160SphilipGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
236325160Sphilip  $(GCC_INSTRUMENT) \
237325160Sphilip  -Wall -Wextra \
238325160Sphilip  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
239325160Sphilip  -Wbad-function-cast -Wcast-align -Wdate-time \
240325160Sphilip  -Wdeclaration-after-statement -Wdouble-promotion \
241325160Sphilip  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
242325160Sphilip  -Winit-self -Wjump-misses-init -Wlogical-op \
243325160Sphilip  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
244325160Sphilip  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
245325160Sphilip  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
246325160Sphilip  -Wsuggest-attribute=const -Wsuggest-attribute=format \
247325160Sphilip  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
248325160Sphilip  -Wtrampolines -Wundef -Wuninitialized -Wunused \
249325160Sphilip  -Wvariadic-macros -Wvla -Wwrite-strings \
250325160Sphilip  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
251325160Sphilip  -Wno-type-limits -Wno-unused-parameter
252308265Sgjb#
253308265Sgjb# If your system has a "GMT offset" field in its "struct tm"s
254308265Sgjb# (or if you decide to add such a field in your system's "time.h" file),
255308265Sgjb# add the name to a define such as
256308265Sgjb#	-DTM_GMTOFF=tm_gmtoff
257308265Sgjb# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
258308265Sgjb# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
259308265Sgjb# Similarly, if your system has a "zone abbreviation" field, define
260308265Sgjb#	-DTM_ZONE=tm_zone
261308265Sgjb# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
262308265Sgjb# required by POSIX, but are widely available on GNU/Linux and BSD systems.
263308265Sgjb#
264325160Sphilip# The next batch of options control support for external variables
265325160Sphilip# exported by tzcode.  In practice these variables are less useful
266325160Sphilip# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
267325160Sphilip# #
268325160Sphilip# # To omit or support the external variable "tzname", add one of:
269325160Sphilip# #	-DHAVE_TZNAME=0
270325160Sphilip# #	-DHAVE_TZNAME=1
271325160Sphilip# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
272325160Sphilip# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
273325160Sphilip# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
274325160Sphilip# # crashes when combined with some platforms' standard libraries,
275325160Sphilip# # presumably due to memory allocation issues.
276325160Sphilip# #
277325160Sphilip# # To omit or support the external variables "timezone" and "daylight", add
278325160Sphilip# #	-DUSG_COMPAT=0
279325160Sphilip# #	-DUSG_COMPAT=1
280325160Sphilip# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
281325160Sphilip# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
282325160Sphilip# # If not defined, the code attempts to guess USG_COMPAT from other macros.
283325160Sphilip# #
284325160Sphilip# # To support the external variable "altzone", add
285325160Sphilip# #	-DALTZONE
286325160Sphilip# # to the end of the "CFLAGS=" line; although "altzone" appeared in
287325160Sphilip# # System V Release 3.1 it has not been standardized.
288325160Sphilip#
289308265Sgjb# If you want functions that were inspired by early versions of X3J11's work,
290308265Sgjb# add
291308265Sgjb#	-DSTD_INSPIRED
292308265Sgjb# to the end of the "CFLAGS=" line.  This arranges for the functions
293308265Sgjb# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
294308265Sgjb# "posix2time", and "time2posix" to be added to the time conversion library.
295308265Sgjb# "tzsetwall" is like "tzset" except that it arranges for local wall clock
296308265Sgjb# time (rather than the time specified in the TZ environment variable)
297308265Sgjb# to be used.
298308265Sgjb# "offtime" is like "gmtime" except that it accepts a second (long) argument
299308265Sgjb# that gives an offset to add to the time_t when converting it.
300308265Sgjb# "timelocal" is equivalent to "mktime".
301308265Sgjb# "timegm" is like "timelocal" except that it turns a struct tm into
302308265Sgjb# a time_t using UT (rather than local time as "timelocal" does).
303308265Sgjb# "timeoff" is like "timegm" except that it accepts a second (long) argument
304308265Sgjb# that gives an offset to use when converting to a time_t.
305308265Sgjb# "posix2time" and "time2posix" are described in an included manual page.
306308265Sgjb# X3J11's work does not describe any of these functions.
307308265Sgjb# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
308308265Sgjb# These functions may well disappear in future releases of the time
309308265Sgjb# conversion package.
310308265Sgjb#
311308265Sgjb# If you don't want functions that were inspired by NetBSD, add
312308265Sgjb#	-DNETBSD_INSPIRED=0
313308265Sgjb# to the end of the "CFLAGS=" line.  Otherwise, the functions
314308265Sgjb# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
315308265Sgjb# time library, and if STD_INSPIRED is also defined the functions
316308265Sgjb# "posix2time_z" and "time2posix_z" are added as well.
317308265Sgjb# The functions ending in "_z" (or "_rz") are like their unsuffixed
318308265Sgjb# (or suffixed-by-"_r") counterparts, except with an extra first
319308265Sgjb# argument of opaque type timezone_t that specifies the time zone.
320308265Sgjb# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
321308265Sgjb#
322308265Sgjb# If you want to allocate state structures in localtime, add
323308265Sgjb#	-DALL_STATE
324308265Sgjb# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
325308265Sgjb#
326308265Sgjb# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
327308265Sgjb# out by the National Institute of Standards and Technology
328308265Sgjb# which claims to test C and Posix conformance.  If you want to pass PCTS, add
329308265Sgjb#	-DPCTS
330308265Sgjb# to the end of the "CFLAGS=" line.
331308265Sgjb#
332308265Sgjb# If you want strict compliance with XPG4 as of 1994-04-09, add
333308265Sgjb#	-DXPG4_1994_04_09
334308265Sgjb# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
335325160Sphilip# 53 as a week number (rather than 52 or 53) for January days before
336325160Sphilip# January's first Monday when a "%V" format is used and January 1
337308265Sgjb# falls on a Friday, Saturday, or Sunday.
338308265Sgjb
339308265SgjbCFLAGS=
340308265Sgjb
341308265Sgjb# Linker flags.  Default to $(LFLAGS) for backwards compatibility
342308265Sgjb# to release 2012h and earlier.
343308265Sgjb
344308265SgjbLDFLAGS=	$(LFLAGS)
345308265Sgjb
346308265Sgjb# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
347308265Sgjb# submake command lines.  The default is no leap seconds.
348308265Sgjb
349308265SgjbLEAPSECONDS=
350308265Sgjb
351308265Sgjb# The zic command and its arguments.
352308265Sgjb
353308265Sgjbzic=		./zic
354308265SgjbZIC=		$(zic) $(ZFLAGS)
355308265Sgjb
356308265SgjbZFLAGS=
357308265Sgjb
358308265Sgjb# How to use zic to install tz binary files.
359308265Sgjb
360328476SphilipZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
361308265Sgjb
362308265Sgjb# The name of a Posix-compliant 'awk' on your system.
363308265SgjbAWK=		awk
364308265Sgjb
365308265Sgjb# The full path name of a Posix-compliant shell, preferably one that supports
366308265Sgjb# the Korn shell's 'select' statement as an extension.
367308265Sgjb# These days, Bash is the most popular.
368308265Sgjb# It should be OK to set this to /bin/sh, on platforms where /bin/sh
369308265Sgjb# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
370308265Sgjb# is typically nicer if it works.
371308265SgjbKSHELL=		/bin/bash
372308265Sgjb
373308265Sgjb# The path where SGML DTDs are kept and the catalog file(s) to use when
374308265Sgjb# validating.  The default should work on both Debian and Red Hat.
375308265SgjbSGML_TOPDIR= /usr
376308265SgjbSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
377308265SgjbSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
378308265SgjbSGML_CATALOG_FILES= \
379308265Sgjb  $(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
380308265Sgjb
381308265Sgjb# The name, arguments and environment of a program to validate your web pages.
382308265Sgjb# See <http://openjade.sourceforge.net/doc/> for a validator, and
383308265Sgjb# <https://validator.w3.org/source/> for a validation library.
384325160Sphilip# Set VALIDATE=':' if you do not have such a program.
385308265SgjbVALIDATE = nsgmls
386308265SgjbVALIDATE_FLAGS = -s -B -wall -wno-unused-param
387308265SgjbVALIDATE_ENV = \
388328476Sphilip  SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \
389328476Sphilip  SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \
390308265Sgjb  SP_CHARSET_FIXED=YES \
391308265Sgjb  SP_ENCODING=UTF-8
392308265Sgjb
393308265Sgjb# This expensive test requires USE_LTZ.
394308265Sgjb# To suppress it, define this macro to be empty.
395308265SgjbCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
396308265Sgjb
397308265Sgjb# SAFE_CHAR is a regular expression that matches a safe character.
398308265Sgjb# Some parts of this distribution are limited to safe characters;
399308265Sgjb# others can use any UTF-8 character.
400308265Sgjb# For now, the safe characters are a safe subset of ASCII.
401308265Sgjb# The caller must set the shell variable 'sharp' to the character '#',
402308265Sgjb# since Makefile macros cannot contain '#'.
403308265Sgjb# TAB_CHAR is a single tab character, in single quotes.
404308265SgjbTAB_CHAR=	'	'
405308265SgjbSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
406308265SgjbSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
407308265SgjbSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
408308265SgjbSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
409308265SgjbSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
410308265Sgjb
411331663Sphilip# Non-ASCII non-letters that OK_CHAR allows, as these characters are
412331663Sphilip# useful in commentary.  XEmacs 21.5.34 displays them correctly,
413331663Sphilip# presumably because they are Latin-1.
414331663SphilipUNUSUAL_OK_CHARSET= ����������
415331663Sphilip
416308265Sgjb# OK_CHAR matches any character allowed in the distributed files.
417331663Sphilip# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
418331663Sphilip# multibyte letters are also allowed so that commentary can contain a
419331663Sphilip# few safe symbols and people's names and can quote non-English sources.
420331663Sphilip# Other non-letters are limited to ASCII renderings for the
421331663Sphilip# convenience of maintainers using XEmacs 21.5.34, which by default
422331663Sphilip# mishandles Unicode characters U+0100 and greater.
423331663SphilipOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
424308265Sgjb
425308265Sgjb# SAFE_LINE matches a line of safe characters.
426308265Sgjb# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
427308265Sgjb# this is so that comments can contain non-ASCII characters.
428308265Sgjb# OK_LINE matches a line of OK characters.
429308265SgjbSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
430308265SgjbSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
431308265SgjbOK_LINE=	'^'$(OK_CHAR)'*$$'
432308265Sgjb
433308265Sgjb# Flags to give 'tar' when making a distribution.
434308265Sgjb# Try to use flags appropriate for GNU tar.
435308265SgjbGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
436308265SgjbTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
437308265Sgjb		 then echo $(GNUTARFLAGS); \
438308265Sgjb		 else :; \
439308265Sgjb		 fi`
440308265Sgjb
441308265Sgjb# Flags to give 'gzip' when making a distribution.
442308265SgjbGZIPFLAGS=	-9n
443308265Sgjb
444308265Sgjb###############################################################################
445308265Sgjb
446308265Sgjb#MAKE=		make
447308265Sgjb
448308265Sgjbcc=		cc
449328476SphilipCC=		$(cc) -DTZDIR='"$(TZDIR)"'
450308265Sgjb
451308265SgjbAR=		ar
452308265Sgjb
453308265Sgjb# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
454308265SgjbRANLIB=		:
455308265Sgjb
456308265SgjbTZCOBJS=	zic.o
457325160SphilipTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
458308265SgjbDATEOBJS=	date.o localtime.o strftime.o asctime.o
459308265SgjbLIBSRCS=	localtime.c asctime.c difftime.c
460308265SgjbLIBOBJS=	localtime.o asctime.o difftime.o
461308265SgjbHEADERS=	tzfile.h private.h
462308265SgjbNONLIBSRCS=	zic.c zdump.c
463308265SgjbNEWUCBSRCS=	date.c strftime.c
464308265SgjbSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
465308265Sgjb			tzselect.ksh workman.sh
466308265SgjbMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
467308265Sgjb			tzfile.5 tzselect.8 zic.8 zdump.8
468308265SgjbMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
469308265Sgjb			time2posix.3.txt \
470308265Sgjb			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
471308265Sgjb			date.1.txt
472325160SphilipCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
473325160Sphilip			NEWS README theory.html version
474328476SphilipWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
475308265SgjbDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
476308265SgjbPRIMARY_YDATA=	africa antarctica asia australasia \
477308265Sgjb		europe northamerica southamerica
478328476SphilipYDATA=		$(PRIMARY_YDATA) etcetera
479308265SgjbNDATA=		systemv factory
480328476SphilipTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward pacificnew
481328476SphilipTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
482308265SgjbZONETABLES=	zone1970.tab zone.tab
483325160SphilipTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
484308265SgjbLEAP_DEPS=	leapseconds.awk leap-seconds.list
485331663SphilipTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
486331663SphilipDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
487328476SphilipDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
488325160Sphilip			leapseconds yearistype.sh $(ZONETABLES)
489331663SphilipAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
490331663Sphilip			ziguard.awk zishrink.awk
491308265SgjbMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
492308265SgjbTZS_YEAR=	2050
493308265SgjbTZS=		to$(TZS_YEAR).tzs
494308265SgjbTZS_NEW=	to$(TZS_YEAR)new.tzs
495308265SgjbTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
496308265Sgjb			private.h tzfile.h zdump.c zic.c
497325160SphilipENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
498308265Sgjb
499308265Sgjb# Consult these files when deciding whether to rebuild the 'version' file.
500308265Sgjb# This list is not the same as the output of 'git ls-files', since
501308265Sgjb# .gitignore is not distributed.
502308265SgjbVERSION_DEPS= \
503325160Sphilip		calendars CONTRIBUTING LICENSE Makefile NEWS README \
504308265Sgjb		africa antarctica asctime.c asia australasia \
505308265Sgjb		backward backzone \
506308265Sgjb		checklinks.awk checktab.awk \
507308265Sgjb		date.1 date.c difftime.c \
508308265Sgjb		etcetera europe factory iso3166.tab \
509308265Sgjb		leap-seconds.list leapseconds.awk localtime.c \
510308265Sgjb		newctime.3 newstrftime.3 newtzset.3 northamerica \
511308265Sgjb		pacificnew private.h \
512325160Sphilip		southamerica strftime.c systemv theory.html \
513328476Sphilip		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
514308265Sgjb		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
515308265Sgjb		workman.sh yearistype.sh \
516308265Sgjb		zdump.8 zdump.c zic.8 zic.c \
517308265Sgjb		zone.tab zone1970.tab zoneinfo2tdf.pl
518308265Sgjb
519308265Sgjb# And for the benefit of csh users on systems that assume the user
520308265Sgjb# shell should be used to handle commands in Makefiles. . .
521308265Sgjb
522308265SgjbSHELL=		/bin/sh
523308265Sgjb
524331663Sphilipall:		tzselect yearistype zic zdump libtz.a $(TABDATA) \
525331663Sphilip		  vanguard.zi main.zi rearguard.zi
526308265Sgjb
527308265SgjbALL:		all date $(ENCHILADA)
528308265Sgjb
529308265Sgjbinstall:	all $(DATA) $(REDO) $(MANS)
530328476Sphilip		mkdir -p '$(DESTDIR)$(BINDIR)' \
531328476Sphilip			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
532328476Sphilip			'$(DESTDIR)$(LIBDIR)' \
533328476Sphilip			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
534328476Sphilip			'$(DESTDIR)$(MANDIR)/man8'
535328476Sphilip		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \
536328476Sphilip			-t '$(DESTDIR)$(TZDEFAULT)'
537328476Sphilip		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
538328476Sphilip		cp tzselect '$(DESTDIR)$(BINDIR)/.'
539328476Sphilip		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
540328476Sphilip		cp zic '$(DESTDIR)$(ZICDIR)/.'
541328476Sphilip		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
542328476Sphilip		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
543328476Sphilip		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
544328476Sphilip		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
545328476Sphilip		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
546308265Sgjb
547308265SgjbINSTALL:	ALL install date.1
548328476Sphilip		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
549328476Sphilip		cp date '$(DESTDIR)$(BINDIR)/.'
550328476Sphilip		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
551308265Sgjb
552308265Sgjbversion:	$(VERSION_DEPS)
553308265Sgjb		{ (type git) >/dev/null 2>&1 && \
554308265Sgjb		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
555308265Sgjb				--abbrev=7 --dirty` || \
556328476Sphilip		  V='$(VERSION)'; } && \
557308265Sgjb		printf '%s\n' "$$V" >$@.out
558308265Sgjb		mv $@.out $@
559308265Sgjb
560331663Sphilip# These files can be tailored by setting BACKWARD, PACKRATDATA, etc.
561331663Sphilipvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
562331663Sphilip		$(AWK) -v outfile='$@' -f ziguard.awk $(TDATA) $(PACKRATDATA) \
563331663Sphilip		  >$@.out
564331663Sphilip		mv $@.out $@
565331663Sphiliptzdata.zi:	$(DATAFORM).zi version
566328476Sphilip		version=`sed 1q version` && \
567328476Sphilip		  LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
568331663Sphilip		    $(DATAFORM).zi >$@.out
569325160Sphilip		mv $@.out $@
570325160Sphilip
571308265Sgjbversion.h:	version
572308265Sgjb		VERSION=`cat version` && printf '%s\n' \
573308265Sgjb		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
574308265Sgjb		  "static char const TZVERSION[]=\"$$VERSION\";" \
575308265Sgjb		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
576308265Sgjb		  >$@.out
577308265Sgjb		mv $@.out $@
578308265Sgjb
579308265Sgjbzdump:		$(TZDOBJS)
580308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
581308265Sgjb
582308265Sgjbzic:		$(TZCOBJS)
583308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
584308265Sgjb
585308265Sgjbyearistype:	yearistype.sh
586308265Sgjb		cp yearistype.sh yearistype
587308265Sgjb		chmod +x yearistype
588308265Sgjb
589308265Sgjbleapseconds:	$(LEAP_DEPS)
590308265Sgjb		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
591308265Sgjb		mv $@.out $@
592308265Sgjb
593308265Sgjb# Arguments to pass to submakes of install_data.
594308265Sgjb# They can be overridden by later submake arguments.
595308265SgjbINSTALLARGS = \
596328476Sphilip BACKWARD='$(BACKWARD)' \
597328476Sphilip DESTDIR='$(DESTDIR)' \
598308265Sgjb LEAPSECONDS='$(LEAPSECONDS)' \
599308265Sgjb PACKRATDATA='$(PACKRATDATA)' \
600328476Sphilip TZDEFAULT='$(TZDEFAULT)' \
601328476Sphilip TZDIR='$(TZDIR)' \
602328476Sphilip YEARISTYPE='$(YEARISTYPE)' \
603308265Sgjb ZIC='$(ZIC)'
604308265Sgjb
605308265Sgjb# 'make install_data' installs one set of tz binary files.
606325160Sphilipinstall_data:	zic leapseconds yearistype tzdata.zi
607325160Sphilip		$(ZIC_INSTALL) tzdata.zi
608308265Sgjb
609308265Sgjbposix_only:
610308265Sgjb		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
611308265Sgjb
612308265Sgjbright_only:
613308265Sgjb		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
614308265Sgjb			install_data
615308265Sgjb
616308265Sgjb# In earlier versions of this makefile, the other two directories were
617308265Sgjb# subdirectories of $(TZDIR).  However, this led to configuration errors.
618308265Sgjb# For example, with posix_right under the earlier scheme,
619308265Sgjb# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
620308265Sgjb# but gmtime without leap seconds, which led to problems with applications
621308265Sgjb# like sendmail that subtract gmtime from localtime.
622308265Sgjb# Therefore, the other two directories are now siblings of $(TZDIR).
623308265Sgjb# You must replace all of $(TZDIR) to switch from not using leap seconds
624308265Sgjb# to using them, or vice versa.
625308265Sgjbright_posix:	right_only
626328476Sphilip		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
627328476Sphilip		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
628328476Sphilip		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
629328476Sphilip		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
630308265Sgjb
631308265Sgjbposix_right:	posix_only
632328476Sphilip		rm -fr '$(DESTDIR)$(TZDIR)-posix'
633328476Sphilip		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
634328476Sphilip		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
635328476Sphilip		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
636308265Sgjb
637308265Sgjb# This obsolescent rule is present for backwards compatibility with
638308265Sgjb# tz releases 2014g through 2015g.  It should go away eventually.
639308265Sgjbposix_packrat:
640308265Sgjb		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
641308265Sgjb
642308265Sgjbzones:		$(REDO)
643308265Sgjb
644331663Sphilip# dummy.zd is not a real file; it is mentioned here only so that the
645331663Sphilip# top-level 'make' does not have a syntax error.
646331663SphilipZDS = dummy.zd
647331663Sphilip# Rule used only by submakes invoked by the $(TZS_NEW) rule.
648331663Sphilip# It is separate so that GNU 'make -j' can run instances in parallel.
649331663Sphilip$(ZDS): zdump
650331663Sphilip		./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@
651331663Sphilip
652325160Sphilip$(TZS_NEW):	tzdata.zi zdump zic
653331663Sphilip		rm -fr tzs.dir
654331663Sphilip		mkdir tzs.dir
655325160Sphilip		$(zic) -d tzs.dir tzdata.zi
656325160Sphilip		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
657325160Sphilip		   tzdata.zi | LC_ALL=C sort >$@.out
658308265Sgjb		wd=`pwd` && \
659331663Sphilip		set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \
660331663Sphilip			| LC_ALL=C sort -t . -k 2,2` && \
661331663Sphilip		shift && \
662331663Sphilip		ZDS=$$* && \
663331663Sphilip		$(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \
664331663Sphilip		sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out
665331663Sphilip		rm -fr tzs.dir
666331663Sphilip		mv $@.out $@
667308265Sgjb
668308265Sgjb# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
669308265Sgjb# If it exists but 'make check_tzs' fails, a maintainer should inspect the
670308265Sgjb# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
671308265Sgjb$(TZS):
672308265Sgjb		$(MAKE) force_tzs
673308265Sgjb
674308265Sgjbforce_tzs:	$(TZS_NEW)
675308265Sgjb		cp $(TZS_NEW) $(TZS)
676308265Sgjb
677308265Sgjblibtz.a:	$(LIBOBJS)
678309793Sbapt		rm -f $@
679309793Sbapt		$(AR) -rc $@ $(LIBOBJS)
680308265Sgjb		$(RANLIB) $@
681308265Sgjb
682308265Sgjbdate:		$(DATEOBJS)
683308265Sgjb		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
684308265Sgjb
685308265Sgjbtzselect:	tzselect.ksh version
686308265Sgjb		VERSION=`cat version` && sed \
687308265Sgjb			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
688308265Sgjb			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
689308265Sgjb			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
690308265Sgjb			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
691308265Sgjb			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
692308265Sgjb			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
693308265Sgjb			<$@.ksh >$@.out
694308265Sgjb		chmod +x $@.out
695308265Sgjb		mv $@.out $@
696308265Sgjb
697325160Sphilipcheck:		check_character_set check_white_space check_links \
698325160Sphilip		  check_name_lengths check_sorted \
699325160Sphilip		  check_tables check_web check_zishrink check_tzs
700308265Sgjb
701308265Sgjbcheck_character_set: $(ENCHILADA)
702325160Sphilip	test ! '$(UTF8_LOCALE)' || \
703325160Sphilip	! printf 'A\304\200B\n' | \
704325160Sphilip	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
705325160Sphilip		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
706308265Sgjb		sharp='#' && \
707308265Sgjb		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
708308265Sgjb			$(MISC) $(SOURCES) $(WEB_PAGES) \
709331663Sphilip			CONTRIBUTING LICENSE README \
710325160Sphilip			version tzdata.zi && \
711331663Sphilip		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \
712331663Sphilip			Makefile && \
713328476Sphilip		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
714308265Sgjb			leapseconds yearistype.sh zone.tab && \
715325160Sphilip		! grep -Env $(OK_LINE) $(ENCHILADA); \
716325160Sphilip	}
717308265Sgjb
718308265Sgjbcheck_white_space: $(ENCHILADA)
719308265Sgjb		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
720308265Sgjb		! grep -En "$$pat" $(ENCHILADA)
721328476Sphilip		! grep -n '[[:space:]]$$' \
722328476Sphilip			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
723308265Sgjb
724325160SphilipPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
725325160SphilipFILE_NAME_COMPONENT_TOO_LONG = \
726325160Sphilip  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
727325160Sphilip
728328476Sphilipcheck_name_lengths: $(TDATA_TO_CHECK) backzone
729328476Sphilip		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
730328476Sphilip			$(TDATA_TO_CHECK) backzone
731325160Sphilip
732308265SgjbCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
733308265Sgjb
734308265Sgjbcheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
735308265Sgjb		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
736308265Sgjb		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
737308265Sgjb		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
738308265Sgjb		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
739308265Sgjb		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
740308265Sgjb		  LC_ALL=C sort -c
741308265Sgjb		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
742308265Sgjb		  LC_ALL=C sort -cu
743308265Sgjb
744331663Sphilipcheck_links:	checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
745328476Sphilip		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
746325160Sphilip		$(AWK) -f checklinks.awk tzdata.zi
747308265Sgjb
748308265Sgjbcheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
749308265Sgjb		for tab in $(ZONETABLES); do \
750308265Sgjb		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
751308265Sgjb		    || exit; \
752308265Sgjb		done
753308265Sgjb
754308265Sgjbcheck_tzs:	$(TZS) $(TZS_NEW)
755308265Sgjb		diff -u $(TZS) $(TZS_NEW)
756308265Sgjb
757325160Sphilip# This checks only the HTML 4.01 strict page.
758325160Sphilip# To check the the other pages, use <https://validator.w3.org/>.
759325160Sphilipcheck_web:	tz-how-to.html
760325160Sphilip		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
761308265Sgjb
762331663Sphilip# Check that zishrink.awk does not alter the data, and that ziguard.awk
763331663Sphilip# preserves main-format data.
764331663Sphilipcheck_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \
765331663Sphilip		  $(DATAFORM).zi tzdata.zi
766325160Sphilip		for type in posix right; do \
767331663Sphilip		  mkdir -p time_t.dir/$$type time_t.dir/$$type-t \
768331663Sphilip		    time_t.dir/$$type-shrunk && \
769325160Sphilip		  case $$type in \
770325160Sphilip		    right) leap='-L leapseconds';; \
771325160Sphilip	            *) leap=;; \
772325160Sphilip		  esac && \
773331663Sphilip		  $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \
774331663Sphilip		  case $(DATAFORM) in \
775331663Sphilip		    main) \
776331663Sphilip		      $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \
777331663Sphilip		      $(AWK) '/^Rule/' $(TDATA) | \
778331663Sphilip			$(ZIC) $$leap -d time_t.dir/$$type-t - \
779331663Sphilip			  $(PACKRATDATA) && \
780331663Sphilip		      diff -r time_t.dir/$$type time_t.dir/$$type-t;; \
781331663Sphilip		  esac && \
782325160Sphilip		  $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
783325160Sphilip		  diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
784325160Sphilip		done
785325160Sphilip		rm -fr time_t.dir
786325160Sphilip
787308265Sgjbclean_misc:
788308265Sgjb		rm -f core *.o *.out \
789308265Sgjb		  date tzselect version.h zdump zic yearistype libtz.a
790308265Sgjbclean:		clean_misc
791331663Sphilip		rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW)
792308265Sgjb
793308265Sgjbmaintainer-clean: clean
794308265Sgjb		@echo 'This command is intended for maintainers to use; it'
795308265Sgjb		@echo 'deletes files that may need special tools to rebuild.'
796308265Sgjb		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
797308265Sgjb
798308265Sgjbnames:
799308265Sgjb		@echo $(ENCHILADA)
800308265Sgjb
801308265Sgjbpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
802308265Sgjb		tarballs signatures
803308265Sgjb
804308265Sgjbdate.1.txt:	date.1
805308265Sgjbnewctime.3.txt:	newctime.3
806308265Sgjbnewstrftime.3.txt: newstrftime.3
807308265Sgjbnewtzset.3.txt:	newtzset.3
808308265Sgjbtime2posix.3.txt: time2posix.3
809308265Sgjbtzfile.5.txt:	tzfile.5
810308265Sgjbtzselect.8.txt:	tzselect.8
811308265Sgjbzdump.8.txt:	zdump.8
812308265Sgjbzic.8.txt:	zic.8
813308265Sgjb
814308265Sgjb$(MANTXTS):	workman.sh
815308265Sgjb		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
816308265Sgjb		mv $@.out $@
817308265Sgjb
818308265Sgjb# Set the time stamps to those of the git repository, if available,
819308265Sgjb# and if the files have not changed since then.
820308265Sgjb# This uses GNU 'touch' syntax 'touch -d@N FILE',
821308265Sgjb# where N is the number of seconds since 1970.
822308265Sgjb# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
823308265Sgjb# Also, set the timestamp of each prebuilt file like 'leapseconds'
824308265Sgjb# to be the maximum of the files it depends on.
825308265Sgjbset-timestamps.out: $(ENCHILADA)
826308265Sgjb		rm -f $@
827308265Sgjb		if (type git) >/dev/null 2>&1 && \
828308265Sgjb		   files=`git ls-files $(ENCHILADA)` && \
829308265Sgjb		   touch -md @1 test.out; then \
830308265Sgjb		  rm -f test.out && \
831308265Sgjb		  for file in $$files; do \
832308265Sgjb		    if git diff --quiet $$file; then \
833308265Sgjb		      time=`git log -1 --format='tformat:%ct' $$file` && \
834308265Sgjb		      touch -cmd @$$time $$file; \
835308265Sgjb		    else \
836308265Sgjb		      echo >&2 "$$file: warning: does not match repository"; \
837308265Sgjb		    fi || exit; \
838308265Sgjb		  done; \
839308265Sgjb		fi
840308265Sgjb		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
841308265Sgjb		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
842308265Sgjb		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
843308265Sgjb		    exit; \
844308265Sgjb		done
845325160Sphilip		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
846308265Sgjb		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
847308265Sgjb		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
848308265Sgjb		touch $@
849308265Sgjb
850308265Sgjb# The zics below ensure that each data file can stand on its own.
851308265Sgjb# We also do an all-files run to catch links to links.
852308265Sgjb
853308265Sgjbcheck_public:
854308265Sgjb		$(MAKE) maintainer-clean
855328476Sphilip		$(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
856308265Sgjb		mkdir -p public.dir
857328476Sphilip		for i in $(TDATA_TO_CHECK) tzdata.zi; do \
858308265Sgjb		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
859308265Sgjb		done
860328476Sphilip		$(zic) -v -d public.dir $(TDATA_TO_CHECK)
861308265Sgjb		rm -fr public.dir
862308265Sgjb
863308265Sgjb# Check that the code works under various alternative
864308265Sgjb# implementations of time_t.
865308265Sgjbcheck_time_t_alternatives:
866308265Sgjb		if diff -q Makefile Makefile 2>/dev/null; then \
867308265Sgjb		  quiet_option='-q'; \
868308265Sgjb		else \
869308265Sgjb		  quiet_option=''; \
870308265Sgjb		fi && \
871308265Sgjb		wd=`pwd` && \
872308265Sgjb		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
873308265Sgjb		for type in $(TIME_T_ALTERNATIVES); do \
874308265Sgjb		  mkdir -p time_t.dir/$$type && \
875308265Sgjb		  $(MAKE) clean_misc && \
876308265Sgjb		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
877308265Sgjb		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
878308265Sgjb		    REDO='$(REDO)' \
879308265Sgjb		    install && \
880308265Sgjb		  diff $$quiet_option -r \
881328476Sphilip		    time_t.dir/int64_t/etc \
882328476Sphilip		    time_t.dir/$$type/etc && \
883328476Sphilip		  diff $$quiet_option -r \
884328476Sphilip		    time_t.dir/int64_t/usr/share \
885328476Sphilip		    time_t.dir/$$type/usr/share && \
886308265Sgjb		  case $$type in \
887308265Sgjb		  int32_t) range=-2147483648,2147483647;; \
888308265Sgjb		  uint32_t) range=0,4294967296;; \
889308265Sgjb		  int64_t) continue;; \
890308265Sgjb		  *u*) range=0,10000000000;; \
891308265Sgjb		  *) range=-10000000000,10000000000;; \
892308265Sgjb		  esac && \
893308265Sgjb		  echo checking $$type zones ... && \
894328476Sphilip		  time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \
895308265Sgjb		      >time_t.dir/int64_t.out && \
896328476Sphilip		  time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \
897308265Sgjb		      >time_t.dir/$$type.out && \
898308265Sgjb		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
899308265Sgjb		    || exit; \
900308265Sgjb		done
901308265Sgjb		rm -fr time_t.dir
902308265Sgjb
903308265Sgjbtarballs traditional_tarballs signatures traditional_signatures: version
904308265Sgjb		VERSION=`cat version` && \
905308265Sgjb		$(MAKE) VERSION="$$VERSION" $@_version
906308265Sgjb
907331663Sphilip# These *_version rules are intended for use if VERSION is set by some
908331663Sphilip# other means.  Ordinarily these rules are used only by the above
909331663Sphilip# non-_version rules, which set VERSION on the 'make' command line.
910308265Sgjbtarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
911308265Sgjbtraditional_tarballs_version: \
912308265Sgjb  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
913308265Sgjbsignatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
914308265Sgjbtraditional_signatures_version: \
915308265Sgjb  tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
916308265Sgjb
917308265Sgjbtzcode$(VERSION).tar.gz: set-timestamps.out
918308265Sgjb		LC_ALL=C && export LC_ALL && \
919308265Sgjb		tar $(TARFLAGS) -cf - \
920308265Sgjb		    $(COMMON) $(DOCS) $(SOURCES) | \
921308265Sgjb		  gzip $(GZIPFLAGS) >$@.out
922308265Sgjb		mv $@.out $@
923308265Sgjb
924308265Sgjbtzdata$(VERSION).tar.gz: set-timestamps.out
925308265Sgjb		LC_ALL=C && export LC_ALL && \
926308265Sgjb		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
927308265Sgjb		  gzip $(GZIPFLAGS) >$@.out
928308265Sgjb		mv $@.out $@
929308265Sgjb
930308265Sgjbtzdb-$(VERSION).tar.lz: set-timestamps.out
931308265Sgjb		rm -fr tzdb-$(VERSION)
932308265Sgjb		mkdir tzdb-$(VERSION)
933308265Sgjb		ln $(ENCHILADA) tzdb-$(VERSION)
934308265Sgjb		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
935308265Sgjb		LC_ALL=C && export LC_ALL && \
936308265Sgjb		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
937308265Sgjb		mv $@.out $@
938308265Sgjb
939308265Sgjbtzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
940308265Sgjb		gpg --armor --detach-sign $?
941308265Sgjb
942308265Sgjbtzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
943308265Sgjb		gpg --armor --detach-sign $?
944308265Sgjb
945308265Sgjbtzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
946308265Sgjb		gpg --armor --detach-sign $?
947308265Sgjb
948308265Sgjbtypecheck:
949308265Sgjb		$(MAKE) clean
950308265Sgjb		for i in "long long" unsigned; \
951308265Sgjb		do \
952308265Sgjb			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
953308265Sgjb			./zdump -v Europe/Rome ; \
954308265Sgjb			$(MAKE) clean ; \
955308265Sgjb		done
956308265Sgjb
957325160Sphilipzonenames:	tzdata.zi
958325160Sphilip		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
959308265Sgjb
960308265Sgjbasctime.o:	private.h tzfile.h
961308265Sgjbdate.o:		private.h
962308265Sgjbdifftime.o:	private.h
963308265Sgjblocaltime.o:	private.h tzfile.h
964308265Sgjbstrftime.o:	private.h tzfile.h
965308265Sgjbzdump.o:	version.h
966308265Sgjbzic.o:		private.h tzfile.h version.h
967308265Sgjb
968308265Sgjb.KEEP_STATE:
969308265Sgjb
970308265Sgjb.PHONY: ALL INSTALL all
971331663Sphilip.PHONY: check check_character_set check_links check_name_lengths
972308265Sgjb.PHONY: check_public check_sorted check_tables
973308265Sgjb.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
974325160Sphilip.PHONY: check_zishrink
975331663Sphilip.PHONY: clean clean_misc dummy.zd force_tzs
976308265Sgjb.PHONY: install install_data maintainer-clean names
977308265Sgjb.PHONY: posix_only posix_packrat posix_right
978308265Sgjb.PHONY: public right_only right_posix signatures signatures_version
979331663Sphilip.PHONY: tarballs tarballs_version
980331663Sphilip.PHONY: traditional_signatures traditional_signatures_version
981331663Sphilip.PHONY: traditional_tarballs traditional_tarballs_version
982331663Sphilip.PHONY: typecheck
983308265Sgjb.PHONY: zonenames zones
984331663Sphilip.PHONY: $(ZDS)
985