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