xref: /freebsd/contrib/tzdata/Makefile (revision 46bee4edc2bbfe89c76f47e63cd1fa09651151c1)
1ba2b2efdSGlen Barber# This file is in the public domain, so clarified as of
2ba2b2efdSGlen Barber# 2009-05-17 by Arthur David Olson.
3ba2b2efdSGlen Barber
4ba2b2efdSGlen Barber# Package name for the code distribution.
5ba2b2efdSGlen BarberPACKAGE=	tzcode
6ba2b2efdSGlen Barber
7ba2b2efdSGlen Barber# Version number for the distribution, overridden in the 'tarballs' rule below.
8ba2b2efdSGlen BarberVERSION=	unknown
9ba2b2efdSGlen Barber
10ba2b2efdSGlen Barber# Email address for bug reports.
11ba2b2efdSGlen BarberBUGEMAIL=	tz@iana.org
12ba2b2efdSGlen Barber
13*46bee4edSPhilip Paeps# Choose source data features.  To get new features right away, use:
14*46bee4edSPhilip Paeps#	DATAFORM=	vanguard
15*46bee4edSPhilip Paeps# To wait a while before using new features, to give downstream users
16*46bee4edSPhilip Paeps# time to upgrade zic (the default), use:
17*46bee4edSPhilip Paeps#	DATAFORM=	main
18*46bee4edSPhilip Paeps# To wait even longer for new features, use:
19*46bee4edSPhilip Paeps#	DATAFORM=	rearguard
20*46bee4edSPhilip PaepsDATAFORM=		main
21*46bee4edSPhilip Paeps
22ba2b2efdSGlen Barber# Change the line below for your time zone (after finding the zone you want in
23ba2b2efdSGlen Barber# the time zone files, or adding it to a time zone file).
24ba2b2efdSGlen Barber# Alternately, if you discover you've got the wrong time zone, you can just
25ba2b2efdSGlen Barber#	zic -l rightzone
26ba2b2efdSGlen Barber# to correct things.
27ba2b2efdSGlen Barber# Use the command
28ba2b2efdSGlen Barber#	make zonenames
29ba2b2efdSGlen Barber# to get a list of the values you can use for LOCALTIME.
30ba2b2efdSGlen Barber
31ba2b2efdSGlen BarberLOCALTIME=	GMT
32ba2b2efdSGlen Barber
33ba2b2efdSGlen Barber# If you want something other than Eastern United States time as a template
34ba2b2efdSGlen Barber# for handling POSIX-style time zone environment variables,
35ba2b2efdSGlen Barber# change the line below (after finding the zone you want in the
36ba2b2efdSGlen Barber# time zone files, or adding it to a time zone file).
37*46bee4edSPhilip Paeps# When a POSIX-style environment variable is handled, the rules in the
38ba2b2efdSGlen Barber# template file are used to determine "spring forward" and "fall back" days and
39ba2b2efdSGlen Barber# times; the environment variable itself specifies UT offsets of standard and
40*46bee4edSPhilip Paeps# daylight saving time.
41ba2b2efdSGlen Barber# Alternately, if you discover you've got the wrong time zone, you can just
42ba2b2efdSGlen Barber#	zic -p rightzone
43ba2b2efdSGlen Barber# to correct things.
44ba2b2efdSGlen Barber# Use the command
45ba2b2efdSGlen Barber#	make zonenames
46ba2b2efdSGlen Barber# to get a list of the values you can use for POSIXRULES.
47ba2b2efdSGlen Barber# If you want POSIX compatibility, use "America/New_York".
48ba2b2efdSGlen Barber
49ba2b2efdSGlen BarberPOSIXRULES=	America/New_York
50ba2b2efdSGlen Barber
51ba2b2efdSGlen Barber# Also see TZDEFRULESTRING below, which takes effect only
52ba2b2efdSGlen Barber# if the time zone files cannot be accessed.
53ba2b2efdSGlen Barber
54ba2b2efdSGlen Barber
55f2fcff28SPhilip Paeps# Installation locations.
56f2fcff28SPhilip Paeps#
57f2fcff28SPhilip Paeps# The defaults are suitable for Debian, except that if REDO is
58f2fcff28SPhilip Paeps# posix_right or right_posix then files that Debian puts under
59f2fcff28SPhilip Paeps# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
60f2fcff28SPhilip Paeps# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
61f2fcff28SPhilip Paeps# respectively.  Problems with the Debian approach are discussed in
62f2fcff28SPhilip Paeps# the commentary for the right_posix rule (below).
63f2fcff28SPhilip Paeps
64f2fcff28SPhilip Paeps# Destination directory, which can be used for staging.
65f2fcff28SPhilip Paeps# 'make DESTDIR=/stage install' installs under /stage (e.g., to
66f2fcff28SPhilip Paeps# /stage/etc/localtime instead of to /etc/localtime).  Files under
67f2fcff28SPhilip Paeps# /stage are not intended to work as-is, but can be copied by hand to
68f2fcff28SPhilip Paeps# the root directory later.  If DESTDIR is empty, 'make install' does
69f2fcff28SPhilip Paeps# not stage, but installs directly into production locations.
70f2fcff28SPhilip PaepsDESTDIR =
71f2fcff28SPhilip Paeps
72f2fcff28SPhilip Paeps# Everything is installed into subdirectories of TOPDIR, and used there.
73f2fcff28SPhilip Paeps# TOPDIR should be empty (meaning the root directory),
74f2fcff28SPhilip Paeps# or a directory name that does not end in "/".
75f2fcff28SPhilip Paeps# TOPDIR should be empty or an absolute name unless you're just testing.
76f2fcff28SPhilip PaepsTOPDIR =
77f2fcff28SPhilip Paeps
78f2fcff28SPhilip Paeps# The default local time zone is taken from the file TZDEFAULT.
79f2fcff28SPhilip PaepsTZDEFAULT = $(TOPDIR)/etc/localtime
80f2fcff28SPhilip Paeps
81f2fcff28SPhilip Paeps# The subdirectory containing installed program and data files, and
82f2fcff28SPhilip Paeps# likewise for installed files that can be shared among architectures.
83f2fcff28SPhilip Paeps# These should be relative file names.
84f2fcff28SPhilip PaepsUSRDIR = usr
85f2fcff28SPhilip PaepsUSRSHAREDIR = $(USRDIR)/share
86ba2b2efdSGlen Barber
87ba2b2efdSGlen Barber# "Compiled" time zone information is placed in the "TZDIR" directory
88ba2b2efdSGlen Barber# (and subdirectories).
898d7edd17SPhilip Paeps# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
90ba2b2efdSGlen BarberTZDIR_BASENAME=	zoneinfo
91f2fcff28SPhilip PaepsTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
92f2fcff28SPhilip Paeps
93f2fcff28SPhilip Paeps# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
94f2fcff28SPhilip PaepsBINDIR = $(TOPDIR)/$(USRDIR)/bin
95f2fcff28SPhilip Paeps
96f2fcff28SPhilip Paeps# The "zdump" command goes in:
97f2fcff28SPhilip PaepsZDUMPDIR = $(BINDIR)
98f2fcff28SPhilip Paeps
99f2fcff28SPhilip Paeps# The "zic" command goes in:
100f2fcff28SPhilip PaepsZICDIR = $(TOPDIR)/$(USRDIR)/sbin
101f2fcff28SPhilip Paeps
102f2fcff28SPhilip Paeps# Manual pages go in subdirectories of. . .
103f2fcff28SPhilip PaepsMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
104f2fcff28SPhilip Paeps
105f2fcff28SPhilip Paeps# Library functions are put in an archive in LIBDIR.
106f2fcff28SPhilip PaepsLIBDIR = $(TOPDIR)/$(USRDIR)/lib
107f2fcff28SPhilip Paeps
108ba2b2efdSGlen Barber
109ba2b2efdSGlen Barber# Types to try, as an alternative to time_t.  int64_t should be first.
110ba2b2efdSGlen BarberTIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
111ba2b2efdSGlen Barber
112dc135c6eSBaptiste Daroussin# If you want only POSIX time, with time values interpreted as
113dc135c6eSBaptiste Daroussin# seconds since the epoch (not counting leap seconds), use
114ba2b2efdSGlen Barber#	REDO=		posix_only
1158d7edd17SPhilip Paeps# below.  If you want only "right" time, with values interpreted
116dc135c6eSBaptiste Daroussin# as seconds since the epoch (counting leap seconds), use
117ba2b2efdSGlen Barber#	REDO=		right_only
118ba2b2efdSGlen Barber# below.  If you want both sets of data available, with leap seconds not
119ba2b2efdSGlen Barber# counted normally, use
120ba2b2efdSGlen Barber#	REDO=		posix_right
121ba2b2efdSGlen Barber# below.  If you want both sets of data available, with leap seconds counted
122ba2b2efdSGlen Barber# normally, use
123ba2b2efdSGlen Barber#	REDO=		right_posix
124ba2b2efdSGlen Barber# below.  POSIX mandates that leap seconds not be counted; for compatibility
125dc135c6eSBaptiste Daroussin# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
126dc135c6eSBaptiste Daroussin# leap smearing; this can work better than unsmeared "right" time with
127dc135c6eSBaptiste Daroussin# applications that are not leap second aware, and is closer to unsmeared
128dc135c6eSBaptiste Daroussin# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
129ba2b2efdSGlen Barber
130ba2b2efdSGlen BarberREDO=		posix_right
131ba2b2efdSGlen Barber
1328d7edd17SPhilip Paeps# To install data in text form that has all the information of the binary data,
1338d7edd17SPhilip Paeps# (optionally incorporating leap second information), use
1348d7edd17SPhilip Paeps#	TZDATA_TEXT=	tzdata.zi leapseconds
1358d7edd17SPhilip Paeps# To install text data without leap second information (e.g., because
1368d7edd17SPhilip Paeps# REDO='posix_only'), use
1378d7edd17SPhilip Paeps#	TZDATA_TEXT=	tzdata.zi
1388d7edd17SPhilip Paeps# To avoid installing text data, use
1398d7edd17SPhilip Paeps#	TZDATA_TEXT=
1408d7edd17SPhilip Paeps
1418d7edd17SPhilip PaepsTZDATA_TEXT=	leapseconds tzdata.zi
1428d7edd17SPhilip Paeps
1438d7edd17SPhilip Paeps# For backward-compatibility links for old zone names, use
144f2fcff28SPhilip Paeps#	BACKWARD=	backward
145f2fcff28SPhilip Paeps# If you also want the link US/Pacific-New, even though it is confusing
146f2fcff28SPhilip Paeps# and is planned to be removed from the database eventually, use
1478d7edd17SPhilip Paeps#	BACKWARD=	backward pacificnew
1488d7edd17SPhilip Paeps# To omit these links, use
1498d7edd17SPhilip Paeps#	BACKWARD=
1508d7edd17SPhilip Paeps
151f2fcff28SPhilip PaepsBACKWARD=	backward
1528d7edd17SPhilip Paeps
153ba2b2efdSGlen Barber# If you want out-of-scope and often-wrong data from the file 'backzone', use
154ba2b2efdSGlen Barber#	PACKRATDATA=	backzone
155ba2b2efdSGlen Barber# To omit this data, use
156ba2b2efdSGlen Barber#	PACKRATDATA=
157ba2b2efdSGlen Barber
158ba2b2efdSGlen BarberPACKRATDATA=
159ba2b2efdSGlen Barber
1608d7edd17SPhilip Paeps# The name of a locale using the UTF-8 encoding, used during self-tests.
1618d7edd17SPhilip Paeps# The tests are skipped if the name does not appear to work on this system.
1628d7edd17SPhilip Paeps
1638d7edd17SPhilip PaepsUTF8_LOCALE=	en_US.utf8
1648d7edd17SPhilip Paeps
165ba2b2efdSGlen Barber# Since "." may not be in PATH...
166ba2b2efdSGlen Barber
167ba2b2efdSGlen BarberYEARISTYPE=	./yearistype
168ba2b2efdSGlen Barber
169ba2b2efdSGlen Barber# Non-default libraries needed to link.
170ba2b2efdSGlen BarberLDLIBS=
171ba2b2efdSGlen Barber
1728d7edd17SPhilip Paeps# Add the following to the end of the "CFLAGS=" line as needed to override
1738d7edd17SPhilip Paeps# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
174ba2b2efdSGlen Barber#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
1758d7edd17SPhilip Paeps#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
1768d7edd17SPhilip Paeps#	formats that generate only the last two digits of year numbers
1778d7edd17SPhilip Paeps#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
178ba2b2efdSGlen Barber#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
179ba2b2efdSGlen Barber#	than what POSIX specifies, assuming local time is UT.
180ba2b2efdSGlen Barber#	For example, N is 252460800 on AmigaOS.
1818d7edd17SPhilip Paeps#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
1828d7edd17SPhilip Paeps#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
1838d7edd17SPhilip Paeps#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
1848d7edd17SPhilip Paeps#  -DHAVE_GENERIC=0 if _Generic does not work
1858d7edd17SPhilip Paeps#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
1868d7edd17SPhilip Paeps#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
1878d7edd17SPhilip Paeps#	ctime_r and asctime_r incompatibly with the POSIX standard
1888d7edd17SPhilip Paeps#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
1898d7edd17SPhilip Paeps#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
1908d7edd17SPhilip Paeps#  -DHAVE_LINK=0 if your system lacks a link function
1918d7edd17SPhilip Paeps#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
1928d7edd17SPhilip Paeps#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
1938d7edd17SPhilip Paeps#	localtime_rz can make zdump significantly faster, but is nonstandard.
1948d7edd17SPhilip Paeps#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
1958d7edd17SPhilip Paeps#	functions like 'link' or variables like 'tzname' required by POSIX
1968d7edd17SPhilip Paeps#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
1978d7edd17SPhilip Paeps#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
1988d7edd17SPhilip Paeps#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
1998d7edd17SPhilip Paeps#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
2008d7edd17SPhilip Paeps#  -DHAVE_STRDUP=0 if your system lacks the strdup function
201*46bee4edSPhilip Paeps#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
2028d7edd17SPhilip Paeps#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
2038d7edd17SPhilip Paeps#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
2048d7edd17SPhilip Paeps#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
2058d7edd17SPhilip Paeps#  -DHAVE_TZSET=0 if your system lacks a tzset function
2068d7edd17SPhilip Paeps#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
2078d7edd17SPhilip Paeps#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
208*46bee4edSPhilip Paeps#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
209*46bee4edSPhilip Paeps#	with external linkage, e.g., applications cannot define 'localtime'.
2108d7edd17SPhilip Paeps#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
211*46bee4edSPhilip Paeps#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
212*46bee4edSPhilip Paeps#	security implications and is not recommended for general use
2138d7edd17SPhilip Paeps#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
214ba2b2efdSGlen Barber#	not needed by the main-program tz code, which is single-threaded.
215ba2b2efdSGlen Barber#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
216ba2b2efdSGlen Barber#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
2178d7edd17SPhilip Paeps#	This is intended for internal use only; it mangles external names.
218ba2b2efdSGlen Barber#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
219ba2b2efdSGlen Barber#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
220ba2b2efdSGlen Barber#	the default is system-supplied, typically "/usr/lib/locale"
221ba2b2efdSGlen Barber#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
222ba2b2efdSGlen Barber#	DST transitions if the time zone files cannot be accessed
2238d7edd17SPhilip Paeps#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
224ba2b2efdSGlen Barber#	other than simply getting garbage data
225ba2b2efdSGlen Barber#  -DUSE_LTZ=0 to build zdump with the system time zone library
226ba2b2efdSGlen Barber#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
227ba2b2efdSGlen Barber#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
228ba2b2efdSGlen Barber#	(or some other number) to set the maximum time zone abbreviation length
229ba2b2efdSGlen Barber#	that zic will accept without a warning (the default is 6)
230ba2b2efdSGlen Barber#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
2318d7edd17SPhilip Paeps# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
2328d7edd17SPhilip PaepsGCC_INSTRUMENT = \
2338d7edd17SPhilip Paeps  -fsanitize=undefined -fsanitize-address-use-after-scope \
2348d7edd17SPhilip Paeps  -fsanitize-undefined-trap-on-error -fstack-protector
2358d7edd17SPhilip PaepsGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
2368d7edd17SPhilip Paeps  $(GCC_INSTRUMENT) \
237ba2b2efdSGlen Barber  -Wall -Wextra \
2388d7edd17SPhilip Paeps  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
239ba2b2efdSGlen Barber  -Wbad-function-cast -Wcast-align -Wdate-time \
2408d7edd17SPhilip Paeps  -Wdeclaration-after-statement -Wdouble-promotion \
2418d7edd17SPhilip Paeps  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
2428d7edd17SPhilip Paeps  -Winit-self -Wjump-misses-init -Wlogical-op \
2438d7edd17SPhilip Paeps  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
244ba2b2efdSGlen Barber  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
2458d7edd17SPhilip Paeps  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
2468d7edd17SPhilip Paeps  -Wsuggest-attribute=const -Wsuggest-attribute=format \
2478d7edd17SPhilip Paeps  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
2488d7edd17SPhilip Paeps  -Wtrampolines -Wundef -Wuninitialized -Wunused \
2498d7edd17SPhilip Paeps  -Wvariadic-macros -Wvla -Wwrite-strings \
250ba2b2efdSGlen Barber  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
251ba2b2efdSGlen Barber  -Wno-type-limits -Wno-unused-parameter
252ba2b2efdSGlen Barber#
253ba2b2efdSGlen Barber# If your system has a "GMT offset" field in its "struct tm"s
254ba2b2efdSGlen Barber# (or if you decide to add such a field in your system's "time.h" file),
255ba2b2efdSGlen Barber# add the name to a define such as
256ba2b2efdSGlen Barber#	-DTM_GMTOFF=tm_gmtoff
257ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
258ba2b2efdSGlen Barber# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
259ba2b2efdSGlen Barber# Similarly, if your system has a "zone abbreviation" field, define
260ba2b2efdSGlen Barber#	-DTM_ZONE=tm_zone
261ba2b2efdSGlen Barber# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
262ba2b2efdSGlen Barber# required by POSIX, but are widely available on GNU/Linux and BSD systems.
263ba2b2efdSGlen Barber#
2648d7edd17SPhilip Paeps# The next batch of options control support for external variables
2658d7edd17SPhilip Paeps# exported by tzcode.  In practice these variables are less useful
2668d7edd17SPhilip Paeps# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
2678d7edd17SPhilip Paeps# #
2688d7edd17SPhilip Paeps# # To omit or support the external variable "tzname", add one of:
2698d7edd17SPhilip Paeps# #	-DHAVE_TZNAME=0
2708d7edd17SPhilip Paeps# #	-DHAVE_TZNAME=1
2718d7edd17SPhilip Paeps# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
2728d7edd17SPhilip Paeps# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
2738d7edd17SPhilip Paeps# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
2748d7edd17SPhilip Paeps# # crashes when combined with some platforms' standard libraries,
2758d7edd17SPhilip Paeps# # presumably due to memory allocation issues.
2768d7edd17SPhilip Paeps# #
2778d7edd17SPhilip Paeps# # To omit or support the external variables "timezone" and "daylight", add
2788d7edd17SPhilip Paeps# #	-DUSG_COMPAT=0
2798d7edd17SPhilip Paeps# #	-DUSG_COMPAT=1
2808d7edd17SPhilip Paeps# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
2818d7edd17SPhilip Paeps# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
2828d7edd17SPhilip Paeps# # If not defined, the code attempts to guess USG_COMPAT from other macros.
2838d7edd17SPhilip Paeps# #
2848d7edd17SPhilip Paeps# # To support the external variable "altzone", add
2858d7edd17SPhilip Paeps# #	-DALTZONE
2868d7edd17SPhilip Paeps# # to the end of the "CFLAGS=" line; although "altzone" appeared in
2878d7edd17SPhilip Paeps# # System V Release 3.1 it has not been standardized.
2888d7edd17SPhilip Paeps#
289ba2b2efdSGlen Barber# If you want functions that were inspired by early versions of X3J11's work,
290ba2b2efdSGlen Barber# add
291ba2b2efdSGlen Barber#	-DSTD_INSPIRED
292ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This arranges for the functions
293ba2b2efdSGlen Barber# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
294ba2b2efdSGlen Barber# "posix2time", and "time2posix" to be added to the time conversion library.
295ba2b2efdSGlen Barber# "tzsetwall" is like "tzset" except that it arranges for local wall clock
296ba2b2efdSGlen Barber# time (rather than the time specified in the TZ environment variable)
297ba2b2efdSGlen Barber# to be used.
298ba2b2efdSGlen Barber# "offtime" is like "gmtime" except that it accepts a second (long) argument
299ba2b2efdSGlen Barber# that gives an offset to add to the time_t when converting it.
300ba2b2efdSGlen Barber# "timelocal" is equivalent to "mktime".
301ba2b2efdSGlen Barber# "timegm" is like "timelocal" except that it turns a struct tm into
302ba2b2efdSGlen Barber# a time_t using UT (rather than local time as "timelocal" does).
303ba2b2efdSGlen Barber# "timeoff" is like "timegm" except that it accepts a second (long) argument
304ba2b2efdSGlen Barber# that gives an offset to use when converting to a time_t.
305ba2b2efdSGlen Barber# "posix2time" and "time2posix" are described in an included manual page.
306ba2b2efdSGlen Barber# X3J11's work does not describe any of these functions.
307ba2b2efdSGlen Barber# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
308ba2b2efdSGlen Barber# These functions may well disappear in future releases of the time
309ba2b2efdSGlen Barber# conversion package.
310ba2b2efdSGlen Barber#
311ba2b2efdSGlen Barber# If you don't want functions that were inspired by NetBSD, add
312ba2b2efdSGlen Barber#	-DNETBSD_INSPIRED=0
313ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  Otherwise, the functions
314ba2b2efdSGlen Barber# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
315ba2b2efdSGlen Barber# time library, and if STD_INSPIRED is also defined the functions
316ba2b2efdSGlen Barber# "posix2time_z" and "time2posix_z" are added as well.
317ba2b2efdSGlen Barber# The functions ending in "_z" (or "_rz") are like their unsuffixed
318ba2b2efdSGlen Barber# (or suffixed-by-"_r") counterparts, except with an extra first
319ba2b2efdSGlen Barber# argument of opaque type timezone_t that specifies the time zone.
320ba2b2efdSGlen Barber# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
321ba2b2efdSGlen Barber#
322ba2b2efdSGlen Barber# If you want to allocate state structures in localtime, add
323ba2b2efdSGlen Barber#	-DALL_STATE
324ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
325ba2b2efdSGlen Barber#
326ba2b2efdSGlen Barber# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
327ba2b2efdSGlen Barber# out by the National Institute of Standards and Technology
328ba2b2efdSGlen Barber# which claims to test C and Posix conformance.  If you want to pass PCTS, add
329ba2b2efdSGlen Barber#	-DPCTS
330ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.
331ba2b2efdSGlen Barber#
332ba2b2efdSGlen Barber# If you want strict compliance with XPG4 as of 1994-04-09, add
333ba2b2efdSGlen Barber#	-DXPG4_1994_04_09
334ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
3358d7edd17SPhilip Paeps# 53 as a week number (rather than 52 or 53) for January days before
3368d7edd17SPhilip Paeps# January's first Monday when a "%V" format is used and January 1
337ba2b2efdSGlen Barber# falls on a Friday, Saturday, or Sunday.
338ba2b2efdSGlen Barber
339ba2b2efdSGlen BarberCFLAGS=
340ba2b2efdSGlen Barber
341ba2b2efdSGlen Barber# Linker flags.  Default to $(LFLAGS) for backwards compatibility
342ba2b2efdSGlen Barber# to release 2012h and earlier.
343ba2b2efdSGlen Barber
344ba2b2efdSGlen BarberLDFLAGS=	$(LFLAGS)
345ba2b2efdSGlen Barber
346ba2b2efdSGlen Barber# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
347ba2b2efdSGlen Barber# submake command lines.  The default is no leap seconds.
348ba2b2efdSGlen Barber
349ba2b2efdSGlen BarberLEAPSECONDS=
350ba2b2efdSGlen Barber
351ba2b2efdSGlen Barber# The zic command and its arguments.
352ba2b2efdSGlen Barber
353ba2b2efdSGlen Barberzic=		./zic
354ba2b2efdSGlen BarberZIC=		$(zic) $(ZFLAGS)
355ba2b2efdSGlen Barber
356ba2b2efdSGlen BarberZFLAGS=
357ba2b2efdSGlen Barber
358ba2b2efdSGlen Barber# How to use zic to install tz binary files.
359ba2b2efdSGlen Barber
360f2fcff28SPhilip PaepsZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
361ba2b2efdSGlen Barber
362ba2b2efdSGlen Barber# The name of a Posix-compliant 'awk' on your system.
363ba2b2efdSGlen BarberAWK=		awk
364ba2b2efdSGlen Barber
365ba2b2efdSGlen Barber# The full path name of a Posix-compliant shell, preferably one that supports
366ba2b2efdSGlen Barber# the Korn shell's 'select' statement as an extension.
367ba2b2efdSGlen Barber# These days, Bash is the most popular.
368ba2b2efdSGlen Barber# It should be OK to set this to /bin/sh, on platforms where /bin/sh
369ba2b2efdSGlen Barber# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
370ba2b2efdSGlen Barber# is typically nicer if it works.
371ba2b2efdSGlen BarberKSHELL=		/bin/bash
372ba2b2efdSGlen Barber
373ba2b2efdSGlen Barber# The path where SGML DTDs are kept and the catalog file(s) to use when
374ba2b2efdSGlen Barber# validating.  The default should work on both Debian and Red Hat.
375ba2b2efdSGlen BarberSGML_TOPDIR= /usr
376ba2b2efdSGlen BarberSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
377ba2b2efdSGlen BarberSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
378ba2b2efdSGlen BarberSGML_CATALOG_FILES= \
379ba2b2efdSGlen Barber  $(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
380ba2b2efdSGlen Barber
381ba2b2efdSGlen Barber# The name, arguments and environment of a program to validate your web pages.
382ba2b2efdSGlen Barber# See <http://openjade.sourceforge.net/doc/> for a validator, and
383ba2b2efdSGlen Barber# <https://validator.w3.org/source/> for a validation library.
3848d7edd17SPhilip Paeps# Set VALIDATE=':' if you do not have such a program.
385ba2b2efdSGlen BarberVALIDATE = nsgmls
386ba2b2efdSGlen BarberVALIDATE_FLAGS = -s -B -wall -wno-unused-param
387ba2b2efdSGlen BarberVALIDATE_ENV = \
388f2fcff28SPhilip Paeps  SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \
389f2fcff28SPhilip Paeps  SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \
390ba2b2efdSGlen Barber  SP_CHARSET_FIXED=YES \
391ba2b2efdSGlen Barber  SP_ENCODING=UTF-8
392ba2b2efdSGlen Barber
393ba2b2efdSGlen Barber# This expensive test requires USE_LTZ.
394ba2b2efdSGlen Barber# To suppress it, define this macro to be empty.
395ba2b2efdSGlen BarberCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
396ba2b2efdSGlen Barber
397ba2b2efdSGlen Barber# SAFE_CHAR is a regular expression that matches a safe character.
398ba2b2efdSGlen Barber# Some parts of this distribution are limited to safe characters;
399ba2b2efdSGlen Barber# others can use any UTF-8 character.
400ba2b2efdSGlen Barber# For now, the safe characters are a safe subset of ASCII.
401ba2b2efdSGlen Barber# The caller must set the shell variable 'sharp' to the character '#',
402ba2b2efdSGlen Barber# since Makefile macros cannot contain '#'.
403ba2b2efdSGlen Barber# TAB_CHAR is a single tab character, in single quotes.
404ba2b2efdSGlen BarberTAB_CHAR=	'	'
405ba2b2efdSGlen BarberSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
406ba2b2efdSGlen BarberSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
407ba2b2efdSGlen BarberSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
408ba2b2efdSGlen BarberSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
409ba2b2efdSGlen BarberSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
410ba2b2efdSGlen Barber
411*46bee4edSPhilip Paeps# Non-ASCII non-letters that OK_CHAR allows, as these characters are
412*46bee4edSPhilip Paeps# useful in commentary.  XEmacs 21.5.34 displays them correctly,
413*46bee4edSPhilip Paeps# presumably because they are Latin-1.
414*46bee4edSPhilip PaepsUNUSUAL_OK_CHARSET= °±½¾×
415*46bee4edSPhilip Paeps
416ba2b2efdSGlen Barber# OK_CHAR matches any character allowed in the distributed files.
417*46bee4edSPhilip Paeps# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
418*46bee4edSPhilip Paeps# multibyte letters are also allowed so that commentary can contain a
419*46bee4edSPhilip Paeps# few safe symbols and people's names and can quote non-English sources.
420*46bee4edSPhilip Paeps# Other non-letters are limited to ASCII renderings for the
421*46bee4edSPhilip Paeps# convenience of maintainers using XEmacs 21.5.34, which by default
422*46bee4edSPhilip Paeps# mishandles Unicode characters U+0100 and greater.
423*46bee4edSPhilip PaepsOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
424ba2b2efdSGlen Barber
425ba2b2efdSGlen Barber# SAFE_LINE matches a line of safe characters.
426ba2b2efdSGlen Barber# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
427ba2b2efdSGlen Barber# this is so that comments can contain non-ASCII characters.
428ba2b2efdSGlen Barber# OK_LINE matches a line of OK characters.
429ba2b2efdSGlen BarberSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
430ba2b2efdSGlen BarberSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
431ba2b2efdSGlen BarberOK_LINE=	'^'$(OK_CHAR)'*$$'
432ba2b2efdSGlen Barber
433ba2b2efdSGlen Barber# Flags to give 'tar' when making a distribution.
434ba2b2efdSGlen Barber# Try to use flags appropriate for GNU tar.
435ba2b2efdSGlen BarberGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
436ba2b2efdSGlen BarberTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
437ba2b2efdSGlen Barber		 then echo $(GNUTARFLAGS); \
438ba2b2efdSGlen Barber		 else :; \
439ba2b2efdSGlen Barber		 fi`
440ba2b2efdSGlen Barber
441ba2b2efdSGlen Barber# Flags to give 'gzip' when making a distribution.
442ba2b2efdSGlen BarberGZIPFLAGS=	-9n
443ba2b2efdSGlen Barber
444ba2b2efdSGlen Barber###############################################################################
445ba2b2efdSGlen Barber
446ba2b2efdSGlen Barber#MAKE=		make
447ba2b2efdSGlen Barber
448ba2b2efdSGlen Barbercc=		cc
449f2fcff28SPhilip PaepsCC=		$(cc) -DTZDIR='"$(TZDIR)"'
450ba2b2efdSGlen Barber
451ba2b2efdSGlen BarberAR=		ar
452ba2b2efdSGlen Barber
453ba2b2efdSGlen Barber# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
454ba2b2efdSGlen BarberRANLIB=		:
455ba2b2efdSGlen Barber
456ba2b2efdSGlen BarberTZCOBJS=	zic.o
4578d7edd17SPhilip PaepsTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
458ba2b2efdSGlen BarberDATEOBJS=	date.o localtime.o strftime.o asctime.o
459ba2b2efdSGlen BarberLIBSRCS=	localtime.c asctime.c difftime.c
460ba2b2efdSGlen BarberLIBOBJS=	localtime.o asctime.o difftime.o
461ba2b2efdSGlen BarberHEADERS=	tzfile.h private.h
462ba2b2efdSGlen BarberNONLIBSRCS=	zic.c zdump.c
463ba2b2efdSGlen BarberNEWUCBSRCS=	date.c strftime.c
464ba2b2efdSGlen BarberSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
465ba2b2efdSGlen Barber			tzselect.ksh workman.sh
466ba2b2efdSGlen BarberMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
467ba2b2efdSGlen Barber			tzfile.5 tzselect.8 zic.8 zdump.8
468ba2b2efdSGlen BarberMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
469ba2b2efdSGlen Barber			time2posix.3.txt \
470ba2b2efdSGlen Barber			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
471ba2b2efdSGlen Barber			date.1.txt
4728d7edd17SPhilip PaepsCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
4738d7edd17SPhilip Paeps			NEWS README theory.html version
474f2fcff28SPhilip PaepsWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
475ba2b2efdSGlen BarberDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
476ba2b2efdSGlen BarberPRIMARY_YDATA=	africa antarctica asia australasia \
477ba2b2efdSGlen Barber		europe northamerica southamerica
478afb91be3SPhilip PaepsYDATA=		$(PRIMARY_YDATA) etcetera
479ba2b2efdSGlen BarberNDATA=		systemv factory
480afb91be3SPhilip PaepsTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward pacificnew
481afb91be3SPhilip PaepsTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
482ba2b2efdSGlen BarberZONETABLES=	zone1970.tab zone.tab
4838d7edd17SPhilip PaepsTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
484ba2b2efdSGlen BarberLEAP_DEPS=	leapseconds.awk leap-seconds.list
485*46bee4edSPhilip PaepsTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
486*46bee4edSPhilip PaepsDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
487afb91be3SPhilip PaepsDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
4888d7edd17SPhilip Paeps			leapseconds yearistype.sh $(ZONETABLES)
489*46bee4edSPhilip PaepsAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
490*46bee4edSPhilip Paeps			ziguard.awk zishrink.awk
491ba2b2efdSGlen BarberMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
492ba2b2efdSGlen BarberTZS_YEAR=	2050
493ba2b2efdSGlen BarberTZS=		to$(TZS_YEAR).tzs
494ba2b2efdSGlen BarberTZS_NEW=	to$(TZS_YEAR)new.tzs
495ba2b2efdSGlen BarberTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
496ba2b2efdSGlen Barber			private.h tzfile.h zdump.c zic.c
4978d7edd17SPhilip PaepsENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
498ba2b2efdSGlen Barber
499ba2b2efdSGlen Barber# Consult these files when deciding whether to rebuild the 'version' file.
500ba2b2efdSGlen Barber# This list is not the same as the output of 'git ls-files', since
501ba2b2efdSGlen Barber# .gitignore is not distributed.
502ba2b2efdSGlen BarberVERSION_DEPS= \
5038d7edd17SPhilip Paeps		calendars CONTRIBUTING LICENSE Makefile NEWS README \
504ba2b2efdSGlen Barber		africa antarctica asctime.c asia australasia \
505ba2b2efdSGlen Barber		backward backzone \
506ba2b2efdSGlen Barber		checklinks.awk checktab.awk \
507ba2b2efdSGlen Barber		date.1 date.c difftime.c \
508ba2b2efdSGlen Barber		etcetera europe factory iso3166.tab \
509ba2b2efdSGlen Barber		leap-seconds.list leapseconds.awk localtime.c \
510ba2b2efdSGlen Barber		newctime.3 newstrftime.3 newtzset.3 northamerica \
511ba2b2efdSGlen Barber		pacificnew private.h \
5128d7edd17SPhilip Paeps		southamerica strftime.c systemv theory.html \
513f2fcff28SPhilip Paeps		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
514ba2b2efdSGlen Barber		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
515ba2b2efdSGlen Barber		workman.sh yearistype.sh \
516ba2b2efdSGlen Barber		zdump.8 zdump.c zic.8 zic.c \
517ba2b2efdSGlen Barber		zone.tab zone1970.tab zoneinfo2tdf.pl
518ba2b2efdSGlen Barber
519ba2b2efdSGlen Barber# And for the benefit of csh users on systems that assume the user
520ba2b2efdSGlen Barber# shell should be used to handle commands in Makefiles. . .
521ba2b2efdSGlen Barber
522ba2b2efdSGlen BarberSHELL=		/bin/sh
523ba2b2efdSGlen Barber
524*46bee4edSPhilip Paepsall:		tzselect yearistype zic zdump libtz.a $(TABDATA) \
525*46bee4edSPhilip Paeps		  vanguard.zi main.zi rearguard.zi
526ba2b2efdSGlen Barber
527ba2b2efdSGlen BarberALL:		all date $(ENCHILADA)
528ba2b2efdSGlen Barber
529ba2b2efdSGlen Barberinstall:	all $(DATA) $(REDO) $(MANS)
530f2fcff28SPhilip Paeps		mkdir -p '$(DESTDIR)$(BINDIR)' \
531f2fcff28SPhilip Paeps			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
532f2fcff28SPhilip Paeps			'$(DESTDIR)$(LIBDIR)' \
533f2fcff28SPhilip Paeps			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
534f2fcff28SPhilip Paeps			'$(DESTDIR)$(MANDIR)/man8'
535f2fcff28SPhilip Paeps		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \
536f2fcff28SPhilip Paeps			-t '$(DESTDIR)$(TZDEFAULT)'
537f2fcff28SPhilip Paeps		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
538f2fcff28SPhilip Paeps		cp tzselect '$(DESTDIR)$(BINDIR)/.'
539f2fcff28SPhilip Paeps		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
540f2fcff28SPhilip Paeps		cp zic '$(DESTDIR)$(ZICDIR)/.'
541f2fcff28SPhilip Paeps		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
542f2fcff28SPhilip Paeps		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
543f2fcff28SPhilip Paeps		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
544f2fcff28SPhilip Paeps		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
545f2fcff28SPhilip Paeps		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
546ba2b2efdSGlen Barber
547ba2b2efdSGlen BarberINSTALL:	ALL install date.1
548f2fcff28SPhilip Paeps		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
549f2fcff28SPhilip Paeps		cp date '$(DESTDIR)$(BINDIR)/.'
550f2fcff28SPhilip Paeps		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
551ba2b2efdSGlen Barber
552ba2b2efdSGlen Barberversion:	$(VERSION_DEPS)
553ba2b2efdSGlen Barber		{ (type git) >/dev/null 2>&1 && \
554ba2b2efdSGlen Barber		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
555ba2b2efdSGlen Barber				--abbrev=7 --dirty` || \
556f2fcff28SPhilip Paeps		  V='$(VERSION)'; } && \
557ba2b2efdSGlen Barber		printf '%s\n' "$$V" >$@.out
558ba2b2efdSGlen Barber		mv $@.out $@
559ba2b2efdSGlen Barber
560*46bee4edSPhilip Paeps# These files can be tailored by setting BACKWARD, PACKRATDATA, etc.
561*46bee4edSPhilip Paepsvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
562*46bee4edSPhilip Paeps		$(AWK) -v outfile='$@' -f ziguard.awk $(TDATA) $(PACKRATDATA) \
563*46bee4edSPhilip Paeps		  >$@.out
564*46bee4edSPhilip Paeps		mv $@.out $@
565*46bee4edSPhilip Paepstzdata.zi:	$(DATAFORM).zi version
566f2fcff28SPhilip Paeps		version=`sed 1q version` && \
567f2fcff28SPhilip Paeps		  LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
568*46bee4edSPhilip Paeps		    $(DATAFORM).zi >$@.out
5698d7edd17SPhilip Paeps		mv $@.out $@
5708d7edd17SPhilip Paeps
571ba2b2efdSGlen Barberversion.h:	version
572ba2b2efdSGlen Barber		VERSION=`cat version` && printf '%s\n' \
573ba2b2efdSGlen Barber		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
574ba2b2efdSGlen Barber		  "static char const TZVERSION[]=\"$$VERSION\";" \
575ba2b2efdSGlen Barber		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
576ba2b2efdSGlen Barber		  >$@.out
577ba2b2efdSGlen Barber		mv $@.out $@
578ba2b2efdSGlen Barber
579ba2b2efdSGlen Barberzdump:		$(TZDOBJS)
580ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
581ba2b2efdSGlen Barber
582ba2b2efdSGlen Barberzic:		$(TZCOBJS)
583ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
584ba2b2efdSGlen Barber
585ba2b2efdSGlen Barberyearistype:	yearistype.sh
586ba2b2efdSGlen Barber		cp yearistype.sh yearistype
587ba2b2efdSGlen Barber		chmod +x yearistype
588ba2b2efdSGlen Barber
589ba2b2efdSGlen Barberleapseconds:	$(LEAP_DEPS)
590ba2b2efdSGlen Barber		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
591ba2b2efdSGlen Barber		mv $@.out $@
592ba2b2efdSGlen Barber
593ba2b2efdSGlen Barber# Arguments to pass to submakes of install_data.
594ba2b2efdSGlen Barber# They can be overridden by later submake arguments.
595ba2b2efdSGlen BarberINSTALLARGS = \
596f2fcff28SPhilip Paeps BACKWARD='$(BACKWARD)' \
597f2fcff28SPhilip Paeps DESTDIR='$(DESTDIR)' \
598ba2b2efdSGlen Barber LEAPSECONDS='$(LEAPSECONDS)' \
599ba2b2efdSGlen Barber PACKRATDATA='$(PACKRATDATA)' \
600f2fcff28SPhilip Paeps TZDEFAULT='$(TZDEFAULT)' \
601f2fcff28SPhilip Paeps TZDIR='$(TZDIR)' \
602f2fcff28SPhilip Paeps YEARISTYPE='$(YEARISTYPE)' \
603ba2b2efdSGlen Barber ZIC='$(ZIC)'
604ba2b2efdSGlen Barber
605ba2b2efdSGlen Barber# 'make install_data' installs one set of tz binary files.
6068d7edd17SPhilip Paepsinstall_data:	zic leapseconds yearistype tzdata.zi
6078d7edd17SPhilip Paeps		$(ZIC_INSTALL) tzdata.zi
608ba2b2efdSGlen Barber
609ba2b2efdSGlen Barberposix_only:
610ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
611ba2b2efdSGlen Barber
612ba2b2efdSGlen Barberright_only:
613ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
614ba2b2efdSGlen Barber			install_data
615ba2b2efdSGlen Barber
616ba2b2efdSGlen Barber# In earlier versions of this makefile, the other two directories were
617ba2b2efdSGlen Barber# subdirectories of $(TZDIR).  However, this led to configuration errors.
618ba2b2efdSGlen Barber# For example, with posix_right under the earlier scheme,
619ba2b2efdSGlen Barber# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
620ba2b2efdSGlen Barber# but gmtime without leap seconds, which led to problems with applications
621ba2b2efdSGlen Barber# like sendmail that subtract gmtime from localtime.
622ba2b2efdSGlen Barber# Therefore, the other two directories are now siblings of $(TZDIR).
623ba2b2efdSGlen Barber# You must replace all of $(TZDIR) to switch from not using leap seconds
624ba2b2efdSGlen Barber# to using them, or vice versa.
625ba2b2efdSGlen Barberright_posix:	right_only
626f2fcff28SPhilip Paeps		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
627f2fcff28SPhilip Paeps		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
628f2fcff28SPhilip Paeps		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
629f2fcff28SPhilip Paeps		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
630ba2b2efdSGlen Barber
631ba2b2efdSGlen Barberposix_right:	posix_only
632f2fcff28SPhilip Paeps		rm -fr '$(DESTDIR)$(TZDIR)-posix'
633f2fcff28SPhilip Paeps		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
634f2fcff28SPhilip Paeps		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
635f2fcff28SPhilip Paeps		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
636ba2b2efdSGlen Barber
637ba2b2efdSGlen Barber# This obsolescent rule is present for backwards compatibility with
638ba2b2efdSGlen Barber# tz releases 2014g through 2015g.  It should go away eventually.
639ba2b2efdSGlen Barberposix_packrat:
640ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
641ba2b2efdSGlen Barber
642ba2b2efdSGlen Barberzones:		$(REDO)
643ba2b2efdSGlen Barber
644*46bee4edSPhilip Paeps# dummy.zd is not a real file; it is mentioned here only so that the
645*46bee4edSPhilip Paeps# top-level 'make' does not have a syntax error.
646*46bee4edSPhilip PaepsZDS = dummy.zd
647*46bee4edSPhilip Paeps# Rule used only by submakes invoked by the $(TZS_NEW) rule.
648*46bee4edSPhilip Paeps# It is separate so that GNU 'make -j' can run instances in parallel.
649*46bee4edSPhilip Paeps$(ZDS): zdump
650*46bee4edSPhilip Paeps		./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@
651*46bee4edSPhilip Paeps
6528d7edd17SPhilip Paeps$(TZS_NEW):	tzdata.zi zdump zic
653*46bee4edSPhilip Paeps		rm -fr tzs.dir
654*46bee4edSPhilip Paeps		mkdir tzs.dir
6558d7edd17SPhilip Paeps		$(zic) -d tzs.dir tzdata.zi
6568d7edd17SPhilip Paeps		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
6578d7edd17SPhilip Paeps		   tzdata.zi | LC_ALL=C sort >$@.out
658ba2b2efdSGlen Barber		wd=`pwd` && \
659*46bee4edSPhilip Paeps		set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \
660*46bee4edSPhilip Paeps			| LC_ALL=C sort -t . -k 2,2` && \
661*46bee4edSPhilip Paeps		shift && \
662*46bee4edSPhilip Paeps		ZDS=$$* && \
663*46bee4edSPhilip Paeps		$(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \
664*46bee4edSPhilip Paeps		sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out
665*46bee4edSPhilip Paeps		rm -fr tzs.dir
666*46bee4edSPhilip Paeps		mv $@.out $@
667ba2b2efdSGlen Barber
668ba2b2efdSGlen Barber# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
669ba2b2efdSGlen Barber# If it exists but 'make check_tzs' fails, a maintainer should inspect the
670ba2b2efdSGlen Barber# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
671ba2b2efdSGlen Barber$(TZS):
672ba2b2efdSGlen Barber		$(MAKE) force_tzs
673ba2b2efdSGlen Barber
674ba2b2efdSGlen Barberforce_tzs:	$(TZS_NEW)
675ba2b2efdSGlen Barber		cp $(TZS_NEW) $(TZS)
676ba2b2efdSGlen Barber
677ba2b2efdSGlen Barberlibtz.a:	$(LIBOBJS)
678e350c46aSBaptiste Daroussin		rm -f $@
679e350c46aSBaptiste Daroussin		$(AR) -rc $@ $(LIBOBJS)
680ba2b2efdSGlen Barber		$(RANLIB) $@
681ba2b2efdSGlen Barber
682ba2b2efdSGlen Barberdate:		$(DATEOBJS)
683ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
684ba2b2efdSGlen Barber
685ba2b2efdSGlen Barbertzselect:	tzselect.ksh version
686ba2b2efdSGlen Barber		VERSION=`cat version` && sed \
687ba2b2efdSGlen Barber			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
688ba2b2efdSGlen Barber			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
689ba2b2efdSGlen Barber			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
690ba2b2efdSGlen Barber			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
691ba2b2efdSGlen Barber			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
692ba2b2efdSGlen Barber			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
693ba2b2efdSGlen Barber			<$@.ksh >$@.out
694ba2b2efdSGlen Barber		chmod +x $@.out
695ba2b2efdSGlen Barber		mv $@.out $@
696ba2b2efdSGlen Barber
6978d7edd17SPhilip Paepscheck:		check_character_set check_white_space check_links \
6988d7edd17SPhilip Paeps		  check_name_lengths check_sorted \
6998d7edd17SPhilip Paeps		  check_tables check_web check_zishrink check_tzs
700ba2b2efdSGlen Barber
701ba2b2efdSGlen Barbercheck_character_set: $(ENCHILADA)
7028d7edd17SPhilip Paeps	test ! '$(UTF8_LOCALE)' || \
7038d7edd17SPhilip Paeps	! printf 'A\304\200B\n' | \
7048d7edd17SPhilip Paeps	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
7058d7edd17SPhilip Paeps		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
706ba2b2efdSGlen Barber		sharp='#' && \
707ba2b2efdSGlen Barber		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
708ba2b2efdSGlen Barber			$(MISC) $(SOURCES) $(WEB_PAGES) \
709*46bee4edSPhilip Paeps			CONTRIBUTING LICENSE README \
7108d7edd17SPhilip Paeps			version tzdata.zi && \
711*46bee4edSPhilip Paeps		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \
712*46bee4edSPhilip Paeps			Makefile && \
713afb91be3SPhilip Paeps		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
714ba2b2efdSGlen Barber			leapseconds yearistype.sh zone.tab && \
7158d7edd17SPhilip Paeps		! grep -Env $(OK_LINE) $(ENCHILADA); \
7168d7edd17SPhilip Paeps	}
717ba2b2efdSGlen Barber
718ba2b2efdSGlen Barbercheck_white_space: $(ENCHILADA)
719ba2b2efdSGlen Barber		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
720ba2b2efdSGlen Barber		! grep -En "$$pat" $(ENCHILADA)
721afb91be3SPhilip Paeps		! grep -n '[[:space:]]$$' \
722afb91be3SPhilip Paeps			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
723ba2b2efdSGlen Barber
7248d7edd17SPhilip PaepsPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
7258d7edd17SPhilip PaepsFILE_NAME_COMPONENT_TOO_LONG = \
7268d7edd17SPhilip Paeps  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
7278d7edd17SPhilip Paeps
728afb91be3SPhilip Paepscheck_name_lengths: $(TDATA_TO_CHECK) backzone
729afb91be3SPhilip Paeps		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
730afb91be3SPhilip Paeps			$(TDATA_TO_CHECK) backzone
7318d7edd17SPhilip Paeps
732ba2b2efdSGlen BarberCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
733ba2b2efdSGlen Barber
734ba2b2efdSGlen Barbercheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
735ba2b2efdSGlen Barber		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
736ba2b2efdSGlen Barber		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
737ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
738ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
739ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
740ba2b2efdSGlen Barber		  LC_ALL=C sort -c
741ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
742ba2b2efdSGlen Barber		  LC_ALL=C sort -cu
743ba2b2efdSGlen Barber
744*46bee4edSPhilip Paepscheck_links:	checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
745afb91be3SPhilip Paeps		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
7468d7edd17SPhilip Paeps		$(AWK) -f checklinks.awk tzdata.zi
747ba2b2efdSGlen Barber
748ba2b2efdSGlen Barbercheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
749ba2b2efdSGlen Barber		for tab in $(ZONETABLES); do \
750ba2b2efdSGlen Barber		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
751ba2b2efdSGlen Barber		    || exit; \
752ba2b2efdSGlen Barber		done
753ba2b2efdSGlen Barber
754ba2b2efdSGlen Barbercheck_tzs:	$(TZS) $(TZS_NEW)
755ba2b2efdSGlen Barber		diff -u $(TZS) $(TZS_NEW)
756ba2b2efdSGlen Barber
7578d7edd17SPhilip Paeps# This checks only the HTML 4.01 strict page.
7588d7edd17SPhilip Paeps# To check the the other pages, use <https://validator.w3.org/>.
7598d7edd17SPhilip Paepscheck_web:	tz-how-to.html
7608d7edd17SPhilip Paeps		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
7618d7edd17SPhilip Paeps
762*46bee4edSPhilip Paeps# Check that zishrink.awk does not alter the data, and that ziguard.awk
763*46bee4edSPhilip Paeps# preserves main-format data.
764*46bee4edSPhilip Paepscheck_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \
765*46bee4edSPhilip Paeps		  $(DATAFORM).zi tzdata.zi
7668d7edd17SPhilip Paeps		for type in posix right; do \
767*46bee4edSPhilip Paeps		  mkdir -p time_t.dir/$$type time_t.dir/$$type-t \
768*46bee4edSPhilip Paeps		    time_t.dir/$$type-shrunk && \
7698d7edd17SPhilip Paeps		  case $$type in \
7708d7edd17SPhilip Paeps		    right) leap='-L leapseconds';; \
7718d7edd17SPhilip Paeps	            *) leap=;; \
7728d7edd17SPhilip Paeps		  esac && \
773*46bee4edSPhilip Paeps		  $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \
774*46bee4edSPhilip Paeps		  case $(DATAFORM) in \
775*46bee4edSPhilip Paeps		    main) \
776*46bee4edSPhilip Paeps		      $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \
7778d7edd17SPhilip Paeps		      $(AWK) '/^Rule/' $(TDATA) | \
778*46bee4edSPhilip Paeps			$(ZIC) $$leap -d time_t.dir/$$type-t - \
779*46bee4edSPhilip Paeps			  $(PACKRATDATA) && \
780*46bee4edSPhilip Paeps		      diff -r time_t.dir/$$type time_t.dir/$$type-t;; \
781*46bee4edSPhilip Paeps		  esac && \
7828d7edd17SPhilip Paeps		  $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
7838d7edd17SPhilip Paeps		  diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
7848d7edd17SPhilip Paeps		done
7858d7edd17SPhilip Paeps		rm -fr time_t.dir
786ba2b2efdSGlen Barber
787ba2b2efdSGlen Barberclean_misc:
788ba2b2efdSGlen Barber		rm -f core *.o *.out \
789ba2b2efdSGlen Barber		  date tzselect version.h zdump zic yearistype libtz.a
790ba2b2efdSGlen Barberclean:		clean_misc
791*46bee4edSPhilip Paeps		rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW)
792ba2b2efdSGlen Barber
793ba2b2efdSGlen Barbermaintainer-clean: clean
794ba2b2efdSGlen Barber		@echo 'This command is intended for maintainers to use; it'
795ba2b2efdSGlen Barber		@echo 'deletes files that may need special tools to rebuild.'
796ba2b2efdSGlen Barber		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
797ba2b2efdSGlen Barber
798ba2b2efdSGlen Barbernames:
799ba2b2efdSGlen Barber		@echo $(ENCHILADA)
800ba2b2efdSGlen Barber
801ba2b2efdSGlen Barberpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
802ba2b2efdSGlen Barber		tarballs signatures
803ba2b2efdSGlen Barber
804ba2b2efdSGlen Barberdate.1.txt:	date.1
805ba2b2efdSGlen Barbernewctime.3.txt:	newctime.3
806ba2b2efdSGlen Barbernewstrftime.3.txt: newstrftime.3
807ba2b2efdSGlen Barbernewtzset.3.txt:	newtzset.3
808ba2b2efdSGlen Barbertime2posix.3.txt: time2posix.3
809ba2b2efdSGlen Barbertzfile.5.txt:	tzfile.5
810ba2b2efdSGlen Barbertzselect.8.txt:	tzselect.8
811ba2b2efdSGlen Barberzdump.8.txt:	zdump.8
812ba2b2efdSGlen Barberzic.8.txt:	zic.8
813ba2b2efdSGlen Barber
814ba2b2efdSGlen Barber$(MANTXTS):	workman.sh
815ba2b2efdSGlen Barber		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
816ba2b2efdSGlen Barber		mv $@.out $@
817ba2b2efdSGlen Barber
818ba2b2efdSGlen Barber# Set the time stamps to those of the git repository, if available,
819ba2b2efdSGlen Barber# and if the files have not changed since then.
820ba2b2efdSGlen Barber# This uses GNU 'touch' syntax 'touch -d@N FILE',
821ba2b2efdSGlen Barber# where N is the number of seconds since 1970.
822ba2b2efdSGlen Barber# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
823ba2b2efdSGlen Barber# Also, set the timestamp of each prebuilt file like 'leapseconds'
824ba2b2efdSGlen Barber# to be the maximum of the files it depends on.
825ba2b2efdSGlen Barberset-timestamps.out: $(ENCHILADA)
826ba2b2efdSGlen Barber		rm -f $@
827ba2b2efdSGlen Barber		if (type git) >/dev/null 2>&1 && \
828ba2b2efdSGlen Barber		   files=`git ls-files $(ENCHILADA)` && \
829ba2b2efdSGlen Barber		   touch -md @1 test.out; then \
830ba2b2efdSGlen Barber		  rm -f test.out && \
831ba2b2efdSGlen Barber		  for file in $$files; do \
832ba2b2efdSGlen Barber		    if git diff --quiet $$file; then \
833ba2b2efdSGlen Barber		      time=`git log -1 --format='tformat:%ct' $$file` && \
834ba2b2efdSGlen Barber		      touch -cmd @$$time $$file; \
835ba2b2efdSGlen Barber		    else \
836ba2b2efdSGlen Barber		      echo >&2 "$$file: warning: does not match repository"; \
837ba2b2efdSGlen Barber		    fi || exit; \
838ba2b2efdSGlen Barber		  done; \
839ba2b2efdSGlen Barber		fi
840ba2b2efdSGlen Barber		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
841ba2b2efdSGlen Barber		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
842ba2b2efdSGlen Barber		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
843ba2b2efdSGlen Barber		    exit; \
844ba2b2efdSGlen Barber		done
8458d7edd17SPhilip Paeps		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
846ba2b2efdSGlen Barber		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
847ba2b2efdSGlen Barber		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
848ba2b2efdSGlen Barber		touch $@
849ba2b2efdSGlen Barber
850ba2b2efdSGlen Barber# The zics below ensure that each data file can stand on its own.
851ba2b2efdSGlen Barber# We also do an all-files run to catch links to links.
852ba2b2efdSGlen Barber
853ba2b2efdSGlen Barbercheck_public:
854ba2b2efdSGlen Barber		$(MAKE) maintainer-clean
855f2fcff28SPhilip Paeps		$(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
856ba2b2efdSGlen Barber		mkdir -p public.dir
857afb91be3SPhilip Paeps		for i in $(TDATA_TO_CHECK) tzdata.zi; do \
858ba2b2efdSGlen Barber		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
859ba2b2efdSGlen Barber		done
860afb91be3SPhilip Paeps		$(zic) -v -d public.dir $(TDATA_TO_CHECK)
861ba2b2efdSGlen Barber		rm -fr public.dir
862ba2b2efdSGlen Barber
863ba2b2efdSGlen Barber# Check that the code works under various alternative
864ba2b2efdSGlen Barber# implementations of time_t.
865ba2b2efdSGlen Barbercheck_time_t_alternatives:
866ba2b2efdSGlen Barber		if diff -q Makefile Makefile 2>/dev/null; then \
867ba2b2efdSGlen Barber		  quiet_option='-q'; \
868ba2b2efdSGlen Barber		else \
869ba2b2efdSGlen Barber		  quiet_option=''; \
870ba2b2efdSGlen Barber		fi && \
871ba2b2efdSGlen Barber		wd=`pwd` && \
872ba2b2efdSGlen Barber		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
873ba2b2efdSGlen Barber		for type in $(TIME_T_ALTERNATIVES); do \
874ba2b2efdSGlen Barber		  mkdir -p time_t.dir/$$type && \
875ba2b2efdSGlen Barber		  $(MAKE) clean_misc && \
876ba2b2efdSGlen Barber		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
877ba2b2efdSGlen Barber		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
878ba2b2efdSGlen Barber		    REDO='$(REDO)' \
879ba2b2efdSGlen Barber		    install && \
880ba2b2efdSGlen Barber		  diff $$quiet_option -r \
881f2fcff28SPhilip Paeps		    time_t.dir/int64_t/etc \
882f2fcff28SPhilip Paeps		    time_t.dir/$$type/etc && \
883f2fcff28SPhilip Paeps		  diff $$quiet_option -r \
884f2fcff28SPhilip Paeps		    time_t.dir/int64_t/usr/share \
885f2fcff28SPhilip Paeps		    time_t.dir/$$type/usr/share && \
886ba2b2efdSGlen Barber		  case $$type in \
887ba2b2efdSGlen Barber		  int32_t) range=-2147483648,2147483647;; \
888ba2b2efdSGlen Barber		  uint32_t) range=0,4294967296;; \
889ba2b2efdSGlen Barber		  int64_t) continue;; \
890ba2b2efdSGlen Barber		  *u*) range=0,10000000000;; \
891ba2b2efdSGlen Barber		  *) range=-10000000000,10000000000;; \
892ba2b2efdSGlen Barber		  esac && \
893ba2b2efdSGlen Barber		  echo checking $$type zones ... && \
894f2fcff28SPhilip Paeps		  time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \
895ba2b2efdSGlen Barber		      >time_t.dir/int64_t.out && \
896f2fcff28SPhilip Paeps		  time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \
897ba2b2efdSGlen Barber		      >time_t.dir/$$type.out && \
898ba2b2efdSGlen Barber		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
899ba2b2efdSGlen Barber		    || exit; \
900ba2b2efdSGlen Barber		done
901ba2b2efdSGlen Barber		rm -fr time_t.dir
902ba2b2efdSGlen Barber
903ba2b2efdSGlen Barbertarballs traditional_tarballs signatures traditional_signatures: version
904ba2b2efdSGlen Barber		VERSION=`cat version` && \
905ba2b2efdSGlen Barber		$(MAKE) VERSION="$$VERSION" $@_version
906ba2b2efdSGlen Barber
907*46bee4edSPhilip Paeps# These *_version rules are intended for use if VERSION is set by some
908*46bee4edSPhilip Paeps# other means.  Ordinarily these rules are used only by the above
909*46bee4edSPhilip Paeps# non-_version rules, which set VERSION on the 'make' command line.
910ba2b2efdSGlen Barbertarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
911ba2b2efdSGlen Barbertraditional_tarballs_version: \
912ba2b2efdSGlen Barber  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
913ba2b2efdSGlen Barbersignatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
914ba2b2efdSGlen Barbertraditional_signatures_version: \
915ba2b2efdSGlen Barber  tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
916ba2b2efdSGlen Barber
917ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz: set-timestamps.out
918ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
919ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - \
920ba2b2efdSGlen Barber		    $(COMMON) $(DOCS) $(SOURCES) | \
921ba2b2efdSGlen Barber		  gzip $(GZIPFLAGS) >$@.out
922ba2b2efdSGlen Barber		mv $@.out $@
923ba2b2efdSGlen Barber
924ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz: set-timestamps.out
925ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
926ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
927ba2b2efdSGlen Barber		  gzip $(GZIPFLAGS) >$@.out
928ba2b2efdSGlen Barber		mv $@.out $@
929ba2b2efdSGlen Barber
930ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz: set-timestamps.out
931ba2b2efdSGlen Barber		rm -fr tzdb-$(VERSION)
932ba2b2efdSGlen Barber		mkdir tzdb-$(VERSION)
933ba2b2efdSGlen Barber		ln $(ENCHILADA) tzdb-$(VERSION)
934ba2b2efdSGlen Barber		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
935ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
936ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
937ba2b2efdSGlen Barber		mv $@.out $@
938ba2b2efdSGlen Barber
939ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
940ba2b2efdSGlen Barber		gpg --armor --detach-sign $?
941ba2b2efdSGlen Barber
942ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
943ba2b2efdSGlen Barber		gpg --armor --detach-sign $?
944ba2b2efdSGlen Barber
945ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
946ba2b2efdSGlen Barber		gpg --armor --detach-sign $?
947ba2b2efdSGlen Barber
948ba2b2efdSGlen Barbertypecheck:
949ba2b2efdSGlen Barber		$(MAKE) clean
950ba2b2efdSGlen Barber		for i in "long long" unsigned; \
951ba2b2efdSGlen Barber		do \
952ba2b2efdSGlen Barber			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
953ba2b2efdSGlen Barber			./zdump -v Europe/Rome ; \
954ba2b2efdSGlen Barber			$(MAKE) clean ; \
955ba2b2efdSGlen Barber		done
956ba2b2efdSGlen Barber
9578d7edd17SPhilip Paepszonenames:	tzdata.zi
9588d7edd17SPhilip Paeps		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
959ba2b2efdSGlen Barber
960ba2b2efdSGlen Barberasctime.o:	private.h tzfile.h
961ba2b2efdSGlen Barberdate.o:		private.h
962ba2b2efdSGlen Barberdifftime.o:	private.h
963ba2b2efdSGlen Barberlocaltime.o:	private.h tzfile.h
964ba2b2efdSGlen Barberstrftime.o:	private.h tzfile.h
965ba2b2efdSGlen Barberzdump.o:	version.h
966ba2b2efdSGlen Barberzic.o:		private.h tzfile.h version.h
967ba2b2efdSGlen Barber
968ba2b2efdSGlen Barber.KEEP_STATE:
969ba2b2efdSGlen Barber
970ba2b2efdSGlen Barber.PHONY: ALL INSTALL all
971*46bee4edSPhilip Paeps.PHONY: check check_character_set check_links check_name_lengths
972ba2b2efdSGlen Barber.PHONY: check_public check_sorted check_tables
973ba2b2efdSGlen Barber.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
9748d7edd17SPhilip Paeps.PHONY: check_zishrink
975*46bee4edSPhilip Paeps.PHONY: clean clean_misc dummy.zd force_tzs
976ba2b2efdSGlen Barber.PHONY: install install_data maintainer-clean names
977ba2b2efdSGlen Barber.PHONY: posix_only posix_packrat posix_right
978ba2b2efdSGlen Barber.PHONY: public right_only right_posix signatures signatures_version
979*46bee4edSPhilip Paeps.PHONY: tarballs tarballs_version
980*46bee4edSPhilip Paeps.PHONY: traditional_signatures traditional_signatures_version
981*46bee4edSPhilip Paeps.PHONY: traditional_tarballs traditional_tarballs_version
982*46bee4edSPhilip Paeps.PHONY: typecheck
983ba2b2efdSGlen Barber.PHONY: zonenames zones
984*46bee4edSPhilip Paeps.PHONY: $(ZDS)
985