Makefile revision 1.57
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.56Schristos# On older platforms you may need to scrounge for a POSIX-conforming 'make'. 71.56Schristos# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or 81.56Schristos# /usr/xpg4/bin/make, not /usr/ccs/bin/make. 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.56Schristos# make CC='gcc -std=gnu11' "$@" 141.56Schristos# 151.56Schristos# This example script is appropriate for a pre-2017 GNU/Linux system 161.56Schristos# where a non-default setting is needed to support this package's use of C99. 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.57Schristos# The POSIXRULES macro controls interpretation of POSIX-2017.1-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.49SchristosTIME_T_ALTERNATIVES_HEAD = int_least64_t 1361.49SchristosTIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t 1371.1Smlelstv 1381.43Schristos# What kind of TZif data files to generate. (TZif is the binary time 1391.43Schristos# zone data format that zic generates; see Internet RFC 8536.) 1401.37Schristos# If you want only POSIX time, with time values interpreted as 1411.37Schristos# seconds since the epoch (not counting leap seconds), use 1421.1Smlelstv# REDO= posix_only 1431.38Schristos# below. If you want only "right" time, with values interpreted 1441.37Schristos# as seconds since the epoch (counting leap seconds), use 1451.1Smlelstv# REDO= right_only 1461.1Smlelstv# below. If you want both sets of data available, with leap seconds not 1471.1Smlelstv# counted normally, use 1481.1Smlelstv# REDO= posix_right 1491.1Smlelstv# below. If you want both sets of data available, with leap seconds counted 1501.1Smlelstv# normally, use 1511.1Smlelstv# REDO= right_posix 1521.32Schristos# below. POSIX mandates that leap seconds not be counted; for compatibility 1531.37Schristos# with it, use "posix_only" or "posix_right". Use POSIX time on systems with 1541.37Schristos# leap smearing; this can work better than unsmeared "right" time with 1551.37Schristos# applications that are not leap second aware, and is closer to unsmeared 1561.37Schristos# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). 1571.1Smlelstv 1581.1SmlelstvREDO= posix_right 1591.1Smlelstv 1601.45Schristos# Whether to put an "Expires" line in the leapseconds file. 1611.45Schristos# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. 1621.45Schristos# The EXPIRES_LINE value matters only if REDO's value contains "right". 1631.45Schristos# If you change EXPIRES_LINE, remove the leapseconds file before running "make". 1641.45Schristos# zic's support for the Expires line was introduced in tzdb 2020a, 1651.49Schristos# and was modified in tzdb 2021b to generate version 4 TZif files. 1661.49Schristos# EXPIRES_LINE defaults to 0 for now so that the leapseconds file 1671.49Schristos# can be given to pre-2020a zic implementations and so that TZif files 1681.49Schristos# built by newer zic implementations can be read by pre-2021b libraries. 1691.45SchristosEXPIRES_LINE= 0 1701.45Schristos 1711.41Schristos# To install data in text form that has all the information of the TZif data, 1721.38Schristos# (optionally incorporating leap second information), use 1731.38Schristos# TZDATA_TEXT= tzdata.zi leapseconds 1741.38Schristos# To install text data without leap second information (e.g., because 1751.38Schristos# REDO='posix_only'), use 1761.38Schristos# TZDATA_TEXT= tzdata.zi 1771.38Schristos# To avoid installing text data, use 1781.38Schristos# TZDATA_TEXT= 1791.38Schristos 1801.38SchristosTZDATA_TEXT= leapseconds tzdata.zi 1811.38Schristos 1821.38Schristos# For backward-compatibility links for old zone names, use 1831.39Schristos# BACKWARD= backward 1841.38Schristos# To omit these links, use 1851.38Schristos# BACKWARD= 1861.38Schristos 1871.39SchristosBACKWARD= backward 1881.38Schristos 1891.51Schristos# If you want out-of-scope and often-wrong data from the file 'backzone', 1901.51Schristos# but only for entries listed in the backward-compatibility file zone.tab, use 1911.32Schristos# PACKRATDATA= backzone 1921.51Schristos# PACKRATLIST= zone.tab 1931.51Schristos# If you want all the 'backzone' data, use 1941.51Schristos# PACKRATDATA= backzone 1951.51Schristos# PACKRATLIST= 1961.32Schristos# To omit this data, use 1971.32Schristos# PACKRATDATA= 1981.51Schristos# PACKRATLIST= 1991.32Schristos 2001.32SchristosPACKRATDATA= 2011.51SchristosPACKRATLIST= 2021.32Schristos 2031.38Schristos# The name of a locale using the UTF-8 encoding, used during self-tests. 2041.38Schristos# The tests are skipped if the name does not appear to work on this system. 2051.38Schristos 2061.38SchristosUTF8_LOCALE= en_US.utf8 2071.38Schristos 2081.1Smlelstv# Non-default libraries needed to link. 2091.54Schristos# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. 2101.1SmlelstvLDLIBS= 2111.1Smlelstv 2121.56Schristos# Add the following to an uncommented "CFLAGS=" line as needed 2131.56Schristos# to override defaults specified in the source code or by the system. 2141.56Schristos# "-DFOO" is equivalent to "-DFOO=1". 2151.38Schristos# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime 2161.38Schristos# formats that generate only the last two digits of year numbers 2171.38Schristos# -DEPOCH_LOCAL if the 'time' function returns local time not UT 2181.38Schristos# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater 2191.38Schristos# than what POSIX specifies, assuming local time is UT. 2201.38Schristos# For example, N is 252460800 on AmigaOS. 2211.32Schristos# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r 2221.38Schristos# -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ' 2231.54Schristos# -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm 2241.32Schristos# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows) 2251.55Schristos# -DHAVE__GENERIC=0 if _Generic does not work* 2261.54Schristos# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), 2271.54Schristos# -DHAVE_GETRANDOM=0 to avoid using getrandom 2281.54Schristos# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), 2291.54Schristos# where LDLIBS also needs to contain -lintl on some hosts; 2301.54Schristos# -DHAVE_GETTEXT=0 to avoid using gettext 2311.38Schristos# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares 2321.35Schristos# ctime_r and asctime_r incompatibly with the POSIX standard 2331.35Schristos# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). 2341.55Schristos# -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+ 2351.16Schristos# -DHAVE_LINK=0 if your system lacks a link function 2361.23Schristos# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function 2371.23Schristos# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz 2381.23Schristos# localtime_rz can make zdump significantly faster, but is nonstandard. 2391.49Schristos# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. 2401.32Schristos# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare 2411.32Schristos# functions like 'link' or variables like 'tzname' required by POSIX 2421.53Schristos# -DHAVE_SETENV=0 if your system lacks the setenv function 2431.55Schristos# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ 2441.54Schristos# -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like 2451.54Schristos# __builtin_add_overflow work* 2461.55Schristos# -DHAVE_STDINT_H=0 if <stdint.h> does not work*+ 2471.38Schristos# -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l 2481.28Schristos# -DHAVE_STRDUP=0 if your system lacks the strdup function 2491.55Schristos# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ 2501.1Smlelstv# -DHAVE_SYMLINK=0 if your system lacks the symlink function 2511.54Schristos# -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work* 2521.23Schristos# -DHAVE_TZSET=0 if your system lacks a tzset function 2531.54Schristos# -DHAVE_UNISTD_H=0 if <unistd.h> does not work* 2541.54Schristos# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work* 2551.38Schristos# -Dlocale_t=XXX if your system uses XXX instead of locale_t 2561.56Schristos# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ 2571.56Schristos# Typically it is better to use a later standard. For example, 2581.56Schristos# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. 2591.56Schristos# Even with -DPORT_TO_C89, the code needs at least one C99 2601.56Schristos# feature (integers at least 64 bits wide) and maybe more. 2611.40Schristos# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers 2621.40Schristos# with external linkage, e.g., applications cannot define 'localtime'. 2631.38Schristos# -Dssize_t=long on hosts like MS-Windows that lack ssize_t 2641.55Schristos# -DSUPPORT_C89 if the tzcode library should support C89 callers+ 2651.56Schristos# However, this might trigger latent bugs in C99-or-later callers. 2661.40Schristos# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has 2671.40Schristos# security implications and is not recommended for general use 2681.38Schristos# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; 2691.23Schristos# not needed by the main-program tz code, which is single-threaded. 2701.23Schristos# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. 2711.14Schristos# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t 2721.38Schristos# This is intended for internal use only; it mangles external names. 2731.1Smlelstv# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 2741.22Schristos# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 2751.1Smlelstv# the default is system-supplied, typically "/usr/lib/locale" 2761.14Schristos# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 2771.57Schristos# DST transitions for POSIX.1-2017-style TZ strings lacking them, 2781.55Schristos# in the usual case where POSIXRULES is '-'. If not specified, 2791.55Schristos# TZDEFRULESTRING defaults to US rules for future DST transitions. 2801.55Schristos# This mishandles some past timestamps, as US DST rules have changed. 2811.55Schristos# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, 2821.55Schristos# as Europe and US DST rules differ. 2831.55Schristos# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) 2841.38Schristos# -DUNINIT_TRAP if reading uninitialized storage can cause problems 2851.23Schristos# other than simply getting garbage data 2861.23Schristos# -DUSE_LTZ=0 to build zdump with the system time zone library 2871.23Schristos# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. 2881.46Schristos# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and 2891.46Schristos# similarly for "slim". Fat TZif files work around incompatibilities 2901.53Schristos# and bugs in some TZif readers, notably older ones that 2911.53Schristos# ignore or otherwise mishandle 64-bit data in TZif files; 2921.53Schristos# however, fat TZif files may trigger bugs in newer TZif readers. 2931.53Schristos# Slim TZif files are more efficient, and are the default. 2941.1Smlelstv# -DZIC_MAX_ABBR_LEN_WO_WARN=3 2951.1Smlelstv# (or some other number) to set the maximum time zone abbreviation length 2961.1Smlelstv# that zic will accept without a warning (the default is 6) 2971.56Schristos# -g to generate symbolic debugging info 2981.56Schristos# -Idir to include from directory 'dir' 2991.56Schristos# -O0 to disable optimization; other -O options to enable more optimization 3001.56Schristos# -Uname to remove any definition of the macro 'name' 3011.30Schristos# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking 3021.53Schristos# 3031.53Schristos# * Options marked "*" can be omitted if your compiler is C23 compatible. 3041.55Schristos# * Options marked "+" are obsolescent and are planned to be removed 3051.56Schristos# once the code assumes C99 or later, say in the year 2029. 3061.53Schristos# 3071.38Schristos# Select instrumentation via "make GCC_INSTRUMENT='whatever'". 3081.38SchristosGCC_INSTRUMENT = \ 3091.38Schristos -fsanitize=undefined -fsanitize-address-use-after-scope \ 3101.38Schristos -fsanitize-undefined-trap-on-error -fstack-protector 3111.49Schristos# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. 3121.38SchristosGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ 3131.38Schristos $(GCC_INSTRUMENT) \ 3141.38Schristos -Wall -Wextra \ 3151.38Schristos -Walloc-size-larger-than=100000 -Warray-bounds=2 \ 3161.51Schristos -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \ 3171.38Schristos -Wdeclaration-after-statement -Wdouble-promotion \ 3181.49Schristos -Wduplicated-branches -Wduplicated-cond \ 3191.38Schristos -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ 3201.54Schristos -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ 3211.38Schristos -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 3221.49Schristos -Wnull-dereference \ 3231.38Schristos -Wold-style-definition -Woverlength-strings -Wpointer-arith \ 3241.49Schristos -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ 3251.49Schristos -Wstrict-prototypes -Wstringop-overflow=4 \ 3261.40Schristos -Wstringop-truncation -Wsuggest-attribute=cold \ 3271.38Schristos -Wsuggest-attribute=const -Wsuggest-attribute=format \ 3281.40Schristos -Wsuggest-attribute=malloc \ 3291.38Schristos -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ 3301.51Schristos -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \ 3311.38Schristos -Wvariadic-macros -Wvla -Wwrite-strings \ 3321.38Schristos -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ 3331.54Schristos -Wno-type-limits 3341.1Smlelstv# 3351.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s 3361.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file), 3371.1Smlelstv# add the name to a define such as 3381.1Smlelstv# -DTM_GMTOFF=tm_gmtoff 3391.23Schristos# to the end of the "CFLAGS=" line. If not defined, the code attempts to 3401.23Schristos# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. 3411.23Schristos# Similarly, if your system has a "zone abbreviation" field, define 3421.1Smlelstv# -DTM_ZONE=tm_zone 3431.57Schristos# and define NO_TM_ZONE to suppress any guessing. 3441.57Schristos# Although these two fields are not required by POSIX.1-2017, 3451.57Schristos# POSIX 202x/D4 requires them and they are widely available 3461.57Schristos# on GNU/Linux and BSD systems. 3471.1Smlelstv# 3481.38Schristos# The next batch of options control support for external variables 3491.38Schristos# exported by tzcode. In practice these variables are less useful 3501.38Schristos# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 3511.38Schristos# # 3521.38Schristos# # To omit or support the external variable "tzname", add one of: 3531.45Schristos# # -DHAVE_TZNAME=0 # do not support "tzname" 3541.45Schristos# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 3551.45Schristos# # -DHAVE_TZNAME=2 # support and define "tzname" 3561.57Schristos# # to the "CFLAGS=" line. "tzname" is required by POSIX.1-1988 and later. 3571.38Schristos# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 3581.38Schristos# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 3591.38Schristos# # crashes when combined with some platforms' standard libraries, 3601.38Schristos# # presumably due to memory allocation issues. 3611.38Schristos# # 3621.38Schristos# # To omit or support the external variables "timezone" and "daylight", add 3631.45Schristos# # -DUSG_COMPAT=0 # do not support 3641.45Schristos# # -DUSG_COMPAT=1 # support, and variables are defined by system library 3651.45Schristos# # -DUSG_COMPAT=2 # support and define variables 3661.57Schristos# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix 3671.57Schristos# # Systems Group code and are required by POSIX.1-2008 and later (with XSI). 3681.38Schristos# # If not defined, the code attempts to guess USG_COMPAT from other macros. 3691.38Schristos# # 3701.38Schristos# # To support the external variable "altzone", add 3711.45Schristos# # -DALTZONE=0 # do not support 3721.45Schristos# # -DALTZONE=1 # support "altzone", which is defined by system library 3731.45Schristos# # -DALTZONE=2 # support and define "altzone" 3741.38Schristos# # to the end of the "CFLAGS=" line; although "altzone" appeared in 3751.38Schristos# # System V Release 3.1 it has not been standardized. 3761.45Schristos# # If not defined, the code attempts to guess ALTZONE from other macros. 3771.38Schristos# 3781.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work, 3791.1Smlelstv# add 3801.1Smlelstv# -DSTD_INSPIRED 3811.54Schristos# to the end of the "CFLAGS=" line. This arranges for the following 3821.54Schristos# functions to be added to the time conversion library. 3831.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument 3841.1Smlelstv# that gives an offset to add to the time_t when converting it. 3851.56Schristos# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 3861.56Schristos# "timelocal" is nearly equivalent to "mktime". 3871.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument 3881.1Smlelstv# that gives an offset to use when converting to a time_t. 3891.56Schristos# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 3901.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page. 3911.1Smlelstv# X3J11's work does not describe any of these functions. 3921.1Smlelstv# These functions may well disappear in future releases of the time 3931.1Smlelstv# conversion package. 3941.1Smlelstv# 3951.23Schristos# If you don't want functions that were inspired by NetBSD, add 3961.23Schristos# -DNETBSD_INSPIRED=0 3971.23Schristos# to the end of the "CFLAGS=" line. Otherwise, the functions 3981.23Schristos# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 3991.55Schristos# time library, and if STD_INSPIRED is also defined to nonzero the functions 4001.23Schristos# "posix2time_z" and "time2posix_z" are added as well. 4011.23Schristos# The functions ending in "_z" (or "_rz") are like their unsuffixed 4021.23Schristos# (or suffixed-by-"_r") counterparts, except with an extra first 4031.41Schristos# argument of opaque type timezone_t that specifies the timezone. 4041.23Schristos# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 4051.23Schristos# 4061.1Smlelstv# If you want to allocate state structures in localtime, add 4071.1Smlelstv# -DALL_STATE 4081.1Smlelstv# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 4091.1Smlelstv# 4101.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 4111.1Smlelstv# out by the National Institute of Standards and Technology 4121.56Schristos# which claims to test C and POSIX conformance. If you want to pass PCTS, add 4131.1Smlelstv# -DPCTS 4141.1Smlelstv# to the end of the "CFLAGS=" line. 4151.1Smlelstv# 4161.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add 4171.1Smlelstv# -DXPG4_1994_04_09 4181.1Smlelstv# to the end of the "CFLAGS=" line. This causes "strftime" to always return 4191.38Schristos# 53 as a week number (rather than 52 or 53) for January days before 4201.38Schristos# January's first Monday when a "%V" format is used and January 1 4211.1Smlelstv# falls on a Friday, Saturday, or Sunday. 4221.56Schristos# 4231.56Schristos# POSIX says CFLAGS defaults to "-O 1". 4241.56Schristos# Uncomment the following line and edit its contents as needed. 4251.1Smlelstv 4261.56Schristos#CFLAGS= -O 1 4271.1Smlelstv 4281.9Schristos 4291.56Schristos# The name of a POSIX-like library archiver, its flags, C compiler, 4301.56Schristos# linker flags, and 'make' utility. Ordinarily the defaults suffice. 4311.57Schristos# The commented-out values are the defaults specified by POSIX.1-202x/D4. 4321.56Schristos#AR = ar 4331.56Schristos#ARFLAGS = -rv 4341.56Schristos#CC = c17 4351.56Schristos#LDFLAGS = 4361.56Schristos#MAKE = make 4371.1Smlelstv 4381.32Schristos# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in 4391.32Schristos# submake command lines. The default is no leap seconds. 4401.32Schristos 4411.32SchristosLEAPSECONDS= 4421.32Schristos 4431.57Schristos# Where to fetch leap-seconds.list from. 4441.57Schristosleaplist_URI = \ 4451.57Schristos https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list 4461.57Schristos# The file is generated by the IERS Earth Orientation Centre, in Paris. 4471.57Schristosleaplist_TZ = Europe/Paris 4481.57Schristos 4491.32Schristos# The zic command and its arguments. 4501.32Schristos 4511.1Smlelstvzic= ./zic 4521.1SmlelstvZIC= $(zic) $(ZFLAGS) 4531.1Smlelstv 4541.43Schristos# To shrink the size of installed TZif files, 4551.43Schristos# append "-r @N" to omit data before N-seconds-after-the-Epoch. 4561.53Schristos# To grow the files and work around bugs in older applications, 4571.53Schristos# possibly at the expense of introducing bugs in newer ones, 4581.53Schristos# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 4591.44Schristos# See the zic man page for more about -b and -r. 4601.15SchristosZFLAGS= 4611.15Schristos 4621.41Schristos# How to use zic to install TZif files. 4631.32Schristos 4641.39SchristosZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) 4651.32Schristos 4661.56Schristos# The name of a POSIX-compliant 'awk' on your system. 4671.50Schristos# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 4681.50Schristos# Also, it is better (though not essential) if 'awk' supports UTF-8, 4691.50Schristos# and unfortunately mawk and busybox awk do not support UTF-8. 4701.50Schristos# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 4711.9SchristosAWK= awk 4721.9Schristos 4731.56Schristos# The full path name of a POSIX-compliant shell, preferably one that supports 4741.16Schristos# the Korn shell's 'select' statement as an extension. 4751.16Schristos# These days, Bash is the most popular. 4761.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh 4771.56Schristos# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 4781.16Schristos# is typically nicer if it works. 4791.9SchristosKSHELL= /bin/bash 4801.1Smlelstv 4811.57Schristos# Name of curl <https://curl.haxx.se/>, used for HTML validation 4821.57Schristos# and to fetch leap-seconds.list from upstream. 4831.42SchristosCURL= curl 4841.42Schristos 4851.44Schristos# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 4861.44SchristosGPG= gpg 4871.44Schristos 4881.23Schristos# This expensive test requires USE_LTZ. 4891.23Schristos# To suppress it, define this macro to be empty. 4901.23SchristosCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 4911.23Schristos 4921.22Schristos# SAFE_CHAR is a regular expression that matches a safe character. 4931.22Schristos# Some parts of this distribution are limited to safe characters; 4941.22Schristos# others can use any UTF-8 character. 4951.22Schristos# For now, the safe characters are a safe subset of ASCII. 4961.9Schristos# The caller must set the shell variable 'sharp' to the character '#', 4971.9Schristos# since Makefile macros cannot contain '#'. 4981.9Schristos# TAB_CHAR is a single tab character, in single quotes. 4991.9SchristosTAB_CHAR= ' ' 5001.22SchristosSAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 5011.22SchristosSAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 5021.22SchristosSAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 5031.29SchristosSAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 5041.29SchristosSAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 5051.29Schristos 5061.55Schristos# These non-alphabetic, non-ASCII printable characters are Latin-1, 5071.55Schristos# and so are likely displayable even in editors like XEmacs 21 5081.55Schristos# that have limited display capabilities. 5091.55SchristosUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 5101.40Schristos# Non-ASCII non-letters that OK_CHAR allows, as these characters are 5111.41Schristos# useful in commentary. 5121.55SchristosUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 5131.40Schristos 5141.51Schristos# Put this in a bracket expression to match spaces. 5151.51Schristoss = [:space:] 5161.51Schristos 5171.29Schristos# OK_CHAR matches any character allowed in the distributed files. 5181.40Schristos# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 5191.40Schristos# multibyte letters are also allowed so that commentary can contain a 5201.40Schristos# few safe symbols and people's names and can quote non-English sources. 5211.40Schristos# Other non-letters are limited to ASCII renderings for the 5221.40Schristos# convenience of maintainers using XEmacs 21.5.34, which by default 5231.40Schristos# mishandles Unicode characters U+0100 and greater. 5241.40SchristosOK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 5251.22Schristos 5261.22Schristos# SAFE_LINE matches a line of safe characters. 5271.29Schristos# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 5281.22Schristos# this is so that comments can contain non-ASCII characters. 5291.29Schristos# OK_LINE matches a line of OK characters. 5301.22SchristosSAFE_LINE= '^'$(SAFE_CHAR)'*$$' 5311.29SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 5321.29SchristosOK_LINE= '^'$(OK_CHAR)'*$$' 5331.9Schristos 5341.6Schristos# Flags to give 'tar' when making a distribution. 5351.6Schristos# Try to use flags appropriate for GNU tar. 5361.50SchristosGNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \ 5371.50Schristos --numeric-owner --owner=0 --group=0 \ 5381.50Schristos --mode=go+u,go-w --sort=name 5391.6SchristosTARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ 5401.6Schristos then echo $(GNUTARFLAGS); \ 5411.6Schristos else :; \ 5421.6Schristos fi` 5431.6Schristos 5441.6Schristos# Flags to give 'gzip' when making a distribution. 5451.38SchristosGZIPFLAGS= -9n 5461.6Schristos 5471.54Schristos# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 5481.54Schristos# This makes it easier to see which Zone has been affected. 5491.54SchristosDIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ 5501.54Schristos || echo ' -F^TZ=') 5511.54Schristos 5521.56Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 5531.56SchristosRANLIB= : 5541.1Smlelstv 5551.56Schristos# POSIX prohibits defining or using SHELL. However, csh users on systems 5561.56Schristos# that use the user shell for Makefile commands may need to define SHELL. 5571.56Schristos#SHELL= /bin/sh 5581.29Schristos 5591.56Schristos# End of macros that one plausibly might want to tailor. 5601.56Schristos############################################################################### 5611.1Smlelstv 5621.16Schristos 5631.28SchristosTZCOBJS= zic.o 5641.38SchristosTZDOBJS= zdump.o localtime.o asctime.o strftime.o 5651.1SmlelstvDATEOBJS= date.o localtime.o strftime.o asctime.o 5661.45SchristosLIBSRCS= localtime.c asctime.c difftime.c strftime.c 5671.45SchristosLIBOBJS= localtime.o asctime.o difftime.o strftime.o 5681.1SmlelstvHEADERS= tzfile.h private.h 5691.28SchristosNONLIBSRCS= zic.c zdump.c 5701.45SchristosNEWUCBSRCS= date.c 5711.23SchristosSOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 5721.35Schristos tzselect.ksh workman.sh 5731.1SmlelstvMANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 5741.1Smlelstv tzfile.5 tzselect.8 zic.8 zdump.8 5751.16SchristosMANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 5761.16Schristos time2posix.3.txt \ 5771.16Schristos tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 5781.16Schristos date.1.txt 5791.38SchristosCOMMON= calendars CONTRIBUTING LICENSE Makefile \ 5801.49Schristos NEWS README SECURITY theory.html version 5811.39SchristosWEB_PAGES= tz-art.html tz-how-to.html tz-link.html 5821.43SchristosCHECK_WEB_PAGES=check_theory.html check_tz-art.html \ 5831.43Schristos check_tz-how-to.html check_tz-link.html 5841.23SchristosDOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 5851.1SmlelstvPRIMARY_YDATA= africa antarctica asia australasia \ 5861.1Smlelstv europe northamerica southamerica 5871.39SchristosYDATA= $(PRIMARY_YDATA) etcetera 5881.46SchristosNDATA= factory 5891.46SchristosTDATA_TO_CHECK= $(YDATA) $(NDATA) backward 5901.39SchristosTDATA= $(YDATA) $(NDATA) $(BACKWARD) 5911.56SchristosZONETABLES= zone.tab zone1970.tab zonenow.tab 5921.38SchristosTABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 5931.16SchristosLEAP_DEPS= leapseconds.awk leap-seconds.list 5941.51SchristosTZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 5951.51Schristos $(PACKRATDATA) $(PACKRATLIST) 5961.51SchristosDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 5971.39SchristosDATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 5981.46Schristos leapseconds $(ZONETABLES) 5991.56SchristosAWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 6001.40Schristos ziguard.awk zishrink.awk 6011.52SchristosMISC= $(AWK_SCRIPTS) 6021.34SchristosTZS_YEAR= 2050 6031.41SchristosTZS_CUTOFF_FLAG= -c $(TZS_YEAR) 6041.34SchristosTZS= to$(TZS_YEAR).tzs 6051.34SchristosTZS_NEW= to$(TZS_YEAR)new.tzs 6061.49SchristosTZS_DEPS= $(YDATA) asctime.c localtime.c \ 6071.34Schristos private.h tzfile.h zdump.c zic.c 6081.51SchristosTZDATA_DIST = $(COMMON) $(DATA) $(MISC) 6091.41Schristos# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 6101.51SchristosEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 6111.41SchristosENCHILADA = $(EIGHT_YARDS) $(TZS) 6121.34Schristos 6131.34Schristos# Consult these files when deciding whether to rebuild the 'version' file. 6141.34Schristos# This list is not the same as the output of 'git ls-files', since 6151.34Schristos# .gitignore is not distributed. 6161.34SchristosVERSION_DEPS= \ 6171.49Schristos calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 6181.34Schristos africa antarctica asctime.c asia australasia \ 6191.34Schristos backward backzone \ 6201.56Schristos checklinks.awk checknow.awk checktab.awk \ 6211.34Schristos date.1 date.c difftime.c \ 6221.34Schristos etcetera europe factory iso3166.tab \ 6231.34Schristos leap-seconds.list leapseconds.awk localtime.c \ 6241.34Schristos newctime.3 newstrftime.3 newtzset.3 northamerica \ 6251.46Schristos private.h southamerica strftime.c theory.html \ 6261.39Schristos time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 6271.34Schristos tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 6281.46Schristos workman.sh zdump.8 zdump.c zic.8 zic.c \ 6291.40Schristos ziguard.awk zishrink.awk \ 6301.56Schristos zone.tab zone1970.tab zonenow.tab 6311.1Smlelstv 6321.46Schristosall: tzselect zic zdump libtz.a $(TABDATA) \ 6331.40Schristos vanguard.zi main.zi rearguard.zi 6341.1Smlelstv 6351.29SchristosALL: all date $(ENCHILADA) 6361.1Smlelstv 6371.16Schristosinstall: all $(DATA) $(REDO) $(MANS) 6381.39Schristos mkdir -p '$(DESTDIR)$(BINDIR)' \ 6391.39Schristos '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 6401.39Schristos '$(DESTDIR)$(LIBDIR)' \ 6411.39Schristos '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 6421.39Schristos '$(DESTDIR)$(MANDIR)/man8' 6431.44Schristos $(ZIC_INSTALL) -l $(LOCALTIME) \ 6441.44Schristos `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ 6451.44Schristos ` $(POSIXRULES) \ 6461.39Schristos -t '$(DESTDIR)$(TZDEFAULT)' 6471.39Schristos cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 6481.39Schristos cp tzselect '$(DESTDIR)$(BINDIR)/.' 6491.39Schristos cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 6501.39Schristos cp zic '$(DESTDIR)$(ZICDIR)/.' 6511.39Schristos cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 6521.39Schristos $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 6531.39Schristos cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 6541.39Schristos cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 6551.39Schristos cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 6561.1Smlelstv 6571.1SmlelstvINSTALL: ALL install date.1 6581.39Schristos mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 6591.39Schristos cp date '$(DESTDIR)$(BINDIR)/.' 6601.39Schristos cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 6611.1Smlelstv 6621.48Schristos# Calculate version number from git, if available. 6631.48Schristos# Otherwise, use $(VERSION) unless it is "unknown" and there is already 6641.48Schristos# a 'version' file, in which case reuse the existing 'version' contents 6651.48Schristos# and append "-dirty" if the contents do not already end in "-dirty". 6661.34Schristosversion: $(VERSION_DEPS) 6671.35Schristos { (type git) >/dev/null 2>&1 && \ 6681.35Schristos V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 6691.35Schristos --abbrev=7 --dirty` || \ 6701.48Schristos if test '$(VERSION)' = unknown && V=`cat $@`; then \ 6711.48Schristos case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ 6721.48Schristos else \ 6731.48Schristos V='$(VERSION)'; \ 6741.48Schristos fi; } && \ 6751.35Schristos printf '%s\n' "$$V" >$@.out 6761.35Schristos mv $@.out $@ 6771.34Schristos 6781.51Schristos# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 6791.40Schristosvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 6801.51Schristos $(AWK) \ 6811.51Schristos -v DATAFORM=`expr $@ : '\(.*\).zi'` \ 6821.51Schristos -v PACKRATDATA='$(PACKRATDATA)' \ 6831.51Schristos -v PACKRATLIST='$(PACKRATLIST)' \ 6841.51Schristos -f ziguard.awk \ 6851.40Schristos $(TDATA) $(PACKRATDATA) >$@.out 6861.40Schristos mv $@.out $@ 6871.41Schristos# This file has a version comment that attempts to capture any tailoring 6881.51Schristos# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 6891.41Schristostzdata.zi: $(DATAFORM).zi version zishrink.awk 6901.39Schristos version=`sed 1q version` && \ 6911.41Schristos LC_ALL=C $(AWK) \ 6921.41Schristos -v dataform='$(DATAFORM)' \ 6931.41Schristos -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 6941.41Schristos -v redo='$(REDO)' \ 6951.41Schristos -v version="$$version" \ 6961.41Schristos -f zishrink.awk \ 6971.40Schristos $(DATAFORM).zi >$@.out 6981.38Schristos mv $@.out $@ 6991.38Schristos 7001.56Schristostzdir.h: 7011.56Schristos printf '%s\n' >$@.out \ 7021.56Schristos '#ifndef TZDEFAULT' \ 7031.56Schristos '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 7041.56Schristos '#endif' \ 7051.56Schristos '#ifndef TZDIR' \ 7061.56Schristos '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 7071.56Schristos '#endif' 7081.56Schristos mv $@.out $@ 7091.56Schristos 7101.34Schristosversion.h: version 7111.35Schristos VERSION=`cat version` && printf '%s\n' \ 7121.35Schristos 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 7131.35Schristos "static char const TZVERSION[]=\"$$VERSION\";" \ 7141.35Schristos 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 7151.35Schristos >$@.out 7161.35Schristos mv $@.out $@ 7171.6Schristos 7181.1Smlelstvzdump: $(TZDOBJS) 7191.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 7201.1Smlelstv 7211.32Schristoszic: $(TZCOBJS) 7221.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 7231.1Smlelstv 7241.16Schristosleapseconds: $(LEAP_DEPS) 7251.45Schristos $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 7261.45Schristos -f leapseconds.awk leap-seconds.list >$@.out 7271.35Schristos mv $@.out $@ 7281.15Schristos 7291.57Schristos# Awk script to extract a Git-style author from leap-seconds.list comments. 7301.57SchristosEXTRACT_AUTHOR = \ 7311.57Schristos author_line { sub(/^.[[:space:]]*/, ""); \ 7321.57Schristos sub(/:[[:space:]]*/, " <"); \ 7331.57Schristos printf "%s>\n", $$0; \ 7341.57Schristos success = 1; \ 7351.57Schristos exit \ 7361.57Schristos } \ 7371.57Schristos /Questions or comments to:/ { author_line = 1 } \ 7381.57Schristos END { exit !success } 7391.57Schristos 7401.57Schristos# Fetch leap-seconds.list from upstream. 7411.57Schristosfetch-leap-seconds.list: 7421.57Schristos $(CURL) -OR $(leaplist_URI) 7431.57Schristos 7441.57Schristos# Fetch leap-seconds.list from upstream and commit it to the local repository. 7451.57Schristoscommit-leap-seconds.list: fetch-leap-seconds.list 7461.57Schristos author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ 7471.57Schristos date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ 7481.57Schristos git commit --author="$$author" --date="$$date" -m'make $@' \ 7491.57Schristos leap-seconds.list 7501.57Schristos 7511.32Schristos# Arguments to pass to submakes of install_data. 7521.32Schristos# They can be overridden by later submake arguments. 7531.32SchristosINSTALLARGS = \ 7541.39Schristos BACKWARD='$(BACKWARD)' \ 7551.39Schristos DESTDIR='$(DESTDIR)' \ 7561.32Schristos LEAPSECONDS='$(LEAPSECONDS)' \ 7571.32Schristos PACKRATDATA='$(PACKRATDATA)' \ 7581.51Schristos PACKRATLIST='$(PACKRATLIST)' \ 7591.39Schristos TZDEFAULT='$(TZDEFAULT)' \ 7601.39Schristos TZDIR='$(TZDIR)' \ 7611.32Schristos ZIC='$(ZIC)' 7621.32Schristos 7631.46SchristosINSTALL_DATA_DEPS = zic leapseconds tzdata.zi 7641.41Schristos 7651.41Schristos# 'make install_data' installs one set of TZif files. 7661.41Schristosinstall_data: $(INSTALL_DATA_DEPS) 7671.38Schristos $(ZIC_INSTALL) tzdata.zi 7681.32Schristos 7691.41Schristosposix_only: $(INSTALL_DATA_DEPS) 7701.32Schristos $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data 7711.32Schristos 7721.41Schristosright_only: $(INSTALL_DATA_DEPS) 7731.32Schristos $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ 7741.32Schristos install_data 7751.1Smlelstv 7761.1Smlelstv# In earlier versions of this makefile, the other two directories were 7771.1Smlelstv# subdirectories of $(TZDIR). However, this led to configuration errors. 7781.1Smlelstv# For example, with posix_right under the earlier scheme, 7791.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 7801.1Smlelstv# but gmtime without leap seconds, which led to problems with applications 7811.1Smlelstv# like sendmail that subtract gmtime from localtime. 7821.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR). 7831.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds 7841.1Smlelstv# to using them, or vice versa. 7851.32Schristosright_posix: right_only 7861.39Schristos rm -fr '$(DESTDIR)$(TZDIR)-leaps' 7871.39Schristos ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 7881.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 7891.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 7901.15Schristos 7911.32Schristosposix_right: posix_only 7921.39Schristos rm -fr '$(DESTDIR)$(TZDIR)-posix' 7931.39Schristos ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 7941.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 7951.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 7961.32Schristos 7971.1Smlelstvzones: $(REDO) 7981.1Smlelstv 7991.40Schristos# dummy.zd is not a real file; it is mentioned here only so that the 8001.40Schristos# top-level 'make' does not have a syntax error. 8011.40SchristosZDS = dummy.zd 8021.40Schristos# Rule used only by submakes invoked by the $(TZS_NEW) rule. 8031.40Schristos# It is separate so that GNU 'make -j' can run instances in parallel. 8041.40Schristos$(ZDS): zdump 8051.41Schristos ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ 8061.41Schristos >$@ 8071.40Schristos 8081.41SchristosTZS_NEW_DEPS = tzdata.zi zdump zic 8091.41Schristos$(TZS_NEW): $(TZS_NEW_DEPS) 8101.41Schristos rm -fr tzs$(TZS_YEAR).dir 8111.41Schristos mkdir tzs$(TZS_YEAR).dir 8121.41Schristos $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 8131.38Schristos $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 8141.38Schristos tzdata.zi | LC_ALL=C sort >$@.out 8151.35Schristos wd=`pwd` && \ 8161.41Schristos x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 8171.41Schristos tzdata.zi \ 8181.40Schristos | LC_ALL=C sort -t . -k 2,2` && \ 8191.41Schristos set x $$x && \ 8201.40Schristos shift && \ 8211.40Schristos ZDS=$$* && \ 8221.41Schristos $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 8231.41Schristos ZDS="$$ZDS" $$ZDS && \ 8241.41Schristos sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 8251.41Schristos rm -fr tzs$(TZS_YEAR).dir 8261.40Schristos mv $@.out $@ 8271.34Schristos 8281.41Schristos# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the 8291.34Schristos# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 8301.34Schristos$(TZS): 8311.41Schristos touch $@ 8321.34Schristos 8331.34Schristosforce_tzs: $(TZS_NEW) 8341.34Schristos cp $(TZS_NEW) $(TZS) 8351.34Schristos 8361.16Schristoslibtz.a: $(LIBOBJS) 8371.37Schristos rm -f $@ 8381.56Schristos $(AR) $(ARFLAGS) $@ $(LIBOBJS) 8391.16Schristos $(RANLIB) $@ 8401.1Smlelstv 8411.1Smlelstvdate: $(DATEOBJS) 8421.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 8431.1Smlelstv 8441.34Schristostzselect: tzselect.ksh version 8451.35Schristos VERSION=`cat version` && sed \ 8461.56Schristos -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 8471.56Schristos -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 8481.56Schristos -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 8491.56Schristos -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 8501.56Schristos -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 8511.56Schristos -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 8521.56Schristos <$@.ksh >$@.out 8531.35Schristos chmod +x $@.out 8541.35Schristos mv $@.out $@ 8551.1Smlelstv 8561.54Schristoscheck: check_back check_mild 8571.54Schristoscheck_mild: check_character_set check_white_space check_links \ 8581.56Schristos check_name_lengths check_now \ 8591.56Schristos check_slashed_abbrs check_sorted \ 8601.51Schristos check_tables check_web check_ziguard check_zishrink check_tzs 8611.9Schristos 8621.56Schristos# True if UTF8_LOCALE does not work; 8631.56Schristos# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 8641.56SchristosUTF8_LOCALE_MISSING = \ 8651.56Schristos { test ! '$(UTF8_LOCALE)' \ 8661.56Schristos || ! printf 'A\304\200B\n' \ 8671.56Schristos | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 8681.56Schristos || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } 8691.56Schristos 8701.9Schristoscheck_character_set: $(ENCHILADA) 8711.56Schristos $(UTF8_LOCALE_MISSING) || { \ 8721.22Schristos sharp='#' && \ 8731.35Schristos ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 8741.35Schristos $(MISC) $(SOURCES) $(WEB_PAGES) \ 8751.49Schristos CONTRIBUTING LICENSE README SECURITY \ 8761.38Schristos version tzdata.zi && \ 8771.41Schristos ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 8781.40Schristos Makefile && \ 8791.39Schristos ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 8801.46Schristos leapseconds zone.tab && \ 8811.38Schristos ! grep -Env $(OK_LINE) $(ENCHILADA); \ 8821.38Schristos } 8831.41Schristos touch $@ 8841.22Schristos 8851.23Schristoscheck_white_space: $(ENCHILADA) 8861.56Schristos $(UTF8_LOCALE_MISSING) || { \ 8871.35Schristos patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ 8881.56Schristos ! grep -En "$$pat|[$s]\$$" \ 8891.56Schristos $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ 8901.56Schristos } 8911.56Schristos touch $@ 8921.23Schristos 8931.51SchristosPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 8941.51SchristosFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 8951.38Schristos 8961.39Schristoscheck_name_lengths: $(TDATA_TO_CHECK) backzone 8971.39Schristos ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 8981.39Schristos $(TDATA_TO_CHECK) backzone 8991.41Schristos touch $@ 9001.38Schristos 9011.51SchristosPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 9021.51SchristosSTDOFF = [-+]?[0-9:.]+ 9031.51SchristosRULELESS_SAVE = (-|$(STDOFF)[sd]?) 9041.51SchristosRULELESS_SLASHED_ABBRS = \ 9051.51Schristos $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 9061.51Schristos 9071.51Schristoscheck_slashed_abbrs: $(TDATA_TO_CHECK) 9081.51Schristos ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 9091.51Schristos touch $@ 9101.51Schristos 9111.23SchristosCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 9121.23Schristos 9131.55Schristoscheck_sorted: backward backzone 9141.54Schristos $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 9151.53Schristos backward | LC_ALL=C sort -cu 9161.23Schristos $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu 9171.41Schristos touch $@ 9181.23Schristos 9191.54Schristoscheck_back: checklinks.awk $(TDATA_TO_CHECK) 9201.53Schristos $(AWK) \ 9211.53Schristos -v DATAFORM=$(DATAFORM) \ 9221.53Schristos -v backcheck=backward \ 9231.53Schristos -f checklinks.awk $(TDATA_TO_CHECK) 9241.54Schristos touch $@ 9251.54Schristos 9261.54Schristoscheck_links: checklinks.awk tzdata.zi 9271.53Schristos $(AWK) \ 9281.53Schristos -v DATAFORM=$(DATAFORM) \ 9291.53Schristos -f checklinks.awk tzdata.zi 9301.41Schristos touch $@ 9311.26Schristos 9321.56Schristos# Check timestamps from now through 28 years from now, to make sure 9331.56Schristos# that zonenow.tab contains all sequences of planned timestamps, 9341.56Schristos# without any duplicate sequences. In theory this might require 9351.56Schristos# 2800 years but that would take a long time to check. 9361.56SchristosCHECK_NOW_TIMESTAMP = `./date +%s` 9371.56SchristosCHECK_NOW_FUTURE_YEARS = 28 9381.56SchristosCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 9391.56Schristoscheck_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 9401.56Schristos rm -fr $@.dir 9411.56Schristos mkdir $@.dir 9421.56Schristos ./zic -d $@.dir tzdata.zi 9431.56Schristos now=$(CHECK_NOW_TIMESTAMP) && \ 9441.56Schristos future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ 9451.56Schristos ./zdump -i -t $$now,$$future \ 9461.56Schristos $$(find $$PWD/$@.dir/????*/ -type f) \ 9471.56Schristos >$@.dir/zdump.tab 9481.56Schristos $(AWK) \ 9491.56Schristos -v zdump_table=$@.dir/zdump.tab \ 9501.56Schristos -f checknow.awk zonenow.tab 9511.56Schristos rm -fr $@.dir 9521.56Schristos touch $@ 9531.56Schristos 9541.56Schristoscheck_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab 9551.22Schristos for tab in $(ZONETABLES); do \ 9561.49Schristos test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 9571.49Schristos $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 9581.22Schristos || exit; \ 9591.22Schristos done 9601.41Schristos touch $@ 9611.1Smlelstv 9621.34Schristoscheck_tzs: $(TZS) $(TZS_NEW) 9631.41Schristos if test -s $(TZS); then \ 9641.54Schristos $(DIFF_TZS) $(TZS) $(TZS_NEW); \ 9651.41Schristos else \ 9661.41Schristos cp $(TZS_NEW) $(TZS); \ 9671.41Schristos fi 9681.41Schristos touch $@ 9691.34Schristos 9701.42Schristoscheck_web: $(CHECK_WEB_PAGES) 9711.43Schristoscheck_theory.html: theory.html 9721.42Schristoscheck_tz-art.html: tz-art.html 9731.46Schristoscheck_tz-how-to.html: tz-how-to.html 9741.42Schristoscheck_tz-link.html: tz-link.html 9751.46Schristoscheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: 9761.42Schristos $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 9771.42Schristos -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ 9781.42Schristos test ! -s $@.out || { cat $@.out; exit 1; } 9791.42Schristos mv $@.out $@ 9801.38Schristos 9811.51Schristoscheck_ziguard: rearguard.zi vanguard.zi ziguard.awk 9821.51Schristos $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 9831.51Schristos diff -u rearguard.zi - 9841.51Schristos $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 9851.51Schristos diff -u vanguard.zi - 9861.51Schristos touch $@ 9871.51Schristos 9881.40Schristos# Check that zishrink.awk does not alter the data, and that ziguard.awk 9891.40Schristos# preserves main-format data. 9901.41Schristoscheck_zishrink: check_zishrink_posix check_zishrink_right 9911.41Schristoscheck_zishrink_posix check_zishrink_right: \ 9921.51Schristos zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 9931.51Schristos $(TDATA) $(DATAFORM).zi tzdata.zi 9941.41Schristos rm -fr $@.dir $@-t.dir $@-shrunk.dir 9951.41Schristos mkdir $@.dir $@-t.dir $@-shrunk.dir 9961.41Schristos case $@ in \ 9971.41Schristos *_right) leap='-L leapseconds';; \ 9981.41Schristos *) leap=;; \ 9991.41Schristos esac && \ 10001.41Schristos $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ 10011.41Schristos $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ 10021.51Schristos case $(DATAFORM),$(PACKRATLIST) in \ 10031.51Schristos main,) \ 10041.41Schristos $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ 10051.40Schristos $(AWK) '/^Rule/' $(TDATA) | \ 10061.41Schristos $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ 10071.41Schristos diff -r $@.dir $@-t.dir;; \ 10081.41Schristos esac 10091.41Schristos diff -r $@.dir $@-shrunk.dir 10101.41Schristos rm -fr $@.dir $@-t.dir $@-shrunk.dir 10111.41Schristos touch $@ 10121.1Smlelstv 10131.14Schristosclean_misc: 10141.56Schristos rm -fr check_*.dir typecheck_*.dir 10151.41Schristos rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ 10161.41Schristos check_* core typecheck_* \ 10171.56Schristos date tzdir.h tzselect version.h zdump zic libtz.a 10181.14Schristosclean: clean_misc 10191.43Schristos rm -fr *.dir tzdb-*/ 10201.43Schristos rm -f *.zi $(TZS_NEW) 10211.1Smlelstv 10221.1Smlelstvmaintainer-clean: clean 10231.1Smlelstv @echo 'This command is intended for maintainers to use; it' 10241.1Smlelstv @echo 'deletes files that may need special tools to rebuild.' 10251.34Schristos rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 10261.1Smlelstv 10271.1Smlelstvnames: 10281.1Smlelstv @echo $(ENCHILADA) 10291.1Smlelstv 10301.23Schristospublic: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ 10311.16Schristos tarballs signatures 10321.16Schristos 10331.16Schristosdate.1.txt: date.1 10341.16Schristosnewctime.3.txt: newctime.3 10351.16Schristosnewstrftime.3.txt: newstrftime.3 10361.16Schristosnewtzset.3.txt: newtzset.3 10371.16Schristostime2posix.3.txt: time2posix.3 10381.16Schristostzfile.5.txt: tzfile.5 10391.16Schristostzselect.8.txt: tzselect.8 10401.16Schristoszdump.8.txt: zdump.8 10411.16Schristoszic.8.txt: zic.8 10421.16Schristos 10431.16Schristos$(MANTXTS): workman.sh 10441.35Schristos LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out 10451.35Schristos mv $@.out $@ 10461.9Schristos 10471.48Schristos# Set file timestamps deterministically if possible, 10481.48Schristos# so that tarballs containing the timestamps are reproducible. 10491.48Schristos# 10501.48Schristos# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 10511.48Schristos# file DEST to the maximum of the timestamps of the files A B C ..., 10521.48Schristos# plus N if GNU ls and touch are available. 10531.48SchristosSET_TIMESTAMP_N = sh -c '\ 10541.48Schristos n=$$0 dest=$$1; shift; \ 10551.56Schristos <"$$dest" && \ 10561.48Schristos if test $$n != 0 && \ 10571.56Schristos lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ 10581.48Schristos set x $$lsout && \ 10591.56Schristos timestamp=`expr $$7 + $$n` && \ 10601.56Schristos echo "+ touch -md @$$timestamp $$dest" && \ 10611.56Schristos touch -md @$$timestamp "$$dest"; \ 10621.56Schristos else \ 10631.56Schristos newest=`ls -t "$$@" | sed 1q` && \ 10641.56Schristos echo "+ touch -mr $$newest $$dest" && \ 10651.56Schristos touch -mr "$$newest" "$$dest"; \ 10661.56Schristos fi' 10671.48Schristos# If DEST depends on A B C ... in this Makefile, callers should use 10681.48Schristos# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 10691.48Schristos# downstream 'make' that considers equal timestamps to be out of date. 10701.48Schristos# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 10711.48Schristos# If all that matters is that the timestamp be reproducible 10721.48Schristos# and plausible, use $(SET_TIMESTAMP). 10731.48SchristosSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 10741.48SchristosSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 10751.48Schristos 10761.41Schristos# Set the timestamps to those of the git repository, if available, 10771.6Schristos# and if the files have not changed since then. 10781.48Schristos# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 10791.48Schristos# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 10801.48Schristos# If git or GNU is absent, don't bother to sync with git timestamps. 10811.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds' 10821.16Schristos# to be the maximum of the files it depends on. 10831.41Schristosset-timestamps.out: $(EIGHT_YARDS) 10841.16Schristos rm -f $@ 10851.35Schristos if (type git) >/dev/null 2>&1 && \ 10861.41Schristos files=`git ls-files $(EIGHT_YARDS)` && \ 10871.16Schristos touch -md @1 test.out; then \ 10881.16Schristos rm -f test.out && \ 10891.16Schristos for file in $$files; do \ 10901.16Schristos if git diff --quiet $$file; then \ 10911.56Schristos time=`TZ=UTC0 git log -1 \ 10921.56Schristos --format='tformat:%cd' \ 10931.56Schristos --date='format:%Y-%m-%dT%H:%M:%SZ' \ 10941.56Schristos $$file` && \ 10951.56Schristos echo "+ touch -md $$time $$file" && \ 10961.56Schristos touch -md $$time $$file; \ 10971.16Schristos else \ 10981.16Schristos echo >&2 "$$file: warning: does not match repository"; \ 10991.16Schristos fi || exit; \ 11001.16Schristos done; \ 11011.16Schristos fi 11021.48Schristos $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 11031.16Schristos for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ 11041.48Schristos $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ 11051.16Schristos exit; \ 11061.6Schristos done 11071.48Schristos $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 11081.48Schristos $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 11091.41Schristos touch $@ 11101.41Schristosset-tzs-timestamp.out: $(TZS) 11111.48Schristos $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 11121.16Schristos touch $@ 11131.6Schristos 11141.1Smlelstv# The zics below ensure that each data file can stand on its own. 11151.1Smlelstv# We also do an all-files run to catch links to links. 11161.1Smlelstv 11171.41Schristoscheck_public: $(VERSION_DEPS) 11181.41Schristos rm -fr public.dir 11191.41Schristos mkdir public.dir 11201.41Schristos ln $(VERSION_DEPS) public.dir 11211.56Schristos cd public.dir \ 11221.56Schristos && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 11231.48Schristos for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ 11241.48Schristos public.dir/vanguard.zi public.dir/main.zi \ 11251.48Schristos public.dir/rearguard.zi; \ 11261.48Schristos do \ 11271.41Schristos public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \ 11281.9Schristos done 11291.41Schristos public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK) 11301.49Schristos : 11311.49Schristos : Also check 'backzone' syntax. 11321.49Schristos rm public.dir/main.zi 11331.49Schristos cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi 11341.49Schristos public.dir/zic -d public.dir/zoneinfo main.zi 11351.51Schristos rm public.dir/main.zi 11361.51Schristos cd public.dir && \ 11371.51Schristos $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 11381.51Schristos public.dir/zic -d public.dir/zoneinfo main.zi 11391.49Schristos : 11401.34Schristos rm -fr public.dir 11411.41Schristos touch $@ 11421.9Schristos 11431.14Schristos# Check that the code works under various alternative 11441.14Schristos# implementations of time_t. 11451.41Schristoscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES) 11461.41Schristos$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 11471.41Schristos$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 11481.41Schristos rm -fr $@.dir 11491.41Schristos mkdir $@.dir 11501.41Schristos ln $(VERSION_DEPS) $@.dir 11511.41Schristos case $@ in \ 11521.49Schristos int*32_t) range=-2147483648,2147483648;; \ 11531.41Schristos u*) range=0,4294967296;; \ 11541.41Schristos *) range=-4294967296,4294967296;; \ 11551.41Schristos esac && \ 11561.41Schristos wd=`pwd` && \ 11571.41Schristos zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \ 11581.41Schristos if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 11591.41Schristos range_target=; \ 11601.23Schristos else \ 11611.41Schristos range_target=to$$range.tzs; \ 11621.23Schristos fi && \ 11631.41Schristos (cd $@.dir && \ 11641.41Schristos $(MAKE) TOPDIR="$$wd/$@.dir" \ 11651.41Schristos CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \ 11661.23Schristos REDO='$(REDO)' \ 11671.41Schristos D=$$wd/$@.dir \ 11681.41Schristos TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 11691.41Schristos install $$range_target) && \ 11701.41Schristos test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 11711.41Schristos (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \ 11721.41Schristos $(MAKE) TOPDIR="$$wd/$@.dir" \ 11731.41Schristos TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 11741.41Schristos D=$$wd/$@.dir \ 11751.41Schristos to$$range.tzs) && \ 11761.54Schristos $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \ 11771.41Schristos $@.dir/to$$range.tzs && \ 11781.41Schristos if diff -q Makefile Makefile 2>/dev/null; then \ 11791.41Schristos quiet_option='-q'; \ 11801.41Schristos else \ 11811.41Schristos quiet_option=''; \ 11821.41Schristos fi && \ 11831.41Schristos diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \ 11841.41Schristos $@.dir/etc && \ 11851.41Schristos diff $$quiet_option -r \ 11861.41Schristos $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \ 11871.41Schristos $@.dir/usr/share; \ 11881.41Schristos } 11891.41Schristos touch $@ 11901.34Schristos 11911.40SchristosTRADITIONAL_ASC = \ 11921.40Schristos tzcode$(VERSION).tar.gz.asc \ 11931.40Schristos tzdata$(VERSION).tar.gz.asc 11941.41SchristosREARGUARD_ASC = \ 11951.41Schristos tzdata$(VERSION)-rearguard.tar.gz.asc 11961.41SchristosALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 11971.40Schristos tzdb-$(VERSION).tar.lz.asc 11981.40Schristos 11991.51Schristostarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 12001.41Schristossignatures rearguard_signatures traditional_signatures: \ 12011.51Schristos version set-timestamps.out rearguard.zi vanguard.zi 12021.35Schristos VERSION=`cat version` && \ 12031.48Schristos $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 12041.35Schristos 12051.40Schristos# These *_version rules are intended for use if VERSION is set by some 12061.40Schristos# other means. Ordinarily these rules are used only by the above 12071.40Schristos# non-_version rules, which set VERSION on the 'make' command line. 12081.41Schristostarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 12091.40Schristos tzdb-$(VERSION).tar.lz 12101.41Schristosrearguard_tarballs_version: \ 12111.41Schristos tzdata$(VERSION)-rearguard.tar.gz 12121.38Schristostraditional_tarballs_version: \ 12131.38Schristos tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 12141.51Schristostailored_tarballs_version: \ 12151.51Schristos tzdata$(VERSION)-tailored.tar.gz 12161.40Schristossignatures_version: $(ALL_ASC) 12171.41Schristosrearguard_signatures_version: $(REARGUARD_ASC) 12181.40Schristostraditional_signatures_version: $(TRADITIONAL_ASC) 12191.9Schristos 12201.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out 12211.6Schristos LC_ALL=C && export LC_ALL && \ 12221.7Schristos tar $(TARFLAGS) -cf - \ 12231.23Schristos $(COMMON) $(DOCS) $(SOURCES) | \ 12241.38Schristos gzip $(GZIPFLAGS) >$@.out 12251.35Schristos mv $@.out $@ 12261.10Schristos 12271.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out 12281.6Schristos LC_ALL=C && export LC_ALL && \ 12291.51Schristos tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \ 12301.38Schristos gzip $(GZIPFLAGS) >$@.out 12311.35Schristos mv $@.out $@ 12321.9Schristos 12331.51Schristos# Create empty files with a reproducible timestamp. 12341.51SchristosCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 12351.51Schristos 12361.51Schristos# The obsolescent *rearguard* targets and related macros are present 12371.51Schristos# for backwards compatibility with tz releases 2018e through 2022a. 12381.51Schristos# They should go away eventually. To build rearguard tarballs you 12391.51Schristos# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 12401.40Schristostzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 12411.51Schristos rm -fr $@.dir 12421.51Schristos mkdir $@.dir 12431.51Schristos ln $(TZDATA_DIST) $@.dir 12441.51Schristos cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 12451.40Schristos for f in $(TDATA) $(PACKRATDATA); do \ 12461.51Schristos rearf=$@.dir/$$f; \ 12471.40Schristos $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 12481.48Schristos $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 12491.40Schristos done 12501.51Schristos sed '1s/$$/-rearguard/' <version >$@.dir/version 12511.47Schristos : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12521.51Schristos $(CREATE_EMPTY) $@.dir/pacificnew 12531.56Schristos touch -mr version $@.dir/version 12541.40Schristos LC_ALL=C && export LC_ALL && \ 12551.51Schristos (cd $@.dir && \ 12561.47Schristos tar $(TARFLAGS) -cf - \ 12571.51Schristos $(TZDATA_DIST) pacificnew | \ 12581.40Schristos gzip $(GZIPFLAGS)) >$@.out 12591.40Schristos mv $@.out $@ 12601.40Schristos 12611.51Schristos# Create a tailored tarball suitable for TZUpdater and compatible tools. 12621.51Schristos# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 12631.51Schristos# useful for testing whether TZUpdater supports vanguard form. 12641.51Schristos# The generated tarball is not byte-for-byte equivalent to a hand-tailored 12651.51Schristos# traditional tarball, as data entries are put into 'etcetera' even if they 12661.51Schristos# came from some other source file. However, the effect should be the same 12671.51Schristos# for ordinary use, which reads all the source files. 12681.51Schristostzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 12691.51Schristos rm -fr $@.dir 12701.51Schristos mkdir $@.dir 12711.51Schristos : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12721.51Schristos cd $@.dir && \ 12731.51Schristos $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 12741.51Schristos `test $(DATAFORM) = vanguard || echo pacificnew` 12751.51Schristos (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 12761.51Schristos >$@.dir/etcetera 12771.56Schristos touch -mr tzdata.zi $@.dir/etcetera 12781.51Schristos sed -n \ 12791.51Schristos -e '/^# *version *\(.*\)/h' \ 12801.51Schristos -e '/^# *ddeps */H' \ 12811.51Schristos -e '$$!d' \ 12821.51Schristos -e 'g' \ 12831.51Schristos -e 's/^# *version *//' \ 12841.51Schristos -e 's/\n# *ddeps */-/' \ 12851.51Schristos -e 's/ /-/g' \ 12861.51Schristos -e 'p' \ 12871.51Schristos <tzdata.zi >$@.dir/version 12881.56Schristos touch -mr version $@.dir/version 12891.51Schristos links= && \ 12901.51Schristos for file in $(TZDATA_DIST); do \ 12911.51Schristos test -f $@.dir/$$file || links="$$links $$file"; \ 12921.51Schristos done && \ 12931.51Schristos ln $$links $@.dir 12941.51Schristos LC_ALL=C && export LC_ALL && \ 12951.51Schristos (cd $@.dir && \ 12961.51Schristos tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out 12971.51Schristos mv $@.out $@ 12981.51Schristos 12991.41Schristostzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 13001.34Schristos rm -fr tzdb-$(VERSION) 13011.34Schristos mkdir tzdb-$(VERSION) 13021.34Schristos ln $(ENCHILADA) tzdb-$(VERSION) 13031.48Schristos $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 13041.34Schristos LC_ALL=C && export LC_ALL && \ 13051.35Schristos tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out 13061.35Schristos mv $@.out $@ 13071.9Schristos 13081.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 13091.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 13101.40Schristostzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 13111.34Schristostzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 13121.40Schristos$(ALL_ASC): 13131.44Schristos $(GPG) --armor --detach-sign $? 13141.34Schristos 13151.41SchristosTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 13161.41Schristostypecheck: typecheck_long_long typecheck_unsigned 13171.41Schristostypecheck_long_long typecheck_unsigned: $(VERSION_DEPS) 13181.41Schristos rm -fr $@.dir 13191.41Schristos mkdir $@.dir 13201.41Schristos ln $(VERSION_DEPS) $@.dir 13211.41Schristos cd $@.dir && \ 13221.41Schristos case $@ in \ 13231.41Schristos *_long_long) i="long long";; \ 13241.41Schristos *_unsigned ) i="unsigned" ;; \ 13251.41Schristos esac && \ 13261.41Schristos typecheck_cflags='' && \ 13271.41Schristos $(MAKE) \ 13281.41Schristos CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 13291.41Schristos TOPDIR="`pwd`" \ 13301.41Schristos install 13311.41Schristos $@.dir/zdump -i -c 1970,1971 Europe/Rome 13321.41Schristos touch $@ 13331.1Smlelstv 13341.38Schristoszonenames: tzdata.zi 13351.38Schristos @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 13361.1Smlelstv 13371.1Smlelstvasctime.o: private.h tzfile.h 13381.1Smlelstvdate.o: private.h 13391.1Smlelstvdifftime.o: private.h 13401.56Schristoslocaltime.o: private.h tzfile.h tzdir.h 13411.23Schristosstrftime.o: private.h tzfile.h 13421.6Schristoszdump.o: version.h 13431.56Schristoszic.o: private.h tzfile.h tzdir.h version.h 13441.1Smlelstv 13451.22Schristos.PHONY: ALL INSTALL all 13461.54Schristos.PHONY: check check_mild check_time_t_alternatives 13471.42Schristos.PHONY: check_web check_zishrink 13481.57Schristos.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd 13491.57Schristos.PHONY: fetch-leap-seconds.list force_tzs 13501.32Schristos.PHONY: install install_data maintainer-clean names 13511.51Schristos.PHONY: posix_only posix_right public 13521.41Schristos.PHONY: rearguard_signatures rearguard_signatures_version 13531.41Schristos.PHONY: rearguard_tarballs rearguard_tarballs_version 13541.41Schristos.PHONY: right_only right_posix signatures signatures_version 13551.40Schristos.PHONY: tarballs tarballs_version 13561.40Schristos.PHONY: traditional_signatures traditional_signatures_version 13571.40Schristos.PHONY: traditional_tarballs traditional_tarballs_version 13581.51Schristos.PHONY: tailored_tarballs tailored_tarballs_version 13591.40Schristos.PHONY: typecheck 13601.22Schristos.PHONY: zonenames zones 13611.40Schristos.PHONY: $(ZDS) 1362