xref: /freebsd/contrib/tzdata/Makefile (revision 9f9fc6bb8028ea29da6b04c338c750cedc3040f3)
189abb9f8SPhilip Paeps# Make and install tzdb code and data.
289abb9f8SPhilip Paeps
3ba2b2efdSGlen Barber# This file is in the public domain, so clarified as of
4ba2b2efdSGlen Barber# 2009-05-17 by Arthur David Olson.
5ba2b2efdSGlen Barber
6ba2b2efdSGlen Barber# Package name for the code distribution.
7ba2b2efdSGlen BarberPACKAGE=	tzcode
8ba2b2efdSGlen Barber
9ba2b2efdSGlen Barber# Version number for the distribution, overridden in the 'tarballs' rule below.
10ba2b2efdSGlen BarberVERSION=	unknown
11ba2b2efdSGlen Barber
12ba2b2efdSGlen Barber# Email address for bug reports.
13ba2b2efdSGlen BarberBUGEMAIL=	tz@iana.org
14ba2b2efdSGlen Barber
15ad48359aSPhilip Paeps# DATAFORM selects the data format.
16ad48359aSPhilip Paeps# Available formats represent essentially the same data, albeit
17ad48359aSPhilip Paeps# possibly with minor discrepancies that users are not likely to notice.
18ad48359aSPhilip Paeps# To get new features and the best data right away, use:
1946bee4edSPhilip Paeps#	DATAFORM=	vanguard
2046bee4edSPhilip Paeps# To wait a while before using new features, to give downstream users
2146bee4edSPhilip Paeps# time to upgrade zic (the default), use:
2246bee4edSPhilip Paeps#	DATAFORM=	main
2346bee4edSPhilip Paeps# To wait even longer for new features, use:
2446bee4edSPhilip Paeps#	DATAFORM=	rearguard
2512a899b6SPhilip Paeps# Rearguard users might also want "ZFLAGS = -b fat"; see below.
2646bee4edSPhilip PaepsDATAFORM=		main
2746bee4edSPhilip Paeps
2889abb9f8SPhilip Paeps# Change the line below for your timezone (after finding the one you want in
2989abb9f8SPhilip Paeps# one of the $(TDATA) source files, or adding it to a source file).
30d81c2dd9SPhilip Paeps# Alternatively, if you discover you've got the wrong timezone, you can just
3112a899b6SPhilip Paeps# 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
32ba2b2efdSGlen Barber# Use the command
33ba2b2efdSGlen Barber#	make zonenames
34ba2b2efdSGlen Barber# to get a list of the values you can use for LOCALTIME.
35ba2b2efdSGlen Barber
36*9f9fc6bbSPhilip PaepsLOCALTIME=	Factory
37ba2b2efdSGlen Barber
382865ab3fSPhilip Paeps# The POSIXRULES macro controls interpretation of nonstandard and obsolete
392865ab3fSPhilip Paeps# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules.
4012a899b6SPhilip Paeps# Such a setting uses the rules in a template file to determine
4112a899b6SPhilip Paeps# "spring forward" and "fall back" days and times; the environment
4212a899b6SPhilip Paeps# variable itself specifies UT offsets of standard and daylight saving time.
432865ab3fSPhilip Paeps#
4412a899b6SPhilip Paeps# If POSIXRULES is '-', no template is installed; this is the default.
452865ab3fSPhilip Paeps#
4612a899b6SPhilip Paeps# Any other value for POSIXRULES is obsolete and should not be relied on, as:
472865ab3fSPhilip Paeps# * It does not work correctly in popular implementations such as GNU/Linux.
4894c2d487SPhilip Paeps# * It does not work even in tzcode, except for historical timestamps
4994c2d487SPhilip Paeps#   that precede the last explicit transition in the POSIXRULES file.
5094c2d487SPhilip Paeps#   Hence it typically does not work for current and future timestamps.
512865ab3fSPhilip Paeps# In short, software should avoid ruleless settings like TZ='EET-2EEST'
522865ab3fSPhilip Paeps# and so should not depend on the value of POSIXRULES.
5312a899b6SPhilip Paeps#
5412a899b6SPhilip Paeps# If, despite the above, you want a template for handling these settings,
5512a899b6SPhilip Paeps# you can change the line below (after finding the timezone you want in the
5612a899b6SPhilip Paeps# one of the $(TDATA) source files, or adding it to a source file).
5712a899b6SPhilip Paeps# Alternatively, if you discover you've got the wrong timezone, you can just
5812a899b6SPhilip Paeps# 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
5912a899b6SPhilip Paeps# Use the command
6012a899b6SPhilip Paeps#	make zonenames
6112a899b6SPhilip Paeps# to get a list of the values you can use for POSIXRULES.
62ba2b2efdSGlen Barber
6312a899b6SPhilip PaepsPOSIXRULES=	-
64ba2b2efdSGlen Barber
65ba2b2efdSGlen Barber# Also see TZDEFRULESTRING below, which takes effect only
66ba2b2efdSGlen Barber# if the time zone files cannot be accessed.
67ba2b2efdSGlen Barber
68ba2b2efdSGlen Barber
69f2fcff28SPhilip Paeps# Installation locations.
70f2fcff28SPhilip Paeps#
71f2fcff28SPhilip Paeps# The defaults are suitable for Debian, except that if REDO is
72f2fcff28SPhilip Paeps# posix_right or right_posix then files that Debian puts under
73f2fcff28SPhilip Paeps# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
74f2fcff28SPhilip Paeps# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
75f2fcff28SPhilip Paeps# respectively.  Problems with the Debian approach are discussed in
76f2fcff28SPhilip Paeps# the commentary for the right_posix rule (below).
77f2fcff28SPhilip Paeps
78f2fcff28SPhilip Paeps# Destination directory, which can be used for staging.
79f2fcff28SPhilip Paeps# 'make DESTDIR=/stage install' installs under /stage (e.g., to
80f2fcff28SPhilip Paeps# /stage/etc/localtime instead of to /etc/localtime).  Files under
81f2fcff28SPhilip Paeps# /stage are not intended to work as-is, but can be copied by hand to
82f2fcff28SPhilip Paeps# the root directory later.  If DESTDIR is empty, 'make install' does
83f2fcff28SPhilip Paeps# not stage, but installs directly into production locations.
84f2fcff28SPhilip PaepsDESTDIR =
85f2fcff28SPhilip Paeps
86f2fcff28SPhilip Paeps# Everything is installed into subdirectories of TOPDIR, and used there.
87f2fcff28SPhilip Paeps# TOPDIR should be empty (meaning the root directory),
88f2fcff28SPhilip Paeps# or a directory name that does not end in "/".
89f2fcff28SPhilip Paeps# TOPDIR should be empty or an absolute name unless you're just testing.
90f2fcff28SPhilip PaepsTOPDIR =
91f2fcff28SPhilip Paeps
92f2fcff28SPhilip Paeps# The default local timezone is taken from the file TZDEFAULT.
93f2fcff28SPhilip PaepsTZDEFAULT = $(TOPDIR)/etc/localtime
94f2fcff28SPhilip Paeps
95f2fcff28SPhilip Paeps# The subdirectory containing installed program and data files, and
96f2fcff28SPhilip Paeps# likewise for installed files that can be shared among architectures.
97f2fcff28SPhilip Paeps# These should be relative file names.
98f2fcff28SPhilip PaepsUSRDIR = usr
99f2fcff28SPhilip PaepsUSRSHAREDIR = $(USRDIR)/share
100ba2b2efdSGlen Barber
101ba2b2efdSGlen Barber# "Compiled" timezone information is placed in the "TZDIR" directory
102ba2b2efdSGlen Barber# (and subdirectories).
1038d7edd17SPhilip Paeps# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
104ba2b2efdSGlen BarberTZDIR_BASENAME=	zoneinfo
105f2fcff28SPhilip PaepsTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
106f2fcff28SPhilip Paeps
107f2fcff28SPhilip Paeps# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
108f2fcff28SPhilip PaepsBINDIR = $(TOPDIR)/$(USRDIR)/bin
109f2fcff28SPhilip Paeps
110f2fcff28SPhilip Paeps# The "zdump" command goes in:
111f2fcff28SPhilip PaepsZDUMPDIR = $(BINDIR)
112f2fcff28SPhilip Paeps
113f2fcff28SPhilip Paeps# The "zic" command goes in:
114f2fcff28SPhilip PaepsZICDIR = $(TOPDIR)/$(USRDIR)/sbin
115f2fcff28SPhilip Paeps
116f2fcff28SPhilip Paeps# Manual pages go in subdirectories of. . .
117f2fcff28SPhilip PaepsMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
118f2fcff28SPhilip Paeps
119f2fcff28SPhilip Paeps# Library functions are put in an archive in LIBDIR.
120f2fcff28SPhilip PaepsLIBDIR = $(TOPDIR)/$(USRDIR)/lib
121f2fcff28SPhilip Paeps
122ba2b2efdSGlen Barber
12389abb9f8SPhilip Paeps# Types to try, as an alternative to time_t.
12489abb9f8SPhilip PaepsTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
12594c2d487SPhilip PaepsTIME_T_ALTERNATIVES_HEAD = int_least64_t
12694c2d487SPhilip PaepsTIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
127ba2b2efdSGlen Barber
128ad48359aSPhilip Paeps# What kind of TZif data files to generate.  (TZif is the binary time
129ad48359aSPhilip Paeps# zone data format that zic generates; see Internet RFC 8536.)
130dc135c6eSBaptiste Daroussin# If you want only POSIX time, with time values interpreted as
131dc135c6eSBaptiste Daroussin# seconds since the epoch (not counting leap seconds), use
132ba2b2efdSGlen Barber#	REDO=		posix_only
1338d7edd17SPhilip Paeps# below.  If you want only "right" time, with values interpreted
134dc135c6eSBaptiste Daroussin# as seconds since the epoch (counting leap seconds), use
135ba2b2efdSGlen Barber#	REDO=		right_only
136ba2b2efdSGlen Barber# below.  If you want both sets of data available, with leap seconds not
137ba2b2efdSGlen Barber# counted normally, use
138ba2b2efdSGlen Barber#	REDO=		posix_right
139ba2b2efdSGlen Barber# below.  If you want both sets of data available, with leap seconds counted
140ba2b2efdSGlen Barber# normally, use
141ba2b2efdSGlen Barber#	REDO=		right_posix
142ba2b2efdSGlen Barber# below.  POSIX mandates that leap seconds not be counted; for compatibility
143dc135c6eSBaptiste Daroussin# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
144dc135c6eSBaptiste Daroussin# leap smearing; this can work better than unsmeared "right" time with
145dc135c6eSBaptiste Daroussin# applications that are not leap second aware, and is closer to unsmeared
146dc135c6eSBaptiste Daroussin# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
147ba2b2efdSGlen Barber
148ba2b2efdSGlen BarberREDO=		posix_right
149ba2b2efdSGlen Barber
150dd5f96c4SPhilip Paeps# Whether to put an "Expires" line in the leapseconds file.
151dd5f96c4SPhilip Paeps# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
152dd5f96c4SPhilip Paeps# The EXPIRES_LINE value matters only if REDO's value contains "right".
153dd5f96c4SPhilip Paeps# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
154dd5f96c4SPhilip Paeps# zic's support for the Expires line was introduced in tzdb 2020a,
15594c2d487SPhilip Paeps# and was modified in tzdb 2021b to generate version 4 TZif files.
15694c2d487SPhilip Paeps# EXPIRES_LINE defaults to 0 for now so that the leapseconds file
15794c2d487SPhilip Paeps# can be given to pre-2020a zic implementations and so that TZif files
15894c2d487SPhilip Paeps# built by newer zic implementations can be read by pre-2021b libraries.
159dd5f96c4SPhilip PaepsEXPIRES_LINE=	0
160dd5f96c4SPhilip Paeps
16189abb9f8SPhilip Paeps# To install data in text form that has all the information of the TZif data,
1628d7edd17SPhilip Paeps# (optionally incorporating leap second information), use
1638d7edd17SPhilip Paeps#	TZDATA_TEXT=	tzdata.zi leapseconds
1648d7edd17SPhilip Paeps# To install text data without leap second information (e.g., because
1658d7edd17SPhilip Paeps# REDO='posix_only'), use
1668d7edd17SPhilip Paeps#	TZDATA_TEXT=	tzdata.zi
1678d7edd17SPhilip Paeps# To avoid installing text data, use
1688d7edd17SPhilip Paeps#	TZDATA_TEXT=
1698d7edd17SPhilip Paeps
1708d7edd17SPhilip PaepsTZDATA_TEXT=	leapseconds tzdata.zi
1718d7edd17SPhilip Paeps
1728d7edd17SPhilip Paeps# For backward-compatibility links for old zone names, use
173f2fcff28SPhilip Paeps#	BACKWARD=	backward
1748d7edd17SPhilip Paeps# To omit these links, use
1758d7edd17SPhilip Paeps#	BACKWARD=
1768d7edd17SPhilip Paeps
177f2fcff28SPhilip PaepsBACKWARD=	backward
1788d7edd17SPhilip Paeps
179*9f9fc6bbSPhilip Paeps# If you want out-of-scope and often-wrong data from the file 'backzone',
180*9f9fc6bbSPhilip Paeps# but only for entries listed in the backward-compatibility file zone.tab, use
181ba2b2efdSGlen Barber#	PACKRATDATA=	backzone
182*9f9fc6bbSPhilip Paeps#	PACKRATLIST=	zone.tab
183*9f9fc6bbSPhilip Paeps# If you want all the 'backzone' data, use
184*9f9fc6bbSPhilip Paeps#	PACKRATDATA=	backzone
185*9f9fc6bbSPhilip Paeps#	PACKRATLIST=
186ba2b2efdSGlen Barber# To omit this data, use
187ba2b2efdSGlen Barber#	PACKRATDATA=
188*9f9fc6bbSPhilip Paeps#	PACKRATLIST=
189ba2b2efdSGlen Barber
190ba2b2efdSGlen BarberPACKRATDATA=
191*9f9fc6bbSPhilip PaepsPACKRATLIST=
192ba2b2efdSGlen Barber
1938d7edd17SPhilip Paeps# The name of a locale using the UTF-8 encoding, used during self-tests.
1948d7edd17SPhilip Paeps# The tests are skipped if the name does not appear to work on this system.
1958d7edd17SPhilip Paeps
1968d7edd17SPhilip PaepsUTF8_LOCALE=	en_US.utf8
1978d7edd17SPhilip Paeps
198ba2b2efdSGlen Barber# Non-default libraries needed to link.
199ba2b2efdSGlen BarberLDLIBS=
200ba2b2efdSGlen Barber
2018d7edd17SPhilip Paeps# Add the following to the end of the "CFLAGS=" line as needed to override
2028d7edd17SPhilip Paeps# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
2038d7edd17SPhilip Paeps#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
2048d7edd17SPhilip Paeps#	formats that generate only the last two digits of year numbers
2058d7edd17SPhilip Paeps#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
206ba2b2efdSGlen Barber#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
207ba2b2efdSGlen Barber#	than what POSIX specifies, assuming local time is UT.
208ba2b2efdSGlen Barber#	For example, N is 252460800 on AmigaOS.
2098d7edd17SPhilip Paeps#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
2108d7edd17SPhilip Paeps#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
2118d7edd17SPhilip Paeps#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
2128d7edd17SPhilip Paeps#  -DHAVE_GENERIC=0 if _Generic does not work
2138d7edd17SPhilip Paeps#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
2148d7edd17SPhilip Paeps#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
2158d7edd17SPhilip Paeps#	ctime_r and asctime_r incompatibly with the POSIX standard
2168d7edd17SPhilip Paeps#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
2178d7edd17SPhilip Paeps#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
2188d7edd17SPhilip Paeps#  -DHAVE_LINK=0 if your system lacks a link function
2198d7edd17SPhilip Paeps#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
2208d7edd17SPhilip Paeps#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
2218d7edd17SPhilip Paeps#	localtime_rz can make zdump significantly faster, but is nonstandard.
22294c2d487SPhilip Paeps#  -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
2238d7edd17SPhilip Paeps#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
2248d7edd17SPhilip Paeps#	functions like 'link' or variables like 'tzname' required by POSIX
2258d7edd17SPhilip Paeps#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
2268d7edd17SPhilip Paeps#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
2278d7edd17SPhilip Paeps#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
2288d7edd17SPhilip Paeps#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
2298d7edd17SPhilip Paeps#  -DHAVE_STRDUP=0 if your system lacks the strdup function
23046bee4edSPhilip Paeps#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
2318d7edd17SPhilip Paeps#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
2328d7edd17SPhilip Paeps#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
2338d7edd17SPhilip Paeps#  -DHAVE_TZSET=0 if your system lacks a tzset function
2348d7edd17SPhilip Paeps#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
2358d7edd17SPhilip Paeps#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
23646bee4edSPhilip Paeps#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
23746bee4edSPhilip Paeps#	with external linkage, e.g., applications cannot define 'localtime'.
2388d7edd17SPhilip Paeps#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
23946bee4edSPhilip Paeps#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
24046bee4edSPhilip Paeps#	security implications and is not recommended for general use
2418d7edd17SPhilip Paeps#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
242ba2b2efdSGlen Barber#	not needed by the main-program tz code, which is single-threaded.
243ba2b2efdSGlen Barber#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
244ba2b2efdSGlen Barber#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
2458d7edd17SPhilip Paeps#	This is intended for internal use only; it mangles external names.
246ba2b2efdSGlen Barber#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
247ba2b2efdSGlen Barber#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
248ba2b2efdSGlen Barber#	the default is system-supplied, typically "/usr/lib/locale"
249ba2b2efdSGlen Barber#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
250ba2b2efdSGlen Barber#	DST transitions if the time zone files cannot be accessed
2518d7edd17SPhilip Paeps#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
252ba2b2efdSGlen Barber#	other than simply getting garbage data
253ba2b2efdSGlen Barber#  -DUSE_LTZ=0 to build zdump with the system time zone library
254ba2b2efdSGlen Barber#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
25512a899b6SPhilip Paeps#  -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
25612a899b6SPhilip Paeps#	similarly for "slim".  Fat TZif files work around incompatibilities
2572865ab3fSPhilip Paeps#	and bugs in some TZif readers, notably readers that mishandle 64-bit
2582865ab3fSPhilip Paeps#	data in TZif files.  Slim TZif files are more efficient and do not
2592865ab3fSPhilip Paeps#	work around these incompatibilities and bugs.  If not given, the
26012a899b6SPhilip Paeps#	default is "slim".
261ba2b2efdSGlen Barber#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
262ba2b2efdSGlen Barber#	(or some other number) to set the maximum time zone abbreviation length
263ba2b2efdSGlen Barber#	that zic will accept without a warning (the default is 6)
264ba2b2efdSGlen Barber#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
2658d7edd17SPhilip Paeps# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
2668d7edd17SPhilip PaepsGCC_INSTRUMENT = \
2678d7edd17SPhilip Paeps  -fsanitize=undefined -fsanitize-address-use-after-scope \
2688d7edd17SPhilip Paeps  -fsanitize-undefined-trap-on-error -fstack-protector
26994c2d487SPhilip Paeps# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
2708d7edd17SPhilip PaepsGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
2718d7edd17SPhilip Paeps  $(GCC_INSTRUMENT) \
272ba2b2efdSGlen Barber  -Wall -Wextra \
2738d7edd17SPhilip Paeps  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
274*9f9fc6bbSPhilip Paeps  -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
2758d7edd17SPhilip Paeps  -Wdeclaration-after-statement -Wdouble-promotion \
27694c2d487SPhilip Paeps  -Wduplicated-branches -Wduplicated-cond \
2778d7edd17SPhilip Paeps  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
27894c2d487SPhilip Paeps  -Winit-self -Wlogical-op \
2798d7edd17SPhilip Paeps  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
28094c2d487SPhilip Paeps  -Wnull-dereference \
281ba2b2efdSGlen Barber  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
28294c2d487SPhilip Paeps  -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
28394c2d487SPhilip Paeps  -Wstrict-prototypes -Wstringop-overflow=4 \
284d81c2dd9SPhilip Paeps  -Wstringop-truncation -Wsuggest-attribute=cold \
2858d7edd17SPhilip Paeps  -Wsuggest-attribute=const -Wsuggest-attribute=format \
286d81c2dd9SPhilip Paeps  -Wsuggest-attribute=malloc \
2878d7edd17SPhilip Paeps  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
288*9f9fc6bbSPhilip Paeps  -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
2898d7edd17SPhilip Paeps  -Wvariadic-macros -Wvla -Wwrite-strings \
290ba2b2efdSGlen Barber  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
291ba2b2efdSGlen Barber  -Wno-type-limits -Wno-unused-parameter
292ba2b2efdSGlen Barber#
293ba2b2efdSGlen Barber# If your system has a "GMT offset" field in its "struct tm"s
294ba2b2efdSGlen Barber# (or if you decide to add such a field in your system's "time.h" file),
295ba2b2efdSGlen Barber# add the name to a define such as
296ba2b2efdSGlen Barber#	-DTM_GMTOFF=tm_gmtoff
297ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
298ba2b2efdSGlen Barber# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
299ba2b2efdSGlen Barber# Similarly, if your system has a "zone abbreviation" field, define
300ba2b2efdSGlen Barber#	-DTM_ZONE=tm_zone
301ba2b2efdSGlen Barber# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
302ba2b2efdSGlen Barber# required by POSIX, but are widely available on GNU/Linux and BSD systems.
303ba2b2efdSGlen Barber#
3048d7edd17SPhilip Paeps# The next batch of options control support for external variables
3058d7edd17SPhilip Paeps# exported by tzcode.  In practice these variables are less useful
3068d7edd17SPhilip Paeps# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
3078d7edd17SPhilip Paeps# #
3088d7edd17SPhilip Paeps# # To omit or support the external variable "tzname", add one of:
309dd5f96c4SPhilip Paeps# #	-DHAVE_TZNAME=0 # do not support "tzname"
310dd5f96c4SPhilip Paeps# #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
311dd5f96c4SPhilip Paeps# #	-DHAVE_TZNAME=2 # support and define "tzname"
3128d7edd17SPhilip Paeps# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
3138d7edd17SPhilip Paeps# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
3148d7edd17SPhilip Paeps# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
3158d7edd17SPhilip Paeps# # crashes when combined with some platforms' standard libraries,
3168d7edd17SPhilip Paeps# # presumably due to memory allocation issues.
3178d7edd17SPhilip Paeps# #
3188d7edd17SPhilip Paeps# # To omit or support the external variables "timezone" and "daylight", add
319dd5f96c4SPhilip Paeps# #	-DUSG_COMPAT=0 # do not support
320dd5f96c4SPhilip Paeps# #	-DUSG_COMPAT=1 # support, and variables are defined by system library
321dd5f96c4SPhilip Paeps# #	-DUSG_COMPAT=2 # support and define variables
3228d7edd17SPhilip Paeps# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
3238d7edd17SPhilip Paeps# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
3248d7edd17SPhilip Paeps# # If not defined, the code attempts to guess USG_COMPAT from other macros.
3258d7edd17SPhilip Paeps# #
3268d7edd17SPhilip Paeps# # To support the external variable "altzone", add
327dd5f96c4SPhilip Paeps# #	-DALTZONE=0 # do not support
328dd5f96c4SPhilip Paeps# #	-DALTZONE=1 # support "altzone", which is defined by system library
329dd5f96c4SPhilip Paeps# #	-DALTZONE=2 # support and define "altzone"
3308d7edd17SPhilip Paeps# # to the end of the "CFLAGS=" line; although "altzone" appeared in
3318d7edd17SPhilip Paeps# # System V Release 3.1 it has not been standardized.
332dd5f96c4SPhilip Paeps# # If not defined, the code attempts to guess ALTZONE from other macros.
3338d7edd17SPhilip Paeps#
334ba2b2efdSGlen Barber# If you want functions that were inspired by early versions of X3J11's work,
335ba2b2efdSGlen Barber# add
336ba2b2efdSGlen Barber#	-DSTD_INSPIRED
337ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This arranges for the functions
33812a899b6SPhilip Paeps# "offtime", "timelocal", "timegm", "timeoff",
339ba2b2efdSGlen Barber# "posix2time", and "time2posix" to be added to the time conversion library.
340ba2b2efdSGlen Barber# "offtime" is like "gmtime" except that it accepts a second (long) argument
341ba2b2efdSGlen Barber# that gives an offset to add to the time_t when converting it.
342ba2b2efdSGlen Barber# "timelocal" is equivalent to "mktime".
343ba2b2efdSGlen Barber# "timegm" is like "timelocal" except that it turns a struct tm into
344ba2b2efdSGlen Barber# a time_t using UT (rather than local time as "timelocal" does).
345ba2b2efdSGlen Barber# "timeoff" is like "timegm" except that it accepts a second (long) argument
346ba2b2efdSGlen Barber# that gives an offset to use when converting to a time_t.
347ba2b2efdSGlen Barber# "posix2time" and "time2posix" are described in an included manual page.
348ba2b2efdSGlen Barber# X3J11's work does not describe any of these functions.
349ba2b2efdSGlen Barber# These functions may well disappear in future releases of the time
350ba2b2efdSGlen Barber# conversion package.
351ba2b2efdSGlen Barber#
352ba2b2efdSGlen Barber# If you don't want functions that were inspired by NetBSD, add
353ba2b2efdSGlen Barber#	-DNETBSD_INSPIRED=0
354ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  Otherwise, the functions
355ba2b2efdSGlen Barber# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
356ba2b2efdSGlen Barber# time library, and if STD_INSPIRED is also defined the functions
357ba2b2efdSGlen Barber# "posix2time_z" and "time2posix_z" are added as well.
358ba2b2efdSGlen Barber# The functions ending in "_z" (or "_rz") are like their unsuffixed
359ba2b2efdSGlen Barber# (or suffixed-by-"_r") counterparts, except with an extra first
360ba2b2efdSGlen Barber# argument of opaque type timezone_t that specifies the timezone.
361ba2b2efdSGlen Barber# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
362ba2b2efdSGlen Barber#
363ba2b2efdSGlen Barber# If you want to allocate state structures in localtime, add
364ba2b2efdSGlen Barber#	-DALL_STATE
365ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
366ba2b2efdSGlen Barber#
367ba2b2efdSGlen Barber# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
368ba2b2efdSGlen Barber# out by the National Institute of Standards and Technology
369ba2b2efdSGlen Barber# which claims to test C and Posix conformance.  If you want to pass PCTS, add
370ba2b2efdSGlen Barber#	-DPCTS
371ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.
372ba2b2efdSGlen Barber#
373ba2b2efdSGlen Barber# If you want strict compliance with XPG4 as of 1994-04-09, add
374ba2b2efdSGlen Barber#	-DXPG4_1994_04_09
375ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
3768d7edd17SPhilip Paeps# 53 as a week number (rather than 52 or 53) for January days before
3778d7edd17SPhilip Paeps# January's first Monday when a "%V" format is used and January 1
378ba2b2efdSGlen Barber# falls on a Friday, Saturday, or Sunday.
379ba2b2efdSGlen Barber
380ba2b2efdSGlen BarberCFLAGS=
381ba2b2efdSGlen Barber
382ba2b2efdSGlen Barber# Linker flags.  Default to $(LFLAGS) for backwards compatibility
383ba2b2efdSGlen Barber# to release 2012h and earlier.
384ba2b2efdSGlen Barber
385ba2b2efdSGlen BarberLDFLAGS=	$(LFLAGS)
386ba2b2efdSGlen Barber
387ba2b2efdSGlen Barber# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
388ba2b2efdSGlen Barber# submake command lines.  The default is no leap seconds.
389ba2b2efdSGlen Barber
390ba2b2efdSGlen BarberLEAPSECONDS=
391ba2b2efdSGlen Barber
392ba2b2efdSGlen Barber# The zic command and its arguments.
393ba2b2efdSGlen Barber
394ba2b2efdSGlen Barberzic=		./zic
395ba2b2efdSGlen BarberZIC=		$(zic) $(ZFLAGS)
396ba2b2efdSGlen Barber
397ad48359aSPhilip Paeps# To shrink the size of installed TZif files,
398ad48359aSPhilip Paeps# append "-r @N" to omit data before N-seconds-after-the-Epoch.
39912a899b6SPhilip Paeps# To grow the files and work around older application bugs, append "-b fat";
4002865ab3fSPhilip Paeps# see ZIC_BLOAT_DEFAULT above.
4012865ab3fSPhilip Paeps# See the zic man page for more about -b and -r.
402ba2b2efdSGlen BarberZFLAGS=
403ba2b2efdSGlen Barber
40489abb9f8SPhilip Paeps# How to use zic to install TZif files.
405ba2b2efdSGlen Barber
406f2fcff28SPhilip PaepsZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
407ba2b2efdSGlen Barber
408ba2b2efdSGlen Barber# The name of a Posix-compliant 'awk' on your system.
4098ea5af2bSPhilip Paeps# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
4108ea5af2bSPhilip Paeps# Also, it is better (though not essential) if 'awk' supports UTF-8,
4118ea5af2bSPhilip Paeps# and unfortunately mawk and busybox awk do not support UTF-8.
4128ea5af2bSPhilip Paeps# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
413ba2b2efdSGlen BarberAWK=		awk
414ba2b2efdSGlen Barber
415ba2b2efdSGlen Barber# The full path name of a Posix-compliant shell, preferably one that supports
416ba2b2efdSGlen Barber# the Korn shell's 'select' statement as an extension.
417ba2b2efdSGlen Barber# These days, Bash is the most popular.
418ba2b2efdSGlen Barber# It should be OK to set this to /bin/sh, on platforms where /bin/sh
419ba2b2efdSGlen Barber# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
420ba2b2efdSGlen Barber# is typically nicer if it works.
421ba2b2efdSGlen BarberKSHELL=		/bin/bash
422ba2b2efdSGlen Barber
4232c5e84ccSPhilip Paeps# Name of curl <https://curl.haxx.se/>, used for HTML validation.
4242c5e84ccSPhilip PaepsCURL=		curl
4252c5e84ccSPhilip Paeps
4262865ab3fSPhilip Paeps# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
4272865ab3fSPhilip PaepsGPG=		gpg
4282865ab3fSPhilip Paeps
429ba2b2efdSGlen Barber# This expensive test requires USE_LTZ.
430ba2b2efdSGlen Barber# To suppress it, define this macro to be empty.
431ba2b2efdSGlen BarberCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
432ba2b2efdSGlen Barber
433ba2b2efdSGlen Barber# SAFE_CHAR is a regular expression that matches a safe character.
434ba2b2efdSGlen Barber# Some parts of this distribution are limited to safe characters;
435ba2b2efdSGlen Barber# others can use any UTF-8 character.
436ba2b2efdSGlen Barber# For now, the safe characters are a safe subset of ASCII.
437ba2b2efdSGlen Barber# The caller must set the shell variable 'sharp' to the character '#',
438ba2b2efdSGlen Barber# since Makefile macros cannot contain '#'.
439ba2b2efdSGlen Barber# TAB_CHAR is a single tab character, in single quotes.
440ba2b2efdSGlen BarberTAB_CHAR=	'	'
441ba2b2efdSGlen BarberSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
442ba2b2efdSGlen BarberSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
443ba2b2efdSGlen BarberSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
444ba2b2efdSGlen BarberSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
445ba2b2efdSGlen BarberSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
446ba2b2efdSGlen Barber
44789abb9f8SPhilip Paeps# These characters are Latin-1, and so are likely to be displayable
44889abb9f8SPhilip Paeps# even in editors with limited character sets.
44989abb9f8SPhilip PaepsUNUSUAL_OK_LATIN_1 = «°±»½¾×
45089abb9f8SPhilip Paeps# This IPA symbol is represented in Unicode as the composition of
45189abb9f8SPhilip Paeps# U+0075 and U+032F, and U+032F is not considered alphabetic by some
45289abb9f8SPhilip Paeps# grep implementations that do not grok composition.
45389abb9f8SPhilip PaepsUNUSUAL_OK_IPA = u̯
45446bee4edSPhilip Paeps# Non-ASCII non-letters that OK_CHAR allows, as these characters are
45589abb9f8SPhilip Paeps# useful in commentary.
45689abb9f8SPhilip PaepsUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
45746bee4edSPhilip Paeps
458*9f9fc6bbSPhilip Paeps# Put this in a bracket expression to match spaces.
459*9f9fc6bbSPhilip Paepss = [:space:]
460*9f9fc6bbSPhilip Paeps
461ba2b2efdSGlen Barber# OK_CHAR matches any character allowed in the distributed files.
46246bee4edSPhilip Paeps# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
46346bee4edSPhilip Paeps# multibyte letters are also allowed so that commentary can contain a
46446bee4edSPhilip Paeps# few safe symbols and people's names and can quote non-English sources.
46546bee4edSPhilip Paeps# Other non-letters are limited to ASCII renderings for the
46646bee4edSPhilip Paeps# convenience of maintainers using XEmacs 21.5.34, which by default
46746bee4edSPhilip Paeps# mishandles Unicode characters U+0100 and greater.
46846bee4edSPhilip PaepsOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
469ba2b2efdSGlen Barber
470ba2b2efdSGlen Barber# SAFE_LINE matches a line of safe characters.
471ba2b2efdSGlen Barber# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
472ba2b2efdSGlen Barber# this is so that comments can contain non-ASCII characters.
473ba2b2efdSGlen Barber# OK_LINE matches a line of OK characters.
474ba2b2efdSGlen BarberSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
475ba2b2efdSGlen BarberSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
476ba2b2efdSGlen BarberOK_LINE=	'^'$(OK_CHAR)'*$$'
477ba2b2efdSGlen Barber
478ba2b2efdSGlen Barber# Flags to give 'tar' when making a distribution.
479ba2b2efdSGlen Barber# Try to use flags appropriate for GNU tar.
4808ea5af2bSPhilip PaepsGNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
4818ea5af2bSPhilip Paeps  --numeric-owner --owner=0 --group=0 \
4828ea5af2bSPhilip Paeps  --mode=go+u,go-w --sort=name
483ba2b2efdSGlen BarberTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
484ba2b2efdSGlen Barber		 then echo $(GNUTARFLAGS); \
485ba2b2efdSGlen Barber		 else :; \
486ba2b2efdSGlen Barber		 fi`
487ba2b2efdSGlen Barber
488ba2b2efdSGlen Barber# Flags to give 'gzip' when making a distribution.
489ba2b2efdSGlen BarberGZIPFLAGS=	-9n
490ba2b2efdSGlen Barber
491ba2b2efdSGlen Barber###############################################################################
492ba2b2efdSGlen Barber
493ba2b2efdSGlen Barber#MAKE=		make
494ba2b2efdSGlen Barber
495ba2b2efdSGlen Barbercc=		cc
496f2fcff28SPhilip PaepsCC=		$(cc) -DTZDIR='"$(TZDIR)"'
497ba2b2efdSGlen Barber
498ba2b2efdSGlen BarberAR=		ar
499ba2b2efdSGlen Barber
500ba2b2efdSGlen Barber# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
501ba2b2efdSGlen BarberRANLIB=		:
502ba2b2efdSGlen Barber
503ba2b2efdSGlen BarberTZCOBJS=	zic.o
5048d7edd17SPhilip PaepsTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
505ba2b2efdSGlen BarberDATEOBJS=	date.o localtime.o strftime.o asctime.o
506dd5f96c4SPhilip PaepsLIBSRCS=	localtime.c asctime.c difftime.c strftime.c
507dd5f96c4SPhilip PaepsLIBOBJS=	localtime.o asctime.o difftime.o strftime.o
508ba2b2efdSGlen BarberHEADERS=	tzfile.h private.h
509ba2b2efdSGlen BarberNONLIBSRCS=	zic.c zdump.c
510dd5f96c4SPhilip PaepsNEWUCBSRCS=	date.c
511ba2b2efdSGlen BarberSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
512ba2b2efdSGlen Barber			tzselect.ksh workman.sh
513ba2b2efdSGlen BarberMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
514ba2b2efdSGlen Barber			tzfile.5 tzselect.8 zic.8 zdump.8
515ba2b2efdSGlen BarberMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
516ba2b2efdSGlen Barber			time2posix.3.txt \
517ba2b2efdSGlen Barber			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
518ba2b2efdSGlen Barber			date.1.txt
5198d7edd17SPhilip PaepsCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
52093d120dbSPhilip Paeps			NEWS README SECURITY theory.html version
521f2fcff28SPhilip PaepsWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
522ad48359aSPhilip PaepsCHECK_WEB_PAGES=check_theory.html check_tz-art.html \
523ad48359aSPhilip Paeps			check_tz-how-to.html check_tz-link.html
524ba2b2efdSGlen BarberDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
525ba2b2efdSGlen BarberPRIMARY_YDATA=	africa antarctica asia australasia \
526ba2b2efdSGlen Barber		europe northamerica southamerica
527afb91be3SPhilip PaepsYDATA=		$(PRIMARY_YDATA) etcetera
52812a899b6SPhilip PaepsNDATA=		factory
52912a899b6SPhilip PaepsTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward
530afb91be3SPhilip PaepsTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
531ba2b2efdSGlen BarberZONETABLES=	zone1970.tab zone.tab
5328d7edd17SPhilip PaepsTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
533ba2b2efdSGlen BarberLEAP_DEPS=	leapseconds.awk leap-seconds.list
534*9f9fc6bbSPhilip PaepsTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) \
535*9f9fc6bbSPhilip Paeps		  $(PACKRATDATA) $(PACKRATLIST)
536*9f9fc6bbSPhilip PaepsDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
537afb91be3SPhilip PaepsDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
53812a899b6SPhilip Paeps			leapseconds $(ZONETABLES)
53946bee4edSPhilip PaepsAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
54046bee4edSPhilip Paeps			ziguard.awk zishrink.awk
541ba2b2efdSGlen BarberMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
542ba2b2efdSGlen BarberTZS_YEAR=	2050
54389abb9f8SPhilip PaepsTZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
544ba2b2efdSGlen BarberTZS=		to$(TZS_YEAR).tzs
545ba2b2efdSGlen BarberTZS_NEW=	to$(TZS_YEAR)new.tzs
54694c2d487SPhilip PaepsTZS_DEPS=	$(YDATA) asctime.c localtime.c \
547ba2b2efdSGlen Barber			private.h tzfile.h zdump.c zic.c
548*9f9fc6bbSPhilip PaepsTZDATA_DIST = $(COMMON) $(DATA) $(MISC)
54989abb9f8SPhilip Paeps# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
550*9f9fc6bbSPhilip PaepsEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
55189abb9f8SPhilip PaepsENCHILADA = $(EIGHT_YARDS) $(TZS)
552ba2b2efdSGlen Barber
553ba2b2efdSGlen Barber# Consult these files when deciding whether to rebuild the 'version' file.
554ba2b2efdSGlen Barber# This list is not the same as the output of 'git ls-files', since
555ba2b2efdSGlen Barber# .gitignore is not distributed.
556ba2b2efdSGlen BarberVERSION_DEPS= \
55793d120dbSPhilip Paeps		calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
558ba2b2efdSGlen Barber		africa antarctica asctime.c asia australasia \
559ba2b2efdSGlen Barber		backward backzone \
560ba2b2efdSGlen Barber		checklinks.awk checktab.awk \
561ba2b2efdSGlen Barber		date.1 date.c difftime.c \
562ba2b2efdSGlen Barber		etcetera europe factory iso3166.tab \
563ba2b2efdSGlen Barber		leap-seconds.list leapseconds.awk localtime.c \
564ba2b2efdSGlen Barber		newctime.3 newstrftime.3 newtzset.3 northamerica \
56512a899b6SPhilip Paeps		private.h southamerica strftime.c theory.html \
566f2fcff28SPhilip Paeps		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
567ba2b2efdSGlen Barber		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
56812a899b6SPhilip Paeps		workman.sh zdump.8 zdump.c zic.8 zic.c \
569d81c2dd9SPhilip Paeps		ziguard.awk zishrink.awk \
570ba2b2efdSGlen Barber		zone.tab zone1970.tab zoneinfo2tdf.pl
571ba2b2efdSGlen Barber
572ba2b2efdSGlen Barber# And for the benefit of csh users on systems that assume the user
573ba2b2efdSGlen Barber# shell should be used to handle commands in Makefiles. . .
574ba2b2efdSGlen Barber
575ba2b2efdSGlen BarberSHELL=		/bin/sh
576ba2b2efdSGlen Barber
57712a899b6SPhilip Paepsall:		tzselect zic zdump libtz.a $(TABDATA) \
57846bee4edSPhilip Paeps		  vanguard.zi main.zi rearguard.zi
579ba2b2efdSGlen Barber
580ba2b2efdSGlen BarberALL:		all date $(ENCHILADA)
581ba2b2efdSGlen Barber
582ba2b2efdSGlen Barberinstall:	all $(DATA) $(REDO) $(MANS)
583f2fcff28SPhilip Paeps		mkdir -p '$(DESTDIR)$(BINDIR)' \
584f2fcff28SPhilip Paeps			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
585f2fcff28SPhilip Paeps			'$(DESTDIR)$(LIBDIR)' \
586f2fcff28SPhilip Paeps			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
587f2fcff28SPhilip Paeps			'$(DESTDIR)$(MANDIR)/man8'
5882865ab3fSPhilip Paeps		$(ZIC_INSTALL) -l $(LOCALTIME) \
5892865ab3fSPhilip Paeps			`case '$(POSIXRULES)' in ?*) echo '-p';; esac \
5902865ab3fSPhilip Paeps			` $(POSIXRULES) \
591f2fcff28SPhilip Paeps			-t '$(DESTDIR)$(TZDEFAULT)'
592f2fcff28SPhilip Paeps		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
593f2fcff28SPhilip Paeps		cp tzselect '$(DESTDIR)$(BINDIR)/.'
594f2fcff28SPhilip Paeps		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
595f2fcff28SPhilip Paeps		cp zic '$(DESTDIR)$(ZICDIR)/.'
596f2fcff28SPhilip Paeps		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
597f2fcff28SPhilip Paeps		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
598f2fcff28SPhilip Paeps		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
599f2fcff28SPhilip Paeps		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
600f2fcff28SPhilip Paeps		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
601ba2b2efdSGlen Barber
602ba2b2efdSGlen BarberINSTALL:	ALL install date.1
603f2fcff28SPhilip Paeps		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
604f2fcff28SPhilip Paeps		cp date '$(DESTDIR)$(BINDIR)/.'
605f2fcff28SPhilip Paeps		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
606ba2b2efdSGlen Barber
607dc505d53SPhilip Paeps# Calculate version number from git, if available.
608dc505d53SPhilip Paeps# Otherwise, use $(VERSION) unless it is "unknown" and there is already
609dc505d53SPhilip Paeps# a 'version' file, in which case reuse the existing 'version' contents
610dc505d53SPhilip Paeps# and append "-dirty" if the contents do not already end in "-dirty".
611ba2b2efdSGlen Barberversion:	$(VERSION_DEPS)
612ba2b2efdSGlen Barber		{ (type git) >/dev/null 2>&1 && \
613ba2b2efdSGlen Barber		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
614ba2b2efdSGlen Barber				--abbrev=7 --dirty` || \
615dc505d53SPhilip Paeps		  if test '$(VERSION)' = unknown && V=`cat $@`; then \
616dc505d53SPhilip Paeps		    case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
617dc505d53SPhilip Paeps		  else \
618dc505d53SPhilip Paeps		    V='$(VERSION)'; \
619dc505d53SPhilip Paeps		  fi; } && \
620ba2b2efdSGlen Barber		printf '%s\n' "$$V" >$@.out
621ba2b2efdSGlen Barber		mv $@.out $@
622ba2b2efdSGlen Barber
623*9f9fc6bbSPhilip Paeps# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
62446bee4edSPhilip Paepsvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
625*9f9fc6bbSPhilip Paeps		$(AWK) \
626*9f9fc6bbSPhilip Paeps		  -v DATAFORM=`expr $@ : '\(.*\).zi'` \
627*9f9fc6bbSPhilip Paeps		  -v PACKRATDATA='$(PACKRATDATA)' \
628*9f9fc6bbSPhilip Paeps		  -v PACKRATLIST='$(PACKRATLIST)' \
629*9f9fc6bbSPhilip Paeps		  -f ziguard.awk \
630d81c2dd9SPhilip Paeps		  $(TDATA) $(PACKRATDATA) >$@.out
63146bee4edSPhilip Paeps		mv $@.out $@
63289abb9f8SPhilip Paeps# This file has a version comment that attempts to capture any tailoring
633*9f9fc6bbSPhilip Paeps# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
63489abb9f8SPhilip Paepstzdata.zi:	$(DATAFORM).zi version zishrink.awk
635f2fcff28SPhilip Paeps		version=`sed 1q version` && \
63689abb9f8SPhilip Paeps		  LC_ALL=C $(AWK) \
63789abb9f8SPhilip Paeps		    -v dataform='$(DATAFORM)' \
63889abb9f8SPhilip Paeps		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
63989abb9f8SPhilip Paeps		    -v redo='$(REDO)' \
64089abb9f8SPhilip Paeps		    -v version="$$version" \
64189abb9f8SPhilip Paeps		    -f zishrink.awk \
64246bee4edSPhilip Paeps		    $(DATAFORM).zi >$@.out
6438d7edd17SPhilip Paeps		mv $@.out $@
6448d7edd17SPhilip Paeps
645ba2b2efdSGlen Barberversion.h:	version
646ba2b2efdSGlen Barber		VERSION=`cat version` && printf '%s\n' \
647ba2b2efdSGlen Barber		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
648ba2b2efdSGlen Barber		  "static char const TZVERSION[]=\"$$VERSION\";" \
649ba2b2efdSGlen Barber		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
650ba2b2efdSGlen Barber		  >$@.out
651ba2b2efdSGlen Barber		mv $@.out $@
652ba2b2efdSGlen Barber
653ba2b2efdSGlen Barberzdump:		$(TZDOBJS)
654ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
655ba2b2efdSGlen Barber
656ba2b2efdSGlen Barberzic:		$(TZCOBJS)
657ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
658ba2b2efdSGlen Barber
659ba2b2efdSGlen Barberleapseconds:	$(LEAP_DEPS)
660dd5f96c4SPhilip Paeps		$(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
661dd5f96c4SPhilip Paeps		  -f leapseconds.awk leap-seconds.list >$@.out
662ba2b2efdSGlen Barber		mv $@.out $@
663ba2b2efdSGlen Barber
664ba2b2efdSGlen Barber# Arguments to pass to submakes of install_data.
665ba2b2efdSGlen Barber# They can be overridden by later submake arguments.
666ba2b2efdSGlen BarberINSTALLARGS = \
667f2fcff28SPhilip Paeps BACKWARD='$(BACKWARD)' \
668f2fcff28SPhilip Paeps DESTDIR='$(DESTDIR)' \
669ba2b2efdSGlen Barber LEAPSECONDS='$(LEAPSECONDS)' \
670ba2b2efdSGlen Barber PACKRATDATA='$(PACKRATDATA)' \
671*9f9fc6bbSPhilip Paeps PACKRATLIST='$(PACKRATLIST)' \
672f2fcff28SPhilip Paeps TZDEFAULT='$(TZDEFAULT)' \
673f2fcff28SPhilip Paeps TZDIR='$(TZDIR)' \
674ba2b2efdSGlen Barber ZIC='$(ZIC)'
675ba2b2efdSGlen Barber
67612a899b6SPhilip PaepsINSTALL_DATA_DEPS = zic leapseconds tzdata.zi
67789abb9f8SPhilip Paeps
67889abb9f8SPhilip Paeps# 'make install_data' installs one set of TZif files.
67989abb9f8SPhilip Paepsinstall_data: $(INSTALL_DATA_DEPS)
6808d7edd17SPhilip Paeps		$(ZIC_INSTALL) tzdata.zi
681ba2b2efdSGlen Barber
68289abb9f8SPhilip Paepsposix_only: $(INSTALL_DATA_DEPS)
683ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
684ba2b2efdSGlen Barber
68589abb9f8SPhilip Paepsright_only: $(INSTALL_DATA_DEPS)
686ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
687ba2b2efdSGlen Barber			install_data
688ba2b2efdSGlen Barber
689ba2b2efdSGlen Barber# In earlier versions of this makefile, the other two directories were
690ba2b2efdSGlen Barber# subdirectories of $(TZDIR).  However, this led to configuration errors.
691ba2b2efdSGlen Barber# For example, with posix_right under the earlier scheme,
692ba2b2efdSGlen Barber# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
693ba2b2efdSGlen Barber# but gmtime without leap seconds, which led to problems with applications
694ba2b2efdSGlen Barber# like sendmail that subtract gmtime from localtime.
695ba2b2efdSGlen Barber# Therefore, the other two directories are now siblings of $(TZDIR).
696ba2b2efdSGlen Barber# You must replace all of $(TZDIR) to switch from not using leap seconds
697ba2b2efdSGlen Barber# to using them, or vice versa.
698ba2b2efdSGlen Barberright_posix:	right_only
699f2fcff28SPhilip Paeps		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
700f2fcff28SPhilip Paeps		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
701f2fcff28SPhilip Paeps		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
702f2fcff28SPhilip Paeps		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
703ba2b2efdSGlen Barber
704ba2b2efdSGlen Barberposix_right:	posix_only
705f2fcff28SPhilip Paeps		rm -fr '$(DESTDIR)$(TZDIR)-posix'
706f2fcff28SPhilip Paeps		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
707f2fcff28SPhilip Paeps		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
708f2fcff28SPhilip Paeps		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
709ba2b2efdSGlen Barber
710ba2b2efdSGlen Barberzones:		$(REDO)
711ba2b2efdSGlen Barber
71246bee4edSPhilip Paeps# dummy.zd is not a real file; it is mentioned here only so that the
71346bee4edSPhilip Paeps# top-level 'make' does not have a syntax error.
71446bee4edSPhilip PaepsZDS = dummy.zd
71546bee4edSPhilip Paeps# Rule used only by submakes invoked by the $(TZS_NEW) rule.
71646bee4edSPhilip Paeps# It is separate so that GNU 'make -j' can run instances in parallel.
71746bee4edSPhilip Paeps$(ZDS): zdump
71889abb9f8SPhilip Paeps		./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
71989abb9f8SPhilip Paeps		  >$@
72046bee4edSPhilip Paeps
72189abb9f8SPhilip PaepsTZS_NEW_DEPS = tzdata.zi zdump zic
72289abb9f8SPhilip Paeps$(TZS_NEW): $(TZS_NEW_DEPS)
72389abb9f8SPhilip Paeps		rm -fr tzs$(TZS_YEAR).dir
72489abb9f8SPhilip Paeps		mkdir tzs$(TZS_YEAR).dir
72589abb9f8SPhilip Paeps		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
7268d7edd17SPhilip Paeps		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
7278d7edd17SPhilip Paeps		   tzdata.zi | LC_ALL=C sort >$@.out
728ba2b2efdSGlen Barber		wd=`pwd` && \
72989abb9f8SPhilip Paeps		x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
73089abb9f8SPhilip Paeps				tzdata.zi \
73146bee4edSPhilip Paeps			| LC_ALL=C sort -t . -k 2,2` && \
73289abb9f8SPhilip Paeps		set x $$x && \
73346bee4edSPhilip Paeps		shift && \
73446bee4edSPhilip Paeps		ZDS=$$* && \
73589abb9f8SPhilip Paeps		$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
73689abb9f8SPhilip Paeps		  ZDS="$$ZDS" $$ZDS && \
73789abb9f8SPhilip Paeps		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
73889abb9f8SPhilip Paeps		rm -fr tzs$(TZS_YEAR).dir
73946bee4edSPhilip Paeps		mv $@.out $@
740ba2b2efdSGlen Barber
74189abb9f8SPhilip Paeps# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
742ba2b2efdSGlen Barber# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
743ba2b2efdSGlen Barber$(TZS):
74489abb9f8SPhilip Paeps		touch $@
745ba2b2efdSGlen Barber
746ba2b2efdSGlen Barberforce_tzs:	$(TZS_NEW)
747ba2b2efdSGlen Barber		cp $(TZS_NEW) $(TZS)
748ba2b2efdSGlen Barber
749ba2b2efdSGlen Barberlibtz.a:	$(LIBOBJS)
750e350c46aSBaptiste Daroussin		rm -f $@
751e350c46aSBaptiste Daroussin		$(AR) -rc $@ $(LIBOBJS)
752ba2b2efdSGlen Barber		$(RANLIB) $@
753ba2b2efdSGlen Barber
754ba2b2efdSGlen Barberdate:		$(DATEOBJS)
755ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
756ba2b2efdSGlen Barber
757ba2b2efdSGlen Barbertzselect:	tzselect.ksh version
758ba2b2efdSGlen Barber		VERSION=`cat version` && sed \
759ba2b2efdSGlen Barber			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
7608ea5af2bSPhilip Paeps			-e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \
761ba2b2efdSGlen Barber			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
762ba2b2efdSGlen Barber			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
763ba2b2efdSGlen Barber			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
764ba2b2efdSGlen Barber			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
765ba2b2efdSGlen Barber			<$@.ksh >$@.out
766ba2b2efdSGlen Barber		chmod +x $@.out
767ba2b2efdSGlen Barber		mv $@.out $@
768ba2b2efdSGlen Barber
7698d7edd17SPhilip Paepscheck:		check_character_set check_white_space check_links \
770*9f9fc6bbSPhilip Paeps		  check_name_lengths check_slashed_abbrs check_sorted \
771*9f9fc6bbSPhilip Paeps		  check_tables check_web check_ziguard check_zishrink check_tzs
772ba2b2efdSGlen Barber
773ba2b2efdSGlen Barbercheck_character_set: $(ENCHILADA)
7748d7edd17SPhilip Paeps	test ! '$(UTF8_LOCALE)' || \
7758d7edd17SPhilip Paeps	! printf 'A\304\200B\n' | \
7768d7edd17SPhilip Paeps	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
7778d7edd17SPhilip Paeps		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
778ba2b2efdSGlen Barber		sharp='#' && \
779ba2b2efdSGlen Barber		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
780ba2b2efdSGlen Barber			$(MISC) $(SOURCES) $(WEB_PAGES) \
78193d120dbSPhilip Paeps			CONTRIBUTING LICENSE README SECURITY \
7828d7edd17SPhilip Paeps			version tzdata.zi && \
78389abb9f8SPhilip Paeps		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
78446bee4edSPhilip Paeps			Makefile && \
785afb91be3SPhilip Paeps		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
78612a899b6SPhilip Paeps			leapseconds zone.tab && \
7878d7edd17SPhilip Paeps		! grep -Env $(OK_LINE) $(ENCHILADA); \
7888d7edd17SPhilip Paeps	}
78989abb9f8SPhilip Paeps	touch $@
790ba2b2efdSGlen Barber
791ba2b2efdSGlen Barbercheck_white_space: $(ENCHILADA)
792ba2b2efdSGlen Barber		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
79389abb9f8SPhilip Paeps		! grep -En "$$pat" \
79489abb9f8SPhilip Paeps			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
795*9f9fc6bbSPhilip Paeps		! grep -n '[$s]$$' \
796afb91be3SPhilip Paeps			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
79789abb9f8SPhilip Paeps		touch $@
798ba2b2efdSGlen Barber
799*9f9fc6bbSPhilip PaepsPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
800*9f9fc6bbSPhilip PaepsFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
8018d7edd17SPhilip Paeps
802afb91be3SPhilip Paepscheck_name_lengths: $(TDATA_TO_CHECK) backzone
803afb91be3SPhilip Paeps		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
804afb91be3SPhilip Paeps			$(TDATA_TO_CHECK) backzone
80589abb9f8SPhilip Paeps		touch $@
8068d7edd17SPhilip Paeps
807*9f9fc6bbSPhilip PaepsPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
808*9f9fc6bbSPhilip PaepsSTDOFF = [-+]?[0-9:.]+
809*9f9fc6bbSPhilip PaepsRULELESS_SAVE = (-|$(STDOFF)[sd]?)
810*9f9fc6bbSPhilip PaepsRULELESS_SLASHED_ABBRS = \
811*9f9fc6bbSPhilip Paeps  $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
812*9f9fc6bbSPhilip Paeps
813*9f9fc6bbSPhilip Paepscheck_slashed_abbrs: $(TDATA_TO_CHECK)
814*9f9fc6bbSPhilip Paeps		! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
815*9f9fc6bbSPhilip Paeps		touch $@
816*9f9fc6bbSPhilip Paeps
817ba2b2efdSGlen BarberCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
818ba2b2efdSGlen Barber
819ba2b2efdSGlen Barbercheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
820ba2b2efdSGlen Barber		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
821ba2b2efdSGlen Barber		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
82289abb9f8SPhilip Paeps		touch $@
823ba2b2efdSGlen Barber
82446bee4edSPhilip Paepscheck_links:	checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
825afb91be3SPhilip Paeps		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
8268d7edd17SPhilip Paeps		$(AWK) -f checklinks.awk tzdata.zi
82789abb9f8SPhilip Paeps		touch $@
828ba2b2efdSGlen Barber
82994c2d487SPhilip Paepscheck_tables:	checktab.awk $(YDATA) backward $(ZONETABLES)
830ba2b2efdSGlen Barber		for tab in $(ZONETABLES); do \
83194c2d487SPhilip Paeps		  test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
83294c2d487SPhilip Paeps		  $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
833ba2b2efdSGlen Barber		    || exit; \
834ba2b2efdSGlen Barber		done
83589abb9f8SPhilip Paeps		touch $@
836ba2b2efdSGlen Barber
837ba2b2efdSGlen Barbercheck_tzs:	$(TZS) $(TZS_NEW)
83889abb9f8SPhilip Paeps		if test -s $(TZS); then \
83989abb9f8SPhilip Paeps		  diff -u $(TZS) $(TZS_NEW); \
84089abb9f8SPhilip Paeps		else \
84189abb9f8SPhilip Paeps		  cp $(TZS_NEW) $(TZS); \
84289abb9f8SPhilip Paeps		fi
84389abb9f8SPhilip Paeps		touch $@
844ba2b2efdSGlen Barber
8452c5e84ccSPhilip Paepscheck_web:	$(CHECK_WEB_PAGES)
846ad48359aSPhilip Paepscheck_theory.html: theory.html
8472c5e84ccSPhilip Paepscheck_tz-art.html: tz-art.html
84812a899b6SPhilip Paepscheck_tz-how-to.html: tz-how-to.html
8492c5e84ccSPhilip Paepscheck_tz-link.html: tz-link.html
85012a899b6SPhilip Paepscheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
8512c5e84ccSPhilip Paeps		$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
8522c5e84ccSPhilip Paeps		    -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
8532c5e84ccSPhilip Paeps		  test ! -s $@.out || { cat $@.out; exit 1; }
8542c5e84ccSPhilip Paeps		mv $@.out $@
8558d7edd17SPhilip Paeps
856*9f9fc6bbSPhilip Paepscheck_ziguard: rearguard.zi vanguard.zi ziguard.awk
857*9f9fc6bbSPhilip Paeps		$(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
858*9f9fc6bbSPhilip Paeps		  diff -u rearguard.zi -
859*9f9fc6bbSPhilip Paeps		$(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
860*9f9fc6bbSPhilip Paeps		  diff -u vanguard.zi -
861*9f9fc6bbSPhilip Paeps		touch $@
862*9f9fc6bbSPhilip Paeps
86346bee4edSPhilip Paeps# Check that zishrink.awk does not alter the data, and that ziguard.awk
86446bee4edSPhilip Paeps# preserves main-format data.
86589abb9f8SPhilip Paepscheck_zishrink: check_zishrink_posix check_zishrink_right
86689abb9f8SPhilip Paepscheck_zishrink_posix check_zishrink_right: \
867*9f9fc6bbSPhilip Paeps  zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
868*9f9fc6bbSPhilip Paeps  $(TDATA) $(DATAFORM).zi tzdata.zi
86989abb9f8SPhilip Paeps		rm -fr $@.dir $@-t.dir $@-shrunk.dir
87089abb9f8SPhilip Paeps		mkdir $@.dir $@-t.dir $@-shrunk.dir
87189abb9f8SPhilip Paeps		case $@ in \
87289abb9f8SPhilip Paeps		  *_right) leap='-L leapseconds';; \
8738d7edd17SPhilip Paeps		  *) leap=;; \
8748d7edd17SPhilip Paeps		esac && \
87589abb9f8SPhilip Paeps		  $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
87689abb9f8SPhilip Paeps		  $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
877*9f9fc6bbSPhilip Paeps		  case $(DATAFORM),$(PACKRATLIST) in \
878*9f9fc6bbSPhilip Paeps		    main,) \
87989abb9f8SPhilip Paeps		      $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
8808d7edd17SPhilip Paeps		      $(AWK) '/^Rule/' $(TDATA) | \
88189abb9f8SPhilip Paeps			$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
88289abb9f8SPhilip Paeps		      diff -r $@.dir $@-t.dir;; \
88389abb9f8SPhilip Paeps		  esac
88489abb9f8SPhilip Paeps		diff -r $@.dir $@-shrunk.dir
88589abb9f8SPhilip Paeps		rm -fr $@.dir $@-t.dir $@-shrunk.dir
88689abb9f8SPhilip Paeps		touch $@
887ba2b2efdSGlen Barber
888ba2b2efdSGlen Barberclean_misc:
889ad48359aSPhilip Paeps		rm -fr check_*.dir
89089abb9f8SPhilip Paeps		rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
89189abb9f8SPhilip Paeps		  check_* core typecheck_* \
89212a899b6SPhilip Paeps		  date tzselect version.h zdump zic libtz.a
893ba2b2efdSGlen Barberclean:		clean_misc
894ad48359aSPhilip Paeps		rm -fr *.dir tzdb-*/
895ad48359aSPhilip Paeps		rm -f *.zi $(TZS_NEW)
896ba2b2efdSGlen Barber
897ba2b2efdSGlen Barbermaintainer-clean: clean
898ba2b2efdSGlen Barber		@echo 'This command is intended for maintainers to use; it'
899ba2b2efdSGlen Barber		@echo 'deletes files that may need special tools to rebuild.'
900ba2b2efdSGlen Barber		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
901ba2b2efdSGlen Barber
902ba2b2efdSGlen Barbernames:
903ba2b2efdSGlen Barber		@echo $(ENCHILADA)
904ba2b2efdSGlen Barber
905ba2b2efdSGlen Barberpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
906ba2b2efdSGlen Barber		tarballs signatures
907ba2b2efdSGlen Barber
908ba2b2efdSGlen Barberdate.1.txt:	date.1
909ba2b2efdSGlen Barbernewctime.3.txt:	newctime.3
910ba2b2efdSGlen Barbernewstrftime.3.txt: newstrftime.3
911ba2b2efdSGlen Barbernewtzset.3.txt:	newtzset.3
912ba2b2efdSGlen Barbertime2posix.3.txt: time2posix.3
913ba2b2efdSGlen Barbertzfile.5.txt:	tzfile.5
914ba2b2efdSGlen Barbertzselect.8.txt:	tzselect.8
915ba2b2efdSGlen Barberzdump.8.txt:	zdump.8
916ba2b2efdSGlen Barberzic.8.txt:	zic.8
917ba2b2efdSGlen Barber
918ba2b2efdSGlen Barber$(MANTXTS):	workman.sh
919ba2b2efdSGlen Barber		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
920ba2b2efdSGlen Barber		mv $@.out $@
921ba2b2efdSGlen Barber
922dc505d53SPhilip Paeps# Set file timestamps deterministically if possible,
923dc505d53SPhilip Paeps# so that tarballs containing the timestamps are reproducible.
924dc505d53SPhilip Paeps#
925dc505d53SPhilip Paeps# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
926dc505d53SPhilip Paeps# file DEST to the maximum of the timestamps of the files A B C ...,
927dc505d53SPhilip Paeps# plus N if GNU ls and touch are available.
928dc505d53SPhilip PaepsSET_TIMESTAMP_N = sh -c '\
929dc505d53SPhilip Paeps  n=$$0 dest=$$1; shift; \
930dc505d53SPhilip Paeps  touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \
931dc505d53SPhilip Paeps  if test $$n != 0 && \
932dc505d53SPhilip Paeps     lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \
933dc505d53SPhilip Paeps    set x $$lsout && \
934dc505d53SPhilip Paeps    touch -cmd @`expr $$7 + $$n` "$$dest"; \
935dc505d53SPhilip Paeps  else :; fi'
936dc505d53SPhilip Paeps# If DEST depends on A B C ... in this Makefile, callers should use
937dc505d53SPhilip Paeps# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
938dc505d53SPhilip Paeps# downstream 'make' that considers equal timestamps to be out of date.
939dc505d53SPhilip Paeps# POSIX allows this 'make' behavior, and HP-UX 'make' does it.
940dc505d53SPhilip Paeps# If all that matters is that the timestamp be reproducible
941dc505d53SPhilip Paeps# and plausible, use $(SET_TIMESTAMP).
942dc505d53SPhilip PaepsSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
943dc505d53SPhilip PaepsSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
944dc505d53SPhilip Paeps
945ba2b2efdSGlen Barber# Set the timestamps to those of the git repository, if available,
946ba2b2efdSGlen Barber# and if the files have not changed since then.
947dc505d53SPhilip Paeps# This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
948dc505d53SPhilip Paeps# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
949dc505d53SPhilip Paeps# If git or GNU is absent, don't bother to sync with git timestamps.
950ba2b2efdSGlen Barber# Also, set the timestamp of each prebuilt file like 'leapseconds'
951ba2b2efdSGlen Barber# to be the maximum of the files it depends on.
95289abb9f8SPhilip Paepsset-timestamps.out: $(EIGHT_YARDS)
953ba2b2efdSGlen Barber		rm -f $@
954ba2b2efdSGlen Barber		if (type git) >/dev/null 2>&1 && \
95589abb9f8SPhilip Paeps		   files=`git ls-files $(EIGHT_YARDS)` && \
956ba2b2efdSGlen Barber		   touch -md @1 test.out; then \
957ba2b2efdSGlen Barber		  rm -f test.out && \
958ba2b2efdSGlen Barber		  for file in $$files; do \
959ba2b2efdSGlen Barber		    if git diff --quiet $$file; then \
960ba2b2efdSGlen Barber		      time=`git log -1 --format='tformat:%ct' $$file` && \
961ba2b2efdSGlen Barber		      touch -cmd @$$time $$file; \
962ba2b2efdSGlen Barber		    else \
963ba2b2efdSGlen Barber		      echo >&2 "$$file: warning: does not match repository"; \
964ba2b2efdSGlen Barber		    fi || exit; \
965ba2b2efdSGlen Barber		  done; \
966ba2b2efdSGlen Barber		fi
967dc505d53SPhilip Paeps		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
968ba2b2efdSGlen Barber		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
969dc505d53SPhilip Paeps		  $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
970ba2b2efdSGlen Barber		    exit; \
971ba2b2efdSGlen Barber		done
972dc505d53SPhilip Paeps		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
973dc505d53SPhilip Paeps		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
974ba2b2efdSGlen Barber		touch $@
97589abb9f8SPhilip Paepsset-tzs-timestamp.out: $(TZS)
976dc505d53SPhilip Paeps		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
97789abb9f8SPhilip Paeps		touch $@
978ba2b2efdSGlen Barber
979ba2b2efdSGlen Barber# The zics below ensure that each data file can stand on its own.
980ba2b2efdSGlen Barber# We also do an all-files run to catch links to links.
981ba2b2efdSGlen Barber
98289abb9f8SPhilip Paepscheck_public: $(VERSION_DEPS)
983ba2b2efdSGlen Barber		rm -fr public.dir
98489abb9f8SPhilip Paeps		mkdir public.dir
98589abb9f8SPhilip Paeps		ln $(VERSION_DEPS) public.dir
98689abb9f8SPhilip Paeps		cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
987e35a01eeSPhilip Paeps		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
988e35a01eeSPhilip Paeps		    public.dir/vanguard.zi public.dir/main.zi \
989e35a01eeSPhilip Paeps		    public.dir/rearguard.zi; \
990e35a01eeSPhilip Paeps		do \
99189abb9f8SPhilip Paeps		  public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
99289abb9f8SPhilip Paeps		done
99389abb9f8SPhilip Paeps		public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
99494c2d487SPhilip Paeps		:
99594c2d487SPhilip Paeps		: Also check 'backzone' syntax.
99694c2d487SPhilip Paeps		rm public.dir/main.zi
99794c2d487SPhilip Paeps		cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
99894c2d487SPhilip Paeps		public.dir/zic -d public.dir/zoneinfo main.zi
999*9f9fc6bbSPhilip Paeps		rm public.dir/main.zi
1000*9f9fc6bbSPhilip Paeps		cd public.dir && \
1001*9f9fc6bbSPhilip Paeps		  $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
1002*9f9fc6bbSPhilip Paeps		public.dir/zic -d public.dir/zoneinfo main.zi
100394c2d487SPhilip Paeps		:
100489abb9f8SPhilip Paeps		rm -fr public.dir
100589abb9f8SPhilip Paeps		touch $@
1006ba2b2efdSGlen Barber
1007ba2b2efdSGlen Barber# Check that the code works under various alternative
1008ba2b2efdSGlen Barber# implementations of time_t.
100989abb9f8SPhilip Paepscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES)
101089abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
101189abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
101289abb9f8SPhilip Paeps		rm -fr $@.dir
101389abb9f8SPhilip Paeps		mkdir $@.dir
101489abb9f8SPhilip Paeps		ln $(VERSION_DEPS) $@.dir
101589abb9f8SPhilip Paeps		case $@ in \
101694c2d487SPhilip Paeps		  int*32_t) range=-2147483648,2147483648;; \
101789abb9f8SPhilip Paeps		  u*) range=0,4294967296;; \
101889abb9f8SPhilip Paeps		  *) range=-4294967296,4294967296;; \
101989abb9f8SPhilip Paeps		esac && \
102089abb9f8SPhilip Paeps		wd=`pwd` && \
102189abb9f8SPhilip Paeps		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
102289abb9f8SPhilip Paeps		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
102389abb9f8SPhilip Paeps		  range_target=; \
102489abb9f8SPhilip Paeps		else \
102589abb9f8SPhilip Paeps		  range_target=to$$range.tzs; \
102689abb9f8SPhilip Paeps		fi && \
102789abb9f8SPhilip Paeps		(cd $@.dir && \
102889abb9f8SPhilip Paeps		  $(MAKE) TOPDIR="$$wd/$@.dir" \
102989abb9f8SPhilip Paeps		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
103089abb9f8SPhilip Paeps		    REDO='$(REDO)' \
103189abb9f8SPhilip Paeps			D=$$wd/$@.dir \
103289abb9f8SPhilip Paeps		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
103389abb9f8SPhilip Paeps		    install $$range_target) && \
103489abb9f8SPhilip Paeps		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
103589abb9f8SPhilip Paeps		  (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
103689abb9f8SPhilip Paeps		    $(MAKE) TOPDIR="$$wd/$@.dir" \
103789abb9f8SPhilip Paeps		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
103889abb9f8SPhilip Paeps			D=$$wd/$@.dir \
103989abb9f8SPhilip Paeps		      to$$range.tzs) && \
104089abb9f8SPhilip Paeps		  diff -u $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
104189abb9f8SPhilip Paeps			  $@.dir/to$$range.tzs && \
1042ba2b2efdSGlen Barber		  if diff -q Makefile Makefile 2>/dev/null; then \
1043ba2b2efdSGlen Barber		    quiet_option='-q'; \
1044ba2b2efdSGlen Barber		  else \
1045ba2b2efdSGlen Barber		    quiet_option=''; \
1046ba2b2efdSGlen Barber		  fi && \
104789abb9f8SPhilip Paeps		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
104889abb9f8SPhilip Paeps					   $@.dir/etc && \
1049ba2b2efdSGlen Barber		    diff $$quiet_option -r \
105089abb9f8SPhilip Paeps		      $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
105189abb9f8SPhilip Paeps		      $@.dir/usr/share; \
105289abb9f8SPhilip Paeps		}
105389abb9f8SPhilip Paeps		touch $@
1054ba2b2efdSGlen Barber
1055d81c2dd9SPhilip PaepsTRADITIONAL_ASC = \
1056d81c2dd9SPhilip Paeps  tzcode$(VERSION).tar.gz.asc \
1057d81c2dd9SPhilip Paeps  tzdata$(VERSION).tar.gz.asc
105889abb9f8SPhilip PaepsREARGUARD_ASC = \
105989abb9f8SPhilip Paeps  tzdata$(VERSION)-rearguard.tar.gz.asc
106089abb9f8SPhilip PaepsALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
1061d81c2dd9SPhilip Paeps  tzdb-$(VERSION).tar.lz.asc
1062d81c2dd9SPhilip Paeps
1063*9f9fc6bbSPhilip Paepstarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
106489abb9f8SPhilip Paepssignatures rearguard_signatures traditional_signatures: \
1065*9f9fc6bbSPhilip Paeps  version set-timestamps.out rearguard.zi vanguard.zi
1066ba2b2efdSGlen Barber		VERSION=`cat version` && \
1067dc505d53SPhilip Paeps		$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
1068ba2b2efdSGlen Barber
106946bee4edSPhilip Paeps# These *_version rules are intended for use if VERSION is set by some
107046bee4edSPhilip Paeps# other means.  Ordinarily these rules are used only by the above
107146bee4edSPhilip Paeps# non-_version rules, which set VERSION on the 'make' command line.
107289abb9f8SPhilip Paepstarballs_version: traditional_tarballs_version rearguard_tarballs_version \
1073d81c2dd9SPhilip Paeps  tzdb-$(VERSION).tar.lz
107489abb9f8SPhilip Paepsrearguard_tarballs_version: \
107589abb9f8SPhilip Paeps  tzdata$(VERSION)-rearguard.tar.gz
1076ba2b2efdSGlen Barbertraditional_tarballs_version: \
1077ba2b2efdSGlen Barber  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
1078*9f9fc6bbSPhilip Paepstailored_tarballs_version: \
1079*9f9fc6bbSPhilip Paeps  tzdata$(VERSION)-tailored.tar.gz
1080d81c2dd9SPhilip Paepssignatures_version: $(ALL_ASC)
108189abb9f8SPhilip Paepsrearguard_signatures_version: $(REARGUARD_ASC)
1082d81c2dd9SPhilip Paepstraditional_signatures_version: $(TRADITIONAL_ASC)
1083ba2b2efdSGlen Barber
1084ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz: set-timestamps.out
1085ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
1086ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - \
1087ba2b2efdSGlen Barber		    $(COMMON) $(DOCS) $(SOURCES) | \
1088ba2b2efdSGlen Barber		  gzip $(GZIPFLAGS) >$@.out
1089ba2b2efdSGlen Barber		mv $@.out $@
1090ba2b2efdSGlen Barber
1091ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz: set-timestamps.out
1092ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
1093*9f9fc6bbSPhilip Paeps		tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
1094ba2b2efdSGlen Barber		  gzip $(GZIPFLAGS) >$@.out
1095ba2b2efdSGlen Barber		mv $@.out $@
1096ba2b2efdSGlen Barber
1097*9f9fc6bbSPhilip Paeps# Create empty files with a reproducible timestamp.
1098*9f9fc6bbSPhilip PaepsCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
1099*9f9fc6bbSPhilip Paeps
1100*9f9fc6bbSPhilip Paeps# The obsolescent *rearguard* targets and related macros are present
1101*9f9fc6bbSPhilip Paeps# for backwards compatibility with tz releases 2018e through 2022a.
1102*9f9fc6bbSPhilip Paeps# They should go away eventually.  To build rearguard tarballs you
1103*9f9fc6bbSPhilip Paeps# can instead use 'make DATAFORM=rearguard tailored_tarballs'.
1104d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
1105*9f9fc6bbSPhilip Paeps		rm -fr $@.dir
1106*9f9fc6bbSPhilip Paeps		mkdir $@.dir
1107*9f9fc6bbSPhilip Paeps		ln $(TZDATA_DIST) $@.dir
1108*9f9fc6bbSPhilip Paeps		cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
1109d81c2dd9SPhilip Paeps		for f in $(TDATA) $(PACKRATDATA); do \
1110*9f9fc6bbSPhilip Paeps		  rearf=$@.dir/$$f; \
1111d81c2dd9SPhilip Paeps		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
1112dc505d53SPhilip Paeps		  $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
1113d81c2dd9SPhilip Paeps		done
1114*9f9fc6bbSPhilip Paeps		sed '1s/$$/-rearguard/' <version >$@.dir/version
1115e7e2d659SPhilip Paeps		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1116*9f9fc6bbSPhilip Paeps		$(CREATE_EMPTY) $@.dir/pacificnew
1117*9f9fc6bbSPhilip Paeps		touch -cmr version $@.dir/version
1118d81c2dd9SPhilip Paeps		LC_ALL=C && export LC_ALL && \
1119*9f9fc6bbSPhilip Paeps		  (cd $@.dir && \
1120e7e2d659SPhilip Paeps		   tar $(TARFLAGS) -cf - \
1121*9f9fc6bbSPhilip Paeps			$(TZDATA_DIST) pacificnew | \
1122d81c2dd9SPhilip Paeps		     gzip $(GZIPFLAGS)) >$@.out
1123d81c2dd9SPhilip Paeps		mv $@.out $@
1124d81c2dd9SPhilip Paeps
1125*9f9fc6bbSPhilip Paeps# Create a tailored tarball suitable for TZUpdater and compatible tools.
1126*9f9fc6bbSPhilip Paeps# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
1127*9f9fc6bbSPhilip Paeps# useful for testing whether TZUpdater supports vanguard form.
1128*9f9fc6bbSPhilip Paeps# The generated tarball is not byte-for-byte equivalent to a hand-tailored
1129*9f9fc6bbSPhilip Paeps# traditional tarball, as data entries are put into 'etcetera' even if they
1130*9f9fc6bbSPhilip Paeps# came from some other source file.  However, the effect should be the same
1131*9f9fc6bbSPhilip Paeps# for ordinary use, which reads all the source files.
1132*9f9fc6bbSPhilip Paepstzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
1133*9f9fc6bbSPhilip Paeps		rm -fr $@.dir
1134*9f9fc6bbSPhilip Paeps		mkdir $@.dir
1135*9f9fc6bbSPhilip Paeps		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1136*9f9fc6bbSPhilip Paeps		cd $@.dir && \
1137*9f9fc6bbSPhilip Paeps		  $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
1138*9f9fc6bbSPhilip Paeps		  `test $(DATAFORM) = vanguard || echo pacificnew`
1139*9f9fc6bbSPhilip Paeps		(grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
1140*9f9fc6bbSPhilip Paeps		  >$@.dir/etcetera
1141*9f9fc6bbSPhilip Paeps		touch -cmr tzdata.zi $@.dir/etcetera
1142*9f9fc6bbSPhilip Paeps		sed -n \
1143*9f9fc6bbSPhilip Paeps		  -e '/^# *version  *\(.*\)/h' \
1144*9f9fc6bbSPhilip Paeps		  -e '/^# *ddeps  */H' \
1145*9f9fc6bbSPhilip Paeps		  -e '$$!d' \
1146*9f9fc6bbSPhilip Paeps		  -e 'g' \
1147*9f9fc6bbSPhilip Paeps		  -e 's/^# *version  *//' \
1148*9f9fc6bbSPhilip Paeps		  -e 's/\n# *ddeps  */-/' \
1149*9f9fc6bbSPhilip Paeps		  -e 's/ /-/g' \
1150*9f9fc6bbSPhilip Paeps		  -e 'p' \
1151*9f9fc6bbSPhilip Paeps		  <tzdata.zi >$@.dir/version
1152*9f9fc6bbSPhilip Paeps		touch -cmr version $@.dir/version
1153*9f9fc6bbSPhilip Paeps		links= && \
1154*9f9fc6bbSPhilip Paeps		  for file in $(TZDATA_DIST); do \
1155*9f9fc6bbSPhilip Paeps		    test -f $@.dir/$$file || links="$$links $$file"; \
1156*9f9fc6bbSPhilip Paeps		  done && \
1157*9f9fc6bbSPhilip Paeps		  ln $$links $@.dir
1158*9f9fc6bbSPhilip Paeps		LC_ALL=C && export LC_ALL && \
1159*9f9fc6bbSPhilip Paeps		  (cd $@.dir && \
1160*9f9fc6bbSPhilip Paeps		   tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out
1161*9f9fc6bbSPhilip Paeps		mv $@.out $@
1162*9f9fc6bbSPhilip Paeps
116389abb9f8SPhilip Paepstzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
1164ba2b2efdSGlen Barber		rm -fr tzdb-$(VERSION)
1165ba2b2efdSGlen Barber		mkdir tzdb-$(VERSION)
1166ba2b2efdSGlen Barber		ln $(ENCHILADA) tzdb-$(VERSION)
1167dc505d53SPhilip Paeps		$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
1168ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
1169ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
1170ba2b2efdSGlen Barber		mv $@.out $@
1171ba2b2efdSGlen Barber
1172ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
1173ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
1174d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
1175ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
1176d81c2dd9SPhilip Paeps$(ALL_ASC):
11772865ab3fSPhilip Paeps		$(GPG) --armor --detach-sign $?
1178ba2b2efdSGlen Barber
117989abb9f8SPhilip PaepsTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
118089abb9f8SPhilip Paepstypecheck: typecheck_long_long typecheck_unsigned
118189abb9f8SPhilip Paepstypecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
118289abb9f8SPhilip Paeps		rm -fr $@.dir
118389abb9f8SPhilip Paeps		mkdir $@.dir
118489abb9f8SPhilip Paeps		ln $(VERSION_DEPS) $@.dir
118589abb9f8SPhilip Paeps		cd $@.dir && \
118689abb9f8SPhilip Paeps		  case $@ in \
118789abb9f8SPhilip Paeps		    *_long_long) i="long long";; \
118889abb9f8SPhilip Paeps		    *_unsigned ) i="unsigned" ;; \
118989abb9f8SPhilip Paeps		  esac && \
119089abb9f8SPhilip Paeps		  typecheck_cflags='' && \
119189abb9f8SPhilip Paeps		  $(MAKE) \
119289abb9f8SPhilip Paeps		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
119389abb9f8SPhilip Paeps		    TOPDIR="`pwd`" \
119489abb9f8SPhilip Paeps		    install
119589abb9f8SPhilip Paeps		$@.dir/zdump -i -c 1970,1971 Europe/Rome
119689abb9f8SPhilip Paeps		touch $@
1197ba2b2efdSGlen Barber
11988d7edd17SPhilip Paepszonenames:	tzdata.zi
11998d7edd17SPhilip Paeps		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
1200ba2b2efdSGlen Barber
1201ba2b2efdSGlen Barberasctime.o:	private.h tzfile.h
1202ba2b2efdSGlen Barberdate.o:		private.h
1203ba2b2efdSGlen Barberdifftime.o:	private.h
1204ba2b2efdSGlen Barberlocaltime.o:	private.h tzfile.h
1205ba2b2efdSGlen Barberstrftime.o:	private.h tzfile.h
1206ba2b2efdSGlen Barberzdump.o:	version.h
1207ba2b2efdSGlen Barberzic.o:		private.h tzfile.h version.h
1208ba2b2efdSGlen Barber
1209ba2b2efdSGlen Barber.PHONY: ALL INSTALL all
121089abb9f8SPhilip Paeps.PHONY: check check_time_t_alternatives
12112c5e84ccSPhilip Paeps.PHONY: check_web check_zishrink
121246bee4edSPhilip Paeps.PHONY: clean clean_misc dummy.zd force_tzs
1213ba2b2efdSGlen Barber.PHONY: install install_data maintainer-clean names
1214*9f9fc6bbSPhilip Paeps.PHONY: posix_only posix_right public
121589abb9f8SPhilip Paeps.PHONY: rearguard_signatures rearguard_signatures_version
121689abb9f8SPhilip Paeps.PHONY: rearguard_tarballs rearguard_tarballs_version
121789abb9f8SPhilip Paeps.PHONY: right_only right_posix signatures signatures_version
121846bee4edSPhilip Paeps.PHONY: tarballs tarballs_version
121946bee4edSPhilip Paeps.PHONY: traditional_signatures traditional_signatures_version
122046bee4edSPhilip Paeps.PHONY: traditional_tarballs traditional_tarballs_version
1221*9f9fc6bbSPhilip Paeps.PHONY: tailored_tarballs tailored_tarballs_version
122246bee4edSPhilip Paeps.PHONY: typecheck
1223ba2b2efdSGlen Barber.PHONY: zonenames zones
122446bee4edSPhilip Paeps.PHONY: $(ZDS)
1225