11.41Schristos# Make and install tzdb code and data. 21.1Smlelstv# This file is in the public domain, so clarified as of 31.1Smlelstv# 2009-05-17 by Arthur David Olson. 41.56Schristos# Request POSIX conformance; this must be the first non-comment line. 51.56Schristos.POSIX: 61.58Schristos# On older platforms you may need to scrounge for POSIX conformance. 71.58Schristos# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007), 81.58Schristos# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'. 91.56Schristos 101.56Schristos# To affect how this Makefile works, you can run a shell script like this: 111.56Schristos# 121.56Schristos# #!/bin/sh 131.58Schristos# make CC='gcc -std=gnu23' "$@" 141.56Schristos# 151.58Schristos# This example script is appropriate for a circa 2024 GNU/Linux system 161.58Schristos# where a non-default setting enables this package's optional use of C23. 171.56Schristos# 181.56Schristos# Alternatively, you can simply edit this Makefile to tailor the following 191.56Schristos# macro definitions. 201.56Schristos 211.56Schristos############################################################################### 221.56Schristos# Start of macros that one plausibly might want to tailor. 231.1Smlelstv 241.10Schristos# Package name for the code distribution. 251.10SchristosPACKAGE= tzcode 261.10Schristos 271.34Schristos# Version number for the distribution, overridden in the 'tarballs' rule below. 281.35SchristosVERSION= unknown 291.9Schristos 301.9Schristos# Email address for bug reports. 311.9SchristosBUGEMAIL= tz@iana.org 321.6Schristos 331.43Schristos# DATAFORM selects the data format. 341.43Schristos# Available formats represent essentially the same data, albeit 351.43Schristos# possibly with minor discrepancies that users are not likely to notice. 361.43Schristos# To get new features and the best data right away, use: 371.40Schristos# DATAFORM= vanguard 381.40Schristos# To wait a while before using new features, to give downstream users 391.40Schristos# time to upgrade zic (the default), use: 401.40Schristos# DATAFORM= main 411.40Schristos# To wait even longer for new features, use: 421.40Schristos# DATAFORM= rearguard 431.46Schristos# Rearguard users might also want "ZFLAGS = -b fat"; see below. 441.40SchristosDATAFORM= main 451.40Schristos 461.41Schristos# Change the line below for your timezone (after finding the one you want in 471.41Schristos# one of the $(TDATA) source files, or adding it to a source file). 481.41Schristos# Alternatively, if you discover you've got the wrong timezone, you can just 491.46Schristos# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. 501.1Smlelstv# Use the command 511.1Smlelstv# make zonenames 521.1Smlelstv# to get a list of the values you can use for LOCALTIME. 531.1Smlelstv 541.51SchristosLOCALTIME= Factory 551.1Smlelstv 561.58Schristos# The POSIXRULES macro controls interpretation of POSIX-like TZ 571.55Schristos# settings like TZ='EET-2EEST' that lack DST transition rules. 581.46Schristos# If POSIXRULES is '-', no template is installed; this is the default. 591.46Schristos# Any other value for POSIXRULES is obsolete and should not be relied on, as: 601.44Schristos# * It does not work correctly in popular implementations such as GNU/Linux. 611.49Schristos# * It does not work even in tzcode, except for historical timestamps 621.49Schristos# that precede the last explicit transition in the POSIXRULES file. 631.49Schristos# Hence it typically does not work for current and future timestamps. 641.46Schristos# If, despite the above, you want a template for handling these settings, 651.46Schristos# you can change the line below (after finding the timezone you want in the 661.46Schristos# one of the $(TDATA) source files, or adding it to a source file). 671.46Schristos# Alternatively, if you discover you've got the wrong timezone, you can just 681.46Schristos# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. 691.46Schristos# Use the command 701.46Schristos# make zonenames 711.46Schristos# to get a list of the values you can use for POSIXRULES. 721.1Smlelstv 731.46SchristosPOSIXRULES= - 741.1Smlelstv 751.1Smlelstv# Also see TZDEFRULESTRING below, which takes effect only 761.55Schristos# if POSIXRULES is '-' or if the template file cannot be accessed. 771.1Smlelstv 781.1Smlelstv 791.39Schristos# Installation locations. 801.39Schristos# 811.39Schristos# The defaults are suitable for Debian, except that if REDO is 821.39Schristos# posix_right or right_posix then files that Debian puts under 831.39Schristos# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead 841.39Schristos# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, 851.39Schristos# respectively. Problems with the Debian approach are discussed in 861.39Schristos# the commentary for the right_posix rule (below). 871.39Schristos 881.39Schristos# Destination directory, which can be used for staging. 891.39Schristos# 'make DESTDIR=/stage install' installs under /stage (e.g., to 901.39Schristos# /stage/etc/localtime instead of to /etc/localtime). Files under 911.39Schristos# /stage are not intended to work as-is, but can be copied by hand to 921.39Schristos# the root directory later. If DESTDIR is empty, 'make install' does 931.39Schristos# not stage, but installs directly into production locations. 941.39SchristosDESTDIR = 951.39Schristos 961.39Schristos# Everything is installed into subdirectories of TOPDIR, and used there. 971.39Schristos# TOPDIR should be empty (meaning the root directory), 981.39Schristos# or a directory name that does not end in "/". 991.39Schristos# TOPDIR should be empty or an absolute name unless you're just testing. 1001.39SchristosTOPDIR = 1011.39Schristos 1021.41Schristos# The default local timezone is taken from the file TZDEFAULT. 1031.39SchristosTZDEFAULT = $(TOPDIR)/etc/localtime 1041.39Schristos 1051.39Schristos# The subdirectory containing installed program and data files, and 1061.39Schristos# likewise for installed files that can be shared among architectures. 1071.39Schristos# These should be relative file names. 1081.39SchristosUSRDIR = usr 1091.39SchristosUSRSHAREDIR = $(USRDIR)/share 1101.1Smlelstv 1111.41Schristos# "Compiled" timezone information is placed in the "TZDIR" directory 1121.1Smlelstv# (and subdirectories). 1131.38Schristos# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. 1141.15SchristosTZDIR_BASENAME= zoneinfo 1151.39SchristosTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) 1161.1Smlelstv 1171.39Schristos# The "tzselect" and (if you do "make INSTALL") "date" commands go in: 1181.39SchristosBINDIR = $(TOPDIR)/$(USRDIR)/bin 1191.1Smlelstv 1201.39Schristos# The "zdump" command goes in: 1211.39SchristosZDUMPDIR = $(BINDIR) 1221.1Smlelstv 1231.39Schristos# The "zic" command goes in: 1241.39SchristosZICDIR = $(TOPDIR)/$(USRDIR)/sbin 1251.1Smlelstv 1261.1Smlelstv# Manual pages go in subdirectories of. . . 1271.39SchristosMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man 1281.1Smlelstv 1291.39Schristos# Library functions are put in an archive in LIBDIR. 1301.39SchristosLIBDIR = $(TOPDIR)/$(USRDIR)/lib 1311.1Smlelstv 1321.1Smlelstv 1331.41Schristos# Types to try, as an alternative to time_t. 1341.41SchristosTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) 1351.58SchristosTIME_T_ALTERNATIVES_HEAD = int_least64_t.ck 1361.58SchristosTIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ 1371.58Schristos uint_least64_t.ck 1381.1Smlelstv 1391.43Schristos# What kind of TZif data files to generate. (TZif is the binary time 1401.59Schristos# zone data format that zic generates; see Internet RFC 9636.) 1411.37Schristos# If you want only POSIX time, with time values interpreted as 1421.37Schristos# seconds since the epoch (not counting leap seconds), use 1431.1Smlelstv# REDO= posix_only 1441.38Schristos# below. If you want only "right" time, with values interpreted 1451.37Schristos# as seconds since the epoch (counting leap seconds), use 1461.1Smlelstv# REDO= right_only 1471.1Smlelstv# below. If you want both sets of data available, with leap seconds not 1481.1Smlelstv# counted normally, use 1491.1Smlelstv# REDO= posix_right 1501.1Smlelstv# below. If you want both sets of data available, with leap seconds counted 1511.1Smlelstv# normally, use 1521.1Smlelstv# REDO= right_posix 1531.32Schristos# below. POSIX mandates that leap seconds not be counted; for compatibility 1541.37Schristos# with it, use "posix_only" or "posix_right". Use POSIX time on systems with 1551.37Schristos# leap smearing; this can work better than unsmeared "right" time with 1561.37Schristos# applications that are not leap second aware, and is closer to unsmeared 1571.37Schristos# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). 1581.1Smlelstv 1591.1SmlelstvREDO= posix_right 1601.1Smlelstv 1611.45Schristos# Whether to put an "Expires" line in the leapseconds file. 1621.45Schristos# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. 1631.45Schristos# The EXPIRES_LINE value matters only if REDO's value contains "right". 1641.45Schristos# If you change EXPIRES_LINE, remove the leapseconds file before running "make". 1651.45Schristos# zic's support for the Expires line was introduced in tzdb 2020a, 1661.49Schristos# and was modified in tzdb 2021b to generate version 4 TZif files. 1671.49Schristos# EXPIRES_LINE defaults to 0 for now so that the leapseconds file 1681.49Schristos# can be given to pre-2020a zic implementations and so that TZif files 1691.49Schristos# built by newer zic implementations can be read by pre-2021b libraries. 1701.45SchristosEXPIRES_LINE= 0 1711.45Schristos 1721.41Schristos# To install data in text form that has all the information of the TZif data, 1731.38Schristos# (optionally incorporating leap second information), use 1741.38Schristos# TZDATA_TEXT= tzdata.zi leapseconds 1751.38Schristos# To install text data without leap second information (e.g., because 1761.38Schristos# REDO='posix_only'), use 1771.38Schristos# TZDATA_TEXT= tzdata.zi 1781.38Schristos# To avoid installing text data, use 1791.38Schristos# TZDATA_TEXT= 1801.38Schristos 1811.38SchristosTZDATA_TEXT= leapseconds tzdata.zi 1821.38Schristos 1831.38Schristos# For backward-compatibility links for old zone names, use 1841.39Schristos# BACKWARD= backward 1851.38Schristos# To omit these links, use 1861.38Schristos# BACKWARD= 1871.38Schristos 1881.39SchristosBACKWARD= backward 1891.38Schristos 1901.51Schristos# If you want out-of-scope and often-wrong data from the file 'backzone', 1911.51Schristos# but only for entries listed in the backward-compatibility file zone.tab, use 1921.32Schristos# PACKRATDATA= backzone 1931.51Schristos# PACKRATLIST= zone.tab 1941.51Schristos# If you want all the 'backzone' data, use 1951.51Schristos# PACKRATDATA= backzone 1961.51Schristos# PACKRATLIST= 1971.32Schristos# To omit this data, use 1981.32Schristos# PACKRATDATA= 1991.51Schristos# PACKRATLIST= 2001.32Schristos 2011.32SchristosPACKRATDATA= 2021.51SchristosPACKRATLIST= 2031.32Schristos 2041.38Schristos# The name of a locale using the UTF-8 encoding, used during self-tests. 2051.38Schristos# The tests are skipped if the name does not appear to work on this system. 2061.38Schristos 2071.38SchristosUTF8_LOCALE= en_US.utf8 2081.38Schristos 2091.1Smlelstv# Non-default libraries needed to link. 2101.54Schristos# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. 2111.1SmlelstvLDLIBS= 2121.1Smlelstv 2131.56Schristos# Add the following to an uncommented "CFLAGS=" line as needed 2141.56Schristos# to override defaults specified in the source code or by the system. 2151.56Schristos# "-DFOO" is equivalent to "-DFOO=1". 2161.38Schristos# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime 2171.38Schristos# formats that generate only the last two digits of year numbers 2181.38Schristos# -DEPOCH_LOCAL if the 'time' function returns local time not UT 2191.38Schristos# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater 2201.38Schristos# than what POSIX specifies, assuming local time is UT. 2211.38Schristos# For example, N is 252460800 on AmigaOS. 2221.32Schristos# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r 2231.58Schristos# on POSIX platforms predating POSIX.1-2024 2241.38Schristos# -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ' 2251.54Schristos# -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm 2261.32Schristos# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows) 2271.55Schristos# -DHAVE__GENERIC=0 if _Generic does not work* 2281.54Schristos# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), 2291.54Schristos# -DHAVE_GETRANDOM=0 to avoid using getrandom 2301.54Schristos# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), 2311.54Schristos# where LDLIBS also needs to contain -lintl on some hosts; 2321.54Schristos# -DHAVE_GETTEXT=0 to avoid using gettext 2331.38Schristos# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares 2341.58Schristos# ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier 2351.35Schristos# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). 2361.55Schristos# -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+ 2371.16Schristos# -DHAVE_LINK=0 if your system lacks a link function 2381.23Schristos# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function 2391.23Schristos# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz 2401.23Schristos# localtime_rz can make zdump significantly faster, but is nonstandard. 2411.49Schristos# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. 2421.32Schristos# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare 2431.32Schristos# functions like 'link' or variables like 'tzname' required by POSIX 2441.53Schristos# -DHAVE_SETENV=0 if your system lacks the setenv function 2451.55Schristos# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ 2461.54Schristos# -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like 2471.54Schristos# __builtin_add_overflow work* 2481.55Schristos# -DHAVE_STDINT_H=0 if <stdint.h> does not work*+ 2491.38Schristos# -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l 2501.28Schristos# -DHAVE_STRDUP=0 if your system lacks the strdup function 2511.55Schristos# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ 2521.1Smlelstv# -DHAVE_SYMLINK=0 if your system lacks the symlink function 2531.54Schristos# -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work* 2541.23Schristos# -DHAVE_TZSET=0 if your system lacks a tzset function 2551.54Schristos# -DHAVE_UNISTD_H=0 if <unistd.h> does not work* 2561.54Schristos# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work* 2571.38Schristos# -Dlocale_t=XXX if your system uses XXX instead of locale_t 2581.59Schristos# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow 2591.56Schristos# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ 2601.56Schristos# Typically it is better to use a later standard. For example, 2611.56Schristos# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. 2621.56Schristos# Even with -DPORT_TO_C89, the code needs at least one C99 2631.56Schristos# feature (integers at least 64 bits wide) and maybe more. 2641.40Schristos# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers 2651.40Schristos# with external linkage, e.g., applications cannot define 'localtime'. 2661.59Schristos# -Dssize_t=int on hosts like MS-Windows that lack ssize_t 2671.58Schristos# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers 2681.58Schristos# Although -DSUPPORT_C89=0 might work around latent bugs in callers, 2691.58Schristos# it does not conform to POSIX. 2701.58Schristos# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+ 2711.58Schristos# However, this might cause problems in POSIX.1-2024-or-later callers. 2721.40Schristos# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has 2731.40Schristos# security implications and is not recommended for general use 2741.38Schristos# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; 2751.23Schristos# not needed by the main-program tz code, which is single-threaded. 2761.23Schristos# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. 2771.14Schristos# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t 2781.38Schristos# This is intended for internal use only; it mangles external names. 2791.1Smlelstv# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 2801.22Schristos# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 2811.1Smlelstv# the default is system-supplied, typically "/usr/lib/locale" 2821.14Schristos# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 2831.58Schristos# DST transitions for proleptic format TZ strings lacking them, 2841.55Schristos# in the usual case where POSIXRULES is '-'. If not specified, 2851.55Schristos# TZDEFRULESTRING defaults to US rules for future DST transitions. 2861.55Schristos# This mishandles some past timestamps, as US DST rules have changed. 2871.55Schristos# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, 2881.55Schristos# as Europe and US DST rules differ. 2891.59Schristos# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254) 2901.38Schristos# -DUNINIT_TRAP if reading uninitialized storage can cause problems 2911.23Schristos# other than simply getting garbage data 2921.23Schristos# -DUSE_LTZ=0 to build zdump with the system time zone library 2931.23Schristos# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. 2941.46Schristos# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and 2951.46Schristos# similarly for "slim". Fat TZif files work around incompatibilities 2961.53Schristos# and bugs in some TZif readers, notably older ones that 2971.53Schristos# ignore or otherwise mishandle 64-bit data in TZif files; 2981.53Schristos# however, fat TZif files may trigger bugs in newer TZif readers. 2991.53Schristos# Slim TZif files are more efficient, and are the default. 3001.1Smlelstv# -DZIC_MAX_ABBR_LEN_WO_WARN=3 3011.1Smlelstv# (or some other number) to set the maximum time zone abbreviation length 3021.1Smlelstv# that zic will accept without a warning (the default is 6) 3031.56Schristos# -g to generate symbolic debugging info 3041.56Schristos# -Idir to include from directory 'dir' 3051.56Schristos# -O0 to disable optimization; other -O options to enable more optimization 3061.56Schristos# -Uname to remove any definition of the macro 'name' 3071.30Schristos# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking 3081.53Schristos# 3091.53Schristos# * Options marked "*" can be omitted if your compiler is C23 compatible. 3101.55Schristos# * Options marked "+" are obsolescent and are planned to be removed 3111.58Schristos# once the code assumes C99 or later (say in the year 2029) 3121.58Schristos# and POSIX.1-2024 or later (say in the year 2034). 3131.53Schristos# 3141.38Schristos# Select instrumentation via "make GCC_INSTRUMENT='whatever'". 3151.38SchristosGCC_INSTRUMENT = \ 3161.38Schristos -fsanitize=undefined -fsanitize-address-use-after-scope \ 3171.38Schristos -fsanitize-undefined-trap-on-error -fstack-protector 3181.49Schristos# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. 3191.58SchristosGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ 3201.38Schristos $(GCC_INSTRUMENT) \ 3211.38Schristos -Wall -Wextra \ 3221.38Schristos -Walloc-size-larger-than=100000 -Warray-bounds=2 \ 3231.59Schristos -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \ 3241.59Schristos -Wdate-time \ 3251.38Schristos -Wdeclaration-after-statement -Wdouble-promotion \ 3261.58Schristos -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ 3271.38Schristos -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ 3281.54Schristos -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ 3291.58Schristos -Wmissing-declarations -Wmissing-prototypes \ 3301.58Schristos -Wmissing-variable-declarations -Wnested-externs \ 3311.49Schristos -Wnull-dereference \ 3321.38Schristos -Wold-style-definition -Woverlength-strings -Wpointer-arith \ 3331.49Schristos -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ 3341.49Schristos -Wstrict-prototypes -Wstringop-overflow=4 \ 3351.40Schristos -Wstringop-truncation -Wsuggest-attribute=cold \ 3361.38Schristos -Wsuggest-attribute=const -Wsuggest-attribute=format \ 3371.40Schristos -Wsuggest-attribute=malloc \ 3381.38Schristos -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ 3391.58Schristos -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \ 3401.38Schristos -Wvariadic-macros -Wvla -Wwrite-strings \ 3411.59Schristos -Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits 3421.1Smlelstv# 3431.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s 3441.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file), 3451.1Smlelstv# add the name to a define such as 3461.1Smlelstv# -DTM_GMTOFF=tm_gmtoff 3471.23Schristos# to the end of the "CFLAGS=" line. If not defined, the code attempts to 3481.23Schristos# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. 3491.23Schristos# Similarly, if your system has a "zone abbreviation" field, define 3501.1Smlelstv# -DTM_ZONE=tm_zone 3511.57Schristos# and define NO_TM_ZONE to suppress any guessing. 3521.58Schristos# Although POSIX.1-2024 requires these fields and they are widely available 3531.58Schristos# on GNU/Linux and BSD systems, some older systems lack them. 3541.1Smlelstv# 3551.38Schristos# The next batch of options control support for external variables 3561.38Schristos# exported by tzcode. In practice these variables are less useful 3571.38Schristos# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 3581.38Schristos# # 3591.38Schristos# # To omit or support the external variable "tzname", add one of: 3601.45Schristos# # -DHAVE_TZNAME=0 # do not support "tzname" 3611.45Schristos# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 3621.45Schristos# # -DHAVE_TZNAME=2 # support and define "tzname" 3631.58Schristos# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988 3641.58Schristos# # and later, its contents are unspecified if you use a geographical TZ 3651.58Schristos# # and the variable is planned to be removed in a future POSIX edition. 3661.38Schristos# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 3671.38Schristos# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 3681.38Schristos# # crashes when combined with some platforms' standard libraries, 3691.38Schristos# # presumably due to memory allocation issues. 3701.38Schristos# # 3711.38Schristos# # To omit or support the external variables "timezone" and "daylight", add 3721.45Schristos# # -DUSG_COMPAT=0 # do not support 3731.45Schristos# # -DUSG_COMPAT=1 # support, and variables are defined by system library 3741.45Schristos# # -DUSG_COMPAT=2 # support and define variables 3751.57Schristos# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix 3761.58Schristos# # Systems Group code and are required by POSIX.1-2008 and later (with XSI), 3771.58Schristos# # although their contents are unspecified if you use a geographical TZ 3781.58Schristos# # and the variables are planned to be removed in a future edition of POSIX. 3791.38Schristos# # If not defined, the code attempts to guess USG_COMPAT from other macros. 3801.38Schristos# # 3811.38Schristos# # To support the external variable "altzone", add 3821.45Schristos# # -DALTZONE=0 # do not support 3831.45Schristos# # -DALTZONE=1 # support "altzone", which is defined by system library 3841.45Schristos# # -DALTZONE=2 # support and define "altzone" 3851.38Schristos# # to the end of the "CFLAGS=" line; although "altzone" appeared in 3861.38Schristos# # System V Release 3.1 it has not been standardized. 3871.45Schristos# # If not defined, the code attempts to guess ALTZONE from other macros. 3881.38Schristos# 3891.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work, 3901.1Smlelstv# add 3911.1Smlelstv# -DSTD_INSPIRED 3921.54Schristos# to the end of the "CFLAGS=" line. This arranges for the following 3931.54Schristos# functions to be added to the time conversion library. 3941.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument 3951.1Smlelstv# that gives an offset to add to the time_t when converting it. 3961.56Schristos# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 3971.56Schristos# "timelocal" is nearly equivalent to "mktime". 3981.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument 3991.1Smlelstv# that gives an offset to use when converting to a time_t. 4001.56Schristos# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 4011.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page. 4021.1Smlelstv# X3J11's work does not describe any of these functions. 4031.1Smlelstv# These functions may well disappear in future releases of the time 4041.1Smlelstv# conversion package. 4051.1Smlelstv# 4061.23Schristos# If you don't want functions that were inspired by NetBSD, add 4071.23Schristos# -DNETBSD_INSPIRED=0 4081.23Schristos# to the end of the "CFLAGS=" line. Otherwise, the functions 4091.23Schristos# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 4101.55Schristos# time library, and if STD_INSPIRED is also defined to nonzero the functions 4111.23Schristos# "posix2time_z" and "time2posix_z" are added as well. 4121.23Schristos# The functions ending in "_z" (or "_rz") are like their unsuffixed 4131.23Schristos# (or suffixed-by-"_r") counterparts, except with an extra first 4141.41Schristos# argument of opaque type timezone_t that specifies the timezone. 4151.23Schristos# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 4161.23Schristos# 4171.1Smlelstv# If you want to allocate state structures in localtime, add 4181.1Smlelstv# -DALL_STATE 4191.1Smlelstv# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 4201.1Smlelstv# 4211.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 4221.1Smlelstv# out by the National Institute of Standards and Technology 4231.56Schristos# which claims to test C and POSIX conformance. If you want to pass PCTS, add 4241.1Smlelstv# -DPCTS 4251.1Smlelstv# to the end of the "CFLAGS=" line. 4261.1Smlelstv# 4271.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add 4281.1Smlelstv# -DXPG4_1994_04_09 4291.1Smlelstv# to the end of the "CFLAGS=" line. This causes "strftime" to always return 4301.38Schristos# 53 as a week number (rather than 52 or 53) for January days before 4311.38Schristos# January's first Monday when a "%V" format is used and January 1 4321.1Smlelstv# falls on a Friday, Saturday, or Sunday. 4331.56Schristos# 4341.56Schristos# POSIX says CFLAGS defaults to "-O 1". 4351.56Schristos# Uncomment the following line and edit its contents as needed. 4361.1Smlelstv 4371.56Schristos#CFLAGS= -O 1 4381.1Smlelstv 4391.9Schristos 4401.56Schristos# The name of a POSIX-like library archiver, its flags, C compiler, 4411.56Schristos# linker flags, and 'make' utility. Ordinarily the defaults suffice. 4421.58Schristos# The commented-out values are the defaults specified by POSIX.1-2024. 4431.56Schristos#AR = ar 4441.56Schristos#ARFLAGS = -rv 4451.56Schristos#CC = c17 4461.56Schristos#LDFLAGS = 4471.56Schristos#MAKE = make 4481.1Smlelstv 4491.57Schristos# Where to fetch leap-seconds.list from. 4501.57Schristosleaplist_URI = \ 4511.57Schristos https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list 4521.57Schristos# The file is generated by the IERS Earth Orientation Centre, in Paris. 4531.57Schristosleaplist_TZ = Europe/Paris 4541.57Schristos 4551.32Schristos# The zic command and its arguments. 4561.32Schristos 4571.1Smlelstvzic= ./zic 4581.1SmlelstvZIC= $(zic) $(ZFLAGS) 4591.1Smlelstv 4601.43Schristos# To shrink the size of installed TZif files, 4611.43Schristos# append "-r @N" to omit data before N-seconds-after-the-Epoch. 4621.53Schristos# To grow the files and work around bugs in older applications, 4631.53Schristos# possibly at the expense of introducing bugs in newer ones, 4641.53Schristos# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 4651.44Schristos# See the zic man page for more about -b and -r. 4661.15SchristosZFLAGS= 4671.15Schristos 4681.41Schristos# How to use zic to install TZif files. 4691.32Schristos 4701.58SchristosZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' 4711.32Schristos 4721.56Schristos# The name of a POSIX-compliant 'awk' on your system. 4731.50Schristos# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 4741.50Schristos# Also, it is better (though not essential) if 'awk' supports UTF-8, 4751.50Schristos# and unfortunately mawk and busybox awk do not support UTF-8. 4761.50Schristos# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 4771.9SchristosAWK= awk 4781.9Schristos 4791.56Schristos# The full path name of a POSIX-compliant shell, preferably one that supports 4801.16Schristos# the Korn shell's 'select' statement as an extension. 4811.16Schristos# These days, Bash is the most popular. 4821.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh 4831.56Schristos# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 4841.16Schristos# is typically nicer if it works. 4851.9SchristosKSHELL= /bin/bash 4861.1Smlelstv 4871.57Schristos# Name of curl <https://curl.haxx.se/>, used for HTML validation 4881.57Schristos# and to fetch leap-seconds.list from upstream. 4891.58Schristos# Set CURL=: to disable use of the Internet. 4901.42SchristosCURL= curl 4911.42Schristos 4921.44Schristos# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 4931.44SchristosGPG= gpg 4941.44Schristos 4951.23Schristos# This expensive test requires USE_LTZ. 4961.23Schristos# To suppress it, define this macro to be empty. 4971.23SchristosCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 4981.23Schristos 4991.22Schristos# SAFE_CHAR is a regular expression that matches a safe character. 5001.22Schristos# Some parts of this distribution are limited to safe characters; 5011.22Schristos# others can use any UTF-8 character. 5021.22Schristos# For now, the safe characters are a safe subset of ASCII. 5031.9Schristos# The caller must set the shell variable 'sharp' to the character '#', 5041.9Schristos# since Makefile macros cannot contain '#'. 5051.9Schristos# TAB_CHAR is a single tab character, in single quotes. 5061.9SchristosTAB_CHAR= ' ' 5071.22SchristosSAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 5081.22SchristosSAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 5091.22SchristosSAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 5101.29SchristosSAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 5111.29SchristosSAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 5121.29Schristos 5131.55Schristos# These non-alphabetic, non-ASCII printable characters are Latin-1, 5141.55Schristos# and so are likely displayable even in editors like XEmacs 21 5151.55Schristos# that have limited display capabilities. 5161.55SchristosUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 5171.40Schristos# Non-ASCII non-letters that OK_CHAR allows, as these characters are 5181.41Schristos# useful in commentary. 5191.55SchristosUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 5201.40Schristos 5211.51Schristos# Put this in a bracket expression to match spaces. 5221.51Schristoss = [:space:] 5231.51Schristos 5241.29Schristos# OK_CHAR matches any character allowed in the distributed files. 5251.40Schristos# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 5261.40Schristos# multibyte letters are also allowed so that commentary can contain a 5271.40Schristos# few safe symbols and people's names and can quote non-English sources. 5281.40Schristos# Other non-letters are limited to ASCII renderings for the 5291.40Schristos# convenience of maintainers using XEmacs 21.5.34, which by default 5301.40Schristos# mishandles Unicode characters U+0100 and greater. 5311.40SchristosOK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 5321.22Schristos 5331.22Schristos# SAFE_LINE matches a line of safe characters. 5341.29Schristos# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 5351.22Schristos# this is so that comments can contain non-ASCII characters. 5361.29Schristos# OK_LINE matches a line of OK characters. 5371.22SchristosSAFE_LINE= '^'$(SAFE_CHAR)'*$$' 5381.29SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 5391.29SchristosOK_LINE= '^'$(OK_CHAR)'*$$' 5401.9Schristos 5411.6Schristos# Flags to give 'tar' when making a distribution. 5421.6Schristos# Try to use flags appropriate for GNU tar. 5431.58SchristosGNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \ 5441.50Schristos --numeric-owner --owner=0 --group=0 \ 5451.50Schristos --mode=go+u,go-w --sort=name 5461.58SchristosSETUP_TAR= \ 5471.58Schristos export LC_ALL=C && \ 5481.58Schristos if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \ 5491.58Schristos TAR='tar $(GNUTARFLAGS)'; \ 5501.58Schristos else \ 5511.58Schristos TAR=tar; \ 5521.58Schristos fi 5531.6Schristos 5541.6Schristos# Flags to give 'gzip' when making a distribution. 5551.38SchristosGZIPFLAGS= -9n 5561.6Schristos 5571.54Schristos# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 5581.54Schristos# This makes it easier to see which Zone has been affected. 5591.58SchristosSETUP_DIFF_TZS = \ 5601.58Schristos if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \ 5611.58Schristos DIFF_TZS='diff -u -F^TZ='; \ 5621.58Schristos else \ 5631.58Schristos DIFF_TZS='diff -u'; \ 5641.58Schristos fi 5651.54Schristos 5661.56Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 5671.56SchristosRANLIB= : 5681.1Smlelstv 5691.56Schristos# POSIX prohibits defining or using SHELL. However, csh users on systems 5701.56Schristos# that use the user shell for Makefile commands may need to define SHELL. 5711.56Schristos#SHELL= /bin/sh 5721.29Schristos 5731.56Schristos# End of macros that one plausibly might want to tailor. 5741.56Schristos############################################################################### 5751.1Smlelstv 5761.16Schristos 5771.28SchristosTZCOBJS= zic.o 5781.58SchristosTZDOBJS= zdump.o localtime.o strftime.o 5791.58SchristosDATEOBJS= date.o localtime.o strftime.o 5801.45SchristosLIBSRCS= localtime.c asctime.c difftime.c strftime.c 5811.45SchristosLIBOBJS= localtime.o asctime.o difftime.o strftime.o 5821.1SmlelstvHEADERS= tzfile.h private.h 5831.28SchristosNONLIBSRCS= zic.c zdump.c 5841.45SchristosNEWUCBSRCS= date.c 5851.23SchristosSOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 5861.35Schristos tzselect.ksh workman.sh 5871.1SmlelstvMANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 5881.1Smlelstv tzfile.5 tzselect.8 zic.8 zdump.8 5891.16SchristosMANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 5901.16Schristos time2posix.3.txt \ 5911.16Schristos tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 5921.16Schristos date.1.txt 5931.38SchristosCOMMON= calendars CONTRIBUTING LICENSE Makefile \ 5941.49Schristos NEWS README SECURITY theory.html version 5951.39SchristosWEB_PAGES= tz-art.html tz-how-to.html tz-link.html 5961.58SchristosCHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck 5971.23SchristosDOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 5981.1SmlelstvPRIMARY_YDATA= africa antarctica asia australasia \ 5991.1Smlelstv europe northamerica southamerica 6001.39SchristosYDATA= $(PRIMARY_YDATA) etcetera 6011.46SchristosNDATA= factory 6021.46SchristosTDATA_TO_CHECK= $(YDATA) $(NDATA) backward 6031.39SchristosTDATA= $(YDATA) $(NDATA) $(BACKWARD) 6041.56SchristosZONETABLES= zone.tab zone1970.tab zonenow.tab 6051.38SchristosTABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 6061.16SchristosLEAP_DEPS= leapseconds.awk leap-seconds.list 6071.51SchristosTZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 6081.51Schristos $(PACKRATDATA) $(PACKRATLIST) 6091.51SchristosDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 6101.39SchristosDATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 6111.46Schristos leapseconds $(ZONETABLES) 6121.56SchristosAWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 6131.40Schristos ziguard.awk zishrink.awk 6141.52SchristosMISC= $(AWK_SCRIPTS) 6151.34SchristosTZS_YEAR= 2050 6161.41SchristosTZS_CUTOFF_FLAG= -c $(TZS_YEAR) 6171.34SchristosTZS= to$(TZS_YEAR).tzs 6181.34SchristosTZS_NEW= to$(TZS_YEAR)new.tzs 6191.59SchristosTZS_DEPS= $(YDATA) localtime.c private.h \ 6201.59Schristos strftime.c tzfile.h zdump.c zic.c 6211.51SchristosTZDATA_DIST = $(COMMON) $(DATA) $(MISC) 6221.41Schristos# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 6231.51SchristosEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 6241.41SchristosENCHILADA = $(EIGHT_YARDS) $(TZS) 6251.34Schristos 6261.34Schristos# Consult these files when deciding whether to rebuild the 'version' file. 6271.34Schristos# This list is not the same as the output of 'git ls-files', since 6281.34Schristos# .gitignore is not distributed. 6291.34SchristosVERSION_DEPS= \ 6301.49Schristos calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 6311.34Schristos africa antarctica asctime.c asia australasia \ 6321.34Schristos backward backzone \ 6331.56Schristos checklinks.awk checknow.awk checktab.awk \ 6341.34Schristos date.1 date.c difftime.c \ 6351.34Schristos etcetera europe factory iso3166.tab \ 6361.34Schristos leap-seconds.list leapseconds.awk localtime.c \ 6371.34Schristos newctime.3 newstrftime.3 newtzset.3 northamerica \ 6381.46Schristos private.h southamerica strftime.c theory.html \ 6391.39Schristos time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 6401.34Schristos tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 6411.46Schristos workman.sh zdump.8 zdump.c zic.8 zic.c \ 6421.40Schristos ziguard.awk zishrink.awk \ 6431.56Schristos zone.tab zone1970.tab zonenow.tab 6441.1Smlelstv 6451.46Schristosall: tzselect zic zdump libtz.a $(TABDATA) \ 6461.40Schristos vanguard.zi main.zi rearguard.zi 6471.1Smlelstv 6481.29SchristosALL: all date $(ENCHILADA) 6491.1Smlelstv 6501.16Schristosinstall: all $(DATA) $(REDO) $(MANS) 6511.39Schristos mkdir -p '$(DESTDIR)$(BINDIR)' \ 6521.39Schristos '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 6531.39Schristos '$(DESTDIR)$(LIBDIR)' \ 6541.39Schristos '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 6551.39Schristos '$(DESTDIR)$(MANDIR)/man8' 6561.44Schristos $(ZIC_INSTALL) -l $(LOCALTIME) \ 6571.58Schristos -p $(POSIXRULES) \ 6581.39Schristos -t '$(DESTDIR)$(TZDEFAULT)' 6591.39Schristos cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 6601.39Schristos cp tzselect '$(DESTDIR)$(BINDIR)/.' 6611.39Schristos cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 6621.39Schristos cp zic '$(DESTDIR)$(ZICDIR)/.' 6631.39Schristos cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 6641.39Schristos $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 6651.39Schristos cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 6661.39Schristos cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 6671.39Schristos cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 6681.1Smlelstv 6691.1SmlelstvINSTALL: ALL install date.1 6701.39Schristos mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 6711.39Schristos cp date '$(DESTDIR)$(BINDIR)/.' 6721.39Schristos cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 6731.1Smlelstv 6741.48Schristos# Calculate version number from git, if available. 6751.48Schristos# Otherwise, use $(VERSION) unless it is "unknown" and there is already 6761.48Schristos# a 'version' file, in which case reuse the existing 'version' contents 6771.48Schristos# and append "-dirty" if the contents do not already end in "-dirty". 6781.34Schristosversion: $(VERSION_DEPS) 6791.35Schristos { (type git) >/dev/null 2>&1 && \ 6801.58Schristos V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 6811.58Schristos --abbrev=7 --dirty) || \ 6821.58Schristos if test '$(VERSION)' = unknown && read -r V <$@; then \ 6831.58Schristos V=$${V%-dirty}-dirty; \ 6841.48Schristos else \ 6851.48Schristos V='$(VERSION)'; \ 6861.48Schristos fi; } && \ 6871.35Schristos printf '%s\n' "$$V" >$@.out 6881.35Schristos mv $@.out $@ 6891.34Schristos 6901.51Schristos# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 6911.40Schristosvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 6921.51Schristos $(AWK) \ 6931.58Schristos -v DATAFORM=$(@:.zi=) \ 6941.51Schristos -v PACKRATDATA='$(PACKRATDATA)' \ 6951.51Schristos -v PACKRATLIST='$(PACKRATLIST)' \ 6961.51Schristos -f ziguard.awk \ 6971.40Schristos $(TDATA) $(PACKRATDATA) >$@.out 6981.40Schristos mv $@.out $@ 6991.41Schristos# This file has a version comment that attempts to capture any tailoring 7001.51Schristos# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 7011.41Schristostzdata.zi: $(DATAFORM).zi version zishrink.awk 7021.58Schristos read -r version <version && \ 7031.41Schristos LC_ALL=C $(AWK) \ 7041.41Schristos -v dataform='$(DATAFORM)' \ 7051.41Schristos -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 7061.41Schristos -v redo='$(REDO)' \ 7071.41Schristos -v version="$$version" \ 7081.41Schristos -f zishrink.awk \ 7091.40Schristos $(DATAFORM).zi >$@.out 7101.38Schristos mv $@.out $@ 7111.38Schristos 7121.56Schristostzdir.h: 7131.56Schristos printf '%s\n' >$@.out \ 7141.56Schristos '#ifndef TZDEFAULT' \ 7151.56Schristos '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 7161.56Schristos '#endif' \ 7171.56Schristos '#ifndef TZDIR' \ 7181.56Schristos '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 7191.56Schristos '#endif' 7201.56Schristos mv $@.out $@ 7211.56Schristos 7221.34Schristosversion.h: version 7231.58Schristos read -r VERSION <version && printf '%s\n' \ 7241.35Schristos 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 7251.35Schristos "static char const TZVERSION[]=\"$$VERSION\";" \ 7261.35Schristos 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 7271.35Schristos >$@.out 7281.35Schristos mv $@.out $@ 7291.6Schristos 7301.1Smlelstvzdump: $(TZDOBJS) 7311.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 7321.1Smlelstv 7331.32Schristoszic: $(TZCOBJS) 7341.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 7351.1Smlelstv 7361.16Schristosleapseconds: $(LEAP_DEPS) 7371.45Schristos $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 7381.45Schristos -f leapseconds.awk leap-seconds.list >$@.out 7391.35Schristos mv $@.out $@ 7401.15Schristos 7411.57Schristos# Awk script to extract a Git-style author from leap-seconds.list comments. 7421.57SchristosEXTRACT_AUTHOR = \ 7431.57Schristos author_line { sub(/^.[[:space:]]*/, ""); \ 7441.57Schristos sub(/:[[:space:]]*/, " <"); \ 7451.57Schristos printf "%s>\n", $$0; \ 7461.57Schristos success = 1; \ 7471.57Schristos exit \ 7481.57Schristos } \ 7491.57Schristos /Questions or comments to:/ { author_line = 1 } \ 7501.57Schristos END { exit !success } 7511.57Schristos 7521.57Schristos# Fetch leap-seconds.list from upstream. 7531.57Schristosfetch-leap-seconds.list: 7541.57Schristos $(CURL) -OR $(leaplist_URI) 7551.57Schristos 7561.57Schristos# Fetch leap-seconds.list from upstream and commit it to the local repository. 7571.57Schristoscommit-leap-seconds.list: fetch-leap-seconds.list 7581.57Schristos author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ 7591.57Schristos date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ 7601.57Schristos git commit --author="$$author" --date="$$date" -m'make $@' \ 7611.57Schristos leap-seconds.list 7621.57Schristos 7631.58Schristos# Arguments to pass to submakes. 7641.32Schristos# They can be overridden by later submake arguments. 7651.32SchristosINSTALLARGS = \ 7661.39Schristos BACKWARD='$(BACKWARD)' \ 7671.39Schristos DESTDIR='$(DESTDIR)' \ 7681.32Schristos PACKRATDATA='$(PACKRATDATA)' \ 7691.51Schristos PACKRATLIST='$(PACKRATLIST)' \ 7701.39Schristos TZDEFAULT='$(TZDEFAULT)' \ 7711.39Schristos TZDIR='$(TZDIR)' \ 7721.32Schristos ZIC='$(ZIC)' 7731.32Schristos 7741.46SchristosINSTALL_DATA_DEPS = zic leapseconds tzdata.zi 7751.41Schristos 7761.58Schristosposix_only: $(INSTALL_DATA_DEPS) 7771.38Schristos $(ZIC_INSTALL) tzdata.zi 7781.32Schristos 7791.41Schristosright_only: $(INSTALL_DATA_DEPS) 7801.58Schristos $(ZIC_INSTALL) -L leapseconds tzdata.zi 7811.1Smlelstv 7821.1Smlelstv# In earlier versions of this makefile, the other two directories were 7831.1Smlelstv# subdirectories of $(TZDIR). However, this led to configuration errors. 7841.1Smlelstv# For example, with posix_right under the earlier scheme, 7851.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 7861.1Smlelstv# but gmtime without leap seconds, which led to problems with applications 7871.1Smlelstv# like sendmail that subtract gmtime from localtime. 7881.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR). 7891.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds 7901.1Smlelstv# to using them, or vice versa. 7911.32Schristosright_posix: right_only 7921.39Schristos rm -fr '$(DESTDIR)$(TZDIR)-leaps' 7931.39Schristos ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 7941.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 7951.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 7961.15Schristos 7971.32Schristosposix_right: posix_only 7981.39Schristos rm -fr '$(DESTDIR)$(TZDIR)-posix' 7991.39Schristos ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 8001.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 8011.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 8021.32Schristos 8031.1Smlelstvzones: $(REDO) 8041.1Smlelstv 8051.40Schristos# dummy.zd is not a real file; it is mentioned here only so that the 8061.40Schristos# top-level 'make' does not have a syntax error. 8071.40SchristosZDS = dummy.zd 8081.40Schristos# Rule used only by submakes invoked by the $(TZS_NEW) rule. 8091.40Schristos# It is separate so that GNU 'make -j' can run instances in parallel. 8101.40Schristos$(ZDS): zdump 8111.58Schristos ./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@ 8121.40Schristos 8131.41SchristosTZS_NEW_DEPS = tzdata.zi zdump zic 8141.41Schristos$(TZS_NEW): $(TZS_NEW_DEPS) 8151.41Schristos rm -fr tzs$(TZS_YEAR).dir 8161.41Schristos mkdir tzs$(TZS_YEAR).dir 8171.41Schristos $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 8181.38Schristos $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 8191.38Schristos tzdata.zi | LC_ALL=C sort >$@.out 8201.58Schristos x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 8211.41Schristos tzdata.zi \ 8221.58Schristos | LC_ALL=C sort -t . -k 2,2) && \ 8231.41Schristos set x $$x && \ 8241.40Schristos shift && \ 8251.40Schristos ZDS=$$* && \ 8261.58Schristos $(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 8271.41Schristos ZDS="$$ZDS" $$ZDS && \ 8281.41Schristos sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 8291.41Schristos rm -fr tzs$(TZS_YEAR).dir 8301.40Schristos mv $@.out $@ 8311.34Schristos 8321.58Schristos# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the 8331.34Schristos# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 8341.34Schristos$(TZS): 8351.41Schristos touch $@ 8361.34Schristos 8371.34Schristosforce_tzs: $(TZS_NEW) 8381.34Schristos cp $(TZS_NEW) $(TZS) 8391.34Schristos 8401.16Schristoslibtz.a: $(LIBOBJS) 8411.37Schristos rm -f $@ 8421.56Schristos $(AR) $(ARFLAGS) $@ $(LIBOBJS) 8431.16Schristos $(RANLIB) $@ 8441.1Smlelstv 8451.1Smlelstvdate: $(DATEOBJS) 8461.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 8471.1Smlelstv 8481.34Schristostzselect: tzselect.ksh version 8491.58Schristos read -r VERSION <version && sed \ 8501.56Schristos -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 8511.56Schristos -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 8521.56Schristos -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 8531.56Schristos -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 8541.56Schristos -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 8551.56Schristos -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 8561.56Schristos <$@.ksh >$@.out 8571.35Schristos chmod +x $@.out 8581.35Schristos mv $@.out $@ 8591.1Smlelstv 8601.59Schristoscheck: check_mild back.ck now.ck 8611.58Schristoscheck_mild: check_web check_zishrink \ 8621.58Schristos character-set.ck white-space.ck links.ck mainguard.ck \ 8631.59Schristos name-lengths.ck slashed-abbrs.ck sorted.ck \ 8641.58Schristos tables.ck ziguard.ck tzs.ck 8651.9Schristos 8661.56Schristos# True if UTF8_LOCALE does not work; 8671.56Schristos# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 8681.56SchristosUTF8_LOCALE_MISSING = \ 8691.56Schristos { test ! '$(UTF8_LOCALE)' \ 8701.56Schristos || ! printf 'A\304\200B\n' \ 8711.56Schristos | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 8721.58Schristos || { export LC_ALL='$(UTF8_LOCALE)'; false; }; } 8731.56Schristos 8741.58Schristoscharacter-set.ck: $(ENCHILADA) 8751.56Schristos $(UTF8_LOCALE_MISSING) || { \ 8761.22Schristos sharp='#' && \ 8771.35Schristos ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 8781.35Schristos $(MISC) $(SOURCES) $(WEB_PAGES) \ 8791.49Schristos CONTRIBUTING LICENSE README SECURITY \ 8801.38Schristos version tzdata.zi && \ 8811.41Schristos ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 8821.40Schristos Makefile && \ 8831.39Schristos ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 8841.46Schristos leapseconds zone.tab && \ 8851.38Schristos ! grep -Env $(OK_LINE) $(ENCHILADA); \ 8861.38Schristos } 8871.41Schristos touch $@ 8881.22Schristos 8891.58Schristoswhite-space.ck: $(ENCHILADA) 8901.56Schristos $(UTF8_LOCALE_MISSING) || { \ 8911.58Schristos enchilada='$(ENCHILADA)' && \ 8921.58Schristos patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \ 8931.56Schristos ! grep -En "$$pat|[$s]\$$" \ 8941.58Schristos $${enchilada%leap-seconds.list*} \ 8951.58Schristos $${enchilada#*leap-seconds.list}; \ 8961.56Schristos } 8971.56Schristos touch $@ 8981.23Schristos 8991.51SchristosPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 9001.51SchristosFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 9011.38Schristos 9021.58Schristosname-lengths.ck: $(TDATA_TO_CHECK) backzone 9031.58Schristos :;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 9041.39Schristos $(TDATA_TO_CHECK) backzone 9051.41Schristos touch $@ 9061.38Schristos 9071.58Schristosmainguard.ck: main.zi 9081.58Schristos test '$(PACKRATLIST)' || \ 9091.58Schristos cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi 9101.58Schristos touch $@ 9111.58Schristos 9121.51SchristosPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 9131.51SchristosSTDOFF = [-+]?[0-9:.]+ 9141.51SchristosRULELESS_SAVE = (-|$(STDOFF)[sd]?) 9151.51SchristosRULELESS_SLASHED_ABBRS = \ 9161.51Schristos $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 9171.51Schristos 9181.58Schristosslashed-abbrs.ck: $(TDATA_TO_CHECK) 9191.58Schristos :;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 9201.51Schristos touch $@ 9211.51Schristos 9221.23SchristosCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 9231.23Schristos 9241.58Schristossorted.ck: backward backzone 9251.54Schristos $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 9261.53Schristos backward | LC_ALL=C sort -cu 9271.58Schristos $(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu 9281.41Schristos touch $@ 9291.23Schristos 9301.58Schristosback.ck: checklinks.awk $(TDATA_TO_CHECK) 9311.53Schristos $(AWK) \ 9321.53Schristos -v DATAFORM=$(DATAFORM) \ 9331.53Schristos -v backcheck=backward \ 9341.53Schristos -f checklinks.awk $(TDATA_TO_CHECK) 9351.54Schristos touch $@ 9361.54Schristos 9371.58Schristoslinks.ck: checklinks.awk tzdata.zi 9381.53Schristos $(AWK) \ 9391.53Schristos -v DATAFORM=$(DATAFORM) \ 9401.53Schristos -f checklinks.awk tzdata.zi 9411.41Schristos touch $@ 9421.26Schristos 9431.56Schristos# Check timestamps from now through 28 years from now, to make sure 9441.56Schristos# that zonenow.tab contains all sequences of planned timestamps, 9451.56Schristos# without any duplicate sequences. In theory this might require 9461.58Schristos# 2800+ years but that would take a long time to check. 9471.58SchristosCHECK_NOW_TIMESTAMP = $$(./date +%s) 9481.56SchristosCHECK_NOW_FUTURE_YEARS = 28 9491.58SchristosCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) * 366 * 24 * 60 * 60 9501.58Schristosnow.ck: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 9511.58Schristos rm -fr $@d 9521.58Schristos mkdir $@d 9531.58Schristos ./zic -d $@d tzdata.zi 9541.56Schristos now=$(CHECK_NOW_TIMESTAMP) && \ 9551.58Schristos future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \ 9561.56Schristos ./zdump -i -t $$now,$$future \ 9571.58Schristos $$(find "$$PWD/$@d"/????*/ -type f) \ 9581.58Schristos >$@d/zdump-now.tab && \ 9591.58Schristos ./zdump -i -t 0,$$future \ 9601.58Schristos $$(find "$$PWD/$@d" -name Etc -prune \ 9611.58Schristos -o -type f ! -name '*.tab' -print) \ 9621.58Schristos >$@d/zdump-1970.tab 9631.56Schristos $(AWK) \ 9641.58Schristos -v zdump_table=$@d/zdump-now.tab \ 9651.56Schristos -f checknow.awk zonenow.tab 9661.58Schristos $(AWK) \ 9671.58Schristos 'BEGIN {print "-\t-\tUTC"} /^Zone/ {print "-\t-\t" $$2}' \ 9681.58Schristos $(PRIMARY_YDATA) backward factory | \ 9691.58Schristos $(AWK) \ 9701.58Schristos -v zdump_table=$@d/zdump-1970.tab \ 9711.58Schristos -f checknow.awk 9721.58Schristos rm -fr $@d 9731.56Schristos touch $@ 9741.56Schristos 9751.58Schristostables.ck: checktab.awk $(YDATA) backward zone.tab zone1970.tab 9761.22Schristos for tab in $(ZONETABLES); do \ 9771.49Schristos test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 9781.49Schristos $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 9791.22Schristos || exit; \ 9801.22Schristos done 9811.41Schristos touch $@ 9821.1Smlelstv 9831.58Schristostzs.ck: $(TZS) $(TZS_NEW) 9841.41Schristos if test -s $(TZS); then \ 9851.58Schristos $(SETUP_DIFF_TZS) && $$DIFF_TZS $(TZS) $(TZS_NEW); \ 9861.41Schristos else \ 9871.41Schristos cp $(TZS_NEW) $(TZS); \ 9881.41Schristos fi 9891.41Schristos touch $@ 9901.34Schristos 9911.42Schristoscheck_web: $(CHECK_WEB_PAGES) 9921.58Schristos.SUFFIXES: .ck .html 9931.58Schristos.html.ck: 9941.58Schristos { ! ($(CURL) --version) >/dev/null 2>&1 || \ 9951.58Schristos $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 9961.58Schristos -F file=@$<; } >$@.out && \ 9971.42Schristos test ! -s $@.out || { cat $@.out; exit 1; } 9981.42Schristos mv $@.out $@ 9991.38Schristos 10001.58Schristosziguard.ck: rearguard.zi vanguard.zi ziguard.awk 10011.51Schristos $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 10021.51Schristos diff -u rearguard.zi - 10031.51Schristos $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 10041.51Schristos diff -u vanguard.zi - 10051.51Schristos touch $@ 10061.51Schristos 10071.40Schristos# Check that zishrink.awk does not alter the data, and that ziguard.awk 10081.40Schristos# preserves main-format data. 10091.58Schristoscheck_zishrink: zishrink-posix.ck zishrink-right.ck 10101.58Schristoszishrink-posix.ck zishrink-right.ck: \ 10111.51Schristos zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 10121.51Schristos $(TDATA) $(DATAFORM).zi tzdata.zi 10131.58Schristos rm -fr $@d t-$@d shrunk-$@d 10141.58Schristos mkdir $@d t-$@d shrunk-$@d 10151.41Schristos case $@ in \ 10161.58Schristos *right*) leap='-L leapseconds';; \ 10171.41Schristos *) leap=;; \ 10181.41Schristos esac && \ 10191.58Schristos $(ZIC) $$leap -d $@d $(DATAFORM).zi && \ 10201.58Schristos $(ZIC) $$leap -d shrunk-$@d tzdata.zi && \ 10211.51Schristos case $(DATAFORM),$(PACKRATLIST) in \ 10221.51Schristos main,) \ 10231.58Schristos $(ZIC) $$leap -d t-$@d $(TDATA) && \ 10241.40Schristos $(AWK) '/^Rule/' $(TDATA) | \ 10251.58Schristos $(ZIC) $$leap -d t-$@d - $(PACKRATDATA) && \ 10261.58Schristos diff -r $@d t-$@d;; \ 10271.41Schristos esac 10281.58Schristos diff -r $@d shrunk-$@d 10291.58Schristos rm -fr $@d t-$@d shrunk-$@d 10301.41Schristos touch $@ 10311.1Smlelstv 10321.14Schristosclean_misc: 10331.58Schristos rm -fr *.ckd *.dir 10341.58Schristos rm -f *.ck *.core *.o *.out core core.* \ 10351.56Schristos date tzdir.h tzselect version.h zdump zic libtz.a 10361.14Schristosclean: clean_misc 10371.58Schristos rm -fr tzdb-*/ 10381.43Schristos rm -f *.zi $(TZS_NEW) 10391.1Smlelstv 10401.1Smlelstvmaintainer-clean: clean 10411.1Smlelstv @echo 'This command is intended for maintainers to use; it' 10421.1Smlelstv @echo 'deletes files that may need special tools to rebuild.' 10431.34Schristos rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 10441.1Smlelstv 10451.1Smlelstvnames: 10461.1Smlelstv @echo $(ENCHILADA) 10471.1Smlelstv 10481.58Schristospublic: check public.ck $(CHECK_TIME_T_ALTERNATIVES) \ 10491.16Schristos tarballs signatures 10501.16Schristos 10511.16Schristosdate.1.txt: date.1 10521.16Schristosnewctime.3.txt: newctime.3 10531.16Schristosnewstrftime.3.txt: newstrftime.3 10541.16Schristosnewtzset.3.txt: newtzset.3 10551.16Schristostime2posix.3.txt: time2posix.3 10561.16Schristostzfile.5.txt: tzfile.5 10571.16Schristostzselect.8.txt: tzselect.8 10581.16Schristoszdump.8.txt: zdump.8 10591.16Schristoszic.8.txt: zic.8 10601.16Schristos 10611.16Schristos$(MANTXTS): workman.sh 10621.58Schristos LC_ALL=C sh workman.sh $(@:.txt=) >$@.out 10631.35Schristos mv $@.out $@ 10641.9Schristos 10651.48Schristos# Set file timestamps deterministically if possible, 10661.48Schristos# so that tarballs containing the timestamps are reproducible. 10671.48Schristos# 10681.48Schristos# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 10691.48Schristos# file DEST to the maximum of the timestamps of the files A B C ..., 10701.48Schristos# plus N if GNU ls and touch are available. 10711.48SchristosSET_TIMESTAMP_N = sh -c '\ 10721.48Schristos n=$$0 dest=$$1; shift; \ 10731.56Schristos <"$$dest" && \ 10741.48Schristos if test $$n != 0 && \ 10751.58Schristos lsout=$$(ls -nt --time-style="+%s" "$$@" 2>/dev/null); then \ 10761.48Schristos set x $$lsout && \ 10771.58Schristos timestamp=$$(($$7 + $$n)) && \ 10781.56Schristos echo "+ touch -md @$$timestamp $$dest" && \ 10791.56Schristos touch -md @$$timestamp "$$dest"; \ 10801.56Schristos else \ 10811.58Schristos newest=$$(ls -t "$$@" | sed 1q) && \ 10821.56Schristos echo "+ touch -mr $$newest $$dest" && \ 10831.56Schristos touch -mr "$$newest" "$$dest"; \ 10841.56Schristos fi' 10851.48Schristos# If DEST depends on A B C ... in this Makefile, callers should use 10861.48Schristos# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 10871.48Schristos# downstream 'make' that considers equal timestamps to be out of date. 10881.48Schristos# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 10891.48Schristos# If all that matters is that the timestamp be reproducible 10901.48Schristos# and plausible, use $(SET_TIMESTAMP). 10911.48SchristosSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 10921.48SchristosSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 10931.48Schristos 10941.41Schristos# Set the timestamps to those of the git repository, if available, 10951.6Schristos# and if the files have not changed since then. 10961.48Schristos# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 10971.48Schristos# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 10981.48Schristos# If git or GNU is absent, don't bother to sync with git timestamps. 10991.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds' 11001.16Schristos# to be the maximum of the files it depends on. 11011.41Schristosset-timestamps.out: $(EIGHT_YARDS) 11021.16Schristos rm -f $@ 11031.35Schristos if (type git) >/dev/null 2>&1 && \ 11041.58Schristos files=$$(git ls-files $(EIGHT_YARDS)) && \ 11051.16Schristos touch -md @1 test.out; then \ 11061.16Schristos rm -f test.out && \ 11071.16Schristos for file in $$files; do \ 11081.59Schristos if git diff --quiet HEAD $$file; then \ 11091.58Schristos time=$$(TZ=UTC0 git log -1 \ 11101.56Schristos --format='tformat:%cd' \ 11111.56Schristos --date='format:%Y-%m-%dT%H:%M:%SZ' \ 11121.58Schristos $$file) && \ 11131.56Schristos echo "+ touch -md $$time $$file" && \ 11141.56Schristos touch -md $$time $$file; \ 11151.16Schristos else \ 11161.16Schristos echo >&2 "$$file: warning: does not match repository"; \ 11171.16Schristos fi || exit; \ 11181.16Schristos done; \ 11191.16Schristos fi 11201.48Schristos $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 11211.58Schristos for file in $(MANTXTS); do \ 11221.58Schristos $(SET_TIMESTAMP_DEP) $$file $${file%.txt} workman.sh || \ 11231.16Schristos exit; \ 11241.6Schristos done 11251.48Schristos $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 11261.48Schristos $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 11271.41Schristos touch $@ 11281.41Schristosset-tzs-timestamp.out: $(TZS) 11291.48Schristos $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 11301.16Schristos touch $@ 11311.6Schristos 11321.1Smlelstv# The zics below ensure that each data file can stand on its own. 11331.1Smlelstv# We also do an all-files run to catch links to links. 11341.1Smlelstv 11351.58Schristospublic.ck: $(VERSION_DEPS) 11361.58Schristos rm -fr $@d 11371.58Schristos mkdir $@d 11381.58Schristos ln $(VERSION_DEPS) $@d 11391.58Schristos cd $@d \ 11401.56Schristos && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 11411.58Schristos for i in $(TDATA_TO_CHECK) \ 11421.58Schristos tzdata.zi vanguard.zi main.zi rearguard.zi; \ 11431.48Schristos do \ 11441.58Schristos $@d/zic -v -d $@d/zoneinfo $@d/$$i || exit; \ 11451.9Schristos done 11461.58Schristos $@d/zic -v -d $@d/zoneinfo-all $(TDATA_TO_CHECK) 11471.49Schristos : 11481.49Schristos : Also check 'backzone' syntax. 11491.58Schristos rm $@d/main.zi 11501.58Schristos cd $@d && $(MAKE) PACKRATDATA=backzone main.zi 11511.58Schristos $@d/zic -d $@d/zoneinfo main.zi 11521.58Schristos rm $@d/main.zi 11531.58Schristos cd $@d && \ 11541.51Schristos $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 11551.58Schristos $@d/zic -d $@d/zoneinfo main.zi 11561.49Schristos : 11571.58Schristos rm -fr $@d 11581.41Schristos touch $@ 11591.9Schristos 11601.14Schristos# Check that the code works under various alternative 11611.14Schristos# implementations of time_t. 11621.41Schristoscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES) 11631.41Schristos$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 11641.41Schristos$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 11651.58Schristos rm -fr $@d 11661.58Schristos mkdir $@d 11671.58Schristos ln $(VERSION_DEPS) $@d 11681.41Schristos case $@ in \ 11691.58Schristos *32_t*) range=-2147483648,2147483648;; \ 11701.41Schristos u*) range=0,4294967296;; \ 11711.41Schristos *) range=-4294967296,4294967296;; \ 11721.41Schristos esac && \ 11731.58Schristos wd=$$PWD && \ 11741.58Schristos zones=$$($(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab) && \ 11751.41Schristos if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 11761.41Schristos range_target=; \ 11771.23Schristos else \ 11781.41Schristos range_target=to$$range.tzs; \ 11791.23Schristos fi && \ 11801.58Schristos (cd $@d && \ 11811.58Schristos $(MAKE) TOPDIR="$$wd/$@d" \ 11821.58Schristos CFLAGS='$(CFLAGS) -Dtime_tz='"'$(@:.ck=)'" \ 11831.23Schristos REDO='$(REDO)' \ 11841.58Schristos D="$$wd/$@d" \ 11851.41Schristos TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 11861.41Schristos install $$range_target) && \ 11871.41Schristos test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 11881.58Schristos (cd $(TIME_T_ALTERNATIVES_HEAD)d && \ 11891.58Schristos $(MAKE) TOPDIR="$$wd/$@d" \ 11901.41Schristos TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 11911.58Schristos D="$$wd/$@d" \ 11921.41Schristos to$$range.tzs) && \ 11931.58Schristos $(SETUP_DIFF_TZS) && \ 11941.58Schristos $$DIFF_TZS $(TIME_T_ALTERNATIVES_HEAD)d/to$$range.tzs \ 11951.58Schristos $@d/to$$range.tzs && \ 11961.41Schristos if diff -q Makefile Makefile 2>/dev/null; then \ 11971.41Schristos quiet_option='-q'; \ 11981.41Schristos else \ 11991.41Schristos quiet_option=''; \ 12001.41Schristos fi && \ 12011.58Schristos diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD)d/etc \ 12021.58Schristos $@d/etc && \ 12031.41Schristos diff $$quiet_option -r \ 12041.58Schristos $(TIME_T_ALTERNATIVES_HEAD)d/usr/share \ 12051.58Schristos $@d/usr/share; \ 12061.41Schristos } 12071.41Schristos touch $@ 12081.34Schristos 12091.40SchristosTRADITIONAL_ASC = \ 12101.40Schristos tzcode$(VERSION).tar.gz.asc \ 12111.40Schristos tzdata$(VERSION).tar.gz.asc 12121.41SchristosREARGUARD_ASC = \ 12131.41Schristos tzdata$(VERSION)-rearguard.tar.gz.asc 12141.41SchristosALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 12151.40Schristos tzdb-$(VERSION).tar.lz.asc 12161.40Schristos 12171.51Schristostarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 12181.41Schristossignatures rearguard_signatures traditional_signatures: \ 12191.51Schristos version set-timestamps.out rearguard.zi vanguard.zi 12201.58Schristos read -r VERSION <version && \ 12211.48Schristos $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 12221.35Schristos 12231.40Schristos# These *_version rules are intended for use if VERSION is set by some 12241.40Schristos# other means. Ordinarily these rules are used only by the above 12251.40Schristos# non-_version rules, which set VERSION on the 'make' command line. 12261.41Schristostarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 12271.40Schristos tzdb-$(VERSION).tar.lz 12281.41Schristosrearguard_tarballs_version: \ 12291.41Schristos tzdata$(VERSION)-rearguard.tar.gz 12301.38Schristostraditional_tarballs_version: \ 12311.38Schristos tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 12321.51Schristostailored_tarballs_version: \ 12331.51Schristos tzdata$(VERSION)-tailored.tar.gz 12341.40Schristossignatures_version: $(ALL_ASC) 12351.41Schristosrearguard_signatures_version: $(REARGUARD_ASC) 12361.40Schristostraditional_signatures_version: $(TRADITIONAL_ASC) 12371.9Schristos 12381.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out 12391.58Schristos $(SETUP_TAR) && \ 12401.58Schristos $$TAR -cf - \ 12411.23Schristos $(COMMON) $(DOCS) $(SOURCES) | \ 12421.38Schristos gzip $(GZIPFLAGS) >$@.out 12431.35Schristos mv $@.out $@ 12441.10Schristos 12451.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out 12461.58Schristos $(SETUP_TAR) && \ 12471.58Schristos $$TAR -cf - $(TZDATA_DIST) | \ 12481.38Schristos gzip $(GZIPFLAGS) >$@.out 12491.35Schristos mv $@.out $@ 12501.9Schristos 12511.51Schristos# Create empty files with a reproducible timestamp. 12521.51SchristosCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 12531.51Schristos 12541.51Schristos# The obsolescent *rearguard* targets and related macros are present 12551.51Schristos# for backwards compatibility with tz releases 2018e through 2022a. 12561.51Schristos# They should go away eventually. To build rearguard tarballs you 12571.51Schristos# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 12581.40Schristostzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 12591.51Schristos rm -fr $@.dir 12601.51Schristos mkdir $@.dir 12611.51Schristos ln $(TZDATA_DIST) $@.dir 12621.51Schristos cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 12631.40Schristos for f in $(TDATA) $(PACKRATDATA); do \ 12641.51Schristos rearf=$@.dir/$$f; \ 12651.40Schristos $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 12661.48Schristos $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 12671.40Schristos done 12681.51Schristos sed '1s/$$/-rearguard/' <version >$@.dir/version 12691.47Schristos : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12701.51Schristos $(CREATE_EMPTY) $@.dir/pacificnew 12711.56Schristos touch -mr version $@.dir/version 12721.58Schristos $(SETUP_TAR) && \ 12731.51Schristos (cd $@.dir && \ 12741.58Schristos $$TAR -cf - \ 12751.51Schristos $(TZDATA_DIST) pacificnew | \ 12761.40Schristos gzip $(GZIPFLAGS)) >$@.out 12771.40Schristos mv $@.out $@ 12781.40Schristos 12791.51Schristos# Create a tailored tarball suitable for TZUpdater and compatible tools. 12801.51Schristos# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 12811.51Schristos# useful for testing whether TZUpdater supports vanguard form. 12821.51Schristos# The generated tarball is not byte-for-byte equivalent to a hand-tailored 12831.51Schristos# traditional tarball, as data entries are put into 'etcetera' even if they 12841.51Schristos# came from some other source file. However, the effect should be the same 12851.51Schristos# for ordinary use, which reads all the source files. 12861.51Schristostzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 12871.51Schristos rm -fr $@.dir 12881.51Schristos mkdir $@.dir 12891.51Schristos : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12901.58Schristos if test $(DATAFORM) = vanguard; then \ 12911.58Schristos pacificnew=; \ 12921.58Schristos else \ 12931.58Schristos pacificnew=pacificnew; \ 12941.58Schristos fi && \ 12951.51Schristos cd $@.dir && \ 12961.51Schristos $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 12971.58Schristos $$pacificnew 12981.51Schristos (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 12991.51Schristos >$@.dir/etcetera 13001.56Schristos touch -mr tzdata.zi $@.dir/etcetera 13011.51Schristos sed -n \ 13021.51Schristos -e '/^# *version *\(.*\)/h' \ 13031.51Schristos -e '/^# *ddeps */H' \ 13041.51Schristos -e '$$!d' \ 13051.51Schristos -e 'g' \ 13061.51Schristos -e 's/^# *version *//' \ 13071.51Schristos -e 's/\n# *ddeps */-/' \ 13081.51Schristos -e 's/ /-/g' \ 13091.51Schristos -e 'p' \ 13101.51Schristos <tzdata.zi >$@.dir/version 13111.56Schristos touch -mr version $@.dir/version 13121.51Schristos links= && \ 13131.51Schristos for file in $(TZDATA_DIST); do \ 13141.51Schristos test -f $@.dir/$$file || links="$$links $$file"; \ 13151.51Schristos done && \ 13161.51Schristos ln $$links $@.dir 13171.58Schristos $(SETUP_TAR) && \ 13181.51Schristos (cd $@.dir && \ 13191.58Schristos $$TAR -cf - * | gzip $(GZIPFLAGS)) >$@.out 13201.51Schristos mv $@.out $@ 13211.51Schristos 13221.41Schristostzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 13231.34Schristos rm -fr tzdb-$(VERSION) 13241.34Schristos mkdir tzdb-$(VERSION) 13251.34Schristos ln $(ENCHILADA) tzdb-$(VERSION) 13261.48Schristos $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 13271.58Schristos $(SETUP_TAR) && \ 13281.58Schristos $$TAR -cf - tzdb-$(VERSION) | lzip -9 >$@.out 13291.35Schristos mv $@.out $@ 13301.9Schristos 13311.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 13321.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 13331.40Schristostzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 13341.34Schristostzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 13351.40Schristos$(ALL_ASC): 13361.44Schristos $(GPG) --armor --detach-sign $? 13371.34Schristos 13381.41SchristosTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 13391.58Schristostypecheck: long-long.ck unsigned.ck 13401.58Schristoslong-long.ck unsigned.ck: $(VERSION_DEPS) 13411.58Schristos rm -fr $@d 13421.58Schristos mkdir $@d 13431.58Schristos ln $(VERSION_DEPS) $@d 13441.58Schristos cd $@d && \ 13451.41Schristos case $@ in \ 13461.58Schristos long-long.*) i="long long";; \ 13471.58Schristos unsigned.* ) i="unsigned" ;; \ 13481.41Schristos esac && \ 13491.41Schristos $(MAKE) \ 13501.41Schristos CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 13511.58Schristos TOPDIR="$$PWD" \ 13521.41Schristos install 13531.58Schristos $@d/zdump -i -c 1970,1971 Europe/Rome 13541.41Schristos touch $@ 13551.1Smlelstv 13561.38Schristoszonenames: tzdata.zi 13571.38Schristos @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 13581.1Smlelstv 13591.59Schristosasctime.o: private.h 13601.1Smlelstvdate.o: private.h 13611.1Smlelstvdifftime.o: private.h 13621.59Schristoslocaltime.o: private.h tzdir.h tzfile.h 13631.59Schristosstrftime.o: localtime.c private.h tzdir.h tzfile.h 13641.59Schristoszdump.o: private.h version.h 13651.59Schristoszic.o: private.h tzdir.h tzfile.h version.h 13661.1Smlelstv 13671.22Schristos.PHONY: ALL INSTALL all 13681.54Schristos.PHONY: check check_mild check_time_t_alternatives 13691.42Schristos.PHONY: check_web check_zishrink 13701.57Schristos.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd 13711.57Schristos.PHONY: fetch-leap-seconds.list force_tzs 13721.58Schristos.PHONY: install maintainer-clean names 13731.51Schristos.PHONY: posix_only posix_right public 13741.41Schristos.PHONY: rearguard_signatures rearguard_signatures_version 13751.41Schristos.PHONY: rearguard_tarballs rearguard_tarballs_version 13761.41Schristos.PHONY: right_only right_posix signatures signatures_version 13771.40Schristos.PHONY: tarballs tarballs_version 13781.40Schristos.PHONY: traditional_signatures traditional_signatures_version 13791.40Schristos.PHONY: traditional_tarballs traditional_tarballs_version 13801.51Schristos.PHONY: tailored_tarballs tailored_tarballs_version 13811.40Schristos.PHONY: typecheck 13821.22Schristos.PHONY: zonenames zones 13831.40Schristos.PHONY: $(ZDS) 1384