Makefile revision 1.39
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
461.39Schristos# Installation locations.
471.39Schristos#
481.39Schristos# The defaults are suitable for Debian, except that if REDO is
491.39Schristos# posix_right or right_posix then files that Debian puts under
501.39Schristos# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
511.39Schristos# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
521.39Schristos# respectively.  Problems with the Debian approach are discussed in
531.39Schristos# the commentary for the right_posix rule (below).
541.39Schristos
551.39Schristos# Destination directory, which can be used for staging.
561.39Schristos# 'make DESTDIR=/stage install' installs under /stage (e.g., to
571.39Schristos# /stage/etc/localtime instead of to /etc/localtime).  Files under
581.39Schristos# /stage are not intended to work as-is, but can be copied by hand to
591.39Schristos# the root directory later.  If DESTDIR is empty, 'make install' does
601.39Schristos# not stage, but installs directly into production locations.
611.39SchristosDESTDIR =
621.39Schristos
631.39Schristos# Everything is installed into subdirectories of TOPDIR, and used there.
641.39Schristos# TOPDIR should be empty (meaning the root directory),
651.39Schristos# or a directory name that does not end in "/".
661.39Schristos# TOPDIR should be empty or an absolute name unless you're just testing.
671.39SchristosTOPDIR =
681.39Schristos
691.39Schristos# The default local time zone is taken from the file TZDEFAULT.
701.39SchristosTZDEFAULT = $(TOPDIR)/etc/localtime
711.39Schristos
721.39Schristos# The subdirectory containing installed program and data files, and
731.39Schristos# likewise for installed files that can be shared among architectures.
741.39Schristos# These should be relative file names.
751.39SchristosUSRDIR = usr
761.39SchristosUSRSHAREDIR = $(USRDIR)/share
771.1Smlelstv
781.1Smlelstv# "Compiled" time zone information is placed in the "TZDIR" directory
791.1Smlelstv# (and subdirectories).
801.38Schristos# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
811.15SchristosTZDIR_BASENAME=	zoneinfo
821.39SchristosTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
831.1Smlelstv
841.39Schristos# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
851.39SchristosBINDIR = $(TOPDIR)/$(USRDIR)/bin
861.1Smlelstv
871.39Schristos# The "zdump" command goes in:
881.39SchristosZDUMPDIR = $(BINDIR)
891.1Smlelstv
901.39Schristos# The "zic" command goes in:
911.39SchristosZICDIR = $(TOPDIR)/$(USRDIR)/sbin
921.1Smlelstv
931.1Smlelstv# Manual pages go in subdirectories of. . .
941.39SchristosMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
951.1Smlelstv
961.39Schristos# Library functions are put in an archive in LIBDIR.
971.39SchristosLIBDIR = $(TOPDIR)/$(USRDIR)/lib
981.1Smlelstv
991.1Smlelstv
1001.39Schristos# Types to try, as an alternative to time_t.  int64_t should be first.
1011.39SchristosTIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
1021.1Smlelstv
1031.37Schristos# If you want only POSIX time, with time values interpreted as
1041.37Schristos# seconds since the epoch (not counting leap seconds), use
1051.1Smlelstv#	REDO=		posix_only
1061.38Schristos# below.  If you want only "right" time, with values interpreted
1071.37Schristos# as seconds since the epoch (counting leap seconds), use
1081.1Smlelstv#	REDO=		right_only
1091.1Smlelstv# below.  If you want both sets of data available, with leap seconds not
1101.1Smlelstv# counted normally, use
1111.1Smlelstv#	REDO=		posix_right
1121.1Smlelstv# below.  If you want both sets of data available, with leap seconds counted
1131.1Smlelstv# normally, use
1141.1Smlelstv#	REDO=		right_posix
1151.32Schristos# below.  POSIX mandates that leap seconds not be counted; for compatibility
1161.37Schristos# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
1171.37Schristos# leap smearing; this can work better than unsmeared "right" time with
1181.37Schristos# applications that are not leap second aware, and is closer to unsmeared
1191.37Schristos# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
1201.1Smlelstv
1211.1SmlelstvREDO=		posix_right
1221.1Smlelstv
1231.38Schristos# To install data in text form that has all the information of the binary data,
1241.38Schristos# (optionally incorporating leap second information), use
1251.38Schristos#	TZDATA_TEXT=	tzdata.zi leapseconds
1261.38Schristos# To install text data without leap second information (e.g., because
1271.38Schristos# REDO='posix_only'), use
1281.38Schristos#	TZDATA_TEXT=	tzdata.zi
1291.38Schristos# To avoid installing text data, use
1301.38Schristos#	TZDATA_TEXT=
1311.38Schristos
1321.38SchristosTZDATA_TEXT=	leapseconds tzdata.zi
1331.38Schristos
1341.38Schristos# For backward-compatibility links for old zone names, use
1351.39Schristos#	BACKWARD=	backward
1361.39Schristos# If you also want the link US/Pacific-New, even though it is confusing
1371.39Schristos# and is planned to be removed from the database eventually, use
1381.38Schristos#	BACKWARD=	backward pacificnew
1391.38Schristos# To omit these links, use
1401.38Schristos#	BACKWARD=
1411.38Schristos
1421.39SchristosBACKWARD=	backward
1431.38Schristos
1441.32Schristos# If you want out-of-scope and often-wrong data from the file 'backzone', use
1451.32Schristos#	PACKRATDATA=	backzone
1461.32Schristos# To omit this data, use
1471.32Schristos#	PACKRATDATA=
1481.32Schristos
1491.32SchristosPACKRATDATA=
1501.32Schristos
1511.38Schristos# The name of a locale using the UTF-8 encoding, used during self-tests.
1521.38Schristos# The tests are skipped if the name does not appear to work on this system.
1531.38Schristos
1541.38SchristosUTF8_LOCALE=	en_US.utf8
1551.38Schristos
1561.1Smlelstv# Since "." may not be in PATH...
1571.1Smlelstv
1581.1SmlelstvYEARISTYPE=	./yearistype
1591.1Smlelstv
1601.1Smlelstv# Non-default libraries needed to link.
1611.1SmlelstvLDLIBS=
1621.1Smlelstv
1631.38Schristos# Add the following to the end of the "CFLAGS=" line as needed to override
1641.38Schristos# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
1651.19Schristos#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
1661.38Schristos#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
1671.38Schristos#	formats that generate only the last two digits of year numbers
1681.38Schristos#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
1691.38Schristos#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
1701.38Schristos#	than what POSIX specifies, assuming local time is UT.
1711.38Schristos#	For example, N is 252460800 on AmigaOS.
1721.32Schristos#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
1731.38Schristos#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
1741.32Schristos#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
1751.38Schristos#  -DHAVE_GENERIC=0 if _Generic does not work
1761.38Schristos#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
1771.38Schristos#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
1781.35Schristos#	ctime_r and asctime_r incompatibly with the POSIX standard
1791.35Schristos#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
1801.38Schristos#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
1811.16Schristos#  -DHAVE_LINK=0 if your system lacks a link function
1821.23Schristos#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
1831.23Schristos#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
1841.23Schristos#	localtime_rz can make zdump significantly faster, but is nonstandard.
1851.32Schristos#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
1861.32Schristos#	functions like 'link' or variables like 'tzname' required by POSIX
1871.38Schristos#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
1881.38Schristos#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
1891.38Schristos#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
1901.38Schristos#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
1911.28Schristos#  -DHAVE_STRDUP=0 if your system lacks the strdup function
1921.1Smlelstv#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
1931.38Schristos#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
1941.38Schristos#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
1951.23Schristos#  -DHAVE_TZSET=0 if your system lacks a tzset function
1961.38Schristos#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
1971.38Schristos#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
1981.38Schristos#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
1991.38Schristos#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
2001.23Schristos#	not needed by the main-program tz code, which is single-threaded.
2011.23Schristos#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
2021.14Schristos#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
2031.38Schristos#	This is intended for internal use only; it mangles external names.
2041.1Smlelstv#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
2051.22Schristos#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
2061.1Smlelstv#	the default is system-supplied, typically "/usr/lib/locale"
2071.14Schristos#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
2081.38Schristos#	DST transitions if the time zone files cannot be accessed
2091.38Schristos#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
2101.23Schristos#	other than simply getting garbage data
2111.23Schristos#  -DUSE_LTZ=0 to build zdump with the system time zone library
2121.23Schristos#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
2131.1Smlelstv#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
2141.1Smlelstv#	(or some other number) to set the maximum time zone abbreviation length
2151.1Smlelstv#	that zic will accept without a warning (the default is 6)
2161.30Schristos#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
2171.38Schristos# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
2181.38SchristosGCC_INSTRUMENT = \
2191.38Schristos  -fsanitize=undefined -fsanitize-address-use-after-scope \
2201.38Schristos  -fsanitize-undefined-trap-on-error -fstack-protector
2211.38SchristosGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
2221.38Schristos  $(GCC_INSTRUMENT) \
2231.38Schristos  -Wall -Wextra \
2241.38Schristos  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
2251.38Schristos  -Wbad-function-cast -Wcast-align -Wdate-time \
2261.38Schristos  -Wdeclaration-after-statement -Wdouble-promotion \
2271.38Schristos  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
2281.38Schristos  -Winit-self -Wjump-misses-init -Wlogical-op \
2291.38Schristos  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
2301.38Schristos  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
2311.38Schristos  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
2321.38Schristos  -Wsuggest-attribute=const -Wsuggest-attribute=format \
2331.38Schristos  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
2341.38Schristos  -Wtrampolines -Wundef -Wuninitialized -Wunused \
2351.38Schristos  -Wvariadic-macros -Wvla -Wwrite-strings \
2361.38Schristos  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
2371.38Schristos  -Wno-type-limits -Wno-unused-parameter
2381.1Smlelstv#
2391.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s
2401.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
2411.1Smlelstv# add the name to a define such as
2421.1Smlelstv#	-DTM_GMTOFF=tm_gmtoff
2431.23Schristos# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
2441.23Schristos# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
2451.23Schristos# Similarly, if your system has a "zone abbreviation" field, define
2461.1Smlelstv#	-DTM_ZONE=tm_zone
2471.23Schristos# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
2481.23Schristos# required by POSIX, but are widely available on GNU/Linux and BSD systems.
2491.1Smlelstv#
2501.38Schristos# The next batch of options control support for external variables
2511.38Schristos# exported by tzcode.  In practice these variables are less useful
2521.38Schristos# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
2531.38Schristos# #
2541.38Schristos# # To omit or support the external variable "tzname", add one of:
2551.38Schristos# #	-DHAVE_TZNAME=0
2561.38Schristos# #	-DHAVE_TZNAME=1
2571.38Schristos# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
2581.38Schristos# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
2591.38Schristos# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
2601.38Schristos# # crashes when combined with some platforms' standard libraries,
2611.38Schristos# # presumably due to memory allocation issues.
2621.38Schristos# #
2631.38Schristos# # To omit or support the external variables "timezone" and "daylight", add
2641.38Schristos# #	-DUSG_COMPAT=0
2651.38Schristos# #	-DUSG_COMPAT=1
2661.38Schristos# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
2671.38Schristos# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
2681.38Schristos# # If not defined, the code attempts to guess USG_COMPAT from other macros.
2691.38Schristos# #
2701.38Schristos# # To support the external variable "altzone", add
2711.38Schristos# #	-DALTZONE
2721.38Schristos# # to the end of the "CFLAGS=" line; although "altzone" appeared in
2731.38Schristos# # System V Release 3.1 it has not been standardized.
2741.38Schristos#
2751.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work,
2761.1Smlelstv# add
2771.1Smlelstv#	-DSTD_INSPIRED
2781.1Smlelstv# to the end of the "CFLAGS=" line.  This arranges for the functions
2791.1Smlelstv# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
2801.1Smlelstv# "posix2time", and "time2posix" to be added to the time conversion library.
2811.1Smlelstv# "tzsetwall" is like "tzset" except that it arranges for local wall clock
2821.1Smlelstv# time (rather than the time specified in the TZ environment variable)
2831.1Smlelstv# to be used.
2841.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument
2851.1Smlelstv# that gives an offset to add to the time_t when converting it.
2861.1Smlelstv# "timelocal" is equivalent to "mktime".
2871.1Smlelstv# "timegm" is like "timelocal" except that it turns a struct tm into
2881.15Schristos# a time_t using UT (rather than local time as "timelocal" does).
2891.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument
2901.1Smlelstv# that gives an offset to use when converting to a time_t.
2911.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page.
2921.1Smlelstv# X3J11's work does not describe any of these functions.
2931.1Smlelstv# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
2941.1Smlelstv# These functions may well disappear in future releases of the time
2951.1Smlelstv# conversion package.
2961.1Smlelstv#
2971.23Schristos# If you don't want functions that were inspired by NetBSD, add
2981.23Schristos#	-DNETBSD_INSPIRED=0
2991.23Schristos# to the end of the "CFLAGS=" line.  Otherwise, the functions
3001.23Schristos# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
3011.23Schristos# time library, and if STD_INSPIRED is also defined the functions
3021.23Schristos# "posix2time_z" and "time2posix_z" are added as well.
3031.23Schristos# The functions ending in "_z" (or "_rz") are like their unsuffixed
3041.23Schristos# (or suffixed-by-"_r") counterparts, except with an extra first
3051.23Schristos# argument of opaque type timezone_t that specifies the time zone.
3061.23Schristos# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
3071.23Schristos#
3081.1Smlelstv# If you want to allocate state structures in localtime, add
3091.1Smlelstv#	-DALL_STATE
3101.1Smlelstv# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
3111.1Smlelstv#
3121.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
3131.1Smlelstv# out by the National Institute of Standards and Technology
3141.1Smlelstv# which claims to test C and Posix conformance.  If you want to pass PCTS, add
3151.1Smlelstv#	-DPCTS
3161.1Smlelstv# to the end of the "CFLAGS=" line.
3171.1Smlelstv#
3181.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add
3191.1Smlelstv#	-DXPG4_1994_04_09
3201.1Smlelstv# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
3211.38Schristos# 53 as a week number (rather than 52 or 53) for January days before
3221.38Schristos# January's first Monday when a "%V" format is used and January 1
3231.1Smlelstv# falls on a Friday, Saturday, or Sunday.
3241.1Smlelstv
3251.1SmlelstvCFLAGS=
3261.1Smlelstv
3271.9Schristos# Linker flags.  Default to $(LFLAGS) for backwards compatibility
3281.34Schristos# to release 2012h and earlier.
3291.9Schristos
3301.9SchristosLDFLAGS=	$(LFLAGS)
3311.1Smlelstv
3321.32Schristos# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
3331.32Schristos# submake command lines.  The default is no leap seconds.
3341.32Schristos
3351.32SchristosLEAPSECONDS=
3361.32Schristos
3371.32Schristos# The zic command and its arguments.
3381.32Schristos
3391.1Smlelstvzic=		./zic
3401.1SmlelstvZIC=		$(zic) $(ZFLAGS)
3411.1Smlelstv
3421.15SchristosZFLAGS=
3431.15Schristos
3441.34Schristos# How to use zic to install tz binary files.
3451.32Schristos
3461.39SchristosZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
3471.32Schristos
3481.22Schristos# The name of a Posix-compliant 'awk' on your system.
3491.9SchristosAWK=		awk
3501.9Schristos
3511.16Schristos# The full path name of a Posix-compliant shell, preferably one that supports
3521.16Schristos# the Korn shell's 'select' statement as an extension.
3531.16Schristos# These days, Bash is the most popular.
3541.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh
3551.16Schristos# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
3561.16Schristos# is typically nicer if it works.
3571.9SchristosKSHELL=		/bin/bash
3581.1Smlelstv
3591.18Schristos# The path where SGML DTDs are kept and the catalog file(s) to use when
3601.34Schristos# validating.  The default should work on both Debian and Red Hat.
3611.10SchristosSGML_TOPDIR= /usr
3621.9SchristosSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
3631.9SchristosSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
3641.18SchristosSGML_CATALOG_FILES= \
3651.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
3661.1Smlelstv
3671.1Smlelstv# The name, arguments and environment of a program to validate your web pages.
3681.34Schristos# See <http://openjade.sourceforge.net/doc/> for a validator, and
3691.34Schristos# <https://validator.w3.org/source/> for a validation library.
3701.38Schristos# Set VALIDATE=':' if you do not have such a program.
3711.1SmlelstvVALIDATE = nsgmls
3721.1SmlelstvVALIDATE_FLAGS = -s -B -wall -wno-unused-param
3731.1SmlelstvVALIDATE_ENV = \
3741.39Schristos  SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \
3751.39Schristos  SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \
3761.1Smlelstv  SP_CHARSET_FIXED=YES \
3771.1Smlelstv  SP_ENCODING=UTF-8
3781.1Smlelstv
3791.23Schristos# This expensive test requires USE_LTZ.
3801.23Schristos# To suppress it, define this macro to be empty.
3811.23SchristosCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
3821.23Schristos
3831.22Schristos# SAFE_CHAR is a regular expression that matches a safe character.
3841.22Schristos# Some parts of this distribution are limited to safe characters;
3851.22Schristos# others can use any UTF-8 character.
3861.22Schristos# For now, the safe characters are a safe subset of ASCII.
3871.9Schristos# The caller must set the shell variable 'sharp' to the character '#',
3881.9Schristos# since Makefile macros cannot contain '#'.
3891.9Schristos# TAB_CHAR is a single tab character, in single quotes.
3901.9SchristosTAB_CHAR=	'	'
3911.22SchristosSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
3921.22SchristosSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
3931.22SchristosSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
3941.29SchristosSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
3951.29SchristosSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
3961.29Schristos
3971.29Schristos# OK_CHAR matches any character allowed in the distributed files.
3981.29Schristos# This is the same as SAFE_CHAR, except that multibyte letters are
3991.29Schristos# also allowed so that commentary can contain people's names and quote
4001.29Schristos# non-English sources.  For non-letters the sources are limited to
4011.22Schristos# ASCII renderings for the convenience of maintainers whose text editors
4021.22Schristos# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
4031.29SchristosOK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
4041.22Schristos
4051.22Schristos# SAFE_LINE matches a line of safe characters.
4061.29Schristos# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
4071.22Schristos# this is so that comments can contain non-ASCII characters.
4081.29Schristos# OK_LINE matches a line of OK characters.
4091.22SchristosSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
4101.29SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
4111.29SchristosOK_LINE=	'^'$(OK_CHAR)'*$$'
4121.9Schristos
4131.6Schristos# Flags to give 'tar' when making a distribution.
4141.6Schristos# Try to use flags appropriate for GNU tar.
4151.34SchristosGNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
4161.6SchristosTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
4171.6Schristos		 then echo $(GNUTARFLAGS); \
4181.6Schristos		 else :; \
4191.6Schristos		 fi`
4201.6Schristos
4211.6Schristos# Flags to give 'gzip' when making a distribution.
4221.38SchristosGZIPFLAGS=	-9n
4231.6Schristos
4241.1Smlelstv###############################################################################
4251.1Smlelstv
4261.29Schristos#MAKE=		make
4271.29Schristos
4281.1Smlelstvcc=		cc
4291.39SchristosCC=		$(cc) -DTZDIR='"$(TZDIR)"'
4301.1Smlelstv
4311.16SchristosAR=		ar
4321.16Schristos
4331.16Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
4341.16SchristosRANLIB=		:
4351.16Schristos
4361.28SchristosTZCOBJS=	zic.o
4371.38SchristosTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
4381.1SmlelstvDATEOBJS=	date.o localtime.o strftime.o asctime.o
4391.1SmlelstvLIBSRCS=	localtime.c asctime.c difftime.c
4401.1SmlelstvLIBOBJS=	localtime.o asctime.o difftime.o
4411.1SmlelstvHEADERS=	tzfile.h private.h
4421.28SchristosNONLIBSRCS=	zic.c zdump.c
4431.1SmlelstvNEWUCBSRCS=	date.c strftime.c
4441.23SchristosSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
4451.35Schristos			tzselect.ksh workman.sh
4461.1SmlelstvMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
4471.1Smlelstv			tzfile.5 tzselect.8 zic.8 zdump.8
4481.16SchristosMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
4491.16Schristos			time2posix.3.txt \
4501.16Schristos			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
4511.16Schristos			date.1.txt
4521.38SchristosCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
4531.38Schristos			NEWS README theory.html version
4541.39SchristosWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
4551.23SchristosDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
4561.1SmlelstvPRIMARY_YDATA=	africa antarctica asia australasia \
4571.1Smlelstv		europe northamerica southamerica
4581.39SchristosYDATA=		$(PRIMARY_YDATA) etcetera
4591.4SchristosNDATA=		systemv factory
4601.39SchristosTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward pacificnew
4611.39SchristosTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
4621.22SchristosZONETABLES=	zone1970.tab zone.tab
4631.38SchristosTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
4641.16SchristosLEAP_DEPS=	leapseconds.awk leap-seconds.list
4651.39SchristosTZDATA_ZI_DEPS=	zishrink.awk version $(TDATA) $(PACKRATDATA)
4661.39SchristosDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
4671.38Schristos			leapseconds yearistype.sh $(ZONETABLES)
4681.38SchristosAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk zishrink.awk
4691.23SchristosMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
4701.34SchristosTZS_YEAR=	2050
4711.34SchristosTZS=		to$(TZS_YEAR).tzs
4721.34SchristosTZS_NEW=	to$(TZS_YEAR)new.tzs
4731.34SchristosTZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
4741.34Schristos			private.h tzfile.h zdump.c zic.c
4751.38SchristosENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
4761.34Schristos
4771.34Schristos# Consult these files when deciding whether to rebuild the 'version' file.
4781.34Schristos# This list is not the same as the output of 'git ls-files', since
4791.34Schristos# .gitignore is not distributed.
4801.34SchristosVERSION_DEPS= \
4811.38Schristos		calendars CONTRIBUTING LICENSE Makefile NEWS README \
4821.34Schristos		africa antarctica asctime.c asia australasia \
4831.34Schristos		backward backzone \
4841.34Schristos		checklinks.awk checktab.awk \
4851.34Schristos		date.1 date.c difftime.c \
4861.34Schristos		etcetera europe factory iso3166.tab \
4871.34Schristos		leap-seconds.list leapseconds.awk localtime.c \
4881.34Schristos		newctime.3 newstrftime.3 newtzset.3 northamerica \
4891.34Schristos		pacificnew private.h \
4901.38Schristos		southamerica strftime.c systemv theory.html \
4911.39Schristos		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
4921.34Schristos		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
4931.34Schristos		workman.sh yearistype.sh \
4941.34Schristos		zdump.8 zdump.c zic.8 zic.c \
4951.34Schristos		zone.tab zone1970.tab zoneinfo2tdf.pl
4961.1Smlelstv
4971.1Smlelstv# And for the benefit of csh users on systems that assume the user
4981.1Smlelstv# shell should be used to handle commands in Makefiles. . .
4991.1Smlelstv
5001.1SmlelstvSHELL=		/bin/sh
5011.1Smlelstv
5021.32Schristosall:		tzselect yearistype zic zdump libtz.a $(TABDATA)
5031.1Smlelstv
5041.29SchristosALL:		all date $(ENCHILADA)
5051.1Smlelstv
5061.16Schristosinstall:	all $(DATA) $(REDO) $(MANS)
5071.39Schristos		mkdir -p '$(DESTDIR)$(BINDIR)' \
5081.39Schristos			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
5091.39Schristos			'$(DESTDIR)$(LIBDIR)' \
5101.39Schristos			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
5111.39Schristos			'$(DESTDIR)$(MANDIR)/man8'
5121.39Schristos		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \
5131.39Schristos			-t '$(DESTDIR)$(TZDEFAULT)'
5141.39Schristos		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
5151.39Schristos		cp tzselect '$(DESTDIR)$(BINDIR)/.'
5161.39Schristos		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
5171.39Schristos		cp zic '$(DESTDIR)$(ZICDIR)/.'
5181.39Schristos		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
5191.39Schristos		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
5201.39Schristos		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
5211.39Schristos		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
5221.39Schristos		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
5231.1Smlelstv
5241.1SmlelstvINSTALL:	ALL install date.1
5251.39Schristos		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
5261.39Schristos		cp date '$(DESTDIR)$(BINDIR)/.'
5271.39Schristos		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
5281.1Smlelstv
5291.34Schristosversion:	$(VERSION_DEPS)
5301.35Schristos		{ (type git) >/dev/null 2>&1 && \
5311.35Schristos		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
5321.35Schristos				--abbrev=7 --dirty` || \
5331.39Schristos		  V='$(VERSION)'; } && \
5341.35Schristos		printf '%s\n' "$$V" >$@.out
5351.35Schristos		mv $@.out $@
5361.34Schristos
5371.38Schristos# This file can be tailored by setting BACKWARD, PACKRATDATA, etc.
5381.38Schristostzdata.zi:	$(TZDATA_ZI_DEPS)
5391.39Schristos		version=`sed 1q version` && \
5401.39Schristos		  LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
5411.39Schristos		    $(TDATA) $(PACKRATDATA) >$@.out
5421.38Schristos		mv $@.out $@
5431.38Schristos
5441.34Schristosversion.h:	version
5451.35Schristos		VERSION=`cat version` && printf '%s\n' \
5461.35Schristos		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
5471.35Schristos		  "static char const TZVERSION[]=\"$$VERSION\";" \
5481.35Schristos		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
5491.35Schristos		  >$@.out
5501.35Schristos		mv $@.out $@
5511.6Schristos
5521.1Smlelstvzdump:		$(TZDOBJS)
5531.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
5541.1Smlelstv
5551.32Schristoszic:		$(TZCOBJS)
5561.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
5571.1Smlelstv
5581.1Smlelstvyearistype:	yearistype.sh
5591.1Smlelstv		cp yearistype.sh yearistype
5601.1Smlelstv		chmod +x yearistype
5611.1Smlelstv
5621.16Schristosleapseconds:	$(LEAP_DEPS)
5631.35Schristos		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
5641.35Schristos		mv $@.out $@
5651.15Schristos
5661.32Schristos# Arguments to pass to submakes of install_data.
5671.32Schristos# They can be overridden by later submake arguments.
5681.32SchristosINSTALLARGS = \
5691.39Schristos BACKWARD='$(BACKWARD)' \
5701.39Schristos DESTDIR='$(DESTDIR)' \
5711.32Schristos LEAPSECONDS='$(LEAPSECONDS)' \
5721.32Schristos PACKRATDATA='$(PACKRATDATA)' \
5731.39Schristos TZDEFAULT='$(TZDEFAULT)' \
5741.39Schristos TZDIR='$(TZDIR)' \
5751.39Schristos YEARISTYPE='$(YEARISTYPE)' \
5761.32Schristos ZIC='$(ZIC)'
5771.32Schristos
5781.32Schristos# 'make install_data' installs one set of tz binary files.
5791.38Schristosinstall_data:	zic leapseconds yearistype tzdata.zi
5801.38Schristos		$(ZIC_INSTALL) tzdata.zi
5811.32Schristos
5821.32Schristosposix_only:
5831.32Schristos		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
5841.32Schristos
5851.32Schristosright_only:
5861.32Schristos		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
5871.32Schristos			install_data
5881.1Smlelstv
5891.1Smlelstv# In earlier versions of this makefile, the other two directories were
5901.1Smlelstv# subdirectories of $(TZDIR).  However, this led to configuration errors.
5911.1Smlelstv# For example, with posix_right under the earlier scheme,
5921.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
5931.1Smlelstv# but gmtime without leap seconds, which led to problems with applications
5941.1Smlelstv# like sendmail that subtract gmtime from localtime.
5951.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR).
5961.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds
5971.1Smlelstv# to using them, or vice versa.
5981.32Schristosright_posix:	right_only
5991.39Schristos		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
6001.39Schristos		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
6011.39Schristos		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
6021.39Schristos		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
6031.15Schristos
6041.32Schristosposix_right:	posix_only
6051.39Schristos		rm -fr '$(DESTDIR)$(TZDIR)-posix'
6061.39Schristos		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
6071.39Schristos		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
6081.39Schristos		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
6091.32Schristos
6101.32Schristos# This obsolescent rule is present for backwards compatibility with
6111.32Schristos# tz releases 2014g through 2015g.  It should go away eventually.
6121.32Schristosposix_packrat:
6131.32Schristos		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
6141.23Schristos
6151.1Smlelstvzones:		$(REDO)
6161.1Smlelstv
6171.38Schristos$(TZS_NEW):	tzdata.zi zdump zic
6181.34Schristos		mkdir -p tzs.dir
6191.38Schristos		$(zic) -d tzs.dir tzdata.zi
6201.38Schristos		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
6211.38Schristos		   tzdata.zi | LC_ALL=C sort >$@.out
6221.35Schristos		wd=`pwd` && \
6231.35Schristos		zones=`$(AWK) -v wd="$$wd" \
6241.38Schristos				'/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \
6251.35Schristos			 | LC_ALL=C sort` && \
6261.34Schristos		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
6271.35Schristos		sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out
6281.34Schristos		rm -fr tzs.dir $@.out
6291.35Schristos		mv $@.sed.out $@
6301.34Schristos
6311.34Schristos# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
6321.34Schristos# If it exists but 'make check_tzs' fails, a maintainer should inspect the
6331.34Schristos# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
6341.34Schristos$(TZS):
6351.34Schristos		$(MAKE) force_tzs
6361.34Schristos
6371.34Schristosforce_tzs:	$(TZS_NEW)
6381.34Schristos		cp $(TZS_NEW) $(TZS)
6391.34Schristos
6401.16Schristoslibtz.a:	$(LIBOBJS)
6411.37Schristos		rm -f $@
6421.37Schristos		$(AR) -rc $@ $(LIBOBJS)
6431.16Schristos		$(RANLIB) $@
6441.1Smlelstv
6451.1Smlelstvdate:		$(DATEOBJS)
6461.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
6471.1Smlelstv
6481.34Schristostzselect:	tzselect.ksh version
6491.35Schristos		VERSION=`cat version` && sed \
6501.9Schristos			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
6511.1Smlelstv			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
6521.9Schristos			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
6531.9Schristos			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
6541.1Smlelstv			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
6551.35Schristos			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
6561.35Schristos			<$@.ksh >$@.out
6571.35Schristos		chmod +x $@.out
6581.35Schristos		mv $@.out $@
6591.1Smlelstv
6601.38Schristoscheck:		check_character_set check_white_space check_links \
6611.38Schristos		  check_name_lengths check_sorted \
6621.38Schristos		  check_tables check_web check_zishrink check_tzs
6631.9Schristos
6641.9Schristoscheck_character_set: $(ENCHILADA)
6651.38Schristos	test ! '$(UTF8_LOCALE)' || \
6661.38Schristos	! printf 'A\304\200B\n' | \
6671.38Schristos	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
6681.38Schristos		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
6691.22Schristos		sharp='#' && \
6701.35Schristos		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
6711.35Schristos			$(MISC) $(SOURCES) $(WEB_PAGES) \
6721.38Schristos			CONTRIBUTING LICENSE Makefile README \
6731.38Schristos			version tzdata.zi && \
6741.39Schristos		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
6751.29Schristos			leapseconds yearistype.sh zone.tab && \
6761.38Schristos		! grep -Env $(OK_LINE) $(ENCHILADA); \
6771.38Schristos	}
6781.22Schristos
6791.23Schristoscheck_white_space: $(ENCHILADA)
6801.35Schristos		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
6811.35Schristos		! grep -En "$$pat" $(ENCHILADA)
6821.39Schristos		! grep -n '[[:space:]]$$' \
6831.39Schristos			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
6841.23Schristos
6851.38SchristosPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
6861.38SchristosFILE_NAME_COMPONENT_TOO_LONG = \
6871.38Schristos  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
6881.38Schristos
6891.39Schristoscheck_name_lengths: $(TDATA_TO_CHECK) backzone
6901.39Schristos		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
6911.39Schristos			$(TDATA_TO_CHECK) backzone
6921.38Schristos
6931.23SchristosCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
6941.23Schristos
6951.23Schristoscheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
6961.23Schristos		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
6971.23Schristos		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
6981.23Schristos		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
6991.23Schristos		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
7001.23Schristos		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
7011.23Schristos		  LC_ALL=C sort -c
7021.23Schristos		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
7031.23Schristos		  LC_ALL=C sort -cu
7041.23Schristos
7051.39Schristoscheck_links:	checklinks.awk $(TDATA_TO_CHECK)
7061.39Schristos		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
7071.38Schristos		$(AWK) -f checklinks.awk tzdata.zi
7081.26Schristos
7091.22Schristoscheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
7101.22Schristos		for tab in $(ZONETABLES); do \
7111.22Schristos		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
7121.22Schristos		    || exit; \
7131.22Schristos		done
7141.1Smlelstv
7151.34Schristoscheck_tzs:	$(TZS) $(TZS_NEW)
7161.34Schristos		diff -u $(TZS) $(TZS_NEW)
7171.34Schristos
7181.38Schristos# This checks only the HTML 4.01 strict page.
7191.38Schristos# To check the the other pages, use <https://validator.w3.org/>.
7201.38Schristoscheck_web:	tz-how-to.html
7211.38Schristos		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
7221.38Schristos
7231.38Schristos# Check that tzdata.zi generates the same binary data that its sources do.
7241.38Schristoscheck_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA)
7251.38Schristos		for type in posix right; do \
7261.38Schristos		  mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \
7271.38Schristos		  case $$type in \
7281.38Schristos		    right) leap='-L leapseconds';; \
7291.38Schristos	            *) leap=;; \
7301.38Schristos		  esac && \
7311.38Schristos		  $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \
7321.38Schristos		  $(AWK) '/^Rule/' $(TDATA) | \
7331.38Schristos		    $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \
7341.38Schristos		  $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
7351.38Schristos		  diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
7361.38Schristos		done
7371.38Schristos		rm -fr time_t.dir
7381.1Smlelstv
7391.14Schristosclean_misc:
7401.6Schristos		rm -f core *.o *.out \
7411.18Schristos		  date tzselect version.h zdump zic yearistype libtz.a
7421.14Schristosclean:		clean_misc
7431.38Schristos		rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW)
7441.1Smlelstv
7451.1Smlelstvmaintainer-clean: clean
7461.1Smlelstv		@echo 'This command is intended for maintainers to use; it'
7471.1Smlelstv		@echo 'deletes files that may need special tools to rebuild.'
7481.34Schristos		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
7491.1Smlelstv
7501.1Smlelstvnames:
7511.1Smlelstv		@echo $(ENCHILADA)
7521.1Smlelstv
7531.23Schristospublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
7541.16Schristos		tarballs signatures
7551.16Schristos
7561.16Schristosdate.1.txt:	date.1
7571.16Schristosnewctime.3.txt:	newctime.3
7581.16Schristosnewstrftime.3.txt: newstrftime.3
7591.16Schristosnewtzset.3.txt:	newtzset.3
7601.16Schristostime2posix.3.txt: time2posix.3
7611.16Schristostzfile.5.txt:	tzfile.5
7621.16Schristostzselect.8.txt:	tzselect.8
7631.16Schristoszdump.8.txt:	zdump.8
7641.16Schristoszic.8.txt:	zic.8
7651.16Schristos
7661.16Schristos$(MANTXTS):	workman.sh
7671.35Schristos		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
7681.35Schristos		mv $@.out $@
7691.9Schristos
7701.6Schristos# Set the time stamps to those of the git repository, if available,
7711.6Schristos# and if the files have not changed since then.
7721.6Schristos# This uses GNU 'touch' syntax 'touch -d@N FILE',
7731.6Schristos# where N is the number of seconds since 1970.
7741.16Schristos# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
7751.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds'
7761.16Schristos# to be the maximum of the files it depends on.
7771.16Schristosset-timestamps.out: $(ENCHILADA)
7781.16Schristos		rm -f $@
7791.35Schristos		if (type git) >/dev/null 2>&1 && \
7801.35Schristos		   files=`git ls-files $(ENCHILADA)` && \
7811.16Schristos		   touch -md @1 test.out; then \
7821.16Schristos		  rm -f test.out && \
7831.16Schristos		  for file in $$files; do \
7841.16Schristos		    if git diff --quiet $$file; then \
7851.16Schristos		      time=`git log -1 --format='tformat:%ct' $$file` && \
7861.16Schristos		      touch -cmd @$$time $$file; \
7871.16Schristos		    else \
7881.16Schristos		      echo >&2 "$$file: warning: does not match repository"; \
7891.16Schristos		    fi || exit; \
7901.16Schristos		  done; \
7911.16Schristos		fi
7921.16Schristos		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
7931.16Schristos		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
7941.16Schristos		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
7951.16Schristos		    exit; \
7961.6Schristos		done
7971.38Schristos		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
7981.35Schristos		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
7991.35Schristos		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
8001.16Schristos		touch $@
8011.6Schristos
8021.1Smlelstv# The zics below ensure that each data file can stand on its own.
8031.1Smlelstv# We also do an all-files run to catch links to links.
8041.1Smlelstv
8051.29Schristoscheck_public:
8061.29Schristos		$(MAKE) maintainer-clean
8071.39Schristos		$(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
8081.34Schristos		mkdir -p public.dir
8091.39Schristos		for i in $(TDATA_TO_CHECK) tzdata.zi; do \
8101.34Schristos		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
8111.9Schristos		done
8121.39Schristos		$(zic) -v -d public.dir $(TDATA_TO_CHECK)
8131.34Schristos		rm -fr public.dir
8141.9Schristos
8151.14Schristos# Check that the code works under various alternative
8161.14Schristos# implementations of time_t.
8171.14Schristoscheck_time_t_alternatives:
8181.23Schristos		if diff -q Makefile Makefile 2>/dev/null; then \
8191.23Schristos		  quiet_option='-q'; \
8201.23Schristos		else \
8211.23Schristos		  quiet_option=''; \
8221.23Schristos		fi && \
8231.35Schristos		wd=`pwd` && \
8241.22Schristos		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
8251.14Schristos		for type in $(TIME_T_ALTERNATIVES); do \
8261.34Schristos		  mkdir -p time_t.dir/$$type && \
8271.29Schristos		  $(MAKE) clean_misc && \
8281.35Schristos		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
8291.14Schristos		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
8301.23Schristos		    REDO='$(REDO)' \
8311.14Schristos		    install && \
8321.23Schristos		  diff $$quiet_option -r \
8331.39Schristos		    time_t.dir/int64_t/etc \
8341.39Schristos		    time_t.dir/$$type/etc && \
8351.39Schristos		  diff $$quiet_option -r \
8361.39Schristos		    time_t.dir/int64_t/usr/share \
8371.39Schristos		    time_t.dir/$$type/usr/share && \
8381.14Schristos		  case $$type in \
8391.14Schristos		  int32_t) range=-2147483648,2147483647;; \
8401.14Schristos		  uint32_t) range=0,4294967296;; \
8411.14Schristos		  int64_t) continue;; \
8421.14Schristos		  *u*) range=0,10000000000;; \
8431.14Schristos		  *) range=-10000000000,10000000000;; \
8441.14Schristos		  esac && \
8451.14Schristos		  echo checking $$type zones ... && \
8461.39Schristos		  time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \
8471.34Schristos		      >time_t.dir/int64_t.out && \
8481.39Schristos		  time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \
8491.34Schristos		      >time_t.dir/$$type.out && \
8501.34Schristos		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
8511.14Schristos		    || exit; \
8521.14Schristos		done
8531.34Schristos		rm -fr time_t.dir
8541.34Schristos
8551.35Schristostarballs traditional_tarballs signatures traditional_signatures: version
8561.35Schristos		VERSION=`cat version` && \
8571.35Schristos		$(MAKE) VERSION="$$VERSION" $@_version
8581.35Schristos
8591.38Schristostarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
8601.38Schristostraditional_tarballs_version: \
8611.38Schristos  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
8621.35Schristossignatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
8631.35Schristostraditional_signatures_version: \
8641.35Schristos  tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
8651.9Schristos
8661.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out
8671.6Schristos		LC_ALL=C && export LC_ALL && \
8681.7Schristos		tar $(TARFLAGS) -cf - \
8691.23Schristos		    $(COMMON) $(DOCS) $(SOURCES) | \
8701.38Schristos		  gzip $(GZIPFLAGS) >$@.out
8711.35Schristos		mv $@.out $@
8721.10Schristos
8731.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out
8741.6Schristos		LC_ALL=C && export LC_ALL && \
8751.23Schristos		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
8761.38Schristos		  gzip $(GZIPFLAGS) >$@.out
8771.35Schristos		mv $@.out $@
8781.9Schristos
8791.34Schristostzdb-$(VERSION).tar.lz: set-timestamps.out
8801.34Schristos		rm -fr tzdb-$(VERSION)
8811.34Schristos		mkdir tzdb-$(VERSION)
8821.34Schristos		ln $(ENCHILADA) tzdb-$(VERSION)
8831.35Schristos		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
8841.34Schristos		LC_ALL=C && export LC_ALL && \
8851.35Schristos		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
8861.35Schristos		mv $@.out $@
8871.9Schristos
8881.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
8891.9Schristos		gpg --armor --detach-sign $?
8901.9Schristos
8911.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
8921.9Schristos		gpg --armor --detach-sign $?
8931.1Smlelstv
8941.34Schristostzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
8951.34Schristos		gpg --armor --detach-sign $?
8961.34Schristos
8971.1Smlelstvtypecheck:
8981.29Schristos		$(MAKE) clean
8991.15Schristos		for i in "long long" unsigned; \
9001.1Smlelstv		do \
9011.29Schristos			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
9021.1Smlelstv			./zdump -v Europe/Rome ; \
9031.29Schristos			$(MAKE) clean ; \
9041.1Smlelstv		done
9051.1Smlelstv
9061.38Schristoszonenames:	tzdata.zi
9071.38Schristos		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
9081.1Smlelstv
9091.1Smlelstvasctime.o:	private.h tzfile.h
9101.1Smlelstvdate.o:		private.h
9111.1Smlelstvdifftime.o:	private.h
9121.1Smlelstvlocaltime.o:	private.h tzfile.h
9131.23Schristosstrftime.o:	private.h tzfile.h
9141.6Schristoszdump.o:	version.h
9151.6Schristoszic.o:		private.h tzfile.h version.h
9161.1Smlelstv
9171.1Smlelstv.KEEP_STATE:
9181.22Schristos
9191.22Schristos.PHONY: ALL INSTALL all
9201.26Schristos.PHONY: check check_character_set check_links
9211.26Schristos.PHONY: check_public check_sorted check_tables
9221.34Schristos.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
9231.38Schristos.PHONY: check_zishrink
9241.34Schristos.PHONY: clean clean_misc force_tzs
9251.32Schristos.PHONY: install install_data maintainer-clean names
9261.32Schristos.PHONY: posix_only posix_packrat posix_right
9271.34Schristos.PHONY: public right_only right_posix signatures signatures_version
9281.34Schristos.PHONY: tarballs tarballs_version typecheck
9291.22Schristos.PHONY: zonenames zones
930