xref: /freebsd/contrib/tzdata/Makefile (revision ba2b2efdfa24d8c1c26a19d75fab535b6e99d4d4)
1*ba2b2efdSGlen Barber# This file is in the public domain, so clarified as of
2*ba2b2efdSGlen Barber# 2009-05-17 by Arthur David Olson.
3*ba2b2efdSGlen Barber
4*ba2b2efdSGlen Barber# Package name for the code distribution.
5*ba2b2efdSGlen BarberPACKAGE=	tzcode
6*ba2b2efdSGlen Barber
7*ba2b2efdSGlen Barber# Version number for the distribution, overridden in the 'tarballs' rule below.
8*ba2b2efdSGlen BarberVERSION=	unknown
9*ba2b2efdSGlen Barber
10*ba2b2efdSGlen Barber# Email address for bug reports.
11*ba2b2efdSGlen BarberBUGEMAIL=	tz@iana.org
12*ba2b2efdSGlen Barber
13*ba2b2efdSGlen Barber# Change the line below for your time zone (after finding the zone you want in
14*ba2b2efdSGlen Barber# the time zone files, or adding it to a time zone file).
15*ba2b2efdSGlen Barber# Alternately, if you discover you've got the wrong time zone, you can just
16*ba2b2efdSGlen Barber#	zic -l rightzone
17*ba2b2efdSGlen Barber# to correct things.
18*ba2b2efdSGlen Barber# Use the command
19*ba2b2efdSGlen Barber#	make zonenames
20*ba2b2efdSGlen Barber# to get a list of the values you can use for LOCALTIME.
21*ba2b2efdSGlen Barber
22*ba2b2efdSGlen BarberLOCALTIME=	GMT
23*ba2b2efdSGlen Barber
24*ba2b2efdSGlen Barber# If you want something other than Eastern United States time as a template
25*ba2b2efdSGlen Barber# for handling POSIX-style time zone environment variables,
26*ba2b2efdSGlen Barber# change the line below (after finding the zone you want in the
27*ba2b2efdSGlen Barber# time zone files, or adding it to a time zone file).
28*ba2b2efdSGlen Barber# (When a POSIX-style environment variable is handled, the rules in the
29*ba2b2efdSGlen Barber# template file are used to determine "spring forward" and "fall back" days and
30*ba2b2efdSGlen Barber# times; the environment variable itself specifies UT offsets of standard and
31*ba2b2efdSGlen Barber# summer time.)
32*ba2b2efdSGlen Barber# Alternately, if you discover you've got the wrong time zone, you can just
33*ba2b2efdSGlen Barber#	zic -p rightzone
34*ba2b2efdSGlen Barber# to correct things.
35*ba2b2efdSGlen Barber# Use the command
36*ba2b2efdSGlen Barber#	make zonenames
37*ba2b2efdSGlen Barber# to get a list of the values you can use for POSIXRULES.
38*ba2b2efdSGlen Barber# If you want POSIX compatibility, use "America/New_York".
39*ba2b2efdSGlen Barber
40*ba2b2efdSGlen BarberPOSIXRULES=	America/New_York
41*ba2b2efdSGlen Barber
42*ba2b2efdSGlen Barber# Also see TZDEFRULESTRING below, which takes effect only
43*ba2b2efdSGlen Barber# if the time zone files cannot be accessed.
44*ba2b2efdSGlen Barber
45*ba2b2efdSGlen Barber# Everything gets put in subdirectories of. . .
46*ba2b2efdSGlen Barber
47*ba2b2efdSGlen BarberTOPDIR=		/usr/local
48*ba2b2efdSGlen Barber
49*ba2b2efdSGlen Barber# "Compiled" time zone information is placed in the "TZDIR" directory
50*ba2b2efdSGlen Barber# (and subdirectories).
51*ba2b2efdSGlen Barber# Use an absolute path name for TZDIR unless you're just testing the software.
52*ba2b2efdSGlen Barber
53*ba2b2efdSGlen BarberTZDIR_BASENAME=	zoneinfo
54*ba2b2efdSGlen BarberTZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
55*ba2b2efdSGlen Barber
56*ba2b2efdSGlen Barber# Types to try, as an alternative to time_t.  int64_t should be first.
57*ba2b2efdSGlen BarberTIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
58*ba2b2efdSGlen Barber
59*ba2b2efdSGlen Barber# The "tzselect", "zic", and "zdump" commands get installed in. . .
60*ba2b2efdSGlen Barber
61*ba2b2efdSGlen BarberETCDIR=		$(TOPDIR)/etc
62*ba2b2efdSGlen Barber
63*ba2b2efdSGlen Barber# If you "make INSTALL", the "date" command gets installed in. . .
64*ba2b2efdSGlen Barber
65*ba2b2efdSGlen BarberBINDIR=		$(TOPDIR)/bin
66*ba2b2efdSGlen Barber
67*ba2b2efdSGlen Barber# Manual pages go in subdirectories of. . .
68*ba2b2efdSGlen Barber
69*ba2b2efdSGlen BarberMANDIR=		$(TOPDIR)/man
70*ba2b2efdSGlen Barber
71*ba2b2efdSGlen Barber# Library functions are put in an archive in LIBDIR.
72*ba2b2efdSGlen Barber
73*ba2b2efdSGlen BarberLIBDIR=		$(TOPDIR)/lib
74*ba2b2efdSGlen Barber
75*ba2b2efdSGlen Barber# If you always want time values interpreted as "seconds since the epoch
76*ba2b2efdSGlen Barber# (not counting leap seconds)", use
77*ba2b2efdSGlen Barber#	REDO=		posix_only
78*ba2b2efdSGlen Barber# below.  If you always want right time values interpreted as "seconds since
79*ba2b2efdSGlen Barber# the epoch" (counting leap seconds)", use
80*ba2b2efdSGlen Barber#	REDO=		right_only
81*ba2b2efdSGlen Barber# below.  If you want both sets of data available, with leap seconds not
82*ba2b2efdSGlen Barber# counted normally, use
83*ba2b2efdSGlen Barber#	REDO=		posix_right
84*ba2b2efdSGlen Barber# below.  If you want both sets of data available, with leap seconds counted
85*ba2b2efdSGlen Barber# normally, use
86*ba2b2efdSGlen Barber#	REDO=		right_posix
87*ba2b2efdSGlen Barber# below.  POSIX mandates that leap seconds not be counted; for compatibility
88*ba2b2efdSGlen Barber# with it, use "posix_only" or "posix_right".
89*ba2b2efdSGlen Barber
90*ba2b2efdSGlen BarberREDO=		posix_right
91*ba2b2efdSGlen Barber
92*ba2b2efdSGlen Barber# If you want out-of-scope and often-wrong data from the file 'backzone', use
93*ba2b2efdSGlen Barber#	PACKRATDATA=	backzone
94*ba2b2efdSGlen Barber# To omit this data, use
95*ba2b2efdSGlen Barber#	PACKRATDATA=
96*ba2b2efdSGlen Barber
97*ba2b2efdSGlen BarberPACKRATDATA=
98*ba2b2efdSGlen Barber
99*ba2b2efdSGlen Barber# Since "." may not be in PATH...
100*ba2b2efdSGlen Barber
101*ba2b2efdSGlen BarberYEARISTYPE=	./yearistype
102*ba2b2efdSGlen Barber
103*ba2b2efdSGlen Barber# Non-default libraries needed to link.
104*ba2b2efdSGlen BarberLDLIBS=
105*ba2b2efdSGlen Barber
106*ba2b2efdSGlen Barber# Add the following to the end of the "CFLAGS=" line as needed.
107*ba2b2efdSGlen Barber#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
108*ba2b2efdSGlen Barber#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
109*ba2b2efdSGlen Barber#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
110*ba2b2efdSGlen Barber#  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
111*ba2b2efdSGlen Barber#  -DHAVE_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
112*ba2b2efdSGlen Barber#  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
113*ba2b2efdSGlen Barber#	ctime_r and asctime_r incompatibly with the POSIX standard
114*ba2b2efdSGlen Barber#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
115*ba2b2efdSGlen Barber#  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
116*ba2b2efdSGlen Barber#  -DHAVE_LINK=0 if your system lacks a link function
117*ba2b2efdSGlen Barber#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
118*ba2b2efdSGlen Barber#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
119*ba2b2efdSGlen Barber#	This defaults to 1 if a working localtime_rz seems to be available.
120*ba2b2efdSGlen Barber#	localtime_rz can make zdump significantly faster, but is nonstandard.
121*ba2b2efdSGlen Barber#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
122*ba2b2efdSGlen Barber#	functions like 'link' or variables like 'tzname' required by POSIX
123*ba2b2efdSGlen Barber#  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
124*ba2b2efdSGlen Barber#  -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
125*ba2b2efdSGlen Barber#	This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
126*ba2b2efdSGlen Barber#  -DHAVE_STRDUP=0 if your system lacks the strdup function
127*ba2b2efdSGlen Barber#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
128*ba2b2efdSGlen Barber#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
129*ba2b2efdSGlen Barber#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
130*ba2b2efdSGlen Barber#  -DHAVE_TZSET=0 if your system lacks a tzset function
131*ba2b2efdSGlen Barber#  -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
132*ba2b2efdSGlen Barber#  -DEPOCH_LOCAL=1 if the 'time' function returns local time not UT
133*ba2b2efdSGlen Barber#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
134*ba2b2efdSGlen Barber#	than what POSIX specifies, assuming local time is UT.
135*ba2b2efdSGlen Barber#	For example, N is 252460800 on AmigaOS.
136*ba2b2efdSGlen Barber#  -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
137*ba2b2efdSGlen Barber#	if you do not want run time warnings about formats that may cause
138*ba2b2efdSGlen Barber#	year 2000 grief
139*ba2b2efdSGlen Barber#  -Dssize_t=long on ancient hosts that lack ssize_t
140*ba2b2efdSGlen Barber#  -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
141*ba2b2efdSGlen Barber#	not needed by the main-program tz code, which is single-threaded.
142*ba2b2efdSGlen Barber#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
143*ba2b2efdSGlen Barber#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
144*ba2b2efdSGlen Barber#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
145*ba2b2efdSGlen Barber#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
146*ba2b2efdSGlen Barber#	the default is system-supplied, typically "/usr/lib/locale"
147*ba2b2efdSGlen Barber#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
148*ba2b2efdSGlen Barber#	DST transitions if the time zone files cannot be accessed
149*ba2b2efdSGlen Barber#  -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems
150*ba2b2efdSGlen Barber#	other than simply getting garbage data
151*ba2b2efdSGlen Barber#  -DUSE_LTZ=0 to build zdump with the system time zone library
152*ba2b2efdSGlen Barber#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
153*ba2b2efdSGlen Barber#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
154*ba2b2efdSGlen Barber#	(or some other number) to set the maximum time zone abbreviation length
155*ba2b2efdSGlen Barber#	that zic will accept without a warning (the default is 6)
156*ba2b2efdSGlen Barber#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
157*ba2b2efdSGlen BarberGCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
158*ba2b2efdSGlen Barber	-Wall -Wextra \
159*ba2b2efdSGlen Barber	-Wbad-function-cast -Wcast-align -Wdate-time \
160*ba2b2efdSGlen Barber	-Wdeclaration-after-statement \
161*ba2b2efdSGlen Barber	-Wdouble-promotion \
162*ba2b2efdSGlen Barber	-Wformat=2 -Winit-self -Wjump-misses-init \
163*ba2b2efdSGlen Barber	-Wlogical-op -Wmissing-prototypes -Wnested-externs \
164*ba2b2efdSGlen Barber	-Wold-style-definition -Woverlength-strings -Wpointer-arith \
165*ba2b2efdSGlen Barber	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
166*ba2b2efdSGlen Barber	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
167*ba2b2efdSGlen Barber	-Wsuggest-attribute=pure -Wtrampolines \
168*ba2b2efdSGlen Barber	-Wunused -Wwrite-strings \
169*ba2b2efdSGlen Barber	-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
170*ba2b2efdSGlen Barber	-Wno-type-limits -Wno-unused-parameter
171*ba2b2efdSGlen Barber#
172*ba2b2efdSGlen Barber# If you want to use System V compatibility code, add
173*ba2b2efdSGlen Barber#	-DUSG_COMPAT
174*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This arrange for "timezone" and "daylight"
175*ba2b2efdSGlen Barber# variables to be kept up-to-date by the time conversion functions.  Neither
176*ba2b2efdSGlen Barber# "timezone" nor "daylight" is described in X3J11's work.
177*ba2b2efdSGlen Barber#
178*ba2b2efdSGlen Barber# If your system has a "GMT offset" field in its "struct tm"s
179*ba2b2efdSGlen Barber# (or if you decide to add such a field in your system's "time.h" file),
180*ba2b2efdSGlen Barber# add the name to a define such as
181*ba2b2efdSGlen Barber#	-DTM_GMTOFF=tm_gmtoff
182*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
183*ba2b2efdSGlen Barber# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
184*ba2b2efdSGlen Barber# Similarly, if your system has a "zone abbreviation" field, define
185*ba2b2efdSGlen Barber#	-DTM_ZONE=tm_zone
186*ba2b2efdSGlen Barber# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
187*ba2b2efdSGlen Barber# required by POSIX, but are widely available on GNU/Linux and BSD systems.
188*ba2b2efdSGlen Barber#
189*ba2b2efdSGlen Barber# If you want functions that were inspired by early versions of X3J11's work,
190*ba2b2efdSGlen Barber# add
191*ba2b2efdSGlen Barber#	-DSTD_INSPIRED
192*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This arranges for the functions
193*ba2b2efdSGlen Barber# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
194*ba2b2efdSGlen Barber# "posix2time", and "time2posix" to be added to the time conversion library.
195*ba2b2efdSGlen Barber# "tzsetwall" is like "tzset" except that it arranges for local wall clock
196*ba2b2efdSGlen Barber# time (rather than the time specified in the TZ environment variable)
197*ba2b2efdSGlen Barber# to be used.
198*ba2b2efdSGlen Barber# "offtime" is like "gmtime" except that it accepts a second (long) argument
199*ba2b2efdSGlen Barber# that gives an offset to add to the time_t when converting it.
200*ba2b2efdSGlen Barber# "timelocal" is equivalent to "mktime".
201*ba2b2efdSGlen Barber# "timegm" is like "timelocal" except that it turns a struct tm into
202*ba2b2efdSGlen Barber# a time_t using UT (rather than local time as "timelocal" does).
203*ba2b2efdSGlen Barber# "timeoff" is like "timegm" except that it accepts a second (long) argument
204*ba2b2efdSGlen Barber# that gives an offset to use when converting to a time_t.
205*ba2b2efdSGlen Barber# "posix2time" and "time2posix" are described in an included manual page.
206*ba2b2efdSGlen Barber# X3J11's work does not describe any of these functions.
207*ba2b2efdSGlen Barber# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
208*ba2b2efdSGlen Barber# These functions may well disappear in future releases of the time
209*ba2b2efdSGlen Barber# conversion package.
210*ba2b2efdSGlen Barber#
211*ba2b2efdSGlen Barber# If you don't want functions that were inspired by NetBSD, add
212*ba2b2efdSGlen Barber#	-DNETBSD_INSPIRED=0
213*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  Otherwise, the functions
214*ba2b2efdSGlen Barber# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
215*ba2b2efdSGlen Barber# time library, and if STD_INSPIRED is also defined the functions
216*ba2b2efdSGlen Barber# "posix2time_z" and "time2posix_z" are added as well.
217*ba2b2efdSGlen Barber# The functions ending in "_z" (or "_rz") are like their unsuffixed
218*ba2b2efdSGlen Barber# (or suffixed-by-"_r") counterparts, except with an extra first
219*ba2b2efdSGlen Barber# argument of opaque type timezone_t that specifies the time zone.
220*ba2b2efdSGlen Barber# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
221*ba2b2efdSGlen Barber#
222*ba2b2efdSGlen Barber# If you want to allocate state structures in localtime, add
223*ba2b2efdSGlen Barber#	-DALL_STATE
224*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
225*ba2b2efdSGlen Barber#
226*ba2b2efdSGlen Barber# If you want an "altzone" variable (a la System V Release 3.1), add
227*ba2b2efdSGlen Barber#	-DALTZONE
228*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.
229*ba2b2efdSGlen Barber# This variable is not described in X3J11's work.
230*ba2b2efdSGlen Barber#
231*ba2b2efdSGlen Barber# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
232*ba2b2efdSGlen Barber# out by the National Institute of Standards and Technology
233*ba2b2efdSGlen Barber# which claims to test C and Posix conformance.  If you want to pass PCTS, add
234*ba2b2efdSGlen Barber#	-DPCTS
235*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.
236*ba2b2efdSGlen Barber#
237*ba2b2efdSGlen Barber# If you want strict compliance with XPG4 as of 1994-04-09, add
238*ba2b2efdSGlen Barber#	-DXPG4_1994_04_09
239*ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
240*ba2b2efdSGlen Barber# 53 as a week number (rather than 52 or 53) for those days in January that
241*ba2b2efdSGlen Barber# before the first Monday in January when a "%V" format is used and January 1
242*ba2b2efdSGlen Barber# falls on a Friday, Saturday, or Sunday.
243*ba2b2efdSGlen Barber
244*ba2b2efdSGlen BarberCFLAGS=
245*ba2b2efdSGlen Barber
246*ba2b2efdSGlen Barber# Linker flags.  Default to $(LFLAGS) for backwards compatibility
247*ba2b2efdSGlen Barber# to release 2012h and earlier.
248*ba2b2efdSGlen Barber
249*ba2b2efdSGlen BarberLDFLAGS=	$(LFLAGS)
250*ba2b2efdSGlen Barber
251*ba2b2efdSGlen Barber# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
252*ba2b2efdSGlen Barber# submake command lines.  The default is no leap seconds.
253*ba2b2efdSGlen Barber
254*ba2b2efdSGlen BarberLEAPSECONDS=
255*ba2b2efdSGlen Barber
256*ba2b2efdSGlen Barber# The zic command and its arguments.
257*ba2b2efdSGlen Barber
258*ba2b2efdSGlen Barberzic=		./zic
259*ba2b2efdSGlen BarberZIC=		$(zic) $(ZFLAGS)
260*ba2b2efdSGlen Barber
261*ba2b2efdSGlen BarberZFLAGS=
262*ba2b2efdSGlen Barber
263*ba2b2efdSGlen Barber# How to use zic to install tz binary files.
264*ba2b2efdSGlen Barber
265*ba2b2efdSGlen BarberZIC_INSTALL=	$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
266*ba2b2efdSGlen Barber
267*ba2b2efdSGlen Barber# The name of a Posix-compliant 'awk' on your system.
268*ba2b2efdSGlen BarberAWK=		awk
269*ba2b2efdSGlen Barber
270*ba2b2efdSGlen Barber# The full path name of a Posix-compliant shell, preferably one that supports
271*ba2b2efdSGlen Barber# the Korn shell's 'select' statement as an extension.
272*ba2b2efdSGlen Barber# These days, Bash is the most popular.
273*ba2b2efdSGlen Barber# It should be OK to set this to /bin/sh, on platforms where /bin/sh
274*ba2b2efdSGlen Barber# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
275*ba2b2efdSGlen Barber# is typically nicer if it works.
276*ba2b2efdSGlen BarberKSHELL=		/bin/bash
277*ba2b2efdSGlen Barber
278*ba2b2efdSGlen Barber# The path where SGML DTDs are kept and the catalog file(s) to use when
279*ba2b2efdSGlen Barber# validating.  The default should work on both Debian and Red Hat.
280*ba2b2efdSGlen BarberSGML_TOPDIR= /usr
281*ba2b2efdSGlen BarberSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
282*ba2b2efdSGlen BarberSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
283*ba2b2efdSGlen BarberSGML_CATALOG_FILES= \
284*ba2b2efdSGlen 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
285*ba2b2efdSGlen Barber
286*ba2b2efdSGlen Barber# The name, arguments and environment of a program to validate your web pages.
287*ba2b2efdSGlen Barber# See <http://openjade.sourceforge.net/doc/> for a validator, and
288*ba2b2efdSGlen Barber# <https://validator.w3.org/source/> for a validation library.
289*ba2b2efdSGlen BarberVALIDATE = nsgmls
290*ba2b2efdSGlen BarberVALIDATE_FLAGS = -s -B -wall -wno-unused-param
291*ba2b2efdSGlen BarberVALIDATE_ENV = \
292*ba2b2efdSGlen Barber  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
293*ba2b2efdSGlen Barber  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
294*ba2b2efdSGlen Barber  SP_CHARSET_FIXED=YES \
295*ba2b2efdSGlen Barber  SP_ENCODING=UTF-8
296*ba2b2efdSGlen Barber
297*ba2b2efdSGlen Barber# This expensive test requires USE_LTZ.
298*ba2b2efdSGlen Barber# To suppress it, define this macro to be empty.
299*ba2b2efdSGlen BarberCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
300*ba2b2efdSGlen Barber
301*ba2b2efdSGlen Barber# SAFE_CHAR is a regular expression that matches a safe character.
302*ba2b2efdSGlen Barber# Some parts of this distribution are limited to safe characters;
303*ba2b2efdSGlen Barber# others can use any UTF-8 character.
304*ba2b2efdSGlen Barber# For now, the safe characters are a safe subset of ASCII.
305*ba2b2efdSGlen Barber# The caller must set the shell variable 'sharp' to the character '#',
306*ba2b2efdSGlen Barber# since Makefile macros cannot contain '#'.
307*ba2b2efdSGlen Barber# TAB_CHAR is a single tab character, in single quotes.
308*ba2b2efdSGlen BarberTAB_CHAR=	'	'
309*ba2b2efdSGlen BarberSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
310*ba2b2efdSGlen BarberSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
311*ba2b2efdSGlen BarberSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
312*ba2b2efdSGlen BarberSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
313*ba2b2efdSGlen BarberSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
314*ba2b2efdSGlen Barber
315*ba2b2efdSGlen Barber# OK_CHAR matches any character allowed in the distributed files.
316*ba2b2efdSGlen Barber# This is the same as SAFE_CHAR, except that multibyte letters are
317*ba2b2efdSGlen Barber# also allowed so that commentary can contain people's names and quote
318*ba2b2efdSGlen Barber# non-English sources.  For non-letters the sources are limited to
319*ba2b2efdSGlen Barber# ASCII renderings for the convenience of maintainers whose text editors
320*ba2b2efdSGlen Barber# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
321*ba2b2efdSGlen BarberOK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
322*ba2b2efdSGlen Barber
323*ba2b2efdSGlen Barber# SAFE_LINE matches a line of safe characters.
324*ba2b2efdSGlen Barber# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
325*ba2b2efdSGlen Barber# this is so that comments can contain non-ASCII characters.
326*ba2b2efdSGlen Barber# OK_LINE matches a line of OK characters.
327*ba2b2efdSGlen BarberSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
328*ba2b2efdSGlen BarberSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
329*ba2b2efdSGlen BarberOK_LINE=	'^'$(OK_CHAR)'*$$'
330*ba2b2efdSGlen Barber
331*ba2b2efdSGlen Barber# Flags to give 'tar' when making a distribution.
332*ba2b2efdSGlen Barber# Try to use flags appropriate for GNU tar.
333*ba2b2efdSGlen BarberGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
334*ba2b2efdSGlen BarberTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
335*ba2b2efdSGlen Barber		 then echo $(GNUTARFLAGS); \
336*ba2b2efdSGlen Barber		 else :; \
337*ba2b2efdSGlen Barber		 fi`
338*ba2b2efdSGlen Barber
339*ba2b2efdSGlen Barber# Flags to give 'gzip' when making a distribution.
340*ba2b2efdSGlen BarberGZIPFLAGS=	-9n
341*ba2b2efdSGlen Barber
342*ba2b2efdSGlen Barber###############################################################################
343*ba2b2efdSGlen Barber
344*ba2b2efdSGlen Barber#MAKE=		make
345*ba2b2efdSGlen Barber
346*ba2b2efdSGlen Barbercc=		cc
347*ba2b2efdSGlen BarberCC=		$(cc) -DTZDIR=\"$(TZDIR)\"
348*ba2b2efdSGlen Barber
349*ba2b2efdSGlen BarberAR=		ar
350*ba2b2efdSGlen Barber
351*ba2b2efdSGlen Barber# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
352*ba2b2efdSGlen BarberRANLIB=		:
353*ba2b2efdSGlen Barber
354*ba2b2efdSGlen BarberTZCOBJS=	zic.o
355*ba2b2efdSGlen BarberTZDOBJS=	zdump.o localtime.o asctime.o
356*ba2b2efdSGlen BarberDATEOBJS=	date.o localtime.o strftime.o asctime.o
357*ba2b2efdSGlen BarberLIBSRCS=	localtime.c asctime.c difftime.c
358*ba2b2efdSGlen BarberLIBOBJS=	localtime.o asctime.o difftime.o
359*ba2b2efdSGlen BarberHEADERS=	tzfile.h private.h
360*ba2b2efdSGlen BarberNONLIBSRCS=	zic.c zdump.c
361*ba2b2efdSGlen BarberNEWUCBSRCS=	date.c strftime.c
362*ba2b2efdSGlen BarberSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
363*ba2b2efdSGlen Barber			tzselect.ksh workman.sh
364*ba2b2efdSGlen BarberMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
365*ba2b2efdSGlen Barber			tzfile.5 tzselect.8 zic.8 zdump.8
366*ba2b2efdSGlen BarberMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
367*ba2b2efdSGlen Barber			time2posix.3.txt \
368*ba2b2efdSGlen Barber			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
369*ba2b2efdSGlen Barber			date.1.txt
370*ba2b2efdSGlen BarberCOMMON=		CONTRIBUTING LICENSE Makefile NEWS README Theory version
371*ba2b2efdSGlen BarberWEB_PAGES=	tz-art.htm tz-how-to.html tz-link.htm
372*ba2b2efdSGlen BarberDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
373*ba2b2efdSGlen BarberPRIMARY_YDATA=	africa antarctica asia australasia \
374*ba2b2efdSGlen Barber		europe northamerica southamerica
375*ba2b2efdSGlen BarberYDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
376*ba2b2efdSGlen BarberNDATA=		systemv factory
377*ba2b2efdSGlen BarberTDATA=		$(YDATA) $(NDATA)
378*ba2b2efdSGlen BarberZONETABLES=	zone1970.tab zone.tab
379*ba2b2efdSGlen BarberTABDATA=	iso3166.tab leapseconds $(ZONETABLES)
380*ba2b2efdSGlen BarberLEAP_DEPS=	leapseconds.awk leap-seconds.list
381*ba2b2efdSGlen BarberDATA=		$(YDATA) $(NDATA) backzone $(TABDATA) \
382*ba2b2efdSGlen Barber			leap-seconds.list yearistype.sh
383*ba2b2efdSGlen BarberAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
384*ba2b2efdSGlen BarberMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
385*ba2b2efdSGlen BarberTZS_YEAR=	2050
386*ba2b2efdSGlen BarberTZS=		to$(TZS_YEAR).tzs
387*ba2b2efdSGlen BarberTZS_NEW=	to$(TZS_YEAR)new.tzs
388*ba2b2efdSGlen BarberTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
389*ba2b2efdSGlen Barber			private.h tzfile.h zdump.c zic.c
390*ba2b2efdSGlen BarberENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS)
391*ba2b2efdSGlen Barber
392*ba2b2efdSGlen Barber# Consult these files when deciding whether to rebuild the 'version' file.
393*ba2b2efdSGlen Barber# This list is not the same as the output of 'git ls-files', since
394*ba2b2efdSGlen Barber# .gitignore is not distributed.
395*ba2b2efdSGlen BarberVERSION_DEPS= \
396*ba2b2efdSGlen Barber		CONTRIBUTING LICENSE Makefile NEWS README Theory \
397*ba2b2efdSGlen Barber		africa antarctica asctime.c asia australasia \
398*ba2b2efdSGlen Barber		backward backzone \
399*ba2b2efdSGlen Barber		checklinks.awk checktab.awk \
400*ba2b2efdSGlen Barber		date.1 date.c difftime.c \
401*ba2b2efdSGlen Barber		etcetera europe factory iso3166.tab \
402*ba2b2efdSGlen Barber		leap-seconds.list leapseconds.awk localtime.c \
403*ba2b2efdSGlen Barber		newctime.3 newstrftime.3 newtzset.3 northamerica \
404*ba2b2efdSGlen Barber		pacificnew private.h \
405*ba2b2efdSGlen Barber		southamerica strftime.c systemv \
406*ba2b2efdSGlen Barber		time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \
407*ba2b2efdSGlen Barber		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
408*ba2b2efdSGlen Barber		workman.sh yearistype.sh \
409*ba2b2efdSGlen Barber		zdump.8 zdump.c zic.8 zic.c \
410*ba2b2efdSGlen Barber		zone.tab zone1970.tab zoneinfo2tdf.pl
411*ba2b2efdSGlen Barber
412*ba2b2efdSGlen Barber# And for the benefit of csh users on systems that assume the user
413*ba2b2efdSGlen Barber# shell should be used to handle commands in Makefiles. . .
414*ba2b2efdSGlen Barber
415*ba2b2efdSGlen BarberSHELL=		/bin/sh
416*ba2b2efdSGlen Barber
417*ba2b2efdSGlen Barberall:		tzselect yearistype zic zdump libtz.a $(TABDATA)
418*ba2b2efdSGlen Barber
419*ba2b2efdSGlen BarberALL:		all date $(ENCHILADA)
420*ba2b2efdSGlen Barber
421*ba2b2efdSGlen Barberinstall:	all $(DATA) $(REDO) $(MANS)
422*ba2b2efdSGlen Barber		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
423*ba2b2efdSGlen Barber			$(DESTDIR)$(LIBDIR) \
424*ba2b2efdSGlen Barber			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
425*ba2b2efdSGlen Barber			$(DESTDIR)$(MANDIR)/man8
426*ba2b2efdSGlen Barber		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES)
427*ba2b2efdSGlen Barber		cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
428*ba2b2efdSGlen Barber		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
429*ba2b2efdSGlen Barber		cp libtz.a $(DESTDIR)$(LIBDIR)/.
430*ba2b2efdSGlen Barber		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
431*ba2b2efdSGlen Barber		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
432*ba2b2efdSGlen Barber		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
433*ba2b2efdSGlen Barber		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
434*ba2b2efdSGlen Barber
435*ba2b2efdSGlen BarberINSTALL:	ALL install date.1
436*ba2b2efdSGlen Barber		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
437*ba2b2efdSGlen Barber		cp date $(DESTDIR)$(BINDIR)/.
438*ba2b2efdSGlen Barber		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
439*ba2b2efdSGlen Barber
440*ba2b2efdSGlen Barberversion:	$(VERSION_DEPS)
441*ba2b2efdSGlen Barber		{ (type git) >/dev/null 2>&1 && \
442*ba2b2efdSGlen Barber		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
443*ba2b2efdSGlen Barber				--abbrev=7 --dirty` || \
444*ba2b2efdSGlen Barber		  V=$(VERSION); } && \
445*ba2b2efdSGlen Barber		printf '%s\n' "$$V" >$@.out
446*ba2b2efdSGlen Barber		mv $@.out $@
447*ba2b2efdSGlen Barber
448*ba2b2efdSGlen Barberversion.h:	version
449*ba2b2efdSGlen Barber		VERSION=`cat version` && printf '%s\n' \
450*ba2b2efdSGlen Barber		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
451*ba2b2efdSGlen Barber		  "static char const TZVERSION[]=\"$$VERSION\";" \
452*ba2b2efdSGlen Barber		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
453*ba2b2efdSGlen Barber		  >$@.out
454*ba2b2efdSGlen Barber		mv $@.out $@
455*ba2b2efdSGlen Barber
456*ba2b2efdSGlen Barberzdump:		$(TZDOBJS)
457*ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
458*ba2b2efdSGlen Barber
459*ba2b2efdSGlen Barberzic:		$(TZCOBJS)
460*ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
461*ba2b2efdSGlen Barber
462*ba2b2efdSGlen Barberyearistype:	yearistype.sh
463*ba2b2efdSGlen Barber		cp yearistype.sh yearistype
464*ba2b2efdSGlen Barber		chmod +x yearistype
465*ba2b2efdSGlen Barber
466*ba2b2efdSGlen Barberleapseconds:	$(LEAP_DEPS)
467*ba2b2efdSGlen Barber		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
468*ba2b2efdSGlen Barber		mv $@.out $@
469*ba2b2efdSGlen Barber
470*ba2b2efdSGlen Barber# Arguments to pass to submakes of install_data.
471*ba2b2efdSGlen Barber# They can be overridden by later submake arguments.
472*ba2b2efdSGlen BarberINSTALLARGS = \
473*ba2b2efdSGlen Barber DESTDIR=$(DESTDIR) \
474*ba2b2efdSGlen Barber LEAPSECONDS='$(LEAPSECONDS)' \
475*ba2b2efdSGlen Barber PACKRATDATA='$(PACKRATDATA)' \
476*ba2b2efdSGlen Barber TZDIR=$(TZDIR) \
477*ba2b2efdSGlen Barber YEARISTYPE=$(YEARISTYPE) \
478*ba2b2efdSGlen Barber ZIC='$(ZIC)'
479*ba2b2efdSGlen Barber
480*ba2b2efdSGlen Barber# 'make install_data' installs one set of tz binary files.
481*ba2b2efdSGlen Barber# It can be tailored by setting LEAPSECONDS, PACKRATDATA, etc.
482*ba2b2efdSGlen Barberinstall_data:	zic leapseconds yearistype $(PACKRATDATA) $(TDATA)
483*ba2b2efdSGlen Barber		$(ZIC_INSTALL) $(TDATA)
484*ba2b2efdSGlen Barber		$(AWK) '/^Rule/' $(TDATA) | $(ZIC_INSTALL) - $(PACKRATDATA)
485*ba2b2efdSGlen Barber
486*ba2b2efdSGlen Barberposix_only:
487*ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
488*ba2b2efdSGlen Barber
489*ba2b2efdSGlen Barberright_only:
490*ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
491*ba2b2efdSGlen Barber			install_data
492*ba2b2efdSGlen Barber
493*ba2b2efdSGlen Barber# In earlier versions of this makefile, the other two directories were
494*ba2b2efdSGlen Barber# subdirectories of $(TZDIR).  However, this led to configuration errors.
495*ba2b2efdSGlen Barber# For example, with posix_right under the earlier scheme,
496*ba2b2efdSGlen Barber# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
497*ba2b2efdSGlen Barber# but gmtime without leap seconds, which led to problems with applications
498*ba2b2efdSGlen Barber# like sendmail that subtract gmtime from localtime.
499*ba2b2efdSGlen Barber# Therefore, the other two directories are now siblings of $(TZDIR).
500*ba2b2efdSGlen Barber# You must replace all of $(TZDIR) to switch from not using leap seconds
501*ba2b2efdSGlen Barber# to using them, or vice versa.
502*ba2b2efdSGlen Barberright_posix:	right_only
503*ba2b2efdSGlen Barber		rm -fr $(DESTDIR)$(TZDIR)-leaps
504*ba2b2efdSGlen Barber		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
505*ba2b2efdSGlen Barber		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
506*ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
507*ba2b2efdSGlen Barber
508*ba2b2efdSGlen Barberposix_right:	posix_only
509*ba2b2efdSGlen Barber		rm -fr $(DESTDIR)$(TZDIR)-posix
510*ba2b2efdSGlen Barber		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
511*ba2b2efdSGlen Barber		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
512*ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
513*ba2b2efdSGlen Barber
514*ba2b2efdSGlen Barber# This obsolescent rule is present for backwards compatibility with
515*ba2b2efdSGlen Barber# tz releases 2014g through 2015g.  It should go away eventually.
516*ba2b2efdSGlen Barberposix_packrat:
517*ba2b2efdSGlen Barber		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
518*ba2b2efdSGlen Barber
519*ba2b2efdSGlen Barberzones:		$(REDO)
520*ba2b2efdSGlen Barber
521*ba2b2efdSGlen Barber$(TZS_NEW):	$(TDATA) zdump zic
522*ba2b2efdSGlen Barber		mkdir -p tzs.dir
523*ba2b2efdSGlen Barber		$(zic) -d tzs.dir $(TDATA)
524*ba2b2efdSGlen Barber		$(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \
525*ba2b2efdSGlen Barber		   $(TDATA) | LC_ALL=C sort >$@.out
526*ba2b2efdSGlen Barber		wd=`pwd` && \
527*ba2b2efdSGlen Barber		zones=`$(AWK) -v wd="$$wd" \
528*ba2b2efdSGlen Barber				'/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \
529*ba2b2efdSGlen Barber			 | LC_ALL=C sort` && \
530*ba2b2efdSGlen Barber		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
531*ba2b2efdSGlen Barber		sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out
532*ba2b2efdSGlen Barber		rm -fr tzs.dir $@.out
533*ba2b2efdSGlen Barber		mv $@.sed.out $@
534*ba2b2efdSGlen Barber
535*ba2b2efdSGlen Barber# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
536*ba2b2efdSGlen Barber# If it exists but 'make check_tzs' fails, a maintainer should inspect the
537*ba2b2efdSGlen Barber# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
538*ba2b2efdSGlen Barber$(TZS):
539*ba2b2efdSGlen Barber		$(MAKE) force_tzs
540*ba2b2efdSGlen Barber
541*ba2b2efdSGlen Barberforce_tzs:	$(TZS_NEW)
542*ba2b2efdSGlen Barber		cp $(TZS_NEW) $(TZS)
543*ba2b2efdSGlen Barber
544*ba2b2efdSGlen Barberlibtz.a:	$(LIBOBJS)
545*ba2b2efdSGlen Barber		$(AR) ru $@ $(LIBOBJS)
546*ba2b2efdSGlen Barber		$(RANLIB) $@
547*ba2b2efdSGlen Barber
548*ba2b2efdSGlen Barberdate:		$(DATEOBJS)
549*ba2b2efdSGlen Barber		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
550*ba2b2efdSGlen Barber
551*ba2b2efdSGlen Barbertzselect:	tzselect.ksh version
552*ba2b2efdSGlen Barber		VERSION=`cat version` && sed \
553*ba2b2efdSGlen Barber			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
554*ba2b2efdSGlen Barber			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
555*ba2b2efdSGlen Barber			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
556*ba2b2efdSGlen Barber			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
557*ba2b2efdSGlen Barber			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
558*ba2b2efdSGlen Barber			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
559*ba2b2efdSGlen Barber			<$@.ksh >$@.out
560*ba2b2efdSGlen Barber		chmod +x $@.out
561*ba2b2efdSGlen Barber		mv $@.out $@
562*ba2b2efdSGlen Barber
563*ba2b2efdSGlen Barbercheck:		check_character_set check_white_space check_links check_sorted \
564*ba2b2efdSGlen Barber		  check_tables check_tzs check_web
565*ba2b2efdSGlen Barber
566*ba2b2efdSGlen Barbercheck_character_set: $(ENCHILADA)
567*ba2b2efdSGlen Barber		LC_ALL=en_US.utf8 && export LC_ALL && \
568*ba2b2efdSGlen Barber		sharp='#' && \
569*ba2b2efdSGlen Barber		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
570*ba2b2efdSGlen Barber			$(MISC) $(SOURCES) $(WEB_PAGES) \
571*ba2b2efdSGlen Barber			CONTRIBUTING LICENSE Makefile README version && \
572*ba2b2efdSGlen Barber		! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
573*ba2b2efdSGlen Barber			leapseconds yearistype.sh zone.tab && \
574*ba2b2efdSGlen Barber		! grep -Env $(OK_LINE) $(ENCHILADA)
575*ba2b2efdSGlen Barber
576*ba2b2efdSGlen Barbercheck_white_space: $(ENCHILADA)
577*ba2b2efdSGlen Barber		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
578*ba2b2efdSGlen Barber		! grep -En "$$pat" $(ENCHILADA)
579*ba2b2efdSGlen Barber		! grep -n '[[:space:]]$$' $(ENCHILADA)
580*ba2b2efdSGlen Barber
581*ba2b2efdSGlen BarberCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
582*ba2b2efdSGlen Barber
583*ba2b2efdSGlen Barbercheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
584*ba2b2efdSGlen Barber		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
585*ba2b2efdSGlen Barber		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
586*ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
587*ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
588*ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
589*ba2b2efdSGlen Barber		  LC_ALL=C sort -c
590*ba2b2efdSGlen Barber		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
591*ba2b2efdSGlen Barber		  LC_ALL=C sort -cu
592*ba2b2efdSGlen Barber
593*ba2b2efdSGlen Barbercheck_links:	checklinks.awk $(TDATA)
594*ba2b2efdSGlen Barber		$(AWK) -f checklinks.awk $(TDATA)
595*ba2b2efdSGlen Barber
596*ba2b2efdSGlen Barbercheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
597*ba2b2efdSGlen Barber		for tab in $(ZONETABLES); do \
598*ba2b2efdSGlen Barber		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
599*ba2b2efdSGlen Barber		    || exit; \
600*ba2b2efdSGlen Barber		done
601*ba2b2efdSGlen Barber
602*ba2b2efdSGlen Barbercheck_tzs:	$(TZS) $(TZS_NEW)
603*ba2b2efdSGlen Barber		diff -u $(TZS) $(TZS_NEW)
604*ba2b2efdSGlen Barber
605*ba2b2efdSGlen Barbercheck_web:	$(WEB_PAGES)
606*ba2b2efdSGlen Barber		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
607*ba2b2efdSGlen Barber
608*ba2b2efdSGlen Barberclean_misc:
609*ba2b2efdSGlen Barber		rm -f core *.o *.out \
610*ba2b2efdSGlen Barber		  date tzselect version.h zdump zic yearistype libtz.a
611*ba2b2efdSGlen Barberclean:		clean_misc
612*ba2b2efdSGlen Barber		rm -fr *.dir tzdb-*/ $(TZS_NEW)
613*ba2b2efdSGlen Barber
614*ba2b2efdSGlen Barbermaintainer-clean: clean
615*ba2b2efdSGlen Barber		@echo 'This command is intended for maintainers to use; it'
616*ba2b2efdSGlen Barber		@echo 'deletes files that may need special tools to rebuild.'
617*ba2b2efdSGlen Barber		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
618*ba2b2efdSGlen Barber
619*ba2b2efdSGlen Barbernames:
620*ba2b2efdSGlen Barber		@echo $(ENCHILADA)
621*ba2b2efdSGlen Barber
622*ba2b2efdSGlen Barberpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
623*ba2b2efdSGlen Barber		tarballs signatures
624*ba2b2efdSGlen Barber
625*ba2b2efdSGlen Barberdate.1.txt:	date.1
626*ba2b2efdSGlen Barbernewctime.3.txt:	newctime.3
627*ba2b2efdSGlen Barbernewstrftime.3.txt: newstrftime.3
628*ba2b2efdSGlen Barbernewtzset.3.txt:	newtzset.3
629*ba2b2efdSGlen Barbertime2posix.3.txt: time2posix.3
630*ba2b2efdSGlen Barbertzfile.5.txt:	tzfile.5
631*ba2b2efdSGlen Barbertzselect.8.txt:	tzselect.8
632*ba2b2efdSGlen Barberzdump.8.txt:	zdump.8
633*ba2b2efdSGlen Barberzic.8.txt:	zic.8
634*ba2b2efdSGlen Barber
635*ba2b2efdSGlen Barber$(MANTXTS):	workman.sh
636*ba2b2efdSGlen Barber		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
637*ba2b2efdSGlen Barber		mv $@.out $@
638*ba2b2efdSGlen Barber
639*ba2b2efdSGlen Barber# Set the time stamps to those of the git repository, if available,
640*ba2b2efdSGlen Barber# and if the files have not changed since then.
641*ba2b2efdSGlen Barber# This uses GNU 'touch' syntax 'touch -d@N FILE',
642*ba2b2efdSGlen Barber# where N is the number of seconds since 1970.
643*ba2b2efdSGlen Barber# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
644*ba2b2efdSGlen Barber# Also, set the timestamp of each prebuilt file like 'leapseconds'
645*ba2b2efdSGlen Barber# to be the maximum of the files it depends on.
646*ba2b2efdSGlen Barberset-timestamps.out: $(ENCHILADA)
647*ba2b2efdSGlen Barber		rm -f $@
648*ba2b2efdSGlen Barber		if (type git) >/dev/null 2>&1 && \
649*ba2b2efdSGlen Barber		   files=`git ls-files $(ENCHILADA)` && \
650*ba2b2efdSGlen Barber		   touch -md @1 test.out; then \
651*ba2b2efdSGlen Barber		  rm -f test.out && \
652*ba2b2efdSGlen Barber		  for file in $$files; do \
653*ba2b2efdSGlen Barber		    if git diff --quiet $$file; then \
654*ba2b2efdSGlen Barber		      time=`git log -1 --format='tformat:%ct' $$file` && \
655*ba2b2efdSGlen Barber		      touch -cmd @$$time $$file; \
656*ba2b2efdSGlen Barber		    else \
657*ba2b2efdSGlen Barber		      echo >&2 "$$file: warning: does not match repository"; \
658*ba2b2efdSGlen Barber		    fi || exit; \
659*ba2b2efdSGlen Barber		  done; \
660*ba2b2efdSGlen Barber		fi
661*ba2b2efdSGlen Barber		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
662*ba2b2efdSGlen Barber		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
663*ba2b2efdSGlen Barber		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
664*ba2b2efdSGlen Barber		    exit; \
665*ba2b2efdSGlen Barber		done
666*ba2b2efdSGlen Barber		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
667*ba2b2efdSGlen Barber		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
668*ba2b2efdSGlen Barber		touch $@
669*ba2b2efdSGlen Barber
670*ba2b2efdSGlen Barber# The zics below ensure that each data file can stand on its own.
671*ba2b2efdSGlen Barber# We also do an all-files run to catch links to links.
672*ba2b2efdSGlen Barber
673*ba2b2efdSGlen Barbercheck_public:
674*ba2b2efdSGlen Barber		$(MAKE) maintainer-clean
675*ba2b2efdSGlen Barber		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
676*ba2b2efdSGlen Barber		mkdir -p public.dir
677*ba2b2efdSGlen Barber		for i in $(TDATA) ; do \
678*ba2b2efdSGlen Barber		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
679*ba2b2efdSGlen Barber		done
680*ba2b2efdSGlen Barber		$(zic) -v -d public.dir $(TDATA)
681*ba2b2efdSGlen Barber		rm -fr public.dir
682*ba2b2efdSGlen Barber
683*ba2b2efdSGlen Barber# Check that the code works under various alternative
684*ba2b2efdSGlen Barber# implementations of time_t.
685*ba2b2efdSGlen Barbercheck_time_t_alternatives:
686*ba2b2efdSGlen Barber		if diff -q Makefile Makefile 2>/dev/null; then \
687*ba2b2efdSGlen Barber		  quiet_option='-q'; \
688*ba2b2efdSGlen Barber		else \
689*ba2b2efdSGlen Barber		  quiet_option=''; \
690*ba2b2efdSGlen Barber		fi && \
691*ba2b2efdSGlen Barber		wd=`pwd` && \
692*ba2b2efdSGlen Barber		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
693*ba2b2efdSGlen Barber		for type in $(TIME_T_ALTERNATIVES); do \
694*ba2b2efdSGlen Barber		  mkdir -p time_t.dir/$$type && \
695*ba2b2efdSGlen Barber		  $(MAKE) clean_misc && \
696*ba2b2efdSGlen Barber		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
697*ba2b2efdSGlen Barber		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
698*ba2b2efdSGlen Barber		    REDO='$(REDO)' \
699*ba2b2efdSGlen Barber		    install && \
700*ba2b2efdSGlen Barber		  diff $$quiet_option -r \
701*ba2b2efdSGlen Barber		    time_t.dir/int64_t/etc/zoneinfo \
702*ba2b2efdSGlen Barber		    time_t.dir/$$type/etc/zoneinfo && \
703*ba2b2efdSGlen Barber		  case $$type in \
704*ba2b2efdSGlen Barber		  int32_t) range=-2147483648,2147483647;; \
705*ba2b2efdSGlen Barber		  uint32_t) range=0,4294967296;; \
706*ba2b2efdSGlen Barber		  int64_t) continue;; \
707*ba2b2efdSGlen Barber		  *u*) range=0,10000000000;; \
708*ba2b2efdSGlen Barber		  *) range=-10000000000,10000000000;; \
709*ba2b2efdSGlen Barber		  esac && \
710*ba2b2efdSGlen Barber		  echo checking $$type zones ... && \
711*ba2b2efdSGlen Barber		  time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \
712*ba2b2efdSGlen Barber		      >time_t.dir/int64_t.out && \
713*ba2b2efdSGlen Barber		  time_t.dir/$$type/etc/zdump -V -t $$range $$zones \
714*ba2b2efdSGlen Barber		      >time_t.dir/$$type.out && \
715*ba2b2efdSGlen Barber		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
716*ba2b2efdSGlen Barber		    || exit; \
717*ba2b2efdSGlen Barber		done
718*ba2b2efdSGlen Barber		rm -fr time_t.dir
719*ba2b2efdSGlen Barber
720*ba2b2efdSGlen Barbertarballs traditional_tarballs signatures traditional_signatures: version
721*ba2b2efdSGlen Barber		VERSION=`cat version` && \
722*ba2b2efdSGlen Barber		$(MAKE) VERSION="$$VERSION" $@_version
723*ba2b2efdSGlen Barber
724*ba2b2efdSGlen Barbertarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
725*ba2b2efdSGlen Barbertraditional_tarballs_version: \
726*ba2b2efdSGlen Barber  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
727*ba2b2efdSGlen Barbersignatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
728*ba2b2efdSGlen Barbertraditional_signatures_version: \
729*ba2b2efdSGlen Barber  tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
730*ba2b2efdSGlen Barber
731*ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz: set-timestamps.out
732*ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
733*ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - \
734*ba2b2efdSGlen Barber		    $(COMMON) $(DOCS) $(SOURCES) | \
735*ba2b2efdSGlen Barber		  gzip $(GZIPFLAGS) >$@.out
736*ba2b2efdSGlen Barber		mv $@.out $@
737*ba2b2efdSGlen Barber
738*ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz: set-timestamps.out
739*ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
740*ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
741*ba2b2efdSGlen Barber		  gzip $(GZIPFLAGS) >$@.out
742*ba2b2efdSGlen Barber		mv $@.out $@
743*ba2b2efdSGlen Barber
744*ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz: set-timestamps.out
745*ba2b2efdSGlen Barber		rm -fr tzdb-$(VERSION)
746*ba2b2efdSGlen Barber		mkdir tzdb-$(VERSION)
747*ba2b2efdSGlen Barber		ln $(ENCHILADA) tzdb-$(VERSION)
748*ba2b2efdSGlen Barber		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
749*ba2b2efdSGlen Barber		LC_ALL=C && export LC_ALL && \
750*ba2b2efdSGlen Barber		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
751*ba2b2efdSGlen Barber		mv $@.out $@
752*ba2b2efdSGlen Barber
753*ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
754*ba2b2efdSGlen Barber		gpg --armor --detach-sign $?
755*ba2b2efdSGlen Barber
756*ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
757*ba2b2efdSGlen Barber		gpg --armor --detach-sign $?
758*ba2b2efdSGlen Barber
759*ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
760*ba2b2efdSGlen Barber		gpg --armor --detach-sign $?
761*ba2b2efdSGlen Barber
762*ba2b2efdSGlen Barbertypecheck:
763*ba2b2efdSGlen Barber		$(MAKE) clean
764*ba2b2efdSGlen Barber		for i in "long long" unsigned; \
765*ba2b2efdSGlen Barber		do \
766*ba2b2efdSGlen Barber			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
767*ba2b2efdSGlen Barber			./zdump -v Europe/Rome ; \
768*ba2b2efdSGlen Barber			$(MAKE) clean ; \
769*ba2b2efdSGlen Barber		done
770*ba2b2efdSGlen Barber
771*ba2b2efdSGlen Barberzonenames:	$(TDATA)
772*ba2b2efdSGlen Barber		@$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
773*ba2b2efdSGlen Barber
774*ba2b2efdSGlen Barberasctime.o:	private.h tzfile.h
775*ba2b2efdSGlen Barberdate.o:		private.h
776*ba2b2efdSGlen Barberdifftime.o:	private.h
777*ba2b2efdSGlen Barberlocaltime.o:	private.h tzfile.h
778*ba2b2efdSGlen Barberstrftime.o:	private.h tzfile.h
779*ba2b2efdSGlen Barberzdump.o:	version.h
780*ba2b2efdSGlen Barberzic.o:		private.h tzfile.h version.h
781*ba2b2efdSGlen Barber
782*ba2b2efdSGlen Barber.KEEP_STATE:
783*ba2b2efdSGlen Barber
784*ba2b2efdSGlen Barber.PHONY: ALL INSTALL all
785*ba2b2efdSGlen Barber.PHONY: check check_character_set check_links
786*ba2b2efdSGlen Barber.PHONY: check_public check_sorted check_tables
787*ba2b2efdSGlen Barber.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
788*ba2b2efdSGlen Barber.PHONY: clean clean_misc force_tzs
789*ba2b2efdSGlen Barber.PHONY: install install_data maintainer-clean names
790*ba2b2efdSGlen Barber.PHONY: posix_only posix_packrat posix_right
791*ba2b2efdSGlen Barber.PHONY: public right_only right_posix signatures signatures_version
792*ba2b2efdSGlen Barber.PHONY: tarballs tarballs_version typecheck
793*ba2b2efdSGlen Barber.PHONY: zonenames zones
794