Makefile revision 1.38
11.1Smlelstv# This file is in the public domain, so clarified as of
21.1Smlelstv# 2009-05-17 by Arthur David Olson.
31.1Smlelstv
41.10Schristos# Package name for the code distribution.
51.10SchristosPACKAGE=	tzcode
61.10Schristos
71.34Schristos# Version number for the distribution, overridden in the 'tarballs' rule below.
81.35SchristosVERSION=	unknown
91.9Schristos
101.9Schristos# Email address for bug reports.
111.9SchristosBUGEMAIL=	tz@iana.org
121.6Schristos
131.1Smlelstv# Change the line below for your time zone (after finding the zone you want in
141.1Smlelstv# the time zone files, or adding it to a time zone file).
151.1Smlelstv# Alternately, if you discover you've got the wrong time zone, you can just
161.1Smlelstv#	zic -l rightzone
171.1Smlelstv# to correct things.
181.1Smlelstv# Use the command
191.1Smlelstv#	make zonenames
201.1Smlelstv# to get a list of the values you can use for LOCALTIME.
211.1Smlelstv
221.4SchristosLOCALTIME=	GMT
231.1Smlelstv
241.1Smlelstv# If you want something other than Eastern United States time as a template
251.1Smlelstv# for handling POSIX-style time zone environment variables,
261.1Smlelstv# change the line below (after finding the zone you want in the
271.1Smlelstv# time zone files, or adding it to a time zone file).
281.1Smlelstv# (When a POSIX-style environment variable is handled, the rules in the
291.1Smlelstv# template file are used to determine "spring forward" and "fall back" days and
301.15Schristos# times; the environment variable itself specifies UT offsets of standard and
311.1Smlelstv# summer time.)
321.1Smlelstv# Alternately, if you discover you've got the wrong time zone, you can just
331.1Smlelstv#	zic -p rightzone
341.1Smlelstv# to correct things.
351.1Smlelstv# Use the command
361.1Smlelstv#	make zonenames
371.1Smlelstv# to get a list of the values you can use for POSIXRULES.
381.1Smlelstv# If you want POSIX compatibility, use "America/New_York".
391.1Smlelstv
401.1SmlelstvPOSIXRULES=	America/New_York
411.1Smlelstv
421.1Smlelstv# Also see TZDEFRULESTRING below, which takes effect only
431.1Smlelstv# if the time zone files cannot be accessed.
441.1Smlelstv
451.1Smlelstv# Everything gets put in subdirectories of. . .
461.1Smlelstv
471.1SmlelstvTOPDIR=		/usr/local
481.1Smlelstv
491.1Smlelstv# "Compiled" time zone information is placed in the "TZDIR" directory
501.1Smlelstv# (and subdirectories).
511.1Smlelstv# Use an absolute path name for TZDIR unless you're just testing the software.
521.38Schristos# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
531.1Smlelstv
541.15SchristosTZDIR_BASENAME=	zoneinfo
551.15SchristosTZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
561.1Smlelstv
571.14Schristos# Types to try, as an alternative to time_t.  int64_t should be first.
581.14SchristosTIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
591.14Schristos
601.1Smlelstv# The "tzselect", "zic", and "zdump" commands get installed in. . .
611.1Smlelstv
621.1SmlelstvETCDIR=		$(TOPDIR)/etc
631.1Smlelstv
641.1Smlelstv# If you "make INSTALL", the "date" command gets installed in. . .
651.1Smlelstv
661.1SmlelstvBINDIR=		$(TOPDIR)/bin
671.1Smlelstv
681.1Smlelstv# Manual pages go in subdirectories of. . .
691.1Smlelstv
701.1SmlelstvMANDIR=		$(TOPDIR)/man
711.1Smlelstv
721.1Smlelstv# Library functions are put in an archive in LIBDIR.
731.1Smlelstv
741.1SmlelstvLIBDIR=		$(TOPDIR)/lib
751.1Smlelstv
761.37Schristos# If you want only POSIX time, with time values interpreted as
771.37Schristos# seconds since the epoch (not counting leap seconds), use
781.1Smlelstv#	REDO=		posix_only
791.38Schristos# below.  If you want only "right" time, with values interpreted
801.37Schristos# as seconds since the epoch (counting leap seconds), use
811.1Smlelstv#	REDO=		right_only
821.1Smlelstv# below.  If you want both sets of data available, with leap seconds not
831.1Smlelstv# counted normally, use
841.1Smlelstv#	REDO=		posix_right
851.1Smlelstv# below.  If you want both sets of data available, with leap seconds counted
861.1Smlelstv# normally, use
871.1Smlelstv#	REDO=		right_posix
881.32Schristos# below.  POSIX mandates that leap seconds not be counted; for compatibility
891.37Schristos# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
901.37Schristos# leap smearing; this can work better than unsmeared "right" time with
911.37Schristos# applications that are not leap second aware, and is closer to unsmeared
921.37Schristos# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
931.1Smlelstv
941.1SmlelstvREDO=		posix_right
951.1Smlelstv
961.38Schristos# To install data in text form that has all the information of the binary data,
971.38Schristos# (optionally incorporating leap second information), use
981.38Schristos#	TZDATA_TEXT=	tzdata.zi leapseconds
991.38Schristos# To install text data without leap second information (e.g., because
1001.38Schristos# REDO='posix_only'), use
1011.38Schristos#	TZDATA_TEXT=	tzdata.zi
1021.38Schristos# To avoid installing text data, use
1031.38Schristos#	TZDATA_TEXT=
1041.38Schristos
1051.38SchristosTZDATA_TEXT=	leapseconds tzdata.zi
1061.38Schristos
1071.38Schristos# For backward-compatibility links for old zone names, use
1081.38Schristos#	BACKWARD=	backward pacificnew
1091.38Schristos# To omit these links, use
1101.38Schristos#	BACKWARD=
1111.38Schristos
1121.38SchristosBACKWARD=	backward pacificnew
1131.38Schristos
1141.32Schristos# If you want out-of-scope and often-wrong data from the file 'backzone', use
1151.32Schristos#	PACKRATDATA=	backzone
1161.32Schristos# To omit this data, use
1171.32Schristos#	PACKRATDATA=
1181.32Schristos
1191.32SchristosPACKRATDATA=
1201.32Schristos
1211.38Schristos# The name of a locale using the UTF-8 encoding, used during self-tests.
1221.38Schristos# The tests are skipped if the name does not appear to work on this system.
1231.38Schristos
1241.38SchristosUTF8_LOCALE=	en_US.utf8
1251.38Schristos
1261.1Smlelstv# Since "." may not be in PATH...
1271.1Smlelstv
1281.1SmlelstvYEARISTYPE=	./yearistype
1291.1Smlelstv
1301.1Smlelstv# Non-default libraries needed to link.
1311.1SmlelstvLDLIBS=
1321.1Smlelstv
1331.38Schristos# Add the following to the end of the "CFLAGS=" line as needed to override
1341.38Schristos# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
1351.19Schristos#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
1361.38Schristos#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
1371.38Schristos#	formats that generate only the last two digits of year numbers
1381.38Schristos#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
1391.38Schristos#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
1401.38Schristos#	than what POSIX specifies, assuming local time is UT.
1411.38Schristos#	For example, N is 252460800 on AmigaOS.
1421.32Schristos#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
1431.38Schristos#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
1441.32Schristos#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
1451.38Schristos#  -DHAVE_GENERIC=0 if _Generic does not work
1461.38Schristos#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
1471.38Schristos#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
1481.35Schristos#	ctime_r and asctime_r incompatibly with the POSIX standard
1491.35Schristos#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
1501.38Schristos#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
1511.16Schristos#  -DHAVE_LINK=0 if your system lacks a link function
1521.23Schristos#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
1531.23Schristos#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
1541.23Schristos#	localtime_rz can make zdump significantly faster, but is nonstandard.
1551.32Schristos#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
1561.32Schristos#	functions like 'link' or variables like 'tzname' required by POSIX
1571.38Schristos#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
1581.38Schristos#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
1591.38Schristos#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
1601.38Schristos#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
1611.28Schristos#  -DHAVE_STRDUP=0 if your system lacks the strdup function
1621.1Smlelstv#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
1631.38Schristos#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
1641.38Schristos#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
1651.23Schristos#  -DHAVE_TZSET=0 if your system lacks a tzset function
1661.38Schristos#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
1671.38Schristos#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
1681.38Schristos#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
1691.38Schristos#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
1701.23Schristos#	not needed by the main-program tz code, which is single-threaded.
1711.23Schristos#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
1721.14Schristos#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
1731.38Schristos#	This is intended for internal use only; it mangles external names.
1741.1Smlelstv#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
1751.22Schristos#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
1761.1Smlelstv#	the default is system-supplied, typically "/usr/lib/locale"
1771.14Schristos#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
1781.38Schristos#	DST transitions if the time zone files cannot be accessed
1791.38Schristos#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
1801.23Schristos#	other than simply getting garbage data
1811.23Schristos#  -DUSE_LTZ=0 to build zdump with the system time zone library
1821.23Schristos#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
1831.1Smlelstv#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
1841.1Smlelstv#	(or some other number) to set the maximum time zone abbreviation length
1851.1Smlelstv#	that zic will accept without a warning (the default is 6)
1861.30Schristos#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
1871.38Schristos# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
1881.38SchristosGCC_INSTRUMENT = \
1891.38Schristos  -fsanitize=undefined -fsanitize-address-use-after-scope \
1901.38Schristos  -fsanitize-undefined-trap-on-error -fstack-protector
1911.38SchristosGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
1921.38Schristos  $(GCC_INSTRUMENT) \
1931.38Schristos  -Wall -Wextra \
1941.38Schristos  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
1951.38Schristos  -Wbad-function-cast -Wcast-align -Wdate-time \
1961.38Schristos  -Wdeclaration-after-statement -Wdouble-promotion \
1971.38Schristos  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
1981.38Schristos  -Winit-self -Wjump-misses-init -Wlogical-op \
1991.38Schristos  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
2001.38Schristos  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
2011.38Schristos  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
2021.38Schristos  -Wsuggest-attribute=const -Wsuggest-attribute=format \
2031.38Schristos  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
2041.38Schristos  -Wtrampolines -Wundef -Wuninitialized -Wunused \
2051.38Schristos  -Wvariadic-macros -Wvla -Wwrite-strings \
2061.38Schristos  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
2071.38Schristos  -Wno-type-limits -Wno-unused-parameter
2081.1Smlelstv#
2091.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s
2101.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
2111.1Smlelstv# add the name to a define such as
2121.1Smlelstv#	-DTM_GMTOFF=tm_gmtoff
2131.23Schristos# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
2141.23Schristos# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
2151.23Schristos# Similarly, if your system has a "zone abbreviation" field, define
2161.1Smlelstv#	-DTM_ZONE=tm_zone
2171.23Schristos# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
2181.23Schristos# required by POSIX, but are widely available on GNU/Linux and BSD systems.
2191.1Smlelstv#
2201.38Schristos# The next batch of options control support for external variables
2211.38Schristos# exported by tzcode.  In practice these variables are less useful
2221.38Schristos# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
2231.38Schristos# #
2241.38Schristos# # To omit or support the external variable "tzname", add one of:
2251.38Schristos# #	-DHAVE_TZNAME=0
2261.38Schristos# #	-DHAVE_TZNAME=1
2271.38Schristos# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
2281.38Schristos# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
2291.38Schristos# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
2301.38Schristos# # crashes when combined with some platforms' standard libraries,
2311.38Schristos# # presumably due to memory allocation issues.
2321.38Schristos# #
2331.38Schristos# # To omit or support the external variables "timezone" and "daylight", add
2341.38Schristos# #	-DUSG_COMPAT=0
2351.38Schristos# #	-DUSG_COMPAT=1
2361.38Schristos# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
2371.38Schristos# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
2381.38Schristos# # If not defined, the code attempts to guess USG_COMPAT from other macros.
2391.38Schristos# #
2401.38Schristos# # To support the external variable "altzone", add
2411.38Schristos# #	-DALTZONE
2421.38Schristos# # to the end of the "CFLAGS=" line; although "altzone" appeared in
2431.38Schristos# # System V Release 3.1 it has not been standardized.
2441.38Schristos#
2451.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work,
2461.1Smlelstv# add
2471.1Smlelstv#	-DSTD_INSPIRED
2481.1Smlelstv# to the end of the "CFLAGS=" line.  This arranges for the functions
2491.1Smlelstv# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
2501.1Smlelstv# "posix2time", and "time2posix" to be added to the time conversion library.
2511.1Smlelstv# "tzsetwall" is like "tzset" except that it arranges for local wall clock
2521.1Smlelstv# time (rather than the time specified in the TZ environment variable)
2531.1Smlelstv# to be used.
2541.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument
2551.1Smlelstv# that gives an offset to add to the time_t when converting it.
2561.1Smlelstv# "timelocal" is equivalent to "mktime".
2571.1Smlelstv# "timegm" is like "timelocal" except that it turns a struct tm into
2581.15Schristos# a time_t using UT (rather than local time as "timelocal" does).
2591.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument
2601.1Smlelstv# that gives an offset to use when converting to a time_t.
2611.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page.
2621.1Smlelstv# X3J11's work does not describe any of these functions.
2631.1Smlelstv# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
2641.1Smlelstv# These functions may well disappear in future releases of the time
2651.1Smlelstv# conversion package.
2661.1Smlelstv#
2671.23Schristos# If you don't want functions that were inspired by NetBSD, add
2681.23Schristos#	-DNETBSD_INSPIRED=0
2691.23Schristos# to the end of the "CFLAGS=" line.  Otherwise, the functions
2701.23Schristos# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
2711.23Schristos# time library, and if STD_INSPIRED is also defined the functions
2721.23Schristos# "posix2time_z" and "time2posix_z" are added as well.
2731.23Schristos# The functions ending in "_z" (or "_rz") are like their unsuffixed
2741.23Schristos# (or suffixed-by-"_r") counterparts, except with an extra first
2751.23Schristos# argument of opaque type timezone_t that specifies the time zone.
2761.23Schristos# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
2771.23Schristos#
2781.1Smlelstv# If you want to allocate state structures in localtime, add
2791.1Smlelstv#	-DALL_STATE
2801.1Smlelstv# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
2811.1Smlelstv#
2821.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
2831.1Smlelstv# out by the National Institute of Standards and Technology
2841.1Smlelstv# which claims to test C and Posix conformance.  If you want to pass PCTS, add
2851.1Smlelstv#	-DPCTS
2861.1Smlelstv# to the end of the "CFLAGS=" line.
2871.1Smlelstv#
2881.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add
2891.1Smlelstv#	-DXPG4_1994_04_09
2901.1Smlelstv# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
2911.38Schristos# 53 as a week number (rather than 52 or 53) for January days before
2921.38Schristos# January's first Monday when a "%V" format is used and January 1
2931.1Smlelstv# falls on a Friday, Saturday, or Sunday.
2941.1Smlelstv
2951.1SmlelstvCFLAGS=
2961.1Smlelstv
2971.9Schristos# Linker flags.  Default to $(LFLAGS) for backwards compatibility
2981.34Schristos# to release 2012h and earlier.
2991.9Schristos
3001.9SchristosLDFLAGS=	$(LFLAGS)
3011.1Smlelstv
3021.32Schristos# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
3031.32Schristos# submake command lines.  The default is no leap seconds.
3041.32Schristos
3051.32SchristosLEAPSECONDS=
3061.32Schristos
3071.32Schristos# The zic command and its arguments.
3081.32Schristos
3091.1Smlelstvzic=		./zic
3101.1SmlelstvZIC=		$(zic) $(ZFLAGS)
3111.1Smlelstv
3121.15SchristosZFLAGS=
3131.15Schristos
3141.34Schristos# How to use zic to install tz binary files.
3151.32Schristos
3161.38SchristosZIC_INSTALL=	$(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
3171.32Schristos
3181.22Schristos# The name of a Posix-compliant 'awk' on your system.
3191.9SchristosAWK=		awk
3201.9Schristos
3211.16Schristos# The full path name of a Posix-compliant shell, preferably one that supports
3221.16Schristos# the Korn shell's 'select' statement as an extension.
3231.16Schristos# These days, Bash is the most popular.
3241.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh
3251.16Schristos# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
3261.16Schristos# is typically nicer if it works.
3271.9SchristosKSHELL=		/bin/bash
3281.1Smlelstv
3291.18Schristos# The path where SGML DTDs are kept and the catalog file(s) to use when
3301.34Schristos# validating.  The default should work on both Debian and Red Hat.
3311.10SchristosSGML_TOPDIR= /usr
3321.9SchristosSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
3331.9SchristosSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
3341.18SchristosSGML_CATALOG_FILES= \
3351.34Schristos  $(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
3361.1Smlelstv
3371.1Smlelstv# The name, arguments and environment of a program to validate your web pages.
3381.34Schristos# See <http://openjade.sourceforge.net/doc/> for a validator, and
3391.34Schristos# <https://validator.w3.org/source/> for a validation library.
3401.38Schristos# Set VALIDATE=':' if you do not have such a program.
3411.1SmlelstvVALIDATE = nsgmls
3421.1SmlelstvVALIDATE_FLAGS = -s -B -wall -wno-unused-param
3431.1SmlelstvVALIDATE_ENV = \
3441.1Smlelstv  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
3451.1Smlelstv  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
3461.1Smlelstv  SP_CHARSET_FIXED=YES \
3471.1Smlelstv  SP_ENCODING=UTF-8
3481.1Smlelstv
3491.23Schristos# This expensive test requires USE_LTZ.
3501.23Schristos# To suppress it, define this macro to be empty.
3511.23SchristosCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
3521.23Schristos
3531.22Schristos# SAFE_CHAR is a regular expression that matches a safe character.
3541.22Schristos# Some parts of this distribution are limited to safe characters;
3551.22Schristos# others can use any UTF-8 character.
3561.22Schristos# For now, the safe characters are a safe subset of ASCII.
3571.9Schristos# The caller must set the shell variable 'sharp' to the character '#',
3581.9Schristos# since Makefile macros cannot contain '#'.
3591.9Schristos# TAB_CHAR is a single tab character, in single quotes.
3601.9SchristosTAB_CHAR=	'	'
3611.22SchristosSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
3621.22SchristosSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
3631.22SchristosSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
3641.29SchristosSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
3651.29SchristosSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
3661.29Schristos
3671.29Schristos# OK_CHAR matches any character allowed in the distributed files.
3681.29Schristos# This is the same as SAFE_CHAR, except that multibyte letters are
3691.29Schristos# also allowed so that commentary can contain people's names and quote
3701.29Schristos# non-English sources.  For non-letters the sources are limited to
3711.22Schristos# ASCII renderings for the convenience of maintainers whose text editors
3721.22Schristos# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
3731.29SchristosOK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
3741.22Schristos
3751.22Schristos# SAFE_LINE matches a line of safe characters.
3761.29Schristos# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
3771.22Schristos# this is so that comments can contain non-ASCII characters.
3781.29Schristos# OK_LINE matches a line of OK characters.
3791.22SchristosSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
3801.29SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
3811.29SchristosOK_LINE=	'^'$(OK_CHAR)'*$$'
3821.9Schristos
3831.6Schristos# Flags to give 'tar' when making a distribution.
3841.6Schristos# Try to use flags appropriate for GNU tar.
3851.34SchristosGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
3861.6SchristosTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
3871.6Schristos		 then echo $(GNUTARFLAGS); \
3881.6Schristos		 else :; \
3891.6Schristos		 fi`
3901.6Schristos
3911.6Schristos# Flags to give 'gzip' when making a distribution.
3921.38SchristosGZIPFLAGS=	-9n
3931.6Schristos
3941.1Smlelstv###############################################################################
3951.1Smlelstv
3961.29Schristos#MAKE=		make
3971.29Schristos
3981.1Smlelstvcc=		cc
3991.1SmlelstvCC=		$(cc) -DTZDIR=\"$(TZDIR)\"
4001.1Smlelstv
4011.16SchristosAR=		ar
4021.16Schristos
4031.16Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
4041.16SchristosRANLIB=		:
4051.16Schristos
4061.28SchristosTZCOBJS=	zic.o
4071.38SchristosTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
4081.1SmlelstvDATEOBJS=	date.o localtime.o strftime.o asctime.o
4091.1SmlelstvLIBSRCS=	localtime.c asctime.c difftime.c
4101.1SmlelstvLIBOBJS=	localtime.o asctime.o difftime.o
4111.1SmlelstvHEADERS=	tzfile.h private.h
4121.28SchristosNONLIBSRCS=	zic.c zdump.c
4131.1SmlelstvNEWUCBSRCS=	date.c strftime.c
4141.23SchristosSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
4151.35Schristos			tzselect.ksh workman.sh
4161.1SmlelstvMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
4171.1Smlelstv			tzfile.5 tzselect.8 zic.8 zdump.8
4181.16SchristosMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
4191.16Schristos			time2posix.3.txt \
4201.16Schristos			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
4211.16Schristos			date.1.txt
4221.38SchristosCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
4231.38Schristos			NEWS README theory.html version
4241.32SchristosWEB_PAGES=	tz-art.htm tz-how-to.html tz-link.htm
4251.23SchristosDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
4261.1SmlelstvPRIMARY_YDATA=	africa antarctica asia australasia \
4271.1Smlelstv		europe northamerica southamerica
4281.38SchristosYDATA=		$(PRIMARY_YDATA) etcetera $(BACKWARD)
4291.4SchristosNDATA=		systemv factory
4301.16SchristosTDATA=		$(YDATA) $(NDATA)
4311.22SchristosZONETABLES=	zone1970.tab zone.tab
4321.38SchristosTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
4331.16SchristosLEAP_DEPS=	leapseconds.awk leap-seconds.list
4341.38SchristosTZDATA_ZI_DEPS=	zishrink.awk $(TDATA) $(PACKRATDATA)
4351.38SchristosDATA=		$(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \
4361.38Schristos			leapseconds yearistype.sh $(ZONETABLES)
4371.38SchristosAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk zishrink.awk
4381.23SchristosMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
4391.34SchristosTZS_YEAR=	2050
4401.34SchristosTZS=		to$(TZS_YEAR).tzs
4411.34SchristosTZS_NEW=	to$(TZS_YEAR)new.tzs
4421.34SchristosTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
4431.34Schristos			private.h tzfile.h zdump.c zic.c
4441.38SchristosENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
4451.34Schristos
4461.34Schristos# Consult these files when deciding whether to rebuild the 'version' file.
4471.34Schristos# This list is not the same as the output of 'git ls-files', since
4481.34Schristos# .gitignore is not distributed.
4491.34SchristosVERSION_DEPS= \
4501.38Schristos		calendars CONTRIBUTING LICENSE Makefile NEWS README \
4511.34Schristos		africa antarctica asctime.c asia australasia \
4521.34Schristos		backward backzone \
4531.34Schristos		checklinks.awk checktab.awk \
4541.34Schristos		date.1 date.c difftime.c \
4551.34Schristos		etcetera europe factory iso3166.tab \
4561.34Schristos		leap-seconds.list leapseconds.awk localtime.c \
4571.34Schristos		newctime.3 newstrftime.3 newtzset.3 northamerica \
4581.34Schristos		pacificnew private.h \
4591.38Schristos		southamerica strftime.c systemv theory.html \
4601.34Schristos		time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \
4611.34Schristos		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
4621.34Schristos		workman.sh yearistype.sh \
4631.34Schristos		zdump.8 zdump.c zic.8 zic.c \
4641.34Schristos		zone.tab zone1970.tab zoneinfo2tdf.pl
4651.1Smlelstv
4661.1Smlelstv# And for the benefit of csh users on systems that assume the user
4671.1Smlelstv# shell should be used to handle commands in Makefiles. . .
4681.1Smlelstv
4691.1SmlelstvSHELL=		/bin/sh
4701.1Smlelstv
4711.32Schristosall:		tzselect yearistype zic zdump libtz.a $(TABDATA)
4721.1Smlelstv
4731.29SchristosALL:		all date $(ENCHILADA)
4741.1Smlelstv
4751.16Schristosinstall:	all $(DATA) $(REDO) $(MANS)
4761.16Schristos		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
4771.16Schristos			$(DESTDIR)$(LIBDIR) \
4781.16Schristos			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
4791.16Schristos			$(DESTDIR)$(MANDIR)/man8
4801.32Schristos		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES)
4811.38Schristos		cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/.
4821.15Schristos		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
4831.16Schristos		cp libtz.a $(DESTDIR)$(LIBDIR)/.
4841.16Schristos		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
4851.16Schristos		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
4861.16Schristos		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
4871.16Schristos		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
4881.1Smlelstv
4891.1SmlelstvINSTALL:	ALL install date.1
4901.16Schristos		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
4911.15Schristos		cp date $(DESTDIR)$(BINDIR)/.
4921.16Schristos		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
4931.1Smlelstv
4941.34Schristosversion:	$(VERSION_DEPS)
4951.35Schristos		{ (type git) >/dev/null 2>&1 && \
4961.35Schristos		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
4971.35Schristos				--abbrev=7 --dirty` || \
4981.34Schristos		  V=$(VERSION); } && \
4991.35Schristos		printf '%s\n' "$$V" >$@.out
5001.35Schristos		mv $@.out $@
5011.34Schristos
5021.38Schristos# This file can be tailored by setting BACKWARD, PACKRATDATA, etc.
5031.38Schristostzdata.zi:	$(TZDATA_ZI_DEPS)
5041.38Schristos		LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out
5051.38Schristos		mv $@.out $@
5061.38Schristos
5071.34Schristosversion.h:	version
5081.35Schristos		VERSION=`cat version` && printf '%s\n' \
5091.35Schristos		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
5101.35Schristos		  "static char const TZVERSION[]=\"$$VERSION\";" \
5111.35Schristos		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
5121.35Schristos		  >$@.out
5131.35Schristos		mv $@.out $@
5141.6Schristos
5151.1Smlelstvzdump:		$(TZDOBJS)
5161.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
5171.1Smlelstv
5181.32Schristoszic:		$(TZCOBJS)
5191.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
5201.1Smlelstv
5211.1Smlelstvyearistype:	yearistype.sh
5221.1Smlelstv		cp yearistype.sh yearistype
5231.1Smlelstv		chmod +x yearistype
5241.1Smlelstv
5251.16Schristosleapseconds:	$(LEAP_DEPS)
5261.35Schristos		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
5271.35Schristos		mv $@.out $@
5281.15Schristos
5291.32Schristos# Arguments to pass to submakes of install_data.
5301.32Schristos# They can be overridden by later submake arguments.
5311.32SchristosINSTALLARGS = \
5321.38Schristos BACKWARD=$(BACKWARD) \
5331.32Schristos DESTDIR=$(DESTDIR) \
5341.32Schristos LEAPSECONDS='$(LEAPSECONDS)' \
5351.32Schristos PACKRATDATA='$(PACKRATDATA)' \
5361.32Schristos TZDIR=$(TZDIR) \
5371.32Schristos YEARISTYPE=$(YEARISTYPE) \
5381.32Schristos ZIC='$(ZIC)'
5391.32Schristos
5401.32Schristos# 'make install_data' installs one set of tz binary files.
5411.38Schristosinstall_data:	zic leapseconds yearistype tzdata.zi
5421.38Schristos		$(ZIC_INSTALL) tzdata.zi
5431.32Schristos
5441.32Schristosposix_only:
5451.32Schristos		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
5461.32Schristos
5471.32Schristosright_only:
5481.32Schristos		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
5491.32Schristos			install_data
5501.1Smlelstv
5511.1Smlelstv# In earlier versions of this makefile, the other two directories were
5521.1Smlelstv# subdirectories of $(TZDIR).  However, this led to configuration errors.
5531.1Smlelstv# For example, with posix_right under the earlier scheme,
5541.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
5551.1Smlelstv# but gmtime without leap seconds, which led to problems with applications
5561.1Smlelstv# like sendmail that subtract gmtime from localtime.
5571.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR).
5581.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds
5591.1Smlelstv# to using them, or vice versa.
5601.32Schristosright_posix:	right_only
5611.15Schristos		rm -fr $(DESTDIR)$(TZDIR)-leaps
5621.15Schristos		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
5631.32Schristos		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
5641.32Schristos		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
5651.15Schristos
5661.32Schristosposix_right:	posix_only
5671.15Schristos		rm -fr $(DESTDIR)$(TZDIR)-posix
5681.15Schristos		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
5691.32Schristos		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
5701.32Schristos		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
5711.32Schristos
5721.32Schristos# This obsolescent rule is present for backwards compatibility with
5731.32Schristos# tz releases 2014g through 2015g.  It should go away eventually.
5741.32Schristosposix_packrat:
5751.32Schristos		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
5761.23Schristos
5771.1Smlelstvzones:		$(REDO)
5781.1Smlelstv
5791.38Schristos$(TZS_NEW):	tzdata.zi zdump zic
5801.34Schristos		mkdir -p tzs.dir
5811.38Schristos		$(zic) -d tzs.dir tzdata.zi
5821.38Schristos		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
5831.38Schristos		   tzdata.zi | LC_ALL=C sort >$@.out
5841.35Schristos		wd=`pwd` && \
5851.35Schristos		zones=`$(AWK) -v wd="$$wd" \
5861.38Schristos				'/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \
5871.35Schristos			 | LC_ALL=C sort` && \
5881.34Schristos		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
5891.35Schristos		sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out
5901.34Schristos		rm -fr tzs.dir $@.out
5911.35Schristos		mv $@.sed.out $@
5921.34Schristos
5931.34Schristos# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
5941.34Schristos# If it exists but 'make check_tzs' fails, a maintainer should inspect the
5951.34Schristos# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
5961.34Schristos$(TZS):
5971.34Schristos		$(MAKE) force_tzs
5981.34Schristos
5991.34Schristosforce_tzs:	$(TZS_NEW)
6001.34Schristos		cp $(TZS_NEW) $(TZS)
6011.34Schristos
6021.16Schristoslibtz.a:	$(LIBOBJS)
6031.37Schristos		rm -f $@
6041.37Schristos		$(AR) -rc $@ $(LIBOBJS)
6051.16Schristos		$(RANLIB) $@
6061.1Smlelstv
6071.1Smlelstvdate:		$(DATEOBJS)
6081.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
6091.1Smlelstv
6101.34Schristostzselect:	tzselect.ksh version
6111.35Schristos		VERSION=`cat version` && sed \
6121.9Schristos			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
6131.1Smlelstv			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
6141.9Schristos			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
6151.9Schristos			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
6161.1Smlelstv			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
6171.35Schristos			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
6181.35Schristos			<$@.ksh >$@.out
6191.35Schristos		chmod +x $@.out
6201.35Schristos		mv $@.out $@
6211.1Smlelstv
6221.38Schristoscheck:		check_character_set check_white_space check_links \
6231.38Schristos		  check_name_lengths check_sorted \
6241.38Schristos		  check_tables check_web check_zishrink check_tzs
6251.9Schristos
6261.9Schristoscheck_character_set: $(ENCHILADA)
6271.38Schristos	test ! '$(UTF8_LOCALE)' || \
6281.38Schristos	! printf 'A\304\200B\n' | \
6291.38Schristos	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
6301.38Schristos		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
6311.22Schristos		sharp='#' && \
6321.35Schristos		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
6331.35Schristos			$(MISC) $(SOURCES) $(WEB_PAGES) \
6341.38Schristos			CONTRIBUTING LICENSE Makefile README \
6351.38Schristos			version tzdata.zi && \
6361.23Schristos		! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
6371.29Schristos			leapseconds yearistype.sh zone.tab && \
6381.38Schristos		! grep -Env $(OK_LINE) $(ENCHILADA); \
6391.38Schristos	}
6401.22Schristos
6411.23Schristoscheck_white_space: $(ENCHILADA)
6421.35Schristos		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
6431.35Schristos		! grep -En "$$pat" $(ENCHILADA)
6441.27Schristos		! grep -n '[[:space:]]$$' $(ENCHILADA)
6451.23Schristos
6461.38SchristosPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
6471.38SchristosFILE_NAME_COMPONENT_TOO_LONG = \
6481.38Schristos  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
6491.38Schristos
6501.38Schristoscheck_name_lengths: $(TDATA) backzone
6511.38Schristos		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone
6521.38Schristos
6531.23SchristosCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
6541.23Schristos
6551.23Schristoscheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
6561.23Schristos		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
6571.23Schristos		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
6581.23Schristos		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
6591.23Schristos		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
6601.23Schristos		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
6611.23Schristos		  LC_ALL=C sort -c
6621.23Schristos		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
6631.23Schristos		  LC_ALL=C sort -cu
6641.23Schristos
6651.26Schristoscheck_links:	checklinks.awk $(TDATA)
6661.26Schristos		$(AWK) -f checklinks.awk $(TDATA)
6671.38Schristos		$(AWK) -f checklinks.awk tzdata.zi
6681.26Schristos
6691.22Schristoscheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
6701.22Schristos		for tab in $(ZONETABLES); do \
6711.22Schristos		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
6721.22Schristos		    || exit; \
6731.22Schristos		done
6741.1Smlelstv
6751.34Schristoscheck_tzs:	$(TZS) $(TZS_NEW)
6761.34Schristos		diff -u $(TZS) $(TZS_NEW)
6771.34Schristos
6781.38Schristos# This checks only the HTML 4.01 strict page.
6791.38Schristos# To check the the other pages, use <https://validator.w3.org/>.
6801.38Schristoscheck_web:	tz-how-to.html
6811.38Schristos		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
6821.38Schristos
6831.38Schristos# Check that tzdata.zi generates the same binary data that its sources do.
6841.38Schristoscheck_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA)
6851.38Schristos		for type in posix right; do \
6861.38Schristos		  mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \
6871.38Schristos		  case $$type in \
6881.38Schristos		    right) leap='-L leapseconds';; \
6891.38Schristos	            *) leap=;; \
6901.38Schristos		  esac && \
6911.38Schristos		  $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \
6921.38Schristos		  $(AWK) '/^Rule/' $(TDATA) | \
6931.38Schristos		    $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \
6941.38Schristos		  $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
6951.38Schristos		  diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
6961.38Schristos		done
6971.38Schristos		rm -fr time_t.dir
6981.1Smlelstv
6991.14Schristosclean_misc:
7001.6Schristos		rm -f core *.o *.out \
7011.18Schristos		  date tzselect version.h zdump zic yearistype libtz.a
7021.14Schristosclean:		clean_misc
7031.38Schristos		rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW)
7041.1Smlelstv
7051.1Smlelstvmaintainer-clean: clean
7061.1Smlelstv		@echo 'This command is intended for maintainers to use; it'
7071.1Smlelstv		@echo 'deletes files that may need special tools to rebuild.'
7081.34Schristos		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
7091.1Smlelstv
7101.1Smlelstvnames:
7111.1Smlelstv		@echo $(ENCHILADA)
7121.1Smlelstv
7131.23Schristospublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
7141.16Schristos		tarballs signatures
7151.16Schristos
7161.16Schristosdate.1.txt:	date.1
7171.16Schristosnewctime.3.txt:	newctime.3
7181.16Schristosnewstrftime.3.txt: newstrftime.3
7191.16Schristosnewtzset.3.txt:	newtzset.3
7201.16Schristostime2posix.3.txt: time2posix.3
7211.16Schristostzfile.5.txt:	tzfile.5
7221.16Schristostzselect.8.txt:	tzselect.8
7231.16Schristoszdump.8.txt:	zdump.8
7241.16Schristoszic.8.txt:	zic.8
7251.16Schristos
7261.16Schristos$(MANTXTS):	workman.sh
7271.35Schristos		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
7281.35Schristos		mv $@.out $@
7291.9Schristos
7301.6Schristos# Set the time stamps to those of the git repository, if available,
7311.6Schristos# and if the files have not changed since then.
7321.6Schristos# This uses GNU 'touch' syntax 'touch -d@N FILE',
7331.6Schristos# where N is the number of seconds since 1970.
7341.16Schristos# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
7351.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds'
7361.16Schristos# to be the maximum of the files it depends on.
7371.16Schristosset-timestamps.out: $(ENCHILADA)
7381.16Schristos		rm -f $@
7391.35Schristos		if (type git) >/dev/null 2>&1 && \
7401.35Schristos		   files=`git ls-files $(ENCHILADA)` && \
7411.16Schristos		   touch -md @1 test.out; then \
7421.16Schristos		  rm -f test.out && \
7431.16Schristos		  for file in $$files; do \
7441.16Schristos		    if git diff --quiet $$file; then \
7451.16Schristos		      time=`git log -1 --format='tformat:%ct' $$file` && \
7461.16Schristos		      touch -cmd @$$time $$file; \
7471.16Schristos		    else \
7481.16Schristos		      echo >&2 "$$file: warning: does not match repository"; \
7491.16Schristos		    fi || exit; \
7501.16Schristos		  done; \
7511.16Schristos		fi
7521.16Schristos		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
7531.16Schristos		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
7541.16Schristos		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
7551.16Schristos		    exit; \
7561.6Schristos		done
7571.38Schristos		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
7581.35Schristos		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
7591.35Schristos		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
7601.16Schristos		touch $@
7611.6Schristos
7621.1Smlelstv# The zics below ensure that each data file can stand on its own.
7631.1Smlelstv# We also do an all-files run to catch links to links.
7641.1Smlelstv
7651.29Schristoscheck_public:
7661.29Schristos		$(MAKE) maintainer-clean
7671.29Schristos		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
7681.34Schristos		mkdir -p public.dir
7691.38Schristos		for i in $(TDATA) tzdata.zi; do \
7701.34Schristos		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
7711.9Schristos		done
7721.34Schristos		$(zic) -v -d public.dir $(TDATA)
7731.34Schristos		rm -fr public.dir
7741.9Schristos
7751.14Schristos# Check that the code works under various alternative
7761.14Schristos# implementations of time_t.
7771.14Schristoscheck_time_t_alternatives:
7781.23Schristos		if diff -q Makefile Makefile 2>/dev/null; then \
7791.23Schristos		  quiet_option='-q'; \
7801.23Schristos		else \
7811.23Schristos		  quiet_option=''; \
7821.23Schristos		fi && \
7831.35Schristos		wd=`pwd` && \
7841.22Schristos		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
7851.14Schristos		for type in $(TIME_T_ALTERNATIVES); do \
7861.34Schristos		  mkdir -p time_t.dir/$$type && \
7871.29Schristos		  $(MAKE) clean_misc && \
7881.35Schristos		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
7891.14Schristos		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
7901.23Schristos		    REDO='$(REDO)' \
7911.14Schristos		    install && \
7921.23Schristos		  diff $$quiet_option -r \
7931.34Schristos		    time_t.dir/int64_t/etc/zoneinfo \
7941.34Schristos		    time_t.dir/$$type/etc/zoneinfo && \
7951.14Schristos		  case $$type in \
7961.14Schristos		  int32_t) range=-2147483648,2147483647;; \
7971.14Schristos		  uint32_t) range=0,4294967296;; \
7981.14Schristos		  int64_t) continue;; \
7991.14Schristos		  *u*) range=0,10000000000;; \
8001.14Schristos		  *) range=-10000000000,10000000000;; \
8011.14Schristos		  esac && \
8021.14Schristos		  echo checking $$type zones ... && \
8031.34Schristos		  time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \
8041.34Schristos		      >time_t.dir/int64_t.out && \
8051.34Schristos		  time_t.dir/$$type/etc/zdump -V -t $$range $$zones \
8061.34Schristos		      >time_t.dir/$$type.out && \
8071.34Schristos		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
8081.14Schristos		    || exit; \
8091.14Schristos		done
8101.34Schristos		rm -fr time_t.dir
8111.34Schristos
8121.35Schristostarballs traditional_tarballs signatures traditional_signatures: version
8131.35Schristos		VERSION=`cat version` && \
8141.35Schristos		$(MAKE) VERSION="$$VERSION" $@_version
8151.35Schristos
8161.38Schristostarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
8171.38Schristostraditional_tarballs_version: \
8181.38Schristos  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
8191.35Schristossignatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
8201.35Schristostraditional_signatures_version: \
8211.35Schristos  tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
8221.9Schristos
8231.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out
8241.6Schristos		LC_ALL=C && export LC_ALL && \
8251.7Schristos		tar $(TARFLAGS) -cf - \
8261.23Schristos		    $(COMMON) $(DOCS) $(SOURCES) | \
8271.38Schristos		  gzip $(GZIPFLAGS) >$@.out
8281.35Schristos		mv $@.out $@
8291.10Schristos
8301.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out
8311.6Schristos		LC_ALL=C && export LC_ALL && \
8321.23Schristos		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
8331.38Schristos		  gzip $(GZIPFLAGS) >$@.out
8341.35Schristos		mv $@.out $@
8351.9Schristos
8361.34Schristostzdb-$(VERSION).tar.lz: set-timestamps.out
8371.34Schristos		rm -fr tzdb-$(VERSION)
8381.34Schristos		mkdir tzdb-$(VERSION)
8391.34Schristos		ln $(ENCHILADA) tzdb-$(VERSION)
8401.35Schristos		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
8411.34Schristos		LC_ALL=C && export LC_ALL && \
8421.35Schristos		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
8431.35Schristos		mv $@.out $@
8441.9Schristos
8451.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
8461.9Schristos		gpg --armor --detach-sign $?
8471.9Schristos
8481.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
8491.9Schristos		gpg --armor --detach-sign $?
8501.1Smlelstv
8511.34Schristostzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
8521.34Schristos		gpg --armor --detach-sign $?
8531.34Schristos
8541.1Smlelstvtypecheck:
8551.29Schristos		$(MAKE) clean
8561.15Schristos		for i in "long long" unsigned; \
8571.1Smlelstv		do \
8581.29Schristos			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
8591.1Smlelstv			./zdump -v Europe/Rome ; \
8601.29Schristos			$(MAKE) clean ; \
8611.1Smlelstv		done
8621.1Smlelstv
8631.38Schristoszonenames:	tzdata.zi
8641.38Schristos		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
8651.1Smlelstv
8661.1Smlelstvasctime.o:	private.h tzfile.h
8671.1Smlelstvdate.o:		private.h
8681.1Smlelstvdifftime.o:	private.h
8691.1Smlelstvlocaltime.o:	private.h tzfile.h
8701.23Schristosstrftime.o:	private.h tzfile.h
8711.6Schristoszdump.o:	version.h
8721.6Schristoszic.o:		private.h tzfile.h version.h
8731.1Smlelstv
8741.1Smlelstv.KEEP_STATE:
8751.22Schristos
8761.22Schristos.PHONY: ALL INSTALL all
8771.26Schristos.PHONY: check check_character_set check_links
8781.26Schristos.PHONY: check_public check_sorted check_tables
8791.34Schristos.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
8801.38Schristos.PHONY: check_zishrink
8811.34Schristos.PHONY: clean clean_misc force_tzs
8821.32Schristos.PHONY: install install_data maintainer-clean names
8831.32Schristos.PHONY: posix_only posix_packrat posix_right
8841.34Schristos.PHONY: public right_only right_posix signatures signatures_version
8851.34Schristos.PHONY: tarballs tarballs_version typecheck
8861.22Schristos.PHONY: zonenames zones
887