Makefile revision 1.50
11.41Schristos# Make and install tzdb code and data.
21.41Schristos
31.1Smlelstv# This file is in the public domain, so clarified as of
41.1Smlelstv# 2009-05-17 by Arthur David Olson.
51.1Smlelstv
61.10Schristos# Package name for the code distribution.
71.10SchristosPACKAGE=	tzcode
81.10Schristos
91.34Schristos# Version number for the distribution, overridden in the 'tarballs' rule below.
101.35SchristosVERSION=	unknown
111.9Schristos
121.9Schristos# Email address for bug reports.
131.9SchristosBUGEMAIL=	tz@iana.org
141.6Schristos
151.43Schristos# DATAFORM selects the data format.
161.43Schristos# Available formats represent essentially the same data, albeit
171.43Schristos# possibly with minor discrepancies that users are not likely to notice.
181.43Schristos# To get new features and the best data right away, use:
191.40Schristos#	DATAFORM=	vanguard
201.40Schristos# To wait a while before using new features, to give downstream users
211.40Schristos# time to upgrade zic (the default), use:
221.40Schristos#	DATAFORM=	main
231.40Schristos# To wait even longer for new features, use:
241.40Schristos#	DATAFORM=	rearguard
251.46Schristos# Rearguard users might also want "ZFLAGS = -b fat"; see below.
261.40SchristosDATAFORM=		main
271.40Schristos
281.41Schristos# Change the line below for your timezone (after finding the one you want in
291.41Schristos# one of the $(TDATA) source files, or adding it to a source file).
301.41Schristos# Alternatively, if you discover you've got the wrong timezone, you can just
311.46Schristos# 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
321.1Smlelstv# Use the command
331.1Smlelstv#	make zonenames
341.1Smlelstv# to get a list of the values you can use for LOCALTIME.
351.1Smlelstv
361.4SchristosLOCALTIME=	GMT
371.1Smlelstv
381.44Schristos# The POSIXRULES macro controls interpretation of nonstandard and obsolete
391.44Schristos# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules.
401.46Schristos# Such a setting uses the rules in a template file to determine
411.46Schristos# "spring forward" and "fall back" days and times; the environment
421.46Schristos# variable itself specifies UT offsets of standard and daylight saving time.
431.44Schristos#
441.46Schristos# If POSIXRULES is '-', no template is installed; this is the default.
451.44Schristos#
461.46Schristos# Any other value for POSIXRULES is obsolete and should not be relied on, as:
471.44Schristos# * It does not work correctly in popular implementations such as GNU/Linux.
481.49Schristos# * It does not work even in tzcode, except for historical timestamps
491.49Schristos#   that precede the last explicit transition in the POSIXRULES file.
501.49Schristos#   Hence it typically does not work for current and future timestamps.
511.44Schristos# In short, software should avoid ruleless settings like TZ='EET-2EEST'
521.44Schristos# and so should not depend on the value of POSIXRULES.
531.46Schristos#
541.46Schristos# If, despite the above, you want a template for handling these settings,
551.46Schristos# you can change the line below (after finding the timezone you want in the
561.46Schristos# one of the $(TDATA) source files, or adding it to a source file).
571.46Schristos# Alternatively, if you discover you've got the wrong timezone, you can just
581.46Schristos# 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
591.46Schristos# Use the command
601.46Schristos#	make zonenames
611.46Schristos# to get a list of the values you can use for POSIXRULES.
621.1Smlelstv
631.46SchristosPOSIXRULES=	-
641.1Smlelstv
651.1Smlelstv# Also see TZDEFRULESTRING below, which takes effect only
661.1Smlelstv# if the time zone files cannot be accessed.
671.1Smlelstv
681.1Smlelstv
691.39Schristos# Installation locations.
701.39Schristos#
711.39Schristos# The defaults are suitable for Debian, except that if REDO is
721.39Schristos# posix_right or right_posix then files that Debian puts under
731.39Schristos# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
741.39Schristos# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
751.39Schristos# respectively.  Problems with the Debian approach are discussed in
761.39Schristos# the commentary for the right_posix rule (below).
771.39Schristos
781.39Schristos# Destination directory, which can be used for staging.
791.39Schristos# 'make DESTDIR=/stage install' installs under /stage (e.g., to
801.39Schristos# /stage/etc/localtime instead of to /etc/localtime).  Files under
811.39Schristos# /stage are not intended to work as-is, but can be copied by hand to
821.39Schristos# the root directory later.  If DESTDIR is empty, 'make install' does
831.39Schristos# not stage, but installs directly into production locations.
841.39SchristosDESTDIR =
851.39Schristos
861.39Schristos# Everything is installed into subdirectories of TOPDIR, and used there.
871.39Schristos# TOPDIR should be empty (meaning the root directory),
881.39Schristos# or a directory name that does not end in "/".
891.39Schristos# TOPDIR should be empty or an absolute name unless you're just testing.
901.39SchristosTOPDIR =
911.39Schristos
921.41Schristos# The default local timezone is taken from the file TZDEFAULT.
931.39SchristosTZDEFAULT = $(TOPDIR)/etc/localtime
941.39Schristos
951.39Schristos# The subdirectory containing installed program and data files, and
961.39Schristos# likewise for installed files that can be shared among architectures.
971.39Schristos# These should be relative file names.
981.39SchristosUSRDIR = usr
991.39SchristosUSRSHAREDIR = $(USRDIR)/share
1001.1Smlelstv
1011.41Schristos# "Compiled" timezone information is placed in the "TZDIR" directory
1021.1Smlelstv# (and subdirectories).
1031.38Schristos# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
1041.15SchristosTZDIR_BASENAME=	zoneinfo
1051.39SchristosTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
1061.1Smlelstv
1071.39Schristos# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
1081.39SchristosBINDIR = $(TOPDIR)/$(USRDIR)/bin
1091.1Smlelstv
1101.39Schristos# The "zdump" command goes in:
1111.39SchristosZDUMPDIR = $(BINDIR)
1121.1Smlelstv
1131.39Schristos# The "zic" command goes in:
1141.39SchristosZICDIR = $(TOPDIR)/$(USRDIR)/sbin
1151.1Smlelstv
1161.1Smlelstv# Manual pages go in subdirectories of. . .
1171.39SchristosMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
1181.1Smlelstv
1191.39Schristos# Library functions are put in an archive in LIBDIR.
1201.39SchristosLIBDIR = $(TOPDIR)/$(USRDIR)/lib
1211.1Smlelstv
1221.1Smlelstv
1231.41Schristos# Types to try, as an alternative to time_t.
1241.41SchristosTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
1251.49SchristosTIME_T_ALTERNATIVES_HEAD = int_least64_t
1261.49SchristosTIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
1271.1Smlelstv
1281.43Schristos# What kind of TZif data files to generate.  (TZif is the binary time
1291.43Schristos# zone data format that zic generates; see Internet RFC 8536.)
1301.37Schristos# If you want only POSIX time, with time values interpreted as
1311.37Schristos# seconds since the epoch (not counting leap seconds), use
1321.1Smlelstv#	REDO=		posix_only
1331.38Schristos# below.  If you want only "right" time, with values interpreted
1341.37Schristos# as seconds since the epoch (counting leap seconds), use
1351.1Smlelstv#	REDO=		right_only
1361.1Smlelstv# below.  If you want both sets of data available, with leap seconds not
1371.1Smlelstv# counted normally, use
1381.1Smlelstv#	REDO=		posix_right
1391.1Smlelstv# below.  If you want both sets of data available, with leap seconds counted
1401.1Smlelstv# normally, use
1411.1Smlelstv#	REDO=		right_posix
1421.32Schristos# below.  POSIX mandates that leap seconds not be counted; for compatibility
1431.37Schristos# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
1441.37Schristos# leap smearing; this can work better than unsmeared "right" time with
1451.37Schristos# applications that are not leap second aware, and is closer to unsmeared
1461.37Schristos# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
1471.1Smlelstv
1481.1SmlelstvREDO=		posix_right
1491.1Smlelstv
1501.45Schristos# Whether to put an "Expires" line in the leapseconds file.
1511.45Schristos# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
1521.45Schristos# The EXPIRES_LINE value matters only if REDO's value contains "right".
1531.45Schristos# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
1541.45Schristos# zic's support for the Expires line was introduced in tzdb 2020a,
1551.49Schristos# and was modified in tzdb 2021b to generate version 4 TZif files.
1561.49Schristos# EXPIRES_LINE defaults to 0 for now so that the leapseconds file
1571.49Schristos# can be given to pre-2020a zic implementations and so that TZif files
1581.49Schristos# built by newer zic implementations can be read by pre-2021b libraries.
1591.45SchristosEXPIRES_LINE=	0
1601.45Schristos
1611.41Schristos# To install data in text form that has all the information of the TZif data,
1621.38Schristos# (optionally incorporating leap second information), use
1631.38Schristos#	TZDATA_TEXT=	tzdata.zi leapseconds
1641.38Schristos# To install text data without leap second information (e.g., because
1651.38Schristos# REDO='posix_only'), use
1661.38Schristos#	TZDATA_TEXT=	tzdata.zi
1671.38Schristos# To avoid installing text data, use
1681.38Schristos#	TZDATA_TEXT=
1691.38Schristos
1701.38SchristosTZDATA_TEXT=	leapseconds tzdata.zi
1711.38Schristos
1721.38Schristos# For backward-compatibility links for old zone names, use
1731.39Schristos#	BACKWARD=	backward
1741.38Schristos# To omit these links, use
1751.38Schristos#	BACKWARD=
1761.38Schristos
1771.39SchristosBACKWARD=	backward
1781.38Schristos
1791.32Schristos# If you want out-of-scope and often-wrong data from the file 'backzone', use
1801.32Schristos#	PACKRATDATA=	backzone
1811.32Schristos# To omit this data, use
1821.32Schristos#	PACKRATDATA=
1831.32Schristos
1841.32SchristosPACKRATDATA=
1851.32Schristos
1861.38Schristos# The name of a locale using the UTF-8 encoding, used during self-tests.
1871.38Schristos# The tests are skipped if the name does not appear to work on this system.
1881.38Schristos
1891.38SchristosUTF8_LOCALE=	en_US.utf8
1901.38Schristos
1911.1Smlelstv# Non-default libraries needed to link.
1921.1SmlelstvLDLIBS=
1931.1Smlelstv
1941.38Schristos# Add the following to the end of the "CFLAGS=" line as needed to override
1951.38Schristos# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
1961.38Schristos#  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
1971.38Schristos#	formats that generate only the last two digits of year numbers
1981.38Schristos#  -DEPOCH_LOCAL if the 'time' function returns local time not UT
1991.38Schristos#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
2001.38Schristos#	than what POSIX specifies, assuming local time is UT.
2011.38Schristos#	For example, N is 252460800 on AmigaOS.
2021.32Schristos#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
2031.38Schristos#  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
2041.32Schristos#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
2051.38Schristos#  -DHAVE_GENERIC=0 if _Generic does not work
2061.38Schristos#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
2071.38Schristos#  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
2081.35Schristos#	ctime_r and asctime_r incompatibly with the POSIX standard
2091.35Schristos#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
2101.38Schristos#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
2111.16Schristos#  -DHAVE_LINK=0 if your system lacks a link function
2121.23Schristos#  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
2131.23Schristos#  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
2141.23Schristos#	localtime_rz can make zdump significantly faster, but is nonstandard.
2151.49Schristos#  -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
2161.32Schristos#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
2171.32Schristos#	functions like 'link' or variables like 'tzname' required by POSIX
2181.38Schristos#  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
2191.38Schristos#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
2201.38Schristos#  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
2211.38Schristos#  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
2221.28Schristos#  -DHAVE_STRDUP=0 if your system lacks the strdup function
2231.40Schristos#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
2241.1Smlelstv#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
2251.38Schristos#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
2261.23Schristos#  -DHAVE_TZSET=0 if your system lacks a tzset function
2271.38Schristos#  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
2281.38Schristos#  -Dlocale_t=XXX if your system uses XXX instead of locale_t
2291.40Schristos#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
2301.40Schristos#	with external linkage, e.g., applications cannot define 'localtime'.
2311.38Schristos#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
2321.40Schristos#  -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
2331.40Schristos#	security implications and is not recommended for general use
2341.38Schristos#  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
2351.23Schristos#	not needed by the main-program tz code, which is single-threaded.
2361.23Schristos#	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
2371.14Schristos#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
2381.38Schristos#	This is intended for internal use only; it mangles external names.
2391.1Smlelstv#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
2401.22Schristos#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
2411.1Smlelstv#	the default is system-supplied, typically "/usr/lib/locale"
2421.14Schristos#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
2431.38Schristos#	DST transitions if the time zone files cannot be accessed
2441.38Schristos#  -DUNINIT_TRAP if reading uninitialized storage can cause problems
2451.23Schristos#	other than simply getting garbage data
2461.23Schristos#  -DUSE_LTZ=0 to build zdump with the system time zone library
2471.23Schristos#	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
2481.46Schristos#  -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
2491.46Schristos#	similarly for "slim".  Fat TZif files work around incompatibilities
2501.44Schristos#	and bugs in some TZif readers, notably readers that mishandle 64-bit
2511.44Schristos#	data in TZif files.  Slim TZif files are more efficient and do not
2521.44Schristos#	work around these incompatibilities and bugs.  If not given, the
2531.46Schristos#	default is "slim".
2541.1Smlelstv#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
2551.1Smlelstv#	(or some other number) to set the maximum time zone abbreviation length
2561.1Smlelstv#	that zic will accept without a warning (the default is 6)
2571.30Schristos#  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
2581.38Schristos# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
2591.38SchristosGCC_INSTRUMENT = \
2601.38Schristos  -fsanitize=undefined -fsanitize-address-use-after-scope \
2611.38Schristos  -fsanitize-undefined-trap-on-error -fstack-protector
2621.49Schristos# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
2631.38SchristosGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
2641.38Schristos  $(GCC_INSTRUMENT) \
2651.38Schristos  -Wall -Wextra \
2661.38Schristos  -Walloc-size-larger-than=100000 -Warray-bounds=2 \
2671.40Schristos  -Wbad-function-cast -Wcast-align=strict -Wdate-time \
2681.38Schristos  -Wdeclaration-after-statement -Wdouble-promotion \
2691.49Schristos  -Wduplicated-branches -Wduplicated-cond \
2701.38Schristos  -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
2711.49Schristos  -Winit-self -Wlogical-op \
2721.38Schristos  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
2731.49Schristos  -Wnull-dereference \
2741.38Schristos  -Wold-style-definition -Woverlength-strings -Wpointer-arith \
2751.49Schristos  -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
2761.49Schristos  -Wstrict-prototypes -Wstringop-overflow=4 \
2771.40Schristos  -Wstringop-truncation -Wsuggest-attribute=cold \
2781.38Schristos  -Wsuggest-attribute=const -Wsuggest-attribute=format \
2791.40Schristos  -Wsuggest-attribute=malloc \
2801.38Schristos  -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
2811.49Schristos  -Wtrampolines -Wundef -Wuninitialized -Wunused-macros \
2821.38Schristos  -Wvariadic-macros -Wvla -Wwrite-strings \
2831.38Schristos  -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
2841.38Schristos  -Wno-type-limits -Wno-unused-parameter
2851.1Smlelstv#
2861.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s
2871.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
2881.1Smlelstv# add the name to a define such as
2891.1Smlelstv#	-DTM_GMTOFF=tm_gmtoff
2901.23Schristos# to the end of the "CFLAGS=" line.  If not defined, the code attempts to
2911.23Schristos# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
2921.23Schristos# Similarly, if your system has a "zone abbreviation" field, define
2931.1Smlelstv#	-DTM_ZONE=tm_zone
2941.23Schristos# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
2951.23Schristos# required by POSIX, but are widely available on GNU/Linux and BSD systems.
2961.1Smlelstv#
2971.38Schristos# The next batch of options control support for external variables
2981.38Schristos# exported by tzcode.  In practice these variables are less useful
2991.38Schristos# than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
3001.38Schristos# #
3011.38Schristos# # To omit or support the external variable "tzname", add one of:
3021.45Schristos# #	-DHAVE_TZNAME=0 # do not support "tzname"
3031.45Schristos# #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
3041.45Schristos# #	-DHAVE_TZNAME=2 # support and define "tzname"
3051.38Schristos# # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
3061.38Schristos# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
3071.38Schristos# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
3081.38Schristos# # crashes when combined with some platforms' standard libraries,
3091.38Schristos# # presumably due to memory allocation issues.
3101.38Schristos# #
3111.38Schristos# # To omit or support the external variables "timezone" and "daylight", add
3121.45Schristos# #	-DUSG_COMPAT=0 # do not support
3131.45Schristos# #	-DUSG_COMPAT=1 # support, and variables are defined by system library
3141.45Schristos# #	-DUSG_COMPAT=2 # support and define variables
3151.38Schristos# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
3161.38Schristos# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
3171.38Schristos# # If not defined, the code attempts to guess USG_COMPAT from other macros.
3181.38Schristos# #
3191.38Schristos# # To support the external variable "altzone", add
3201.45Schristos# #	-DALTZONE=0 # do not support
3211.45Schristos# #	-DALTZONE=1 # support "altzone", which is defined by system library
3221.45Schristos# #	-DALTZONE=2 # support and define "altzone"
3231.38Schristos# # to the end of the "CFLAGS=" line; although "altzone" appeared in
3241.38Schristos# # System V Release 3.1 it has not been standardized.
3251.45Schristos# # If not defined, the code attempts to guess ALTZONE from other macros.
3261.38Schristos#
3271.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work,
3281.1Smlelstv# add
3291.1Smlelstv#	-DSTD_INSPIRED
3301.1Smlelstv# to the end of the "CFLAGS=" line.  This arranges for the functions
3311.46Schristos# "offtime", "timelocal", "timegm", "timeoff",
3321.1Smlelstv# "posix2time", and "time2posix" to be added to the time conversion library.
3331.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument
3341.1Smlelstv# that gives an offset to add to the time_t when converting it.
3351.1Smlelstv# "timelocal" is equivalent to "mktime".
3361.1Smlelstv# "timegm" is like "timelocal" except that it turns a struct tm into
3371.15Schristos# a time_t using UT (rather than local time as "timelocal" does).
3381.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument
3391.1Smlelstv# that gives an offset to use when converting to a time_t.
3401.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page.
3411.1Smlelstv# X3J11's work does not describe any of these functions.
3421.1Smlelstv# These functions may well disappear in future releases of the time
3431.1Smlelstv# conversion package.
3441.1Smlelstv#
3451.23Schristos# If you don't want functions that were inspired by NetBSD, add
3461.23Schristos#	-DNETBSD_INSPIRED=0
3471.23Schristos# to the end of the "CFLAGS=" line.  Otherwise, the functions
3481.23Schristos# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
3491.23Schristos# time library, and if STD_INSPIRED is also defined the functions
3501.23Schristos# "posix2time_z" and "time2posix_z" are added as well.
3511.23Schristos# The functions ending in "_z" (or "_rz") are like their unsuffixed
3521.23Schristos# (or suffixed-by-"_r") counterparts, except with an extra first
3531.41Schristos# argument of opaque type timezone_t that specifies the timezone.
3541.23Schristos# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
3551.23Schristos#
3561.1Smlelstv# If you want to allocate state structures in localtime, add
3571.1Smlelstv#	-DALL_STATE
3581.1Smlelstv# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
3591.1Smlelstv#
3601.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
3611.1Smlelstv# out by the National Institute of Standards and Technology
3621.1Smlelstv# which claims to test C and Posix conformance.  If you want to pass PCTS, add
3631.1Smlelstv#	-DPCTS
3641.1Smlelstv# to the end of the "CFLAGS=" line.
3651.1Smlelstv#
3661.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add
3671.1Smlelstv#	-DXPG4_1994_04_09
3681.1Smlelstv# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
3691.38Schristos# 53 as a week number (rather than 52 or 53) for January days before
3701.38Schristos# January's first Monday when a "%V" format is used and January 1
3711.1Smlelstv# falls on a Friday, Saturday, or Sunday.
3721.1Smlelstv
3731.1SmlelstvCFLAGS=
3741.1Smlelstv
3751.9Schristos# Linker flags.  Default to $(LFLAGS) for backwards compatibility
3761.34Schristos# to release 2012h and earlier.
3771.9Schristos
3781.9SchristosLDFLAGS=	$(LFLAGS)
3791.1Smlelstv
3801.32Schristos# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
3811.32Schristos# submake command lines.  The default is no leap seconds.
3821.32Schristos
3831.32SchristosLEAPSECONDS=
3841.32Schristos
3851.32Schristos# The zic command and its arguments.
3861.32Schristos
3871.1Smlelstvzic=		./zic
3881.1SmlelstvZIC=		$(zic) $(ZFLAGS)
3891.1Smlelstv
3901.43Schristos# To shrink the size of installed TZif files,
3911.43Schristos# append "-r @N" to omit data before N-seconds-after-the-Epoch.
3921.46Schristos# To grow the files and work around older application bugs, append "-b fat";
3931.44Schristos# see ZIC_BLOAT_DEFAULT above.
3941.44Schristos# See the zic man page for more about -b and -r.
3951.15SchristosZFLAGS=
3961.15Schristos
3971.41Schristos# How to use zic to install TZif files.
3981.32Schristos
3991.39SchristosZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
4001.32Schristos
4011.22Schristos# The name of a Posix-compliant 'awk' on your system.
4021.50Schristos# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
4031.50Schristos# Also, it is better (though not essential) if 'awk' supports UTF-8,
4041.50Schristos# and unfortunately mawk and busybox awk do not support UTF-8.
4051.50Schristos# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
4061.9SchristosAWK=		awk
4071.9Schristos
4081.16Schristos# The full path name of a Posix-compliant shell, preferably one that supports
4091.16Schristos# the Korn shell's 'select' statement as an extension.
4101.16Schristos# These days, Bash is the most popular.
4111.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh
4121.16Schristos# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
4131.16Schristos# is typically nicer if it works.
4141.9SchristosKSHELL=		/bin/bash
4151.1Smlelstv
4161.42Schristos# Name of curl <https://curl.haxx.se/>, used for HTML validation.
4171.42SchristosCURL=		curl
4181.42Schristos
4191.44Schristos# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
4201.44SchristosGPG=		gpg
4211.44Schristos
4221.23Schristos# This expensive test requires USE_LTZ.
4231.23Schristos# To suppress it, define this macro to be empty.
4241.23SchristosCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
4251.23Schristos
4261.22Schristos# SAFE_CHAR is a regular expression that matches a safe character.
4271.22Schristos# Some parts of this distribution are limited to safe characters;
4281.22Schristos# others can use any UTF-8 character.
4291.22Schristos# For now, the safe characters are a safe subset of ASCII.
4301.9Schristos# The caller must set the shell variable 'sharp' to the character '#',
4311.9Schristos# since Makefile macros cannot contain '#'.
4321.9Schristos# TAB_CHAR is a single tab character, in single quotes.
4331.9SchristosTAB_CHAR=	'	'
4341.22SchristosSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
4351.22SchristosSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
4361.22SchristosSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
4371.29SchristosSAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
4381.29SchristosSAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
4391.29Schristos
4401.41Schristos# These characters are Latin-1, and so are likely to be displayable
4411.41Schristos# even in editors with limited character sets.
4421.41SchristosUNUSUAL_OK_LATIN_1 = «°±»½¾×
4431.41Schristos# This IPA symbol is represented in Unicode as the composition of
4441.41Schristos# U+0075 and U+032F, and U+032F is not considered alphabetic by some
4451.41Schristos# grep implementations that do not grok composition.
4461.41SchristosUNUSUAL_OK_IPA = u̯
4471.40Schristos# Non-ASCII non-letters that OK_CHAR allows, as these characters are
4481.41Schristos# useful in commentary.
4491.41SchristosUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
4501.40Schristos
4511.29Schristos# OK_CHAR matches any character allowed in the distributed files.
4521.40Schristos# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
4531.40Schristos# multibyte letters are also allowed so that commentary can contain a
4541.40Schristos# few safe symbols and people's names and can quote non-English sources.
4551.40Schristos# Other non-letters are limited to ASCII renderings for the
4561.40Schristos# convenience of maintainers using XEmacs 21.5.34, which by default
4571.40Schristos# mishandles Unicode characters U+0100 and greater.
4581.40SchristosOK_CHAR=	'[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
4591.22Schristos
4601.22Schristos# SAFE_LINE matches a line of safe characters.
4611.29Schristos# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
4621.22Schristos# this is so that comments can contain non-ASCII characters.
4631.29Schristos# OK_LINE matches a line of OK characters.
4641.22SchristosSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
4651.29SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
4661.29SchristosOK_LINE=	'^'$(OK_CHAR)'*$$'
4671.9Schristos
4681.6Schristos# Flags to give 'tar' when making a distribution.
4691.6Schristos# Try to use flags appropriate for GNU tar.
4701.50SchristosGNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
4711.50Schristos  --numeric-owner --owner=0 --group=0 \
4721.50Schristos  --mode=go+u,go-w --sort=name
4731.6SchristosTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
4741.6Schristos		 then echo $(GNUTARFLAGS); \
4751.6Schristos		 else :; \
4761.6Schristos		 fi`
4771.6Schristos
4781.6Schristos# Flags to give 'gzip' when making a distribution.
4791.38SchristosGZIPFLAGS=	-9n
4801.6Schristos
4811.1Smlelstv###############################################################################
4821.1Smlelstv
4831.29Schristos#MAKE=		make
4841.29Schristos
4851.1Smlelstvcc=		cc
4861.39SchristosCC=		$(cc) -DTZDIR='"$(TZDIR)"'
4871.1Smlelstv
4881.16SchristosAR=		ar
4891.16Schristos
4901.16Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
4911.16SchristosRANLIB=		:
4921.16Schristos
4931.28SchristosTZCOBJS=	zic.o
4941.38SchristosTZDOBJS=	zdump.o localtime.o asctime.o strftime.o
4951.1SmlelstvDATEOBJS=	date.o localtime.o strftime.o asctime.o
4961.45SchristosLIBSRCS=	localtime.c asctime.c difftime.c strftime.c
4971.45SchristosLIBOBJS=	localtime.o asctime.o difftime.o strftime.o
4981.1SmlelstvHEADERS=	tzfile.h private.h
4991.28SchristosNONLIBSRCS=	zic.c zdump.c
5001.45SchristosNEWUCBSRCS=	date.c
5011.23SchristosSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
5021.35Schristos			tzselect.ksh workman.sh
5031.1SmlelstvMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
5041.1Smlelstv			tzfile.5 tzselect.8 zic.8 zdump.8
5051.16SchristosMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
5061.16Schristos			time2posix.3.txt \
5071.16Schristos			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
5081.16Schristos			date.1.txt
5091.38SchristosCOMMON=		calendars CONTRIBUTING LICENSE Makefile \
5101.49Schristos			NEWS README SECURITY theory.html version
5111.39SchristosWEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
5121.43SchristosCHECK_WEB_PAGES=check_theory.html check_tz-art.html \
5131.43Schristos			check_tz-how-to.html check_tz-link.html
5141.23SchristosDOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
5151.1SmlelstvPRIMARY_YDATA=	africa antarctica asia australasia \
5161.1Smlelstv		europe northamerica southamerica
5171.39SchristosYDATA=		$(PRIMARY_YDATA) etcetera
5181.46SchristosNDATA=		factory
5191.46SchristosTDATA_TO_CHECK=	$(YDATA) $(NDATA) backward
5201.39SchristosTDATA=		$(YDATA) $(NDATA) $(BACKWARD)
5211.22SchristosZONETABLES=	zone1970.tab zone.tab
5221.38SchristosTABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
5231.16SchristosLEAP_DEPS=	leapseconds.awk leap-seconds.list
5241.40SchristosTZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
5251.40SchristosDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
5261.39SchristosDATA=		$(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
5271.46Schristos			leapseconds $(ZONETABLES)
5281.40SchristosAWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
5291.40Schristos			ziguard.awk zishrink.awk
5301.23SchristosMISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
5311.34SchristosTZS_YEAR=	2050
5321.41SchristosTZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
5331.34SchristosTZS=		to$(TZS_YEAR).tzs
5341.34SchristosTZS_NEW=	to$(TZS_YEAR)new.tzs
5351.49SchristosTZS_DEPS=	$(YDATA) asctime.c localtime.c \
5361.34Schristos			private.h tzfile.h zdump.c zic.c
5371.41Schristos# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
5381.41SchristosEIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
5391.41SchristosENCHILADA = $(EIGHT_YARDS) $(TZS)
5401.34Schristos
5411.34Schristos# Consult these files when deciding whether to rebuild the 'version' file.
5421.34Schristos# This list is not the same as the output of 'git ls-files', since
5431.34Schristos# .gitignore is not distributed.
5441.34SchristosVERSION_DEPS= \
5451.49Schristos		calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
5461.34Schristos		africa antarctica asctime.c asia australasia \
5471.34Schristos		backward backzone \
5481.34Schristos		checklinks.awk checktab.awk \
5491.34Schristos		date.1 date.c difftime.c \
5501.34Schristos		etcetera europe factory iso3166.tab \
5511.34Schristos		leap-seconds.list leapseconds.awk localtime.c \
5521.34Schristos		newctime.3 newstrftime.3 newtzset.3 northamerica \
5531.46Schristos		private.h southamerica strftime.c theory.html \
5541.39Schristos		time2posix.3 tz-art.html tz-how-to.html tz-link.html \
5551.34Schristos		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
5561.46Schristos		workman.sh zdump.8 zdump.c zic.8 zic.c \
5571.40Schristos		ziguard.awk zishrink.awk \
5581.34Schristos		zone.tab zone1970.tab zoneinfo2tdf.pl
5591.1Smlelstv
5601.1Smlelstv# And for the benefit of csh users on systems that assume the user
5611.1Smlelstv# shell should be used to handle commands in Makefiles. . .
5621.1Smlelstv
5631.1SmlelstvSHELL=		/bin/sh
5641.1Smlelstv
5651.46Schristosall:		tzselect zic zdump libtz.a $(TABDATA) \
5661.40Schristos		  vanguard.zi main.zi rearguard.zi
5671.1Smlelstv
5681.29SchristosALL:		all date $(ENCHILADA)
5691.1Smlelstv
5701.16Schristosinstall:	all $(DATA) $(REDO) $(MANS)
5711.39Schristos		mkdir -p '$(DESTDIR)$(BINDIR)' \
5721.39Schristos			'$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
5731.39Schristos			'$(DESTDIR)$(LIBDIR)' \
5741.39Schristos			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
5751.39Schristos			'$(DESTDIR)$(MANDIR)/man8'
5761.44Schristos		$(ZIC_INSTALL) -l $(LOCALTIME) \
5771.44Schristos			`case '$(POSIXRULES)' in ?*) echo '-p';; esac \
5781.44Schristos			` $(POSIXRULES) \
5791.39Schristos			-t '$(DESTDIR)$(TZDEFAULT)'
5801.39Schristos		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
5811.39Schristos		cp tzselect '$(DESTDIR)$(BINDIR)/.'
5821.39Schristos		cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
5831.39Schristos		cp zic '$(DESTDIR)$(ZICDIR)/.'
5841.39Schristos		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
5851.39Schristos		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
5861.39Schristos		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
5871.39Schristos		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
5881.39Schristos		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
5891.1Smlelstv
5901.1SmlelstvINSTALL:	ALL install date.1
5911.39Schristos		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
5921.39Schristos		cp date '$(DESTDIR)$(BINDIR)/.'
5931.39Schristos		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
5941.1Smlelstv
5951.48Schristos# Calculate version number from git, if available.
5961.48Schristos# Otherwise, use $(VERSION) unless it is "unknown" and there is already
5971.48Schristos# a 'version' file, in which case reuse the existing 'version' contents
5981.48Schristos# and append "-dirty" if the contents do not already end in "-dirty".
5991.34Schristosversion:	$(VERSION_DEPS)
6001.35Schristos		{ (type git) >/dev/null 2>&1 && \
6011.35Schristos		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
6021.35Schristos				--abbrev=7 --dirty` || \
6031.48Schristos		  if test '$(VERSION)' = unknown && V=`cat $@`; then \
6041.48Schristos		    case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
6051.48Schristos		  else \
6061.48Schristos		    V='$(VERSION)'; \
6071.48Schristos		  fi; } && \
6081.35Schristos		printf '%s\n' "$$V" >$@.out
6091.35Schristos		mv $@.out $@
6101.34Schristos
6111.41Schristos# These files can be tailored by setting BACKWARD and PACKRATDATA.
6121.40Schristosvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
6131.40Schristos		$(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
6141.40Schristos		  $(TDATA) $(PACKRATDATA) >$@.out
6151.40Schristos		mv $@.out $@
6161.41Schristos# This file has a version comment that attempts to capture any tailoring
6171.41Schristos# via BACKWARD, DATAFORM, PACKRATDATA, and REDO.
6181.41Schristostzdata.zi:	$(DATAFORM).zi version zishrink.awk
6191.39Schristos		version=`sed 1q version` && \
6201.41Schristos		  LC_ALL=C $(AWK) \
6211.41Schristos		    -v dataform='$(DATAFORM)' \
6221.41Schristos		    -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
6231.41Schristos		    -v redo='$(REDO)' \
6241.41Schristos		    -v version="$$version" \
6251.41Schristos		    -f zishrink.awk \
6261.40Schristos		    $(DATAFORM).zi >$@.out
6271.38Schristos		mv $@.out $@
6281.38Schristos
6291.34Schristosversion.h:	version
6301.35Schristos		VERSION=`cat version` && printf '%s\n' \
6311.35Schristos		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
6321.35Schristos		  "static char const TZVERSION[]=\"$$VERSION\";" \
6331.35Schristos		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
6341.35Schristos		  >$@.out
6351.35Schristos		mv $@.out $@
6361.6Schristos
6371.1Smlelstvzdump:		$(TZDOBJS)
6381.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
6391.1Smlelstv
6401.32Schristoszic:		$(TZCOBJS)
6411.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
6421.1Smlelstv
6431.16Schristosleapseconds:	$(LEAP_DEPS)
6441.45Schristos		$(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
6451.45Schristos		  -f leapseconds.awk leap-seconds.list >$@.out
6461.35Schristos		mv $@.out $@
6471.15Schristos
6481.32Schristos# Arguments to pass to submakes of install_data.
6491.32Schristos# They can be overridden by later submake arguments.
6501.32SchristosINSTALLARGS = \
6511.39Schristos BACKWARD='$(BACKWARD)' \
6521.39Schristos DESTDIR='$(DESTDIR)' \
6531.32Schristos LEAPSECONDS='$(LEAPSECONDS)' \
6541.32Schristos PACKRATDATA='$(PACKRATDATA)' \
6551.39Schristos TZDEFAULT='$(TZDEFAULT)' \
6561.39Schristos TZDIR='$(TZDIR)' \
6571.32Schristos ZIC='$(ZIC)'
6581.32Schristos
6591.46SchristosINSTALL_DATA_DEPS = zic leapseconds tzdata.zi
6601.41Schristos
6611.41Schristos# 'make install_data' installs one set of TZif files.
6621.41Schristosinstall_data: $(INSTALL_DATA_DEPS)
6631.38Schristos		$(ZIC_INSTALL) tzdata.zi
6641.32Schristos
6651.41Schristosposix_only: $(INSTALL_DATA_DEPS)
6661.32Schristos		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
6671.32Schristos
6681.41Schristosright_only: $(INSTALL_DATA_DEPS)
6691.32Schristos		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
6701.32Schristos			install_data
6711.1Smlelstv
6721.1Smlelstv# In earlier versions of this makefile, the other two directories were
6731.1Smlelstv# subdirectories of $(TZDIR).  However, this led to configuration errors.
6741.1Smlelstv# For example, with posix_right under the earlier scheme,
6751.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
6761.1Smlelstv# but gmtime without leap seconds, which led to problems with applications
6771.1Smlelstv# like sendmail that subtract gmtime from localtime.
6781.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR).
6791.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds
6801.1Smlelstv# to using them, or vice versa.
6811.32Schristosright_posix:	right_only
6821.39Schristos		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
6831.39Schristos		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
6841.39Schristos		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
6851.39Schristos		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
6861.15Schristos
6871.32Schristosposix_right:	posix_only
6881.39Schristos		rm -fr '$(DESTDIR)$(TZDIR)-posix'
6891.39Schristos		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
6901.39Schristos		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
6911.39Schristos		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
6921.32Schristos
6931.32Schristos# This obsolescent rule is present for backwards compatibility with
6941.32Schristos# tz releases 2014g through 2015g.  It should go away eventually.
6951.41Schristosposix_packrat: $(INSTALL_DATA_DEPS)
6961.32Schristos		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
6971.23Schristos
6981.1Smlelstvzones:		$(REDO)
6991.1Smlelstv
7001.40Schristos# dummy.zd is not a real file; it is mentioned here only so that the
7011.40Schristos# top-level 'make' does not have a syntax error.
7021.40SchristosZDS = dummy.zd
7031.40Schristos# Rule used only by submakes invoked by the $(TZS_NEW) rule.
7041.40Schristos# It is separate so that GNU 'make -j' can run instances in parallel.
7051.40Schristos$(ZDS): zdump
7061.41Schristos		./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
7071.41Schristos		  >$@
7081.40Schristos
7091.41SchristosTZS_NEW_DEPS = tzdata.zi zdump zic
7101.41Schristos$(TZS_NEW): $(TZS_NEW_DEPS)
7111.41Schristos		rm -fr tzs$(TZS_YEAR).dir
7121.41Schristos		mkdir tzs$(TZS_YEAR).dir
7131.41Schristos		$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
7141.38Schristos		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
7151.38Schristos		   tzdata.zi | LC_ALL=C sort >$@.out
7161.35Schristos		wd=`pwd` && \
7171.41Schristos		x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
7181.41Schristos				tzdata.zi \
7191.40Schristos			| LC_ALL=C sort -t . -k 2,2` && \
7201.41Schristos		set x $$x && \
7211.40Schristos		shift && \
7221.40Schristos		ZDS=$$* && \
7231.41Schristos		$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
7241.41Schristos		  ZDS="$$ZDS" $$ZDS && \
7251.41Schristos		sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
7261.41Schristos		rm -fr tzs$(TZS_YEAR).dir
7271.40Schristos		mv $@.out $@
7281.34Schristos
7291.41Schristos# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
7301.34Schristos# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
7311.34Schristos$(TZS):
7321.41Schristos		touch $@
7331.34Schristos
7341.34Schristosforce_tzs:	$(TZS_NEW)
7351.34Schristos		cp $(TZS_NEW) $(TZS)
7361.34Schristos
7371.16Schristoslibtz.a:	$(LIBOBJS)
7381.37Schristos		rm -f $@
7391.37Schristos		$(AR) -rc $@ $(LIBOBJS)
7401.16Schristos		$(RANLIB) $@
7411.1Smlelstv
7421.1Smlelstvdate:		$(DATEOBJS)
7431.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
7441.1Smlelstv
7451.34Schristostzselect:	tzselect.ksh version
7461.35Schristos		VERSION=`cat version` && sed \
7471.9Schristos			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
7481.50Schristos			-e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \
7491.9Schristos			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
7501.9Schristos			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
7511.1Smlelstv			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
7521.35Schristos			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
7531.35Schristos			<$@.ksh >$@.out
7541.35Schristos		chmod +x $@.out
7551.35Schristos		mv $@.out $@
7561.1Smlelstv
7571.38Schristoscheck:		check_character_set check_white_space check_links \
7581.38Schristos		  check_name_lengths check_sorted \
7591.38Schristos		  check_tables check_web check_zishrink check_tzs
7601.9Schristos
7611.9Schristoscheck_character_set: $(ENCHILADA)
7621.38Schristos	test ! '$(UTF8_LOCALE)' || \
7631.38Schristos	! printf 'A\304\200B\n' | \
7641.38Schristos	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
7651.38Schristos		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
7661.22Schristos		sharp='#' && \
7671.35Schristos		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
7681.35Schristos			$(MISC) $(SOURCES) $(WEB_PAGES) \
7691.49Schristos			CONTRIBUTING LICENSE README SECURITY \
7701.38Schristos			version tzdata.zi && \
7711.41Schristos		! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
7721.40Schristos			Makefile && \
7731.39Schristos		! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
7741.46Schristos			leapseconds zone.tab && \
7751.38Schristos		! grep -Env $(OK_LINE) $(ENCHILADA); \
7761.38Schristos	}
7771.41Schristos	touch $@
7781.22Schristos
7791.23Schristoscheck_white_space: $(ENCHILADA)
7801.35Schristos		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
7811.41Schristos		! grep -En "$$pat" \
7821.41Schristos			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
7831.39Schristos		! grep -n '[[:space:]]$$' \
7841.39Schristos			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
7851.41Schristos		touch $@
7861.23Schristos
7871.38SchristosPRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
7881.38SchristosFILE_NAME_COMPONENT_TOO_LONG = \
7891.38Schristos  $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
7901.38Schristos
7911.39Schristoscheck_name_lengths: $(TDATA_TO_CHECK) backzone
7921.39Schristos		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
7931.39Schristos			$(TDATA_TO_CHECK) backzone
7941.41Schristos		touch $@
7951.38Schristos
7961.23SchristosCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
7971.23Schristos
7981.23Schristoscheck_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
7991.23Schristos		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
8001.23Schristos		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
8011.41Schristos		touch $@
8021.23Schristos
8031.40Schristoscheck_links:	checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
8041.39Schristos		$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
8051.38Schristos		$(AWK) -f checklinks.awk tzdata.zi
8061.41Schristos		touch $@
8071.26Schristos
8081.49Schristoscheck_tables:	checktab.awk $(YDATA) backward $(ZONETABLES)
8091.22Schristos		for tab in $(ZONETABLES); do \
8101.49Schristos		  test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
8111.49Schristos		  $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
8121.22Schristos		    || exit; \
8131.22Schristos		done
8141.41Schristos		touch $@
8151.1Smlelstv
8161.34Schristoscheck_tzs:	$(TZS) $(TZS_NEW)
8171.41Schristos		if test -s $(TZS); then \
8181.41Schristos		  diff -u $(TZS) $(TZS_NEW); \
8191.41Schristos		else \
8201.41Schristos		  cp $(TZS_NEW) $(TZS); \
8211.41Schristos		fi
8221.41Schristos		touch $@
8231.34Schristos
8241.42Schristoscheck_web:	$(CHECK_WEB_PAGES)
8251.43Schristoscheck_theory.html: theory.html
8261.42Schristoscheck_tz-art.html: tz-art.html
8271.46Schristoscheck_tz-how-to.html: tz-how-to.html
8281.42Schristoscheck_tz-link.html: tz-link.html
8291.46Schristoscheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
8301.42Schristos		$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
8311.42Schristos		    -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
8321.42Schristos		  test ! -s $@.out || { cat $@.out; exit 1; }
8331.42Schristos		mv $@.out $@
8341.38Schristos
8351.40Schristos# Check that zishrink.awk does not alter the data, and that ziguard.awk
8361.40Schristos# preserves main-format data.
8371.41Schristoscheck_zishrink: check_zishrink_posix check_zishrink_right
8381.41Schristoscheck_zishrink_posix check_zishrink_right: \
8391.41Schristos  zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi
8401.41Schristos		rm -fr $@.dir $@-t.dir $@-shrunk.dir
8411.41Schristos		mkdir $@.dir $@-t.dir $@-shrunk.dir
8421.41Schristos		case $@ in \
8431.41Schristos		  *_right) leap='-L leapseconds';; \
8441.41Schristos		  *) leap=;; \
8451.41Schristos		esac && \
8461.41Schristos		  $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
8471.41Schristos		  $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
8481.40Schristos		  case $(DATAFORM) in \
8491.40Schristos		    main) \
8501.41Schristos		      $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
8511.40Schristos		      $(AWK) '/^Rule/' $(TDATA) | \
8521.41Schristos			$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
8531.41Schristos		      diff -r $@.dir $@-t.dir;; \
8541.41Schristos		  esac
8551.41Schristos		diff -r $@.dir $@-shrunk.dir
8561.41Schristos		rm -fr $@.dir $@-t.dir $@-shrunk.dir
8571.41Schristos		touch $@
8581.1Smlelstv
8591.14Schristosclean_misc:
8601.43Schristos		rm -fr check_*.dir
8611.41Schristos		rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
8621.41Schristos		  check_* core typecheck_* \
8631.46Schristos		  date tzselect version.h zdump zic libtz.a
8641.14Schristosclean:		clean_misc
8651.43Schristos		rm -fr *.dir tzdb-*/
8661.43Schristos		rm -f *.zi $(TZS_NEW)
8671.1Smlelstv
8681.1Smlelstvmaintainer-clean: clean
8691.1Smlelstv		@echo 'This command is intended for maintainers to use; it'
8701.1Smlelstv		@echo 'deletes files that may need special tools to rebuild.'
8711.34Schristos		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
8721.1Smlelstv
8731.1Smlelstvnames:
8741.1Smlelstv		@echo $(ENCHILADA)
8751.1Smlelstv
8761.23Schristospublic:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
8771.16Schristos		tarballs signatures
8781.16Schristos
8791.16Schristosdate.1.txt:	date.1
8801.16Schristosnewctime.3.txt:	newctime.3
8811.16Schristosnewstrftime.3.txt: newstrftime.3
8821.16Schristosnewtzset.3.txt:	newtzset.3
8831.16Schristostime2posix.3.txt: time2posix.3
8841.16Schristostzfile.5.txt:	tzfile.5
8851.16Schristostzselect.8.txt:	tzselect.8
8861.16Schristoszdump.8.txt:	zdump.8
8871.16Schristoszic.8.txt:	zic.8
8881.16Schristos
8891.16Schristos$(MANTXTS):	workman.sh
8901.35Schristos		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
8911.35Schristos		mv $@.out $@
8921.9Schristos
8931.48Schristos# Set file timestamps deterministically if possible,
8941.48Schristos# so that tarballs containing the timestamps are reproducible.
8951.48Schristos#
8961.48Schristos# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
8971.48Schristos# file DEST to the maximum of the timestamps of the files A B C ...,
8981.48Schristos# plus N if GNU ls and touch are available.
8991.48SchristosSET_TIMESTAMP_N = sh -c '\
9001.48Schristos  n=$$0 dest=$$1; shift; \
9011.48Schristos  touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \
9021.48Schristos  if test $$n != 0 && \
9031.48Schristos     lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \
9041.48Schristos    set x $$lsout && \
9051.48Schristos    touch -cmd @`expr $$7 + $$n` "$$dest"; \
9061.48Schristos  else :; fi'
9071.48Schristos# If DEST depends on A B C ... in this Makefile, callers should use
9081.48Schristos# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
9091.48Schristos# downstream 'make' that considers equal timestamps to be out of date.
9101.48Schristos# POSIX allows this 'make' behavior, and HP-UX 'make' does it.
9111.48Schristos# If all that matters is that the timestamp be reproducible
9121.48Schristos# and plausible, use $(SET_TIMESTAMP).
9131.48SchristosSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
9141.48SchristosSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
9151.48Schristos
9161.41Schristos# Set the timestamps to those of the git repository, if available,
9171.6Schristos# and if the files have not changed since then.
9181.48Schristos# This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
9191.48Schristos# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
9201.48Schristos# If git or GNU is absent, don't bother to sync with git timestamps.
9211.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds'
9221.16Schristos# to be the maximum of the files it depends on.
9231.41Schristosset-timestamps.out: $(EIGHT_YARDS)
9241.16Schristos		rm -f $@
9251.35Schristos		if (type git) >/dev/null 2>&1 && \
9261.41Schristos		   files=`git ls-files $(EIGHT_YARDS)` && \
9271.16Schristos		   touch -md @1 test.out; then \
9281.16Schristos		  rm -f test.out && \
9291.16Schristos		  for file in $$files; do \
9301.16Schristos		    if git diff --quiet $$file; then \
9311.16Schristos		      time=`git log -1 --format='tformat:%ct' $$file` && \
9321.16Schristos		      touch -cmd @$$time $$file; \
9331.16Schristos		    else \
9341.16Schristos		      echo >&2 "$$file: warning: does not match repository"; \
9351.16Schristos		    fi || exit; \
9361.16Schristos		  done; \
9371.16Schristos		fi
9381.48Schristos		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
9391.16Schristos		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
9401.48Schristos		  $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
9411.16Schristos		    exit; \
9421.6Schristos		done
9431.48Schristos		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
9441.48Schristos		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
9451.41Schristos		touch $@
9461.41Schristosset-tzs-timestamp.out: $(TZS)
9471.48Schristos		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
9481.16Schristos		touch $@
9491.6Schristos
9501.1Smlelstv# The zics below ensure that each data file can stand on its own.
9511.1Smlelstv# We also do an all-files run to catch links to links.
9521.1Smlelstv
9531.41Schristoscheck_public: $(VERSION_DEPS)
9541.41Schristos		rm -fr public.dir
9551.41Schristos		mkdir public.dir
9561.41Schristos		ln $(VERSION_DEPS) public.dir
9571.41Schristos		cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
9581.48Schristos		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
9591.48Schristos		    public.dir/vanguard.zi public.dir/main.zi \
9601.48Schristos		    public.dir/rearguard.zi; \
9611.48Schristos		do \
9621.41Schristos		  public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
9631.9Schristos		done
9641.41Schristos		public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
9651.49Schristos		:
9661.49Schristos		: Also check 'backzone' syntax.
9671.49Schristos		rm public.dir/main.zi
9681.49Schristos		cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
9691.49Schristos		public.dir/zic -d public.dir/zoneinfo main.zi
9701.49Schristos		:
9711.34Schristos		rm -fr public.dir
9721.41Schristos		touch $@
9731.9Schristos
9741.14Schristos# Check that the code works under various alternative
9751.14Schristos# implementations of time_t.
9761.41Schristoscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES)
9771.41Schristos$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
9781.41Schristos$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
9791.41Schristos		rm -fr $@.dir
9801.41Schristos		mkdir $@.dir
9811.41Schristos		ln $(VERSION_DEPS) $@.dir
9821.41Schristos		case $@ in \
9831.49Schristos		  int*32_t) range=-2147483648,2147483648;; \
9841.41Schristos		  u*) range=0,4294967296;; \
9851.41Schristos		  *) range=-4294967296,4294967296;; \
9861.41Schristos		esac && \
9871.41Schristos		wd=`pwd` && \
9881.41Schristos		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
9891.41Schristos		if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
9901.41Schristos		  range_target=; \
9911.23Schristos		else \
9921.41Schristos		  range_target=to$$range.tzs; \
9931.23Schristos		fi && \
9941.41Schristos		(cd $@.dir && \
9951.41Schristos		  $(MAKE) TOPDIR="$$wd/$@.dir" \
9961.41Schristos		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
9971.23Schristos		    REDO='$(REDO)' \
9981.41Schristos			D=$$wd/$@.dir \
9991.41Schristos		    TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
10001.41Schristos		    install $$range_target) && \
10011.41Schristos		test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
10021.41Schristos		  (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
10031.41Schristos		    $(MAKE) TOPDIR="$$wd/$@.dir" \
10041.41Schristos		      TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
10051.41Schristos			D=$$wd/$@.dir \
10061.41Schristos		      to$$range.tzs) && \
10071.41Schristos		  diff -u $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
10081.41Schristos			  $@.dir/to$$range.tzs && \
10091.41Schristos		  if diff -q Makefile Makefile 2>/dev/null; then \
10101.41Schristos		    quiet_option='-q'; \
10111.41Schristos		  else \
10121.41Schristos		    quiet_option=''; \
10131.41Schristos		  fi && \
10141.41Schristos		    diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
10151.41Schristos					   $@.dir/etc && \
10161.41Schristos		    diff $$quiet_option -r \
10171.41Schristos		      $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
10181.41Schristos		      $@.dir/usr/share; \
10191.41Schristos		}
10201.41Schristos		touch $@
10211.34Schristos
10221.40SchristosTRADITIONAL_ASC = \
10231.40Schristos  tzcode$(VERSION).tar.gz.asc \
10241.40Schristos  tzdata$(VERSION).tar.gz.asc
10251.41SchristosREARGUARD_ASC = \
10261.41Schristos  tzdata$(VERSION)-rearguard.tar.gz.asc
10271.41SchristosALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
10281.40Schristos  tzdb-$(VERSION).tar.lz.asc
10291.40Schristos
10301.41Schristostarballs rearguard_tarballs traditional_tarballs \
10311.41Schristossignatures rearguard_signatures traditional_signatures: \
10321.41Schristos  version set-timestamps.out rearguard.zi
10331.35Schristos		VERSION=`cat version` && \
10341.48Schristos		$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
10351.35Schristos
10361.40Schristos# These *_version rules are intended for use if VERSION is set by some
10371.40Schristos# other means.  Ordinarily these rules are used only by the above
10381.40Schristos# non-_version rules, which set VERSION on the 'make' command line.
10391.41Schristostarballs_version: traditional_tarballs_version rearguard_tarballs_version \
10401.40Schristos  tzdb-$(VERSION).tar.lz
10411.41Schristosrearguard_tarballs_version: \
10421.41Schristos  tzdata$(VERSION)-rearguard.tar.gz
10431.38Schristostraditional_tarballs_version: \
10441.38Schristos  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
10451.40Schristossignatures_version: $(ALL_ASC)
10461.41Schristosrearguard_signatures_version: $(REARGUARD_ASC)
10471.40Schristostraditional_signatures_version: $(TRADITIONAL_ASC)
10481.9Schristos
10491.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out
10501.6Schristos		LC_ALL=C && export LC_ALL && \
10511.7Schristos		tar $(TARFLAGS) -cf - \
10521.23Schristos		    $(COMMON) $(DOCS) $(SOURCES) | \
10531.38Schristos		  gzip $(GZIPFLAGS) >$@.out
10541.35Schristos		mv $@.out $@
10551.10Schristos
10561.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out
10571.6Schristos		LC_ALL=C && export LC_ALL && \
10581.23Schristos		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
10591.38Schristos		  gzip $(GZIPFLAGS) >$@.out
10601.35Schristos		mv $@.out $@
10611.9Schristos
10621.40Schristostzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
10631.40Schristos		rm -fr tzdata$(VERSION)-rearguard.dir
10641.40Schristos		mkdir tzdata$(VERSION)-rearguard.dir
10651.40Schristos		ln $(COMMON) $(DATA) $(MISC) tzdata$(VERSION)-rearguard.dir
10661.40Schristos		cd tzdata$(VERSION)-rearguard.dir && \
10671.40Schristos		  rm -f $(TDATA) $(PACKRATDATA) version
10681.40Schristos		for f in $(TDATA) $(PACKRATDATA); do \
10691.40Schristos		  rearf=tzdata$(VERSION)-rearguard.dir/$$f; \
10701.40Schristos		  $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
10711.48Schristos		  $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
10721.40Schristos		done
10731.40Schristos		sed '1s/$$/-rearguard/' \
10741.40Schristos		  <version >tzdata$(VERSION)-rearguard.dir/version
10751.47Schristos		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
10761.48Schristos		TZ=UTC0 touch -mt 202010122253.00 \
10771.47Schristos		  tzdata$(VERSION)-rearguard.dir/pacificnew
10781.40Schristos		touch -cmr version tzdata$(VERSION)-rearguard.dir/version
10791.40Schristos		LC_ALL=C && export LC_ALL && \
10801.40Schristos		  (cd tzdata$(VERSION)-rearguard.dir && \
10811.47Schristos		   tar $(TARFLAGS) -cf - \
10821.47Schristos			$(COMMON) $(DATA) $(MISC) pacificnew | \
10831.40Schristos		     gzip $(GZIPFLAGS)) >$@.out
10841.40Schristos		mv $@.out $@
10851.40Schristos
10861.41Schristostzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
10871.34Schristos		rm -fr tzdb-$(VERSION)
10881.34Schristos		mkdir tzdb-$(VERSION)
10891.34Schristos		ln $(ENCHILADA) tzdb-$(VERSION)
10901.48Schristos		$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
10911.34Schristos		LC_ALL=C && export LC_ALL && \
10921.35Schristos		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
10931.35Schristos		mv $@.out $@
10941.9Schristos
10951.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
10961.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
10971.40Schristostzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
10981.34Schristostzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
10991.40Schristos$(ALL_ASC):
11001.44Schristos		$(GPG) --armor --detach-sign $?
11011.34Schristos
11021.41SchristosTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
11031.41Schristostypecheck: typecheck_long_long typecheck_unsigned
11041.41Schristostypecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
11051.41Schristos		rm -fr $@.dir
11061.41Schristos		mkdir $@.dir
11071.41Schristos		ln $(VERSION_DEPS) $@.dir
11081.41Schristos		cd $@.dir && \
11091.41Schristos		  case $@ in \
11101.41Schristos		    *_long_long) i="long long";; \
11111.41Schristos		    *_unsigned ) i="unsigned" ;; \
11121.41Schristos		  esac && \
11131.41Schristos		  typecheck_cflags='' && \
11141.41Schristos		  $(MAKE) \
11151.41Schristos		    CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
11161.41Schristos		    TOPDIR="`pwd`" \
11171.41Schristos		    install
11181.41Schristos		$@.dir/zdump -i -c 1970,1971 Europe/Rome
11191.41Schristos		touch $@
11201.1Smlelstv
11211.38Schristoszonenames:	tzdata.zi
11221.38Schristos		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
11231.1Smlelstv
11241.1Smlelstvasctime.o:	private.h tzfile.h
11251.1Smlelstvdate.o:		private.h
11261.1Smlelstvdifftime.o:	private.h
11271.1Smlelstvlocaltime.o:	private.h tzfile.h
11281.23Schristosstrftime.o:	private.h tzfile.h
11291.6Schristoszdump.o:	version.h
11301.6Schristoszic.o:		private.h tzfile.h version.h
11311.1Smlelstv
11321.22Schristos.PHONY: ALL INSTALL all
11331.41Schristos.PHONY: check check_time_t_alternatives
11341.42Schristos.PHONY: check_web check_zishrink
11351.40Schristos.PHONY: clean clean_misc dummy.zd force_tzs
11361.32Schristos.PHONY: install install_data maintainer-clean names
11371.41Schristos.PHONY: posix_only posix_packrat posix_right public
11381.41Schristos.PHONY: rearguard_signatures rearguard_signatures_version
11391.41Schristos.PHONY: rearguard_tarballs rearguard_tarballs_version
11401.41Schristos.PHONY: right_only right_posix signatures signatures_version
11411.40Schristos.PHONY: tarballs tarballs_version
11421.40Schristos.PHONY: traditional_signatures traditional_signatures_version
11431.40Schristos.PHONY: traditional_tarballs traditional_tarballs_version
11441.40Schristos.PHONY: typecheck
11451.22Schristos.PHONY: zonenames zones
11461.40Schristos.PHONY: $(ZDS)
1147