xref: /minix3/lib/libc/time/Makefile (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
12fe8fb19SBen Gras# This file is in the public domain, so clarified as of
22fe8fb19SBen Gras# 2009-05-17 by Arthur David Olson.
32fe8fb19SBen Gras
484d9c625SLionel Sambuc# Package name for the code distribution.
584d9c625SLionel SambucPACKAGE=	tzcode
684d9c625SLionel Sambuc
7f14fb602SLionel Sambuc# Version numbers of the code and data distributions.
8*0a6a1f1dSLionel SambucVERSION=	2015g
984d9c625SLionel Sambuc
1084d9c625SLionel Sambuc# Email address for bug reports.
1184d9c625SLionel SambucBUGEMAIL=	tz@iana.org
12f14fb602SLionel Sambuc
132fe8fb19SBen Gras# Change the line below for your time zone (after finding the zone you want in
142fe8fb19SBen Gras# the time zone files, or adding it to a time zone file).
152fe8fb19SBen Gras# Alternately, if you discover you've got the wrong time zone, you can just
162fe8fb19SBen Gras#	zic -l rightzone
172fe8fb19SBen Gras# to correct things.
182fe8fb19SBen Gras# Use the command
192fe8fb19SBen Gras#	make zonenames
202fe8fb19SBen Gras# to get a list of the values you can use for LOCALTIME.
212fe8fb19SBen Gras
22f14fb602SLionel SambucLOCALTIME=	GMT
232fe8fb19SBen Gras
242fe8fb19SBen Gras# If you want something other than Eastern United States time as a template
252fe8fb19SBen Gras# for handling POSIX-style time zone environment variables,
262fe8fb19SBen Gras# change the line below (after finding the zone you want in the
272fe8fb19SBen Gras# time zone files, or adding it to a time zone file).
282fe8fb19SBen Gras# (When a POSIX-style environment variable is handled, the rules in the
292fe8fb19SBen Gras# template file are used to determine "spring forward" and "fall back" days and
3084d9c625SLionel Sambuc# times; the environment variable itself specifies UT offsets of standard and
312fe8fb19SBen Gras# summer time.)
322fe8fb19SBen Gras# Alternately, if you discover you've got the wrong time zone, you can just
332fe8fb19SBen Gras#	zic -p rightzone
342fe8fb19SBen Gras# to correct things.
352fe8fb19SBen Gras# Use the command
362fe8fb19SBen Gras#	make zonenames
372fe8fb19SBen Gras# to get a list of the values you can use for POSIXRULES.
382fe8fb19SBen Gras# If you want POSIX compatibility, use "America/New_York".
392fe8fb19SBen Gras
402fe8fb19SBen GrasPOSIXRULES=	America/New_York
412fe8fb19SBen Gras
422fe8fb19SBen Gras# Also see TZDEFRULESTRING below, which takes effect only
432fe8fb19SBen Gras# if the time zone files cannot be accessed.
442fe8fb19SBen Gras
452fe8fb19SBen Gras# Everything gets put in subdirectories of. . .
462fe8fb19SBen Gras
472fe8fb19SBen GrasTOPDIR=		/usr/local
482fe8fb19SBen Gras
492fe8fb19SBen Gras# "Compiled" time zone information is placed in the "TZDIR" directory
502fe8fb19SBen Gras# (and subdirectories).
512fe8fb19SBen Gras# Use an absolute path name for TZDIR unless you're just testing the software.
522fe8fb19SBen Gras
5384d9c625SLionel SambucTZDIR_BASENAME=	zoneinfo
5484d9c625SLionel SambucTZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
5584d9c625SLionel Sambuc
5684d9c625SLionel Sambuc# Types to try, as an alternative to time_t.  int64_t should be first.
5784d9c625SLionel SambucTIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
582fe8fb19SBen Gras
592fe8fb19SBen Gras# The "tzselect", "zic", and "zdump" commands get installed in. . .
602fe8fb19SBen Gras
612fe8fb19SBen GrasETCDIR=		$(TOPDIR)/etc
622fe8fb19SBen Gras
632fe8fb19SBen Gras# If you "make INSTALL", the "date" command gets installed in. . .
642fe8fb19SBen Gras
652fe8fb19SBen GrasBINDIR=		$(TOPDIR)/bin
662fe8fb19SBen Gras
672fe8fb19SBen Gras# Manual pages go in subdirectories of. . .
682fe8fb19SBen Gras
692fe8fb19SBen GrasMANDIR=		$(TOPDIR)/man
702fe8fb19SBen Gras
712fe8fb19SBen Gras# Library functions are put in an archive in LIBDIR.
722fe8fb19SBen Gras
732fe8fb19SBen GrasLIBDIR=		$(TOPDIR)/lib
742fe8fb19SBen Gras
752fe8fb19SBen Gras# If you always want time values interpreted as "seconds since the epoch
762fe8fb19SBen Gras# (not counting leap seconds)", use
772fe8fb19SBen Gras#	REDO=		posix_only
782fe8fb19SBen Gras# below.  If you always want right time values interpreted as "seconds since
792fe8fb19SBen Gras# the epoch" (counting leap seconds)", use
802fe8fb19SBen Gras#	REDO=		right_only
812fe8fb19SBen Gras# below.  If you want both sets of data available, with leap seconds not
822fe8fb19SBen Gras# counted normally, use
832fe8fb19SBen Gras#	REDO=		posix_right
842fe8fb19SBen Gras# below.  If you want both sets of data available, with leap seconds counted
852fe8fb19SBen Gras# normally, use
862fe8fb19SBen Gras#	REDO=		right_posix
87*0a6a1f1dSLionel Sambuc# below.  If you want just POSIX-compatible time values, but with
88*0a6a1f1dSLionel Sambuc# out-of-scope and often-wrong data from the file 'backzone', use
89*0a6a1f1dSLionel Sambuc#	REDO=		posix_packrat
902fe8fb19SBen Gras# POSIX mandates that leap seconds not be counted; for compatibility with it,
91*0a6a1f1dSLionel Sambuc# use "posix_only", "posix_right", or "posix_packrat".
922fe8fb19SBen Gras
932fe8fb19SBen GrasREDO=		posix_right
942fe8fb19SBen Gras
952fe8fb19SBen Gras# Since "." may not be in PATH...
962fe8fb19SBen Gras
972fe8fb19SBen GrasYEARISTYPE=	./yearistype
982fe8fb19SBen Gras
992fe8fb19SBen Gras# Non-default libraries needed to link.
100*0a6a1f1dSLionel Sambuc# Add -lintl if you want to use 'gettext' on Solaris.
1012fe8fb19SBen GrasLDLIBS=
1022fe8fb19SBen Gras
1032fe8fb19SBen Gras# Add the following to the end of the "CFLAGS=" line as needed.
104*0a6a1f1dSLionel Sambuc#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
10584d9c625SLionel Sambuc#  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
106*0a6a1f1dSLionel Sambuc#  -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
1072fe8fb19SBen Gras#  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
1082fe8fb19SBen Gras#	ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
10984d9c625SLionel Sambuc#  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
110*0a6a1f1dSLionel Sambuc#  -DHAVE_LINK=0 if your system lacks a link function
111*0a6a1f1dSLionel Sambuc#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
112*0a6a1f1dSLionel Sambuc#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
113*0a6a1f1dSLionel Sambuc#	This defaults to 1 if a working localtime_rz seems to be available.
114*0a6a1f1dSLionel Sambuc#	localtime_rz can make zdump significantly faster, but is nonstandard.
1152fe8fb19SBen Gras#  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
116*0a6a1f1dSLionel Sambuc#  -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
117*0a6a1f1dSLionel Sambuc#	This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
118*0a6a1f1dSLionel Sambuc#  -DHAVE_STRDUP=0 if your system lacks the strdup function
1192fe8fb19SBen Gras#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
1202fe8fb19SBen Gras#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
1212fe8fb19SBen Gras#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
122*0a6a1f1dSLionel Sambuc#  -DHAVE_TZSET=0 if your system lacks a tzset function
1232fe8fb19SBen Gras#  -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
1242fe8fb19SBen Gras#  -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
1252fe8fb19SBen Gras#	if you do not want run time warnings about formats that may cause
1262fe8fb19SBen Gras#	year 2000 grief
127*0a6a1f1dSLionel Sambuc#  -Dssize_t=long on ancient hosts that lack ssize_t
128*0a6a1f1dSLionel Sambuc#  -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
129*0a6a1f1dSLionel Sambuc#	not needed by the main-program tz code, which is single-threaded.
130*0a6a1f1dSLionel Sambuc#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
13184d9c625SLionel Sambuc#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
13284d9c625SLionel Sambuc#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
133*0a6a1f1dSLionel Sambuc#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
13484d9c625SLionel Sambuc#	the default is system-supplied, typically "/usr/lib/locale"
13584d9c625SLionel Sambuc#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
136*0a6a1f1dSLionel Sambuc#  -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems
137*0a6a1f1dSLionel Sambuc#	other than simply getting garbage data
138*0a6a1f1dSLionel Sambuc#  -DUSE_LTZ=0 to build zdump with the system time zone library
139*0a6a1f1dSLionel Sambuc#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
140f14fb602SLionel Sambuc#  -DNO_ERROR_IN_DST_GAP=1
141f14fb602SLionel Sambuc#	if you want mktime() not to return an error in the DST gap.
1422fe8fb19SBen Gras#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
1432fe8fb19SBen Gras#	(or some other number) to set the maximum time zone abbreviation length
1442fe8fb19SBen Gras#	that zic will accept without a warning (the default is 6)
145*0a6a1f1dSLionel Sambuc#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
14684d9c625SLionel SambucGCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
14784d9c625SLionel Sambuc	-Wall -Wextra \
148*0a6a1f1dSLionel Sambuc	-Wbad-function-cast -Wcast-align -Wdate-time \
149*0a6a1f1dSLionel Sambuc	-Wdeclaration-after-statement \
150*0a6a1f1dSLionel Sambuc	-Wdouble-promotion \
151*0a6a1f1dSLionel Sambuc	-Wformat=2 -Winit-self -Wjump-misses-init \
152*0a6a1f1dSLionel Sambuc	-Wlogical-op -Wmissing-prototypes -Wnested-externs \
153*0a6a1f1dSLionel Sambuc	-Wold-style-definition -Woverlength-strings -Wpointer-arith \
15484d9c625SLionel Sambuc	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
155*0a6a1f1dSLionel Sambuc	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
156*0a6a1f1dSLionel Sambuc	-Wsuggest-attribute=pure -Wtrampolines \
157*0a6a1f1dSLionel Sambuc	-Wunused -Wwrite-strings \
158*0a6a1f1dSLionel Sambuc	-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
159*0a6a1f1dSLionel Sambuc	-Wno-type-limits -Wno-unused-parameter
1602fe8fb19SBen Gras#
1612fe8fb19SBen Gras# If you want to use System V compatibility code, add
1622fe8fb19SBen Gras#	-DUSG_COMPAT
1632fe8fb19SBen Gras# to the end of the "CFLAGS=" line.  This arrange for "timezone" and "daylight"
1642fe8fb19SBen Gras# variables to be kept up-to-date by the time conversion functions.  Neither
1652fe8fb19SBen Gras# "timezone" nor "daylight" is described in X3J11's work.
1662fe8fb19SBen Gras#
1672fe8fb19SBen Gras# If your system has a "GMT offset" field in its "struct tm"s
1682fe8fb19SBen Gras# (or if you decide to add such a field in your system's "time.h" file),
1692fe8fb19SBen Gras# add the name to a define such as
1702fe8fb19SBen Gras#	-DTM_GMTOFF=tm_gmtoff
171*0a6a1f1dSLionel Sambuc# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
172*0a6a1f1dSLionel Sambuc# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
173*0a6a1f1dSLionel Sambuc# Similarly, if your system has a "zone abbreviation" field, define
1742fe8fb19SBen Gras#	-DTM_ZONE=tm_zone
175*0a6a1f1dSLionel Sambuc# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
176*0a6a1f1dSLionel Sambuc# required by POSIX, but are widely available on GNU/Linux and BSD systems.
1772fe8fb19SBen Gras#
1782fe8fb19SBen Gras# If you want functions that were inspired by early versions of X3J11's work,
1792fe8fb19SBen Gras# add
1802fe8fb19SBen Gras#	-DSTD_INSPIRED
1812fe8fb19SBen Gras# to the end of the "CFLAGS=" line.  This arranges for the functions
1822fe8fb19SBen Gras# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
1832fe8fb19SBen Gras# "posix2time", and "time2posix" to be added to the time conversion library.
1842fe8fb19SBen Gras# "tzsetwall" is like "tzset" except that it arranges for local wall clock
1852fe8fb19SBen Gras# time (rather than the time specified in the TZ environment variable)
1862fe8fb19SBen Gras# to be used.
1872fe8fb19SBen Gras# "offtime" is like "gmtime" except that it accepts a second (long) argument
1882fe8fb19SBen Gras# that gives an offset to add to the time_t when converting it.
1892fe8fb19SBen Gras# "timelocal" is equivalent to "mktime".
1902fe8fb19SBen Gras# "timegm" is like "timelocal" except that it turns a struct tm into
19184d9c625SLionel Sambuc# a time_t using UT (rather than local time as "timelocal" does).
1922fe8fb19SBen Gras# "timeoff" is like "timegm" except that it accepts a second (long) argument
1932fe8fb19SBen Gras# that gives an offset to use when converting to a time_t.
1942fe8fb19SBen Gras# "posix2time" and "time2posix" are described in an included manual page.
1952fe8fb19SBen Gras# X3J11's work does not describe any of these functions.
1962fe8fb19SBen Gras# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
1972fe8fb19SBen Gras# These functions may well disappear in future releases of the time
1982fe8fb19SBen Gras# conversion package.
1992fe8fb19SBen Gras#
200*0a6a1f1dSLionel Sambuc# If you don't want functions that were inspired by NetBSD, add
201*0a6a1f1dSLionel Sambuc#	-DNETBSD_INSPIRED=0
202*0a6a1f1dSLionel Sambuc# to the end of the "CFLAGS=" line.  Otherwise, the functions
203*0a6a1f1dSLionel Sambuc# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
204*0a6a1f1dSLionel Sambuc# time library, and if STD_INSPIRED is also defined the functions
205*0a6a1f1dSLionel Sambuc# "posix2time_z" and "time2posix_z" are added as well.
206*0a6a1f1dSLionel Sambuc# The functions ending in "_z" (or "_rz") are like their unsuffixed
207*0a6a1f1dSLionel Sambuc# (or suffixed-by-"_r") counterparts, except with an extra first
208*0a6a1f1dSLionel Sambuc# argument of opaque type timezone_t that specifies the time zone.
209*0a6a1f1dSLionel Sambuc# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
2102fe8fb19SBen Gras#
2112fe8fb19SBen Gras# If you want to allocate state structures in localtime, add
2122fe8fb19SBen Gras#	-DALL_STATE
2132fe8fb19SBen Gras# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
2142fe8fb19SBen Gras#
2152fe8fb19SBen Gras# If you want an "altzone" variable (a la System V Release 3.1), add
2162fe8fb19SBen Gras#	-DALTZONE
2172fe8fb19SBen Gras# to the end of the "CFLAGS=" line.
2182fe8fb19SBen Gras# This variable is not described in X3J11's work.
2192fe8fb19SBen Gras#
2202fe8fb19SBen Gras# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
2212fe8fb19SBen Gras# out by the National Institute of Standards and Technology
2222fe8fb19SBen Gras# which claims to test C and Posix conformance.  If you want to pass PCTS, add
2232fe8fb19SBen Gras#	-DPCTS
2242fe8fb19SBen Gras# to the end of the "CFLAGS=" line.
2252fe8fb19SBen Gras#
2262fe8fb19SBen Gras# If you want strict compliance with XPG4 as of 1994-04-09, add
2272fe8fb19SBen Gras#	-DXPG4_1994_04_09
2282fe8fb19SBen Gras# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
2292fe8fb19SBen Gras# 53 as a week number (rather than 52 or 53) for those days in January that
2302fe8fb19SBen Gras# before the first Monday in January when a "%V" format is used and January 1
2312fe8fb19SBen Gras# falls on a Friday, Saturday, or Sunday.
2322fe8fb19SBen Gras
233*0a6a1f1dSLionel SambucCFLAGS=
2342fe8fb19SBen Gras
23584d9c625SLionel Sambuc# Linker flags.  Default to $(LFLAGS) for backwards compatibility
23684d9c625SLionel Sambuc# to tzcode2012h and earlier.
23784d9c625SLionel Sambuc
23884d9c625SLionel SambucLDFLAGS=	$(LFLAGS)
2392fe8fb19SBen Gras
2402fe8fb19SBen Graszic=		./zic
2412fe8fb19SBen GrasZIC=		$(zic) $(ZFLAGS)
2422fe8fb19SBen Gras
24384d9c625SLionel SambucZFLAGS=
24484d9c625SLionel Sambuc
245*0a6a1f1dSLionel Sambuc# The name of a Posix-compliant 'awk' on your system.
24684d9c625SLionel SambucAWK=		awk
24784d9c625SLionel Sambuc
248*0a6a1f1dSLionel Sambuc# The full path name of a Posix-compliant shell, preferably one that supports
249*0a6a1f1dSLionel Sambuc# the Korn shell's 'select' statement as an extension.
250*0a6a1f1dSLionel Sambuc# These days, Bash is the most popular.
251*0a6a1f1dSLionel Sambuc# It should be OK to set this to /bin/sh, on platforms where /bin/sh
252*0a6a1f1dSLionel Sambuc# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
253*0a6a1f1dSLionel Sambuc# is typically nicer if it works.
25484d9c625SLionel SambucKSHELL=		/bin/bash
2552fe8fb19SBen Gras
256*0a6a1f1dSLionel Sambuc# The path where SGML DTDs are kept and the catalog file(s) to use when
257*0a6a1f1dSLionel Sambuc# validating.  The default is appropriate for Ubuntu 13.10.
258f14fb602SLionel SambucSGML_TOPDIR= /usr
25984d9c625SLionel SambucSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
26084d9c625SLionel SambucSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
261*0a6a1f1dSLionel SambucSGML_CATALOG_FILES= \
262*0a6a1f1dSLionel Sambuc  $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
2632fe8fb19SBen Gras
2642fe8fb19SBen Gras# The name, arguments and environment of a program to validate your web pages.
2652fe8fb19SBen Gras# See <http://www.jclark.com/sp/> for a validator, and
2662fe8fb19SBen Gras# <http://validator.w3.org/source/> for a validation library.
2672fe8fb19SBen GrasVALIDATE = nsgmls
2682fe8fb19SBen GrasVALIDATE_FLAGS = -s -B -wall -wno-unused-param
2692fe8fb19SBen GrasVALIDATE_ENV = \
2702fe8fb19SBen Gras  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
2712fe8fb19SBen Gras  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
2722fe8fb19SBen Gras  SP_CHARSET_FIXED=YES \
2732fe8fb19SBen Gras  SP_ENCODING=UTF-8
2742fe8fb19SBen Gras
275*0a6a1f1dSLionel Sambuc# This expensive test requires USE_LTZ.
276*0a6a1f1dSLionel Sambuc# To suppress it, define this macro to be empty.
277*0a6a1f1dSLionel SambucCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
278*0a6a1f1dSLionel Sambuc
279*0a6a1f1dSLionel Sambuc# SAFE_CHAR is a regular expression that matches a safe character.
280*0a6a1f1dSLionel Sambuc# Some parts of this distribution are limited to safe characters;
281*0a6a1f1dSLionel Sambuc# others can use any UTF-8 character.
282*0a6a1f1dSLionel Sambuc# For now, the safe characters are a safe subset of ASCII.
28384d9c625SLionel Sambuc# The caller must set the shell variable 'sharp' to the character '#',
28484d9c625SLionel Sambuc# since Makefile macros cannot contain '#'.
28584d9c625SLionel Sambuc# TAB_CHAR is a single tab character, in single quotes.
28684d9c625SLionel SambucTAB_CHAR=	'	'
287*0a6a1f1dSLionel SambucSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
288*0a6a1f1dSLionel SambucSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
289*0a6a1f1dSLionel SambucSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
290*0a6a1f1dSLionel SambucSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
291*0a6a1f1dSLionel SambucSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
292*0a6a1f1dSLionel Sambuc
293*0a6a1f1dSLionel Sambuc# OK_CHAR matches any character allowed in the distributed files.
294*0a6a1f1dSLionel Sambuc# This is the same as SAFE_CHAR, except that multibyte letters are
295*0a6a1f1dSLionel Sambuc# also allowed so that commentary can contain people's names and quote
296*0a6a1f1dSLionel Sambuc# non-English sources.  For non-letters the sources are limited to
297*0a6a1f1dSLionel Sambuc# ASCII renderings for the convenience of maintainers whose text editors
298*0a6a1f1dSLionel Sambuc# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
299*0a6a1f1dSLionel SambucOK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
300*0a6a1f1dSLionel Sambuc
301*0a6a1f1dSLionel Sambuc# SAFE_LINE matches a line of safe characters.
302*0a6a1f1dSLionel Sambuc# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
303*0a6a1f1dSLionel Sambuc# this is so that comments can contain non-ASCII characters.
304*0a6a1f1dSLionel Sambuc# OK_LINE matches a line of OK characters.
305*0a6a1f1dSLionel SambucSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
306*0a6a1f1dSLionel SambucSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
307*0a6a1f1dSLionel SambucOK_LINE=	'^'$(OK_CHAR)'*$$'
30884d9c625SLionel Sambuc
309f14fb602SLionel Sambuc# Flags to give 'tar' when making a distribution.
310f14fb602SLionel Sambuc# Try to use flags appropriate for GNU tar.
311f14fb602SLionel SambucGNUTARFLAGS=	--numeric-owner --owner=0 --group=0 --mode=go+u,go-w
312f14fb602SLionel SambucTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
313f14fb602SLionel Sambuc		 then echo $(GNUTARFLAGS); \
314f14fb602SLionel Sambuc		 else :; \
315f14fb602SLionel Sambuc		 fi`
316f14fb602SLionel Sambuc
317f14fb602SLionel Sambuc# Flags to give 'gzip' when making a distribution.
318*0a6a1f1dSLionel SambucGZIPFLAGS=	-9 ${GZIP_N_FLAG}
319f14fb602SLionel Sambuc
3202fe8fb19SBen Gras###############################################################################
3212fe8fb19SBen Gras
322*0a6a1f1dSLionel Sambuc#MAKE=		make
323*0a6a1f1dSLionel Sambuc
3242fe8fb19SBen Grascc=		cc
3252fe8fb19SBen GrasCC=		$(cc) -DTZDIR=\"$(TZDIR)\"
3262fe8fb19SBen Gras
327*0a6a1f1dSLionel SambucAR=		ar
328*0a6a1f1dSLionel Sambuc
329*0a6a1f1dSLionel Sambuc# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
330*0a6a1f1dSLionel SambucRANLIB=		:
331*0a6a1f1dSLionel Sambuc
332*0a6a1f1dSLionel SambucTZCOBJS=	zic.o
333*0a6a1f1dSLionel SambucTZDOBJS=	zdump.o localtime.o asctime.o
3342fe8fb19SBen GrasDATEOBJS=	date.o localtime.o strftime.o asctime.o
3352fe8fb19SBen GrasLIBSRCS=	localtime.c asctime.c difftime.c
3362fe8fb19SBen GrasLIBOBJS=	localtime.o asctime.o difftime.o
3372fe8fb19SBen GrasHEADERS=	tzfile.h private.h
338*0a6a1f1dSLionel SambucNONLIBSRCS=	zic.c zdump.c
3392fe8fb19SBen GrasNEWUCBSRCS=	date.c strftime.c
340*0a6a1f1dSLionel SambucSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
341*0a6a1f1dSLionel Sambuc			tzselect.ksh workman.sh
3422fe8fb19SBen GrasMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
3432fe8fb19SBen Gras			tzfile.5 tzselect.8 zic.8 zdump.8
344*0a6a1f1dSLionel SambucMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
345*0a6a1f1dSLionel Sambuc			time2posix.3.txt \
346*0a6a1f1dSLionel Sambuc			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
347*0a6a1f1dSLionel Sambuc			date.1.txt
348*0a6a1f1dSLionel SambucCOMMON=		CONTRIBUTING Makefile NEWS README Theory
349*0a6a1f1dSLionel SambucWEB_PAGES=	tz-art.htm tz-link.htm
350*0a6a1f1dSLionel SambucDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
3512fe8fb19SBen GrasPRIMARY_YDATA=	africa antarctica asia australasia \
3522fe8fb19SBen Gras		europe northamerica southamerica
353f14fb602SLionel SambucYDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
354f14fb602SLionel SambucNDATA=		systemv factory
355*0a6a1f1dSLionel SambucTDATA=		$(YDATA) $(NDATA)
356*0a6a1f1dSLionel SambucZONETABLES=	zone1970.tab zone.tab
357*0a6a1f1dSLionel SambucTABDATA=	iso3166.tab leapseconds $(ZONETABLES)
358*0a6a1f1dSLionel SambucLEAP_DEPS=	leapseconds.awk leap-seconds.list
359*0a6a1f1dSLionel SambucDATA=		$(YDATA) $(NDATA) backzone $(TABDATA) \
36084d9c625SLionel Sambuc			leap-seconds.list yearistype.sh
361*0a6a1f1dSLionel SambucAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
362*0a6a1f1dSLionel SambucMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
36384d9c625SLionel SambucENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
3642fe8fb19SBen Gras
3652fe8fb19SBen Gras# And for the benefit of csh users on systems that assume the user
3662fe8fb19SBen Gras# shell should be used to handle commands in Makefiles. . .
3672fe8fb19SBen Gras
3682fe8fb19SBen GrasSHELL=		/bin/sh
3692fe8fb19SBen Gras
370*0a6a1f1dSLionel Sambucall:		tzselect zic zdump libtz.a $(TABDATA)
3712fe8fb19SBen Gras
372*0a6a1f1dSLionel SambucALL:		all date $(ENCHILADA)
3732fe8fb19SBen Gras
374*0a6a1f1dSLionel Sambucinstall:	all $(DATA) $(REDO) $(MANS)
375*0a6a1f1dSLionel Sambuc		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
376*0a6a1f1dSLionel Sambuc			$(DESTDIR)$(LIBDIR) \
37784d9c625SLionel Sambuc			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
37884d9c625SLionel Sambuc			$(DESTDIR)$(MANDIR)/man8
379*0a6a1f1dSLionel Sambuc		$(ZIC) -y $(YEARISTYPE) \
380*0a6a1f1dSLionel Sambuc			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
381*0a6a1f1dSLionel Sambuc		cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
382*0a6a1f1dSLionel Sambuc		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
383*0a6a1f1dSLionel Sambuc		cp libtz.a $(DESTDIR)$(LIBDIR)/.
384*0a6a1f1dSLionel Sambuc		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
385*0a6a1f1dSLionel Sambuc		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
386*0a6a1f1dSLionel Sambuc		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
387*0a6a1f1dSLionel Sambuc		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
3882fe8fb19SBen Gras
3892fe8fb19SBen GrasINSTALL:	ALL install date.1
390*0a6a1f1dSLionel Sambuc		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
39184d9c625SLionel Sambuc		cp date $(DESTDIR)$(BINDIR)/.
392*0a6a1f1dSLionel Sambuc		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
3932fe8fb19SBen Gras
394f14fb602SLionel Sambucversion.h:
39584d9c625SLionel Sambuc		(echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
39684d9c625SLionel Sambuc		 echo 'static char const TZVERSION[]="$(VERSION)";' && \
39784d9c625SLionel Sambuc		 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
398f14fb602SLionel Sambuc
3992fe8fb19SBen Graszdump:		$(TZDOBJS)
40084d9c625SLionel Sambuc		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
4012fe8fb19SBen Gras
4022fe8fb19SBen Graszic:		$(TZCOBJS) yearistype
40384d9c625SLionel Sambuc		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
4042fe8fb19SBen Gras
4052fe8fb19SBen Grasyearistype:	yearistype.sh
4062fe8fb19SBen Gras		cp yearistype.sh yearistype
4072fe8fb19SBen Gras		chmod +x yearistype
4082fe8fb19SBen Gras
409*0a6a1f1dSLionel Sambucleapseconds:	$(LEAP_DEPS)
41084d9c625SLionel Sambuc		$(AWK) -f leapseconds.awk leap-seconds.list >$@
41184d9c625SLionel Sambuc
4122fe8fb19SBen Grasposix_only:	zic $(TDATA)
41384d9c625SLionel Sambuc		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
41484d9c625SLionel Sambuc			-L /dev/null $(TDATA)
4152fe8fb19SBen Gras
4162fe8fb19SBen Grasright_only:	zic leapseconds $(TDATA)
41784d9c625SLionel Sambuc		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
41884d9c625SLionel Sambuc			-L leapseconds $(TDATA)
4192fe8fb19SBen Gras
4202fe8fb19SBen Gras# In earlier versions of this makefile, the other two directories were
4212fe8fb19SBen Gras# subdirectories of $(TZDIR).  However, this led to configuration errors.
4222fe8fb19SBen Gras# For example, with posix_right under the earlier scheme,
4232fe8fb19SBen Gras# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
4242fe8fb19SBen Gras# but gmtime without leap seconds, which led to problems with applications
4252fe8fb19SBen Gras# like sendmail that subtract gmtime from localtime.
4262fe8fb19SBen Gras# Therefore, the other two directories are now siblings of $(TZDIR).
4272fe8fb19SBen Gras# You must replace all of $(TZDIR) to switch from not using leap seconds
4282fe8fb19SBen Gras# to using them, or vice versa.
42984d9c625SLionel Sambucright_posix:	right_only leapseconds
43084d9c625SLionel Sambuc		rm -fr $(DESTDIR)$(TZDIR)-leaps
43184d9c625SLionel Sambuc		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
43284d9c625SLionel Sambuc		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
43384d9c625SLionel Sambuc			-L leapseconds $(TDATA)
43484d9c625SLionel Sambuc		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
43584d9c625SLionel Sambuc			-L /dev/null $(TDATA)
4362fe8fb19SBen Gras
43784d9c625SLionel Sambucposix_right:	posix_only leapseconds
43884d9c625SLionel Sambuc		rm -fr $(DESTDIR)$(TZDIR)-posix
43984d9c625SLionel Sambuc		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
44084d9c625SLionel Sambuc		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
44184d9c625SLionel Sambuc			-L /dev/null $(TDATA)
44284d9c625SLionel Sambuc		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
44384d9c625SLionel Sambuc			-L leapseconds $(TDATA)
4442fe8fb19SBen Gras
445*0a6a1f1dSLionel Sambucposix_packrat:	posix_only backzone
446*0a6a1f1dSLionel Sambuc		$(AWK) '/^Rule/' $(TDATA) | \
447*0a6a1f1dSLionel Sambuc		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
448*0a6a1f1dSLionel Sambuc			-L /dev/null - backzone
449*0a6a1f1dSLionel Sambuc
4502fe8fb19SBen Graszones:		$(REDO)
4512fe8fb19SBen Gras
452*0a6a1f1dSLionel Sambuclibtz.a:	$(LIBOBJS)
453*0a6a1f1dSLionel Sambuc		$(AR) ru $@ $(LIBOBJS)
454*0a6a1f1dSLionel Sambuc		$(RANLIB) $@
4552fe8fb19SBen Gras
4562fe8fb19SBen Grasdate:		$(DATEOBJS)
45784d9c625SLionel Sambuc		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
4582fe8fb19SBen Gras
4592fe8fb19SBen Grastzselect:	tzselect.ksh
4602fe8fb19SBen Gras		sed \
46184d9c625SLionel Sambuc			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
4622fe8fb19SBen Gras			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
46384d9c625SLionel Sambuc			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
46484d9c625SLionel Sambuc			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
4652fe8fb19SBen Gras			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
46684d9c625SLionel Sambuc			-e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \
4672fe8fb19SBen Gras			<$? >$@
4682fe8fb19SBen Gras		chmod +x $@
4692fe8fb19SBen Gras
470*0a6a1f1dSLionel Sambuccheck:		check_character_set check_white_space check_links check_sorted \
471*0a6a1f1dSLionel Sambuc		  check_tables check_web
47284d9c625SLionel Sambuc
47384d9c625SLionel Sambuccheck_character_set: $(ENCHILADA)
474*0a6a1f1dSLionel Sambuc		LC_ALL=en_US.utf8 && export LC_ALL && \
475*0a6a1f1dSLionel Sambuc		sharp='#' && \
476*0a6a1f1dSLionel Sambuc		! grep -Env $(SAFE_LINE) Makefile $(MANS) date.1 $(MANTXTS) \
477*0a6a1f1dSLionel Sambuc			$(MISC) $(SOURCES) $(WEB_PAGES) && \
478*0a6a1f1dSLionel Sambuc		! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
479*0a6a1f1dSLionel Sambuc			leapseconds yearistype.sh zone.tab && \
480*0a6a1f1dSLionel Sambuc		! grep -Env $(OK_LINE) $(ENCHILADA)
4812fe8fb19SBen Gras
482*0a6a1f1dSLionel Sambuccheck_white_space: $(ENCHILADA)
483*0a6a1f1dSLionel Sambuc		! grep -En ' '$(TAB_CHAR)"|$$(printf '[\f\r\v]')" $(ENCHILADA)
484*0a6a1f1dSLionel Sambuc		! grep -n '[[:space:]]$$' $(ENCHILADA)
485*0a6a1f1dSLionel Sambuc
486*0a6a1f1dSLionel SambucCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
487*0a6a1f1dSLionel Sambuc
488*0a6a1f1dSLionel Sambuccheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
489*0a6a1f1dSLionel Sambuc		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
490*0a6a1f1dSLionel Sambuc		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
491*0a6a1f1dSLionel Sambuc		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
492*0a6a1f1dSLionel Sambuc		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
493*0a6a1f1dSLionel Sambuc		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
494*0a6a1f1dSLionel Sambuc		  LC_ALL=C sort -c
495*0a6a1f1dSLionel Sambuc		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
496*0a6a1f1dSLionel Sambuc		  LC_ALL=C sort -cu
497*0a6a1f1dSLionel Sambuc
498*0a6a1f1dSLionel Sambuccheck_links:	checklinks.awk $(TDATA)
499*0a6a1f1dSLionel Sambuc		$(AWK) -f checklinks.awk $(TDATA)
500*0a6a1f1dSLionel Sambuc
501*0a6a1f1dSLionel Sambuccheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
502*0a6a1f1dSLionel Sambuc		for tab in $(ZONETABLES); do \
503*0a6a1f1dSLionel Sambuc		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
504*0a6a1f1dSLionel Sambuc		    || exit; \
505*0a6a1f1dSLionel Sambuc		done
5062fe8fb19SBen Gras
5072fe8fb19SBen Grascheck_web:	$(WEB_PAGES)
5082fe8fb19SBen Gras		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
5092fe8fb19SBen Gras
51084d9c625SLionel Sambucclean_misc:
511f14fb602SLionel Sambuc		rm -f core *.o *.out \
512*0a6a1f1dSLionel Sambuc		  date tzselect version.h zdump zic yearistype libtz.a
51384d9c625SLionel Sambucclean:		clean_misc
514*0a6a1f1dSLionel Sambuc		rm -fr tzpublic
5152fe8fb19SBen Gras
5162fe8fb19SBen Grasmaintainer-clean: clean
5172fe8fb19SBen Gras		@echo 'This command is intended for maintainers to use; it'
5182fe8fb19SBen Gras		@echo 'deletes files that may need special tools to rebuild.'
519*0a6a1f1dSLionel Sambuc		rm -f leapseconds $(MANTXTS) *.asc *.tar.gz
5202fe8fb19SBen Gras
5212fe8fb19SBen Grasnames:
5222fe8fb19SBen Gras		@echo $(ENCHILADA)
5232fe8fb19SBen Gras
524*0a6a1f1dSLionel Sambucpublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
525*0a6a1f1dSLionel Sambuc		tarballs signatures
526*0a6a1f1dSLionel Sambuc
527*0a6a1f1dSLionel Sambucdate.1.txt:	date.1
528*0a6a1f1dSLionel Sambucnewctime.3.txt:	newctime.3
529*0a6a1f1dSLionel Sambucnewstrftime.3.txt: newstrftime.3
530*0a6a1f1dSLionel Sambucnewtzset.3.txt:	newtzset.3
531*0a6a1f1dSLionel Sambuctime2posix.3.txt: time2posix.3
532*0a6a1f1dSLionel Sambuctzfile.5.txt:	tzfile.5
533*0a6a1f1dSLionel Sambuctzselect.8.txt:	tzselect.8
534*0a6a1f1dSLionel Sambuczdump.8.txt:	zdump.8
535*0a6a1f1dSLionel Sambuczic.8.txt:	zic.8
536*0a6a1f1dSLionel Sambuc
537*0a6a1f1dSLionel Sambuc$(MANTXTS):	workman.sh
538*0a6a1f1dSLionel Sambuc		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@
53984d9c625SLionel Sambuc
540f14fb602SLionel Sambuc# Set the time stamps to those of the git repository, if available,
541f14fb602SLionel Sambuc# and if the files have not changed since then.
542f14fb602SLionel Sambuc# This uses GNU 'touch' syntax 'touch -d@N FILE',
543f14fb602SLionel Sambuc# where N is the number of seconds since 1970.
544*0a6a1f1dSLionel Sambuc# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
545*0a6a1f1dSLionel Sambuc# Also, set the timestamp of each prebuilt file like 'leapseconds'
546*0a6a1f1dSLionel Sambuc# to be the maximum of the files it depends on.
547*0a6a1f1dSLionel Sambucset-timestamps.out: $(ENCHILADA)
548*0a6a1f1dSLionel Sambuc		rm -f $@
549*0a6a1f1dSLionel Sambuc		if files=`git ls-files $(ENCHILADA)` && \
550*0a6a1f1dSLionel Sambuc		   touch -md @1 test.out; then \
551*0a6a1f1dSLionel Sambuc		  rm -f test.out && \
552f14fb602SLionel Sambuc		  for file in $$files; do \
553*0a6a1f1dSLionel Sambuc		    if git diff --quiet $$file; then \
554*0a6a1f1dSLionel Sambuc		      time=`git log -1 --format='tformat:%ct' $$file` && \
555*0a6a1f1dSLionel Sambuc		      touch -cmd @$$time $$file; \
556*0a6a1f1dSLionel Sambuc		    else \
557*0a6a1f1dSLionel Sambuc		      echo >&2 "$$file: warning: does not match repository"; \
558*0a6a1f1dSLionel Sambuc		    fi || exit; \
559*0a6a1f1dSLionel Sambuc		  done; \
560*0a6a1f1dSLionel Sambuc		fi
561*0a6a1f1dSLionel Sambuc		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
562*0a6a1f1dSLionel Sambuc		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
563*0a6a1f1dSLionel Sambuc		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
564*0a6a1f1dSLionel Sambuc		    exit; \
565f14fb602SLionel Sambuc		done
566*0a6a1f1dSLionel Sambuc		touch $@
567f14fb602SLionel Sambuc
5682fe8fb19SBen Gras# The zics below ensure that each data file can stand on its own.
5692fe8fb19SBen Gras# We also do an all-files run to catch links to links.
5702fe8fb19SBen Gras
571*0a6a1f1dSLionel Sambuccheck_public:
572*0a6a1f1dSLionel Sambuc		$(MAKE) maintainer-clean
573*0a6a1f1dSLionel Sambuc		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
57484d9c625SLionel Sambuc		mkdir tzpublic
57584d9c625SLionel Sambuc		for i in $(TDATA) ; do \
57684d9c625SLionel Sambuc		  $(zic) -v -d tzpublic $$i 2>&1 || exit; \
57784d9c625SLionel Sambuc		done
57884d9c625SLionel Sambuc		$(zic) -v -d tzpublic $(TDATA)
579*0a6a1f1dSLionel Sambuc		rm -fr tzpublic
58084d9c625SLionel Sambuc
58184d9c625SLionel Sambuc# Check that the code works under various alternative
58284d9c625SLionel Sambuc# implementations of time_t.
58384d9c625SLionel Sambuccheck_time_t_alternatives:
584*0a6a1f1dSLionel Sambuc		if diff -q Makefile Makefile 2>/dev/null; then \
585*0a6a1f1dSLionel Sambuc		  quiet_option='-q'; \
586*0a6a1f1dSLionel Sambuc		else \
587*0a6a1f1dSLionel Sambuc		  quiet_option=''; \
588*0a6a1f1dSLionel Sambuc		fi && \
589*0a6a1f1dSLionel Sambuc		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
59084d9c625SLionel Sambuc		for type in $(TIME_T_ALTERNATIVES); do \
591*0a6a1f1dSLionel Sambuc		  mkdir -p tzpublic/$$type && \
592*0a6a1f1dSLionel Sambuc		  $(MAKE) clean_misc && \
593*0a6a1f1dSLionel Sambuc		  $(MAKE) TOPDIR=`pwd`/tzpublic/$$type \
59484d9c625SLionel Sambuc		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
595*0a6a1f1dSLionel Sambuc		    REDO='$(REDO)' \
59684d9c625SLionel Sambuc		    install && \
597*0a6a1f1dSLionel Sambuc		  diff $$quiet_option -r \
598*0a6a1f1dSLionel Sambuc		    tzpublic/int64_t/etc/zoneinfo \
599*0a6a1f1dSLionel Sambuc		    tzpublic/$$type/etc/zoneinfo && \
60084d9c625SLionel Sambuc		  case $$type in \
60184d9c625SLionel Sambuc		  int32_t) range=-2147483648,2147483647;; \
60284d9c625SLionel Sambuc		  uint32_t) range=0,4294967296;; \
60384d9c625SLionel Sambuc		  int64_t) continue;; \
60484d9c625SLionel Sambuc		  *u*) range=0,10000000000;; \
60584d9c625SLionel Sambuc		  *) range=-10000000000,10000000000;; \
60684d9c625SLionel Sambuc		  esac && \
60784d9c625SLionel Sambuc		  echo checking $$type zones ... && \
60884d9c625SLionel Sambuc		  tzpublic/int64_t/etc/zdump -V -t $$range $$zones \
60984d9c625SLionel Sambuc		      >tzpublic/int64_t.out && \
61084d9c625SLionel Sambuc		  tzpublic/$$type/etc/zdump -V -t $$range $$zones \
61184d9c625SLionel Sambuc		      >tzpublic/$$type.out && \
61284d9c625SLionel Sambuc		  diff -u tzpublic/int64_t.out tzpublic/$$type.out \
61384d9c625SLionel Sambuc		    || exit; \
61484d9c625SLionel Sambuc		done
615*0a6a1f1dSLionel Sambuc		rm -fr tzpublic
61684d9c625SLionel Sambuc
61784d9c625SLionel Sambuctarballs:	tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
61884d9c625SLionel Sambuc
619*0a6a1f1dSLionel Sambuctzcode$(VERSION).tar.gz: set-timestamps.out
620f14fb602SLionel Sambuc		LC_ALL=C && export LC_ALL && \
62184d9c625SLionel Sambuc		tar $(TARFLAGS) -cf - \
622*0a6a1f1dSLionel Sambuc		    $(COMMON) $(DOCS) $(SOURCES) | \
623*0a6a1f1dSLionel Sambuc		  ${TOOL_GZIP} $(GZIPFLAGS) > $@
62484d9c625SLionel Sambuc
625*0a6a1f1dSLionel Sambuctzdata$(VERSION).tar.gz: set-timestamps.out
626f14fb602SLionel Sambuc		LC_ALL=C && export LC_ALL && \
627*0a6a1f1dSLionel Sambuc		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
628*0a6a1f1dSLionel Sambuc		  ${TOOL_GZIP} $(GZIPFLAGS) > $@
62984d9c625SLionel Sambuc
63084d9c625SLionel Sambucsignatures:	tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc
63184d9c625SLionel Sambuc
63284d9c625SLionel Sambuctzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
63384d9c625SLionel Sambuc		gpg --armor --detach-sign $?
63484d9c625SLionel Sambuc
63584d9c625SLionel Sambuctzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
63684d9c625SLionel Sambuc		gpg --armor --detach-sign $?
6372fe8fb19SBen Gras
6382fe8fb19SBen Grastypecheck:
639*0a6a1f1dSLionel Sambuc		$(MAKE) clean
64084d9c625SLionel Sambuc		for i in "long long" unsigned; \
6412fe8fb19SBen Gras		do \
642*0a6a1f1dSLionel Sambuc			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
6432fe8fb19SBen Gras			./zdump -v Europe/Rome ; \
644*0a6a1f1dSLionel Sambuc			$(MAKE) clean ; \
6452fe8fb19SBen Gras		done
6462fe8fb19SBen Gras
6472fe8fb19SBen Graszonenames:	$(TDATA)
6482fe8fb19SBen Gras		@$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
6492fe8fb19SBen Gras
6502fe8fb19SBen Grasasctime.o:	private.h tzfile.h
6512fe8fb19SBen Grasdate.o:		private.h
6522fe8fb19SBen Grasdifftime.o:	private.h
6532fe8fb19SBen Graslocaltime.o:	private.h tzfile.h
654*0a6a1f1dSLionel Sambucstrftime.o:	private.h tzfile.h
655f14fb602SLionel Sambuczdump.o:	version.h
656f14fb602SLionel Sambuczic.o:		private.h tzfile.h version.h
6572fe8fb19SBen Gras
6582fe8fb19SBen Gras.KEEP_STATE:
659*0a6a1f1dSLionel Sambuc
660*0a6a1f1dSLionel Sambuc.PHONY: ALL INSTALL all
661*0a6a1f1dSLionel Sambuc.PHONY: check check_character_set check_links
662*0a6a1f1dSLionel Sambuc.PHONY: check_public check_sorted check_tables
663*0a6a1f1dSLionel Sambuc.PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc
664*0a6a1f1dSLionel Sambuc.PHONY: install maintainer-clean names posix_packrat posix_only posix_right
665*0a6a1f1dSLionel Sambuc.PHONY: public right_only right_posix signatures tarballs typecheck
666*0a6a1f1dSLionel Sambuc.PHONY: zonenames zones
667