Makefile revision 308302
1106813Ssimokawa# This file is in the public domain, so clarified as of
2106813Ssimokawa# 2009-05-17 by Arthur David Olson.
3106813Ssimokawa
4106813Ssimokawa# Package name for the code distribution.
5106813SsimokawaPACKAGE=	tzcode
6106813Ssimokawa
7106813Ssimokawa# Version number for the distribution, overridden in the 'tarballs' rule below.
8106813SsimokawaVERSION=	unknown
9106813Ssimokawa
10106813Ssimokawa# Email address for bug reports.
11106813SsimokawaBUGEMAIL=	tz@iana.org
12106813Ssimokawa
13106813Ssimokawa# Change the line below for your time zone (after finding the zone you want in
14106813Ssimokawa# the time zone files, or adding it to a time zone file).
15106813Ssimokawa# Alternately, if you discover you've got the wrong time zone, you can just
16106813Ssimokawa#	zic -l rightzone
17106813Ssimokawa# to correct things.
18106813Ssimokawa# Use the command
19106813Ssimokawa#	make zonenames
20106813Ssimokawa# to get a list of the values you can use for LOCALTIME.
21106813Ssimokawa
22106813SsimokawaLOCALTIME=	GMT
23106813Ssimokawa
24106813Ssimokawa# If you want something other than Eastern United States time as a template
25106813Ssimokawa# for handling POSIX-style time zone environment variables,
26106813Ssimokawa# change the line below (after finding the zone you want in the
27106813Ssimokawa# time zone files, or adding it to a time zone file).
28106813Ssimokawa# (When a POSIX-style environment variable is handled, the rules in the
29106813Ssimokawa# template file are used to determine "spring forward" and "fall back" days and
30106813Ssimokawa# times; the environment variable itself specifies UT offsets of standard and
31106813Ssimokawa# summer time.)
32106813Ssimokawa# Alternately, if you discover you've got the wrong time zone, you can just
33106813Ssimokawa#	zic -p rightzone
34106813Ssimokawa# to correct things.
35106813Ssimokawa# Use the command
36106813Ssimokawa#	make zonenames
37106813Ssimokawa# to get a list of the values you can use for POSIXRULES.
38106813Ssimokawa# If you want POSIX compatibility, use "America/New_York".
39106813Ssimokawa
40106813SsimokawaPOSIXRULES=	America/New_York
41106813Ssimokawa
42106813Ssimokawa# Also see TZDEFRULESTRING below, which takes effect only
43106813Ssimokawa# if the time zone files cannot be accessed.
44106813Ssimokawa
45106813Ssimokawa# Everything gets put in subdirectories of. . .
46106813Ssimokawa
47106813SsimokawaTOPDIR=		/usr/local
48106813Ssimokawa
49106813Ssimokawa# "Compiled" time zone information is placed in the "TZDIR" directory
50106813Ssimokawa# (and subdirectories).
51106813Ssimokawa# Use an absolute path name for TZDIR unless you're just testing the software.
52106813Ssimokawa
53106813SsimokawaTZDIR_BASENAME=	zoneinfo
54106813SsimokawaTZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
55109282Ssimokawa
56106813Ssimokawa# Types to try, as an alternative to time_t.  int64_t should be first.
57106813SsimokawaTIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
58106813Ssimokawa
59106813Ssimokawa# The "tzselect", "zic", and "zdump" commands get installed in. . .
60106813Ssimokawa
61106813SsimokawaETCDIR=		$(TOPDIR)/etc
62106813Ssimokawa
63106813Ssimokawa# If you "make INSTALL", the "date" command gets installed in. . .
64106813Ssimokawa
65106813SsimokawaBINDIR=		$(TOPDIR)/bin
66106813Ssimokawa
67106813Ssimokawa# Manual pages go in subdirectories of. . .
68106813Ssimokawa
69106813SsimokawaMANDIR=		$(TOPDIR)/man
70106813Ssimokawa
71106813Ssimokawa# Library functions are put in an archive in LIBDIR.
72106813Ssimokawa
73106813SsimokawaLIBDIR=		$(TOPDIR)/lib
74106813Ssimokawa
75106813Ssimokawa# If you always want time values interpreted as "seconds since the epoch
76106813Ssimokawa# (not counting leap seconds)", use
77106813Ssimokawa#	REDO=		posix_only
78106813Ssimokawa# below.  If you always want right time values interpreted as "seconds since
79106813Ssimokawa# the epoch" (counting leap seconds)", use
80106813Ssimokawa#	REDO=		right_only
81106813Ssimokawa# below.  If you want both sets of data available, with leap seconds not
82106813Ssimokawa# counted normally, use
83106813Ssimokawa#	REDO=		posix_right
84106813Ssimokawa# below.  If you want both sets of data available, with leap seconds counted
85106813Ssimokawa# normally, use
86106813Ssimokawa#	REDO=		right_posix
87106813Ssimokawa# below.  POSIX mandates that leap seconds not be counted; for compatibility
88106813Ssimokawa# with it, use "posix_only" or "posix_right".
89106813Ssimokawa
90106813SsimokawaREDO=		posix_right
91106813Ssimokawa
92106813Ssimokawa# If you want out-of-scope and often-wrong data from the file 'backzone', use
93106813Ssimokawa#	PACKRATDATA=	backzone
94106813Ssimokawa# To omit this data, use
95106813Ssimokawa#	PACKRATDATA=
96106813Ssimokawa
97106813SsimokawaPACKRATDATA=
98106813Ssimokawa
99106813Ssimokawa# Since "." may not be in PATH...
100106813Ssimokawa
101106813SsimokawaYEARISTYPE=	./yearistype
102106813Ssimokawa
103106813Ssimokawa# Non-default libraries needed to link.
104106813SsimokawaLDLIBS=
105106813Ssimokawa
106106813Ssimokawa# Add the following to the end of the "CFLAGS=" line as needed.
107106813Ssimokawa#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
108106813Ssimokawa#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
109106813Ssimokawa#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
110106813Ssimokawa#  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
111106813Ssimokawa#  -DHAVE_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
112106813Ssimokawa#  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
113106813Ssimokawa#	ctime_r and asctime_r incompatibly with the POSIX standard
114106813Ssimokawa#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
115106813Ssimokawa#  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
116106813Ssimokawa#  -DHAVE_LINK=0 if your system lacks a link function
117106813Ssimokawa#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
118106813Ssimokawa#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
119106813Ssimokawa#	This defaults to 1 if a working localtime_rz seems to be available.
120106813Ssimokawa#	localtime_rz can make zdump significantly faster, but is nonstandard.
121106813Ssimokawa#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
122106813Ssimokawa#	functions like 'link' or variables like 'tzname' required by POSIX
123106813Ssimokawa#  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
124106813Ssimokawa#  -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
125106813Ssimokawa#	This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
126106813Ssimokawa#  -DHAVE_STRDUP=0 if your system lacks the strdup function
127106813Ssimokawa#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
128106813Ssimokawa#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
129106813Ssimokawa#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
130106813Ssimokawa#  -DHAVE_TZSET=0 if your system lacks a tzset function
131106813Ssimokawa#  -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
132106813Ssimokawa#  -DEPOCH_LOCAL=1 if the 'time' function returns local time not UT
133106813Ssimokawa#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
134106813Ssimokawa#	than what POSIX specifies, assuming local time is UT.
135106813Ssimokawa#	For example, N is 252460800 on AmigaOS.
136106813Ssimokawa#  -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
137106813Ssimokawa#	if you do not want run time warnings about formats that may cause
138109802Ssimokawa#	year 2000 grief
139106813Ssimokawa#  -Dssize_t=long on ancient hosts that lack ssize_t
140109802Ssimokawa#  -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
141109802Ssimokawa#	not needed by the main-program tz code, which is single-threaded.
142106813Ssimokawa#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
143106813Ssimokawa#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
144106813Ssimokawa#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
145106813Ssimokawa#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
146106813Ssimokawa#	the default is system-supplied, typically "/usr/lib/locale"
147106813Ssimokawa#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
148106813Ssimokawa#	DST transitions if the time zone files cannot be accessed
149106813Ssimokawa#  -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems
150106813Ssimokawa#	other than simply getting garbage data
151106813Ssimokawa#  -DUSE_LTZ=0 to build zdump with the system time zone library
152106813Ssimokawa#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
153106813Ssimokawa#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
154106813Ssimokawa#	(or some other number) to set the maximum time zone abbreviation length
155106813Ssimokawa#	that zic will accept without a warning (the default is 6)
156106813Ssimokawa#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
157106813SsimokawaGCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
158106813Ssimokawa	-Wall -Wextra \
159106813Ssimokawa	-Wbad-function-cast -Wcast-align -Wdate-time \
160106813Ssimokawa	-Wdeclaration-after-statement \
161109802Ssimokawa	-Wdouble-promotion \
162106813Ssimokawa	-Wformat=2 -Winit-self -Wjump-misses-init \
163106813Ssimokawa	-Wlogical-op -Wmissing-prototypes -Wnested-externs \
164106813Ssimokawa	-Wold-style-definition -Woverlength-strings -Wpointer-arith \
165106813Ssimokawa	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
166106813Ssimokawa	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
167106813Ssimokawa	-Wsuggest-attribute=pure -Wtrampolines \
168109379Ssimokawa	-Wunused -Wwrite-strings \
169106813Ssimokawa	-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
170106813Ssimokawa	-Wno-type-limits -Wno-unused-parameter
171106813Ssimokawa#
172106813Ssimokawa# If you want to use System V compatibility code, add
173106813Ssimokawa#	-DUSG_COMPAT
174106813Ssimokawa# to the end of the "CFLAGS=" line.  This arrange for "timezone" and "daylight"
175106813Ssimokawa# variables to be kept up-to-date by the time conversion functions.  Neither
176109890Ssimokawa# "timezone" nor "daylight" is described in X3J11's work.
177106813Ssimokawa#
178109890Ssimokawa# If your system has a "GMT offset" field in its "struct tm"s
179106813Ssimokawa# (or if you decide to add such a field in your system's "time.h" file),
180109379Ssimokawa# add the name to a define such as
181106813Ssimokawa#	-DTM_GMTOFF=tm_gmtoff
182106813Ssimokawa# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
183106813Ssimokawa# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
184106813Ssimokawa# Similarly, if your system has a "zone abbreviation" field, define
185106813Ssimokawa#	-DTM_ZONE=tm_zone
186106813Ssimokawa# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
187106813Ssimokawa# required by POSIX, but are widely available on GNU/Linux and BSD systems.
188106813Ssimokawa#
189106813Ssimokawa# If you want functions that were inspired by early versions of X3J11's work,
190106813Ssimokawa# add
191106813Ssimokawa#	-DSTD_INSPIRED
192106813Ssimokawa# to the end of the "CFLAGS=" line.  This arranges for the functions
193106813Ssimokawa# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
194106813Ssimokawa# "posix2time", and "time2posix" to be added to the time conversion library.
195106813Ssimokawa# "tzsetwall" is like "tzset" except that it arranges for local wall clock
196106813Ssimokawa# time (rather than the time specified in the TZ environment variable)
197106813Ssimokawa# to be used.
198106813Ssimokawa# "offtime" is like "gmtime" except that it accepts a second (long) argument
199106813Ssimokawa# that gives an offset to add to the time_t when converting it.
200106813Ssimokawa# "timelocal" is equivalent to "mktime".
201106813Ssimokawa# "timegm" is like "timelocal" except that it turns a struct tm into
202106813Ssimokawa# a time_t using UT (rather than local time as "timelocal" does).
203106813Ssimokawa# "timeoff" is like "timegm" except that it accepts a second (long) argument
204106813Ssimokawa# that gives an offset to use when converting to a time_t.
205106813Ssimokawa# "posix2time" and "time2posix" are described in an included manual page.
206106813Ssimokawa# X3J11's work does not describe any of these functions.
207106813Ssimokawa# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
208106813Ssimokawa# These functions may well disappear in future releases of the time
209106813Ssimokawa# conversion package.
210106813Ssimokawa#
211106813Ssimokawa# If you don't want functions that were inspired by NetBSD, add
212106813Ssimokawa#	-DNETBSD_INSPIRED=0
213106813Ssimokawa# to the end of the "CFLAGS=" line.  Otherwise, the functions
214106813Ssimokawa# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
215106813Ssimokawa# time library, and if STD_INSPIRED is also defined the functions
216106813Ssimokawa# "posix2time_z" and "time2posix_z" are added as well.
217106813Ssimokawa# The functions ending in "_z" (or "_rz") are like their unsuffixed
218106813Ssimokawa# (or suffixed-by-"_r") counterparts, except with an extra first
219106813Ssimokawa# argument of opaque type timezone_t that specifies the time zone.
220106813Ssimokawa# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
221106813Ssimokawa#
222106813Ssimokawa# If you want to allocate state structures in localtime, add
223106813Ssimokawa#	-DALL_STATE
224106813Ssimokawa# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
225106813Ssimokawa#
226106813Ssimokawa# If you want an "altzone" variable (a la System V Release 3.1), add
227106813Ssimokawa#	-DALTZONE
228106813Ssimokawa# to the end of the "CFLAGS=" line.
229106813Ssimokawa# This variable is not described in X3J11's work.
230106813Ssimokawa#
231106813Ssimokawa# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
232106813Ssimokawa# out by the National Institute of Standards and Technology
233106813Ssimokawa# which claims to test C and Posix conformance.  If you want to pass PCTS, add
234106813Ssimokawa#	-DPCTS
235106813Ssimokawa# to the end of the "CFLAGS=" line.
236106813Ssimokawa#
237106813Ssimokawa# If you want strict compliance with XPG4 as of 1994-04-09, add
238106813Ssimokawa#	-DXPG4_1994_04_09
239106813Ssimokawa# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
240106813Ssimokawa# 53 as a week number (rather than 52 or 53) for those days in January that
241106813Ssimokawa# before the first Monday in January when a "%V" format is used and January 1
242106813Ssimokawa# falls on a Friday, Saturday, or Sunday.
243106813Ssimokawa
244106813SsimokawaCFLAGS=
245106813Ssimokawa
246106813Ssimokawa# Linker flags.  Default to $(LFLAGS) for backwards compatibility
247106813Ssimokawa# to release 2012h and earlier.
248106813Ssimokawa
249106813SsimokawaLDFLAGS=	$(LFLAGS)
250106813Ssimokawa
251106813Ssimokawa# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
252106813Ssimokawa# submake command lines.  The default is no leap seconds.
253106813Ssimokawa
254106813SsimokawaLEAPSECONDS=
255106813Ssimokawa
256106813Ssimokawa# The zic command and its arguments.
257106813Ssimokawa
258106813Ssimokawazic=		./zic
259106813SsimokawaZIC=		$(zic) $(ZFLAGS)
260106813Ssimokawa
261106813SsimokawaZFLAGS=
262106813Ssimokawa
263106813Ssimokawa# How to use zic to install tz binary files.
264106813Ssimokawa
265106813SsimokawaZIC_INSTALL=	$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
266106813Ssimokawa
267106813Ssimokawa# The name of a Posix-compliant 'awk' on your system.
268106813SsimokawaAWK=		awk
269106813Ssimokawa
270106813Ssimokawa# The full path name of a Posix-compliant shell, preferably one that supports
271106813Ssimokawa# the Korn shell's 'select' statement as an extension.
272106813Ssimokawa# These days, Bash is the most popular.
273106813Ssimokawa# It should be OK to set this to /bin/sh, on platforms where /bin/sh
274106813Ssimokawa# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
275106813Ssimokawa# is typically nicer if it works.
276106813SsimokawaKSHELL=		/bin/bash
277106813Ssimokawa
278106813Ssimokawa# The path where SGML DTDs are kept and the catalog file(s) to use when
279106813Ssimokawa# validating.  The default should work on both Debian and Red Hat.
280106813SsimokawaSGML_TOPDIR= /usr
281106813SsimokawaSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
282106813SsimokawaSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
283106813SsimokawaSGML_CATALOG_FILES= \
284106813Ssimokawa  $(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
285106813Ssimokawa
286106813Ssimokawa# The name, arguments and environment of a program to validate your web pages.
287106813Ssimokawa# See <http://openjade.sourceforge.net/doc/> for a validator, and
288106813Ssimokawa# <https://validator.w3.org/source/> for a validation library.
289106813SsimokawaVALIDATE = nsgmls
290106813SsimokawaVALIDATE_FLAGS = -s -B -wall -wno-unused-param
291109890SsimokawaVALIDATE_ENV = \
292106813Ssimokawa  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
293106813Ssimokawa  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
294106813Ssimokawa  SP_CHARSET_FIXED=YES \
295106813Ssimokawa  SP_ENCODING=UTF-8
296106813Ssimokawa
297106813Ssimokawa# This expensive test requires USE_LTZ.
298106813Ssimokawa# To suppress it, define this macro to be empty.
299106813SsimokawaCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
300106813Ssimokawa
301106813Ssimokawa# SAFE_CHAR is a regular expression that matches a safe character.
302106813Ssimokawa# Some parts of this distribution are limited to safe characters;
303106813Ssimokawa# others can use any UTF-8 character.
304106813Ssimokawa# For now, the safe characters are a safe subset of ASCII.
305106813Ssimokawa# The caller must set the shell variable 'sharp' to the character '#',
306106813Ssimokawa# since Makefile macros cannot contain '#'.
307106813Ssimokawa# TAB_CHAR is a single tab character, in single quotes.
308106813SsimokawaTAB_CHAR=	'	'
309106813SsimokawaSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
310106813SsimokawaSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
311106813SsimokawaSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
312106813SsimokawaSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
313106813SsimokawaSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
314106813Ssimokawa
315106813Ssimokawa# OK_CHAR matches any character allowed in the distributed files.
316106813Ssimokawa# This is the same as SAFE_CHAR, except that multibyte letters are
317106813Ssimokawa# also allowed so that commentary can contain people's names and quote
318106813Ssimokawa# non-English sources.  For non-letters the sources are limited to
319106813Ssimokawa# ASCII renderings for the convenience of maintainers whose text editors
320106813Ssimokawa# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
321106813SsimokawaOK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
322106813Ssimokawa
323106813Ssimokawa# SAFE_LINE matches a line of safe characters.
324106813Ssimokawa# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
325106813Ssimokawa# this is so that comments can contain non-ASCII characters.
326106813Ssimokawa# OK_LINE matches a line of OK characters.
327106813SsimokawaSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
328106813SsimokawaSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
329106813SsimokawaOK_LINE=	'^'$(OK_CHAR)'*$$'
330106813Ssimokawa
331106813Ssimokawa# Flags to give 'tar' when making a distribution.
332106813Ssimokawa# Try to use flags appropriate for GNU tar.
333106813SsimokawaGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
334106813SsimokawaTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
335106813Ssimokawa		 then echo $(GNUTARFLAGS); \
336106813Ssimokawa		 else :; \
337106813Ssimokawa		 fi`
338106813Ssimokawa
339106813Ssimokawa# Flags to give 'gzip' when making a distribution.
340106813SsimokawaGZIPFLAGS=	-9n
341106813Ssimokawa
342106813Ssimokawa###############################################################################
343106813Ssimokawa
344106813Ssimokawa#MAKE=		make
345106813Ssimokawa
346106813Ssimokawacc=		cc
347106813SsimokawaCC=		$(cc) -DTZDIR=\"$(TZDIR)\"
348106813Ssimokawa
349106813SsimokawaAR=		ar
350106813Ssimokawa
351106813Ssimokawa# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
352106813SsimokawaRANLIB=		:
353106813Ssimokawa
354109802SsimokawaTZCOBJS=	zic.o
355106813SsimokawaTZDOBJS=	zdump.o localtime.o asctime.o
356109802SsimokawaDATEOBJS=	date.o localtime.o strftime.o asctime.o
357109802SsimokawaLIBSRCS=	localtime.c asctime.c difftime.c
358109802SsimokawaLIBOBJS=	localtime.o asctime.o difftime.o
359106813SsimokawaHEADERS=	tzfile.h private.h
360109890SsimokawaNONLIBSRCS=	zic.c zdump.c
361106813SsimokawaNEWUCBSRCS=	date.c strftime.c
362109890SsimokawaSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
363106813Ssimokawa			tzselect.ksh workman.sh
364106813SsimokawaMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
365106813Ssimokawa			tzfile.5 tzselect.8 zic.8 zdump.8
366106813SsimokawaMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
367109890Ssimokawa			time2posix.3.txt \
368106813Ssimokawa			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
369106813Ssimokawa			date.1.txt
370106813SsimokawaCOMMON=		CONTRIBUTING LICENSE Makefile NEWS README Theory version
371106813SsimokawaWEB_PAGES=	tz-art.htm tz-how-to.html tz-link.htm
372106813SsimokawaDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
373106813SsimokawaPRIMARY_YDATA=	africa antarctica asia australasia \
374106813Ssimokawa		europe northamerica southamerica
375106813SsimokawaYDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
376106813SsimokawaNDATA=		systemv factory
377106813SsimokawaTDATA=		$(YDATA) $(NDATA)
378106813SsimokawaZONETABLES=	zone1970.tab zone.tab
379106813SsimokawaTABDATA=	iso3166.tab leapseconds $(ZONETABLES)
380106813SsimokawaLEAP_DEPS=	leapseconds.awk leap-seconds.list
381106813SsimokawaDATA=		$(YDATA) $(NDATA) backzone $(TABDATA) \
382106813Ssimokawa			leap-seconds.list yearistype.sh
383106813SsimokawaAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
384106813SsimokawaMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
385106813SsimokawaTZS_YEAR=	2050
386106813SsimokawaTZS=		to$(TZS_YEAR).tzs
387106813SsimokawaTZS_NEW=	to$(TZS_YEAR)new.tzs
388106813SsimokawaTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
389106813Ssimokawa			private.h tzfile.h zdump.c zic.c
390106813SsimokawaENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS)
391106813Ssimokawa
392106813Ssimokawa# Consult these files when deciding whether to rebuild the 'version' file.
393106813Ssimokawa# This list is not the same as the output of 'git ls-files', since
394109802Ssimokawa# .gitignore is not distributed.
395109802SsimokawaVERSION_DEPS= \
396109802Ssimokawa		CONTRIBUTING LICENSE Makefile NEWS README Theory \
397106813Ssimokawa		africa antarctica asctime.c asia australasia \
398106813Ssimokawa		backward backzone \
399106813Ssimokawa		checklinks.awk checktab.awk \
400106813Ssimokawa		date.1 date.c difftime.c \
401106813Ssimokawa		etcetera europe factory iso3166.tab \
402106813Ssimokawa		leap-seconds.list leapseconds.awk localtime.c \
403106813Ssimokawa		newctime.3 newstrftime.3 newtzset.3 northamerica \
404106813Ssimokawa		pacificnew private.h \
405106813Ssimokawa		southamerica strftime.c systemv \
406106813Ssimokawa		time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \
407106813Ssimokawa		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
408106813Ssimokawa		workman.sh yearistype.sh \
409106813Ssimokawa		zdump.8 zdump.c zic.8 zic.c \
410106813Ssimokawa		zone.tab zone1970.tab zoneinfo2tdf.pl
411106813Ssimokawa
412106813Ssimokawa# And for the benefit of csh users on systems that assume the user
413106813Ssimokawa# shell should be used to handle commands in Makefiles. . .
414106813Ssimokawa
415106813SsimokawaSHELL=		/bin/sh
416106813Ssimokawa
417106813Ssimokawaall:		tzselect yearistype zic zdump libtz.a $(TABDATA)
418106813Ssimokawa
419106813SsimokawaALL:		all date $(ENCHILADA)
420106813Ssimokawa
421109179Ssimokawainstall:	all $(DATA) $(REDO) $(MANS)
422106813Ssimokawa		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
423106813Ssimokawa			$(DESTDIR)$(LIBDIR) \
424109179Ssimokawa			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
425106813Ssimokawa			$(DESTDIR)$(MANDIR)/man8
426106813Ssimokawa		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES)
427106813Ssimokawa		cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
428106813Ssimokawa		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
429106813Ssimokawa		cp libtz.a $(DESTDIR)$(LIBDIR)/.
430106813Ssimokawa		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
431106813Ssimokawa		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
432106813Ssimokawa		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
433106813Ssimokawa		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
434106813Ssimokawa
435106813SsimokawaINSTALL:	ALL install date.1
436106813Ssimokawa		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
437106813Ssimokawa		cp date $(DESTDIR)$(BINDIR)/.
438106813Ssimokawa		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
439106813Ssimokawa
440106813Ssimokawaversion:	$(VERSION_DEPS)
441106813Ssimokawa		{ (type git) >/dev/null 2>&1 && \
442106813Ssimokawa		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
443106813Ssimokawa				--abbrev=7 --dirty` || \
444109802Ssimokawa		  V=$(VERSION); } && \
445106813Ssimokawa		printf '%s\n' "$$V" >$@.out
446106813Ssimokawa		mv $@.out $@
447106813Ssimokawa
448106813Ssimokawaversion.h:	version
449106813Ssimokawa		VERSION=`cat version` && printf '%s\n' \
450106813Ssimokawa		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
451106813Ssimokawa		  "static char const TZVERSION[]=\"$$VERSION\";" \
452106813Ssimokawa		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
453106813Ssimokawa		  >$@.out
454106813Ssimokawa		mv $@.out $@
455106813Ssimokawa
456106813Ssimokawazdump:		$(TZDOBJS)
457106813Ssimokawa		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
458106813Ssimokawa
459106813Ssimokawazic:		$(TZCOBJS)
460106813Ssimokawa		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
461106813Ssimokawa
462106813Ssimokawayearistype:	yearistype.sh
463106813Ssimokawa		cp yearistype.sh yearistype
464106813Ssimokawa		chmod +x yearistype
465106813Ssimokawa
466106813Ssimokawaleapseconds:	$(LEAP_DEPS)
467106813Ssimokawa		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
468106813Ssimokawa		mv $@.out $@
469106813Ssimokawa
470106813Ssimokawa# Arguments to pass to submakes of install_data.
471106813Ssimokawa# They can be overridden by later submake arguments.
472106813SsimokawaINSTALLARGS = \
473106813Ssimokawa DESTDIR=$(DESTDIR) \
474106813Ssimokawa LEAPSECONDS='$(LEAPSECONDS)' \
475106813Ssimokawa PACKRATDATA='$(PACKRATDATA)' \
476106813Ssimokawa TZDIR=$(TZDIR) \
477106813Ssimokawa YEARISTYPE=$(YEARISTYPE) \
478106813Ssimokawa ZIC='$(ZIC)'
479106813Ssimokawa
480106813Ssimokawa# 'make install_data' installs one set of tz binary files.
481106813Ssimokawa# It can be tailored by setting LEAPSECONDS, PACKRATDATA, etc.
482106813Ssimokawainstall_data:	zic leapseconds yearistype $(PACKRATDATA) $(TDATA)
483106813Ssimokawa		$(ZIC_INSTALL) $(TDATA)
484106813Ssimokawa		$(AWK) '/^Rule/' $(TDATA) | $(ZIC_INSTALL) - $(PACKRATDATA)
485106813Ssimokawa
486106813Ssimokawaposix_only:
487106813Ssimokawa		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
488106813Ssimokawa
489106813Ssimokawaright_only:
490106813Ssimokawa		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
491106813Ssimokawa			install_data
492106813Ssimokawa
493106813Ssimokawa# In earlier versions of this makefile, the other two directories were
494106813Ssimokawa# subdirectories of $(TZDIR).  However, this led to configuration errors.
495106813Ssimokawa# For example, with posix_right under the earlier scheme,
496106813Ssimokawa# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
497106813Ssimokawa# but gmtime without leap seconds, which led to problems with applications
498106813Ssimokawa# like sendmail that subtract gmtime from localtime.
499106813Ssimokawa# Therefore, the other two directories are now siblings of $(TZDIR).
500106813Ssimokawa# You must replace all of $(TZDIR) to switch from not using leap seconds
501106813Ssimokawa# to using them, or vice versa.
502106813Ssimokawaright_posix:	right_only
503106813Ssimokawa		rm -fr $(DESTDIR)$(TZDIR)-leaps
504106813Ssimokawa		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
505106813Ssimokawa		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
506106813Ssimokawa		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
507106813Ssimokawa
508106813Ssimokawaposix_right:	posix_only
509106813Ssimokawa		rm -fr $(DESTDIR)$(TZDIR)-posix
510106813Ssimokawa		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
511106813Ssimokawa		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
512106813Ssimokawa		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
513106813Ssimokawa
514106813Ssimokawa# This obsolescent rule is present for backwards compatibility with
515106813Ssimokawa# tz releases 2014g through 2015g.  It should go away eventually.
516106813Ssimokawaposix_packrat:
517106813Ssimokawa		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
518109814Ssimokawa
519106813Ssimokawazones:		$(REDO)
520106813Ssimokawa
521106813Ssimokawa$(TZS_NEW):	$(TDATA) zdump zic
522106813Ssimokawa		mkdir -p tzs.dir
523106813Ssimokawa		$(zic) -d tzs.dir $(TDATA)
524106813Ssimokawa		$(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \
525106813Ssimokawa		   $(TDATA) | LC_ALL=C sort >$@.out
526106813Ssimokawa		wd=`pwd` && \
527106813Ssimokawa		zones=`$(AWK) -v wd="$$wd" \
528106813Ssimokawa				'/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \
529106813Ssimokawa			 | LC_ALL=C sort` && \
530106813Ssimokawa		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
531106813Ssimokawa		sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out
532106813Ssimokawa		rm -fr tzs.dir $@.out
533106813Ssimokawa		mv $@.sed.out $@
534106813Ssimokawa
535106813Ssimokawa# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
536106813Ssimokawa# If it exists but 'make check_tzs' fails, a maintainer should inspect the
537106813Ssimokawa# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
538106813Ssimokawa$(TZS):
539106813Ssimokawa		$(MAKE) force_tzs
540106813Ssimokawa
541106813Ssimokawaforce_tzs:	$(TZS_NEW)
542106813Ssimokawa		cp $(TZS_NEW) $(TZS)
543106813Ssimokawa
544106813Ssimokawalibtz.a:	$(LIBOBJS)
545106813Ssimokawa		$(AR) ru $@ $(LIBOBJS)
546106813Ssimokawa		$(RANLIB) $@
547106813Ssimokawa
548106813Ssimokawadate:		$(DATEOBJS)
549106813Ssimokawa		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
550106813Ssimokawa
551106813Ssimokawatzselect:	tzselect.ksh version
552106813Ssimokawa		VERSION=`cat version` && sed \
553106813Ssimokawa			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
554106813Ssimokawa			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
555106813Ssimokawa			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
556106813Ssimokawa			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
557109802Ssimokawa			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
558106813Ssimokawa			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
559106813Ssimokawa			<$@.ksh >$@.out
560106813Ssimokawa		chmod +x $@.out
561106813Ssimokawa		mv $@.out $@
562106813Ssimokawa
563106813Ssimokawacheck:		check_character_set check_white_space check_links check_sorted \
564106813Ssimokawa		  check_tables check_tzs check_web
565109282Ssimokawa
566109282Ssimokawacheck_character_set: $(ENCHILADA)
567109282Ssimokawa		LC_ALL=en_US.utf8 && export LC_ALL && \
568109282Ssimokawa		sharp='#' && \
569109282Ssimokawa		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
570106813Ssimokawa			$(MISC) $(SOURCES) $(WEB_PAGES) \
571106813Ssimokawa			CONTRIBUTING LICENSE Makefile README version && \
572106813Ssimokawa		! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
573106813Ssimokawa			leapseconds yearistype.sh zone.tab && \
574106813Ssimokawa		! grep -Env $(OK_LINE) $(ENCHILADA)
575106813Ssimokawa
576109282Ssimokawacheck_white_space: $(ENCHILADA)
577106813Ssimokawa		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
578106813Ssimokawa		! grep -En "$$pat" $(ENCHILADA)
579106813Ssimokawa		! grep -n '[[:space:]]$$' $(ENCHILADA)
580106813Ssimokawa
581106813SsimokawaCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
582106813Ssimokawa
583106813Ssimokawacheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
584106813Ssimokawa		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
585106813Ssimokawa		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
586106813Ssimokawa		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
587109179Ssimokawa		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
588106813Ssimokawa		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
589109424Ssimokawa		  LC_ALL=C sort -c
590106813Ssimokawa		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
591106813Ssimokawa		  LC_ALL=C sort -cu
592106813Ssimokawa
593109179Ssimokawacheck_links:	checklinks.awk $(TDATA)
594106813Ssimokawa		$(AWK) -f checklinks.awk $(TDATA)
595109424Ssimokawa
596106813Ssimokawacheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
597106813Ssimokawa		for tab in $(ZONETABLES); do \
598106813Ssimokawa		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
599106813Ssimokawa		    || exit; \
600109802Ssimokawa		done
601106813Ssimokawa
602106813Ssimokawacheck_tzs:	$(TZS) $(TZS_NEW)
603106813Ssimokawa		diff -u $(TZS) $(TZS_NEW)
604106813Ssimokawa
605106813Ssimokawacheck_web:	$(WEB_PAGES)
606106813Ssimokawa		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
607106813Ssimokawa
608106813Ssimokawaclean_misc:
609106813Ssimokawa		rm -f core *.o *.out \
610106813Ssimokawa		  date tzselect version.h zdump zic yearistype libtz.a
611106813Ssimokawaclean:		clean_misc
612106813Ssimokawa		rm -fr *.dir tzdb-*/ $(TZS_NEW)
613106813Ssimokawa
614106813Ssimokawamaintainer-clean: clean
615106813Ssimokawa		@echo 'This command is intended for maintainers to use; it'
616106813Ssimokawa		@echo 'deletes files that may need special tools to rebuild.'
617106813Ssimokawa		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
618106813Ssimokawa
619106813Ssimokawanames:
620106813Ssimokawa		@echo $(ENCHILADA)
621106813Ssimokawa
622109424Ssimokawapublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
623106813Ssimokawa		tarballs signatures
624106813Ssimokawa
625106813Ssimokawadate.1.txt:	date.1
626106813Ssimokawanewctime.3.txt:	newctime.3
627109424Ssimokawanewstrftime.3.txt: newstrftime.3
628106813Ssimokawanewtzset.3.txt:	newtzset.3
629106813Ssimokawatime2posix.3.txt: time2posix.3
630106813Ssimokawatzfile.5.txt:	tzfile.5
631106813Ssimokawatzselect.8.txt:	tzselect.8
632106813Ssimokawazdump.8.txt:	zdump.8
633109403Ssimokawazic.8.txt:	zic.8
634109403Ssimokawa
635106813Ssimokawa$(MANTXTS):	workman.sh
636109424Ssimokawa		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
637106813Ssimokawa		mv $@.out $@
638106813Ssimokawa
639106813Ssimokawa# Set the time stamps to those of the git repository, if available,
640106813Ssimokawa# and if the files have not changed since then.
641106813Ssimokawa# This uses GNU 'touch' syntax 'touch -d@N FILE',
642106813Ssimokawa# where N is the number of seconds since 1970.
643106813Ssimokawa# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
644106813Ssimokawa# Also, set the timestamp of each prebuilt file like 'leapseconds'
645106813Ssimokawa# to be the maximum of the files it depends on.
646106813Ssimokawaset-timestamps.out: $(ENCHILADA)
647109403Ssimokawa		rm -f $@
648109403Ssimokawa		if (type git) >/dev/null 2>&1 && \
649106813Ssimokawa		   files=`git ls-files $(ENCHILADA)` && \
650109424Ssimokawa		   touch -md @1 test.out; then \
651106813Ssimokawa		  rm -f test.out && \
652106813Ssimokawa		  for file in $$files; do \
653106813Ssimokawa		    if git diff --quiet $$file; then \
654106813Ssimokawa		      time=`git log -1 --format='tformat:%ct' $$file` && \
655106813Ssimokawa		      touch -cmd @$$time $$file; \
656106813Ssimokawa		    else \
657106813Ssimokawa		      echo >&2 "$$file: warning: does not match repository"; \
658106813Ssimokawa		    fi || exit; \
659106813Ssimokawa		  done; \
660106813Ssimokawa		fi
661106813Ssimokawa		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
662106813Ssimokawa		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
663106813Ssimokawa		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
664106813Ssimokawa		    exit; \
665106813Ssimokawa		done
666106813Ssimokawa		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
667106813Ssimokawa		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
668106813Ssimokawa		touch $@
669106813Ssimokawa
670106813Ssimokawa# The zics below ensure that each data file can stand on its own.
671109890Ssimokawa# We also do an all-files run to catch links to links.
672109890Ssimokawa
673109890Ssimokawacheck_public:
674106813Ssimokawa		$(MAKE) maintainer-clean
675106813Ssimokawa		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
676106813Ssimokawa		mkdir -p public.dir
677109179Ssimokawa		for i in $(TDATA) ; do \
678109890Ssimokawa		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
679106813Ssimokawa		done
680106813Ssimokawa		$(zic) -v -d public.dir $(TDATA)
681106813Ssimokawa		rm -fr public.dir
682109890Ssimokawa
683106813Ssimokawa# Check that the code works under various alternative
684106813Ssimokawa# implementations of time_t.
685106813Ssimokawacheck_time_t_alternatives:
686106813Ssimokawa		if diff -q Makefile Makefile 2>/dev/null; then \
687109890Ssimokawa		  quiet_option='-q'; \
688106813Ssimokawa		else \
689106813Ssimokawa		  quiet_option=''; \
690106813Ssimokawa		fi && \
691106813Ssimokawa		wd=`pwd` && \
692106813Ssimokawa		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
693106813Ssimokawa		for type in $(TIME_T_ALTERNATIVES); do \
694106813Ssimokawa		  mkdir -p time_t.dir/$$type && \
695106813Ssimokawa		  $(MAKE) clean_misc && \
696106813Ssimokawa		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
697106813Ssimokawa		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
698106813Ssimokawa		    REDO='$(REDO)' \
699106813Ssimokawa		    install && \
700106813Ssimokawa		  diff $$quiet_option -r \
701106813Ssimokawa		    time_t.dir/int64_t/etc/zoneinfo \
702106813Ssimokawa		    time_t.dir/$$type/etc/zoneinfo && \
703106813Ssimokawa		  case $$type in \
704106813Ssimokawa		  int32_t) range=-2147483648,2147483647;; \
705106813Ssimokawa		  uint32_t) range=0,4294967296;; \
706106813Ssimokawa		  int64_t) continue;; \
707106813Ssimokawa		  *u*) range=0,10000000000;; \
708106813Ssimokawa		  *) range=-10000000000,10000000000;; \
709106813Ssimokawa		  esac && \
710106813Ssimokawa		  echo checking $$type zones ... && \
711106813Ssimokawa		  time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \
712106813Ssimokawa		      >time_t.dir/int64_t.out && \
713106813Ssimokawa		  time_t.dir/$$type/etc/zdump -V -t $$range $$zones \
714106813Ssimokawa		      >time_t.dir/$$type.out && \
715106813Ssimokawa		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
716106813Ssimokawa		    || exit; \
717106813Ssimokawa		done
718106813Ssimokawa		rm -fr time_t.dir
719106813Ssimokawa
720106813Ssimokawatarballs traditional_tarballs signatures traditional_signatures: version
721106813Ssimokawa		VERSION=`cat version` && \
722106813Ssimokawa		$(MAKE) VERSION="$$VERSION" $@_version
723106813Ssimokawa
724106813Ssimokawatarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
725106813Ssimokawatraditional_tarballs_version: \
726106813Ssimokawa  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
727106813Ssimokawasignatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
728106813Ssimokawatraditional_signatures_version: \
729106813Ssimokawa  tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
730106813Ssimokawa
731106813Ssimokawatzcode$(VERSION).tar.gz: set-timestamps.out
732106813Ssimokawa		LC_ALL=C && export LC_ALL && \
733106813Ssimokawa		tar $(TARFLAGS) -cf - \
734106813Ssimokawa		    $(COMMON) $(DOCS) $(SOURCES) | \
735106813Ssimokawa		  gzip $(GZIPFLAGS) >$@.out
736106813Ssimokawa		mv $@.out $@
737106813Ssimokawa
738106813Ssimokawatzdata$(VERSION).tar.gz: set-timestamps.out
739106813Ssimokawa		LC_ALL=C && export LC_ALL && \
740108782Ssimokawa		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
741108782Ssimokawa		  gzip $(GZIPFLAGS) >$@.out
742106813Ssimokawa		mv $@.out $@
743106813Ssimokawa
744106813Ssimokawatzdb-$(VERSION).tar.lz: set-timestamps.out
745106813Ssimokawa		rm -fr tzdb-$(VERSION)
746106813Ssimokawa		mkdir tzdb-$(VERSION)
747106813Ssimokawa		ln $(ENCHILADA) tzdb-$(VERSION)
748106813Ssimokawa		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
749106813Ssimokawa		LC_ALL=C && export LC_ALL && \
750106813Ssimokawa		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
751106813Ssimokawa		mv $@.out $@
752106813Ssimokawa
753106813Ssimokawatzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
754106813Ssimokawa		gpg --armor --detach-sign $?
755106813Ssimokawa
756106813Ssimokawatzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
757106813Ssimokawa		gpg --armor --detach-sign $?
758106813Ssimokawa
759106813Ssimokawatzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
760106813Ssimokawa		gpg --armor --detach-sign $?
761106813Ssimokawa
762106813Ssimokawatypecheck:
763106813Ssimokawa		$(MAKE) clean
764106813Ssimokawa		for i in "long long" unsigned; \
765106813Ssimokawa		do \
766106813Ssimokawa			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
767106813Ssimokawa			./zdump -v Europe/Rome ; \
768106813Ssimokawa			$(MAKE) clean ; \
769106813Ssimokawa		done
770106813Ssimokawa
771106813Ssimokawazonenames:	$(TDATA)
772106813Ssimokawa		@$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
773106813Ssimokawa
774106813Ssimokawaasctime.o:	private.h tzfile.h
775106813Ssimokawadate.o:		private.h
776106813Ssimokawadifftime.o:	private.h
777106813Ssimokawalocaltime.o:	private.h tzfile.h
778106813Ssimokawastrftime.o:	private.h tzfile.h
779106813Ssimokawazdump.o:	version.h
780106813Ssimokawazic.o:		private.h tzfile.h version.h
781106813Ssimokawa
782106813Ssimokawa.KEEP_STATE:
783106813Ssimokawa
784106813Ssimokawa.PHONY: ALL INSTALL all
785106813Ssimokawa.PHONY: check check_character_set check_links
786106813Ssimokawa.PHONY: check_public check_sorted check_tables
787106813Ssimokawa.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
788106813Ssimokawa.PHONY: clean clean_misc force_tzs
789106813Ssimokawa.PHONY: install install_data maintainer-clean names
790106813Ssimokawa.PHONY: posix_only posix_packrat posix_right
791106813Ssimokawa.PHONY: public right_only right_posix signatures signatures_version
792106813Ssimokawa.PHONY: tarballs tarballs_version typecheck
793106813Ssimokawa.PHONY: zonenames zones
794106813Ssimokawa