Makefile revision 1.56
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.55Schristos# 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.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.55Schristos# DST transitions for POSIX-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.52Schristos# and define NO_TM_ZONE to suppress any guessing. Although these two fields 3441.52Schristos# not required by POSIX, a future version of POSIX is planned to require them 3451.52Schristos# and they are widely available on GNU/Linux and BSD systems. 3461.1Smlelstv# 3471.38Schristos# The next batch of options control support for external variables 3481.38Schristos# exported by tzcode. In practice these variables are less useful 3491.38Schristos# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 3501.38Schristos# # 3511.38Schristos# # To omit or support the external variable "tzname", add one of: 3521.45Schristos# # -DHAVE_TZNAME=0 # do not support "tzname" 3531.45Schristos# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 3541.45Schristos# # -DHAVE_TZNAME=2 # support and define "tzname" 3551.38Schristos# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. 3561.38Schristos# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 3571.38Schristos# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 3581.38Schristos# # crashes when combined with some platforms' standard libraries, 3591.38Schristos# # presumably due to memory allocation issues. 3601.38Schristos# # 3611.38Schristos# # To omit or support the external variables "timezone" and "daylight", add 3621.45Schristos# # -DUSG_COMPAT=0 # do not support 3631.45Schristos# # -DUSG_COMPAT=1 # support, and variables are defined by system library 3641.45Schristos# # -DUSG_COMPAT=2 # support and define variables 3651.38Schristos# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by 3661.38Schristos# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. 3671.38Schristos# # If not defined, the code attempts to guess USG_COMPAT from other macros. 3681.38Schristos# # 3691.38Schristos# # To support the external variable "altzone", add 3701.45Schristos# # -DALTZONE=0 # do not support 3711.45Schristos# # -DALTZONE=1 # support "altzone", which is defined by system library 3721.45Schristos# # -DALTZONE=2 # support and define "altzone" 3731.38Schristos# # to the end of the "CFLAGS=" line; although "altzone" appeared in 3741.38Schristos# # System V Release 3.1 it has not been standardized. 3751.45Schristos# # If not defined, the code attempts to guess ALTZONE from other macros. 3761.38Schristos# 3771.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work, 3781.1Smlelstv# add 3791.1Smlelstv# -DSTD_INSPIRED 3801.54Schristos# to the end of the "CFLAGS=" line. This arranges for the following 3811.54Schristos# functions to be added to the time conversion library. 3821.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument 3831.1Smlelstv# that gives an offset to add to the time_t when converting it. 3841.56Schristos# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 3851.56Schristos# "timelocal" is nearly equivalent to "mktime". 3861.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument 3871.1Smlelstv# that gives an offset to use when converting to a time_t. 3881.56Schristos# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 3891.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page. 3901.1Smlelstv# X3J11's work does not describe any of these functions. 3911.1Smlelstv# These functions may well disappear in future releases of the time 3921.1Smlelstv# conversion package. 3931.1Smlelstv# 3941.23Schristos# If you don't want functions that were inspired by NetBSD, add 3951.23Schristos# -DNETBSD_INSPIRED=0 3961.23Schristos# to the end of the "CFLAGS=" line. Otherwise, the functions 3971.23Schristos# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 3981.55Schristos# time library, and if STD_INSPIRED is also defined to nonzero the functions 3991.23Schristos# "posix2time_z" and "time2posix_z" are added as well. 4001.23Schristos# The functions ending in "_z" (or "_rz") are like their unsuffixed 4011.23Schristos# (or suffixed-by-"_r") counterparts, except with an extra first 4021.41Schristos# argument of opaque type timezone_t that specifies the timezone. 4031.23Schristos# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 4041.23Schristos# 4051.1Smlelstv# If you want to allocate state structures in localtime, add 4061.1Smlelstv# -DALL_STATE 4071.1Smlelstv# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 4081.1Smlelstv# 4091.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 4101.1Smlelstv# out by the National Institute of Standards and Technology 4111.56Schristos# which claims to test C and POSIX conformance. If you want to pass PCTS, add 4121.1Smlelstv# -DPCTS 4131.1Smlelstv# to the end of the "CFLAGS=" line. 4141.1Smlelstv# 4151.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add 4161.1Smlelstv# -DXPG4_1994_04_09 4171.1Smlelstv# to the end of the "CFLAGS=" line. This causes "strftime" to always return 4181.38Schristos# 53 as a week number (rather than 52 or 53) for January days before 4191.38Schristos# January's first Monday when a "%V" format is used and January 1 4201.1Smlelstv# falls on a Friday, Saturday, or Sunday. 4211.56Schristos# 4221.56Schristos# POSIX says CFLAGS defaults to "-O 1". 4231.56Schristos# Uncomment the following line and edit its contents as needed. 4241.1Smlelstv 4251.56Schristos#CFLAGS= -O 1 4261.1Smlelstv 4271.9Schristos 4281.56Schristos# The name of a POSIX-like library archiver, its flags, C compiler, 4291.56Schristos# linker flags, and 'make' utility. Ordinarily the defaults suffice. 4301.56Schristos# The commented-out values are the defaults specified by POSIX 202x/D3. 4311.56Schristos#AR = ar 4321.56Schristos#ARFLAGS = -rv 4331.56Schristos#CC = c17 4341.56Schristos#LDFLAGS = 4351.56Schristos#MAKE = make 4361.1Smlelstv 4371.32Schristos# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in 4381.32Schristos# submake command lines. The default is no leap seconds. 4391.32Schristos 4401.32SchristosLEAPSECONDS= 4411.32Schristos 4421.32Schristos# The zic command and its arguments. 4431.32Schristos 4441.1Smlelstvzic= ./zic 4451.1SmlelstvZIC= $(zic) $(ZFLAGS) 4461.1Smlelstv 4471.43Schristos# To shrink the size of installed TZif files, 4481.43Schristos# append "-r @N" to omit data before N-seconds-after-the-Epoch. 4491.53Schristos# To grow the files and work around bugs in older applications, 4501.53Schristos# possibly at the expense of introducing bugs in newer ones, 4511.53Schristos# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 4521.44Schristos# See the zic man page for more about -b and -r. 4531.15SchristosZFLAGS= 4541.15Schristos 4551.41Schristos# How to use zic to install TZif files. 4561.32Schristos 4571.39SchristosZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) 4581.32Schristos 4591.56Schristos# The name of a POSIX-compliant 'awk' on your system. 4601.50Schristos# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 4611.50Schristos# Also, it is better (though not essential) if 'awk' supports UTF-8, 4621.50Schristos# and unfortunately mawk and busybox awk do not support UTF-8. 4631.50Schristos# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 4641.9SchristosAWK= awk 4651.9Schristos 4661.56Schristos# The full path name of a POSIX-compliant shell, preferably one that supports 4671.16Schristos# the Korn shell's 'select' statement as an extension. 4681.16Schristos# These days, Bash is the most popular. 4691.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh 4701.56Schristos# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 4711.16Schristos# is typically nicer if it works. 4721.9SchristosKSHELL= /bin/bash 4731.1Smlelstv 4741.42Schristos# Name of curl <https://curl.haxx.se/>, used for HTML validation. 4751.42SchristosCURL= curl 4761.42Schristos 4771.44Schristos# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 4781.44SchristosGPG= gpg 4791.44Schristos 4801.23Schristos# This expensive test requires USE_LTZ. 4811.23Schristos# To suppress it, define this macro to be empty. 4821.23SchristosCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 4831.23Schristos 4841.22Schristos# SAFE_CHAR is a regular expression that matches a safe character. 4851.22Schristos# Some parts of this distribution are limited to safe characters; 4861.22Schristos# others can use any UTF-8 character. 4871.22Schristos# For now, the safe characters are a safe subset of ASCII. 4881.9Schristos# The caller must set the shell variable 'sharp' to the character '#', 4891.9Schristos# since Makefile macros cannot contain '#'. 4901.9Schristos# TAB_CHAR is a single tab character, in single quotes. 4911.9SchristosTAB_CHAR= ' ' 4921.22SchristosSAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 4931.22SchristosSAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 4941.22SchristosSAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 4951.29SchristosSAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 4961.29SchristosSAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 4971.29Schristos 4981.55Schristos# These non-alphabetic, non-ASCII printable characters are Latin-1, 4991.55Schristos# and so are likely displayable even in editors like XEmacs 21 5001.55Schristos# that have limited display capabilities. 5011.55SchristosUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 5021.40Schristos# Non-ASCII non-letters that OK_CHAR allows, as these characters are 5031.41Schristos# useful in commentary. 5041.55SchristosUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 5051.40Schristos 5061.51Schristos# Put this in a bracket expression to match spaces. 5071.51Schristoss = [:space:] 5081.51Schristos 5091.29Schristos# OK_CHAR matches any character allowed in the distributed files. 5101.40Schristos# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 5111.40Schristos# multibyte letters are also allowed so that commentary can contain a 5121.40Schristos# few safe symbols and people's names and can quote non-English sources. 5131.40Schristos# Other non-letters are limited to ASCII renderings for the 5141.40Schristos# convenience of maintainers using XEmacs 21.5.34, which by default 5151.40Schristos# mishandles Unicode characters U+0100 and greater. 5161.40SchristosOK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 5171.22Schristos 5181.22Schristos# SAFE_LINE matches a line of safe characters. 5191.29Schristos# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 5201.22Schristos# this is so that comments can contain non-ASCII characters. 5211.29Schristos# OK_LINE matches a line of OK characters. 5221.22SchristosSAFE_LINE= '^'$(SAFE_CHAR)'*$$' 5231.29SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 5241.29SchristosOK_LINE= '^'$(OK_CHAR)'*$$' 5251.9Schristos 5261.6Schristos# Flags to give 'tar' when making a distribution. 5271.6Schristos# Try to use flags appropriate for GNU tar. 5281.50SchristosGNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \ 5291.50Schristos --numeric-owner --owner=0 --group=0 \ 5301.50Schristos --mode=go+u,go-w --sort=name 5311.6SchristosTARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ 5321.6Schristos then echo $(GNUTARFLAGS); \ 5331.6Schristos else :; \ 5341.6Schristos fi` 5351.6Schristos 5361.6Schristos# Flags to give 'gzip' when making a distribution. 5371.38SchristosGZIPFLAGS= -9n 5381.6Schristos 5391.54Schristos# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 5401.54Schristos# This makes it easier to see which Zone has been affected. 5411.54SchristosDIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ 5421.54Schristos || echo ' -F^TZ=') 5431.54Schristos 5441.56Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 5451.56SchristosRANLIB= : 5461.1Smlelstv 5471.56Schristos# POSIX prohibits defining or using SHELL. However, csh users on systems 5481.56Schristos# that use the user shell for Makefile commands may need to define SHELL. 5491.56Schristos#SHELL= /bin/sh 5501.29Schristos 5511.56Schristos# End of macros that one plausibly might want to tailor. 5521.56Schristos############################################################################### 5531.1Smlelstv 5541.16Schristos 5551.28SchristosTZCOBJS= zic.o 5561.38SchristosTZDOBJS= zdump.o localtime.o asctime.o strftime.o 5571.1SmlelstvDATEOBJS= date.o localtime.o strftime.o asctime.o 5581.45SchristosLIBSRCS= localtime.c asctime.c difftime.c strftime.c 5591.45SchristosLIBOBJS= localtime.o asctime.o difftime.o strftime.o 5601.1SmlelstvHEADERS= tzfile.h private.h 5611.28SchristosNONLIBSRCS= zic.c zdump.c 5621.45SchristosNEWUCBSRCS= date.c 5631.23SchristosSOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 5641.35Schristos tzselect.ksh workman.sh 5651.1SmlelstvMANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 5661.1Smlelstv tzfile.5 tzselect.8 zic.8 zdump.8 5671.16SchristosMANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 5681.16Schristos time2posix.3.txt \ 5691.16Schristos tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 5701.16Schristos date.1.txt 5711.38SchristosCOMMON= calendars CONTRIBUTING LICENSE Makefile \ 5721.49Schristos NEWS README SECURITY theory.html version 5731.39SchristosWEB_PAGES= tz-art.html tz-how-to.html tz-link.html 5741.43SchristosCHECK_WEB_PAGES=check_theory.html check_tz-art.html \ 5751.43Schristos check_tz-how-to.html check_tz-link.html 5761.23SchristosDOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 5771.1SmlelstvPRIMARY_YDATA= africa antarctica asia australasia \ 5781.1Smlelstv europe northamerica southamerica 5791.39SchristosYDATA= $(PRIMARY_YDATA) etcetera 5801.46SchristosNDATA= factory 5811.46SchristosTDATA_TO_CHECK= $(YDATA) $(NDATA) backward 5821.39SchristosTDATA= $(YDATA) $(NDATA) $(BACKWARD) 5831.56SchristosZONETABLES= zone.tab zone1970.tab zonenow.tab 5841.38SchristosTABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 5851.16SchristosLEAP_DEPS= leapseconds.awk leap-seconds.list 5861.51SchristosTZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 5871.51Schristos $(PACKRATDATA) $(PACKRATLIST) 5881.51SchristosDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 5891.39SchristosDATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 5901.46Schristos leapseconds $(ZONETABLES) 5911.56SchristosAWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 5921.40Schristos ziguard.awk zishrink.awk 5931.52SchristosMISC= $(AWK_SCRIPTS) 5941.34SchristosTZS_YEAR= 2050 5951.41SchristosTZS_CUTOFF_FLAG= -c $(TZS_YEAR) 5961.34SchristosTZS= to$(TZS_YEAR).tzs 5971.34SchristosTZS_NEW= to$(TZS_YEAR)new.tzs 5981.49SchristosTZS_DEPS= $(YDATA) asctime.c localtime.c \ 5991.34Schristos private.h tzfile.h zdump.c zic.c 6001.51SchristosTZDATA_DIST = $(COMMON) $(DATA) $(MISC) 6011.41Schristos# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 6021.51SchristosEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 6031.41SchristosENCHILADA = $(EIGHT_YARDS) $(TZS) 6041.34Schristos 6051.34Schristos# Consult these files when deciding whether to rebuild the 'version' file. 6061.34Schristos# This list is not the same as the output of 'git ls-files', since 6071.34Schristos# .gitignore is not distributed. 6081.34SchristosVERSION_DEPS= \ 6091.49Schristos calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 6101.34Schristos africa antarctica asctime.c asia australasia \ 6111.34Schristos backward backzone \ 6121.56Schristos checklinks.awk checknow.awk checktab.awk \ 6131.34Schristos date.1 date.c difftime.c \ 6141.34Schristos etcetera europe factory iso3166.tab \ 6151.34Schristos leap-seconds.list leapseconds.awk localtime.c \ 6161.34Schristos newctime.3 newstrftime.3 newtzset.3 northamerica \ 6171.46Schristos private.h southamerica strftime.c theory.html \ 6181.39Schristos time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 6191.34Schristos tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 6201.46Schristos workman.sh zdump.8 zdump.c zic.8 zic.c \ 6211.40Schristos ziguard.awk zishrink.awk \ 6221.56Schristos zone.tab zone1970.tab zonenow.tab 6231.1Smlelstv 6241.46Schristosall: tzselect zic zdump libtz.a $(TABDATA) \ 6251.40Schristos vanguard.zi main.zi rearguard.zi 6261.1Smlelstv 6271.29SchristosALL: all date $(ENCHILADA) 6281.1Smlelstv 6291.16Schristosinstall: all $(DATA) $(REDO) $(MANS) 6301.39Schristos mkdir -p '$(DESTDIR)$(BINDIR)' \ 6311.39Schristos '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 6321.39Schristos '$(DESTDIR)$(LIBDIR)' \ 6331.39Schristos '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 6341.39Schristos '$(DESTDIR)$(MANDIR)/man8' 6351.44Schristos $(ZIC_INSTALL) -l $(LOCALTIME) \ 6361.44Schristos `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ 6371.44Schristos ` $(POSIXRULES) \ 6381.39Schristos -t '$(DESTDIR)$(TZDEFAULT)' 6391.39Schristos cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 6401.39Schristos cp tzselect '$(DESTDIR)$(BINDIR)/.' 6411.39Schristos cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 6421.39Schristos cp zic '$(DESTDIR)$(ZICDIR)/.' 6431.39Schristos cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 6441.39Schristos $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 6451.39Schristos cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 6461.39Schristos cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 6471.39Schristos cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 6481.1Smlelstv 6491.1SmlelstvINSTALL: ALL install date.1 6501.39Schristos mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 6511.39Schristos cp date '$(DESTDIR)$(BINDIR)/.' 6521.39Schristos cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 6531.1Smlelstv 6541.48Schristos# Calculate version number from git, if available. 6551.48Schristos# Otherwise, use $(VERSION) unless it is "unknown" and there is already 6561.48Schristos# a 'version' file, in which case reuse the existing 'version' contents 6571.48Schristos# and append "-dirty" if the contents do not already end in "-dirty". 6581.34Schristosversion: $(VERSION_DEPS) 6591.35Schristos { (type git) >/dev/null 2>&1 && \ 6601.35Schristos V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 6611.35Schristos --abbrev=7 --dirty` || \ 6621.48Schristos if test '$(VERSION)' = unknown && V=`cat $@`; then \ 6631.48Schristos case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ 6641.48Schristos else \ 6651.48Schristos V='$(VERSION)'; \ 6661.48Schristos fi; } && \ 6671.35Schristos printf '%s\n' "$$V" >$@.out 6681.35Schristos mv $@.out $@ 6691.34Schristos 6701.51Schristos# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 6711.40Schristosvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 6721.51Schristos $(AWK) \ 6731.51Schristos -v DATAFORM=`expr $@ : '\(.*\).zi'` \ 6741.51Schristos -v PACKRATDATA='$(PACKRATDATA)' \ 6751.51Schristos -v PACKRATLIST='$(PACKRATLIST)' \ 6761.51Schristos -f ziguard.awk \ 6771.40Schristos $(TDATA) $(PACKRATDATA) >$@.out 6781.40Schristos mv $@.out $@ 6791.41Schristos# This file has a version comment that attempts to capture any tailoring 6801.51Schristos# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 6811.41Schristostzdata.zi: $(DATAFORM).zi version zishrink.awk 6821.39Schristos version=`sed 1q version` && \ 6831.41Schristos LC_ALL=C $(AWK) \ 6841.41Schristos -v dataform='$(DATAFORM)' \ 6851.41Schristos -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 6861.41Schristos -v redo='$(REDO)' \ 6871.41Schristos -v version="$$version" \ 6881.41Schristos -f zishrink.awk \ 6891.40Schristos $(DATAFORM).zi >$@.out 6901.38Schristos mv $@.out $@ 6911.38Schristos 6921.56Schristostzdir.h: 6931.56Schristos printf '%s\n' >$@.out \ 6941.56Schristos '#ifndef TZDEFAULT' \ 6951.56Schristos '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 6961.56Schristos '#endif' \ 6971.56Schristos '#ifndef TZDIR' \ 6981.56Schristos '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 6991.56Schristos '#endif' 7001.56Schristos mv $@.out $@ 7011.56Schristos 7021.34Schristosversion.h: version 7031.35Schristos VERSION=`cat version` && printf '%s\n' \ 7041.35Schristos 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 7051.35Schristos "static char const TZVERSION[]=\"$$VERSION\";" \ 7061.35Schristos 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 7071.35Schristos >$@.out 7081.35Schristos mv $@.out $@ 7091.6Schristos 7101.1Smlelstvzdump: $(TZDOBJS) 7111.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 7121.1Smlelstv 7131.32Schristoszic: $(TZCOBJS) 7141.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 7151.1Smlelstv 7161.16Schristosleapseconds: $(LEAP_DEPS) 7171.45Schristos $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 7181.45Schristos -f leapseconds.awk leap-seconds.list >$@.out 7191.35Schristos mv $@.out $@ 7201.15Schristos 7211.32Schristos# Arguments to pass to submakes of install_data. 7221.32Schristos# They can be overridden by later submake arguments. 7231.32SchristosINSTALLARGS = \ 7241.39Schristos BACKWARD='$(BACKWARD)' \ 7251.39Schristos DESTDIR='$(DESTDIR)' \ 7261.32Schristos LEAPSECONDS='$(LEAPSECONDS)' \ 7271.32Schristos PACKRATDATA='$(PACKRATDATA)' \ 7281.51Schristos PACKRATLIST='$(PACKRATLIST)' \ 7291.39Schristos TZDEFAULT='$(TZDEFAULT)' \ 7301.39Schristos TZDIR='$(TZDIR)' \ 7311.32Schristos ZIC='$(ZIC)' 7321.32Schristos 7331.46SchristosINSTALL_DATA_DEPS = zic leapseconds tzdata.zi 7341.41Schristos 7351.41Schristos# 'make install_data' installs one set of TZif files. 7361.41Schristosinstall_data: $(INSTALL_DATA_DEPS) 7371.38Schristos $(ZIC_INSTALL) tzdata.zi 7381.32Schristos 7391.41Schristosposix_only: $(INSTALL_DATA_DEPS) 7401.32Schristos $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data 7411.32Schristos 7421.41Schristosright_only: $(INSTALL_DATA_DEPS) 7431.32Schristos $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ 7441.32Schristos install_data 7451.1Smlelstv 7461.1Smlelstv# In earlier versions of this makefile, the other two directories were 7471.1Smlelstv# subdirectories of $(TZDIR). However, this led to configuration errors. 7481.1Smlelstv# For example, with posix_right under the earlier scheme, 7491.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 7501.1Smlelstv# but gmtime without leap seconds, which led to problems with applications 7511.1Smlelstv# like sendmail that subtract gmtime from localtime. 7521.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR). 7531.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds 7541.1Smlelstv# to using them, or vice versa. 7551.32Schristosright_posix: right_only 7561.39Schristos rm -fr '$(DESTDIR)$(TZDIR)-leaps' 7571.39Schristos ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 7581.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 7591.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 7601.15Schristos 7611.32Schristosposix_right: posix_only 7621.39Schristos rm -fr '$(DESTDIR)$(TZDIR)-posix' 7631.39Schristos ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 7641.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 7651.39Schristos $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 7661.32Schristos 7671.1Smlelstvzones: $(REDO) 7681.1Smlelstv 7691.40Schristos# dummy.zd is not a real file; it is mentioned here only so that the 7701.40Schristos# top-level 'make' does not have a syntax error. 7711.40SchristosZDS = dummy.zd 7721.40Schristos# Rule used only by submakes invoked by the $(TZS_NEW) rule. 7731.40Schristos# It is separate so that GNU 'make -j' can run instances in parallel. 7741.40Schristos$(ZDS): zdump 7751.41Schristos ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ 7761.41Schristos >$@ 7771.40Schristos 7781.41SchristosTZS_NEW_DEPS = tzdata.zi zdump zic 7791.41Schristos$(TZS_NEW): $(TZS_NEW_DEPS) 7801.41Schristos rm -fr tzs$(TZS_YEAR).dir 7811.41Schristos mkdir tzs$(TZS_YEAR).dir 7821.41Schristos $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 7831.38Schristos $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 7841.38Schristos tzdata.zi | LC_ALL=C sort >$@.out 7851.35Schristos wd=`pwd` && \ 7861.41Schristos x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 7871.41Schristos tzdata.zi \ 7881.40Schristos | LC_ALL=C sort -t . -k 2,2` && \ 7891.41Schristos set x $$x && \ 7901.40Schristos shift && \ 7911.40Schristos ZDS=$$* && \ 7921.41Schristos $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 7931.41Schristos ZDS="$$ZDS" $$ZDS && \ 7941.41Schristos sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 7951.41Schristos rm -fr tzs$(TZS_YEAR).dir 7961.40Schristos mv $@.out $@ 7971.34Schristos 7981.41Schristos# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the 7991.34Schristos# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 8001.34Schristos$(TZS): 8011.41Schristos touch $@ 8021.34Schristos 8031.34Schristosforce_tzs: $(TZS_NEW) 8041.34Schristos cp $(TZS_NEW) $(TZS) 8051.34Schristos 8061.16Schristoslibtz.a: $(LIBOBJS) 8071.37Schristos rm -f $@ 8081.56Schristos $(AR) $(ARFLAGS) $@ $(LIBOBJS) 8091.16Schristos $(RANLIB) $@ 8101.1Smlelstv 8111.1Smlelstvdate: $(DATEOBJS) 8121.9Schristos $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 8131.1Smlelstv 8141.34Schristostzselect: tzselect.ksh version 8151.35Schristos VERSION=`cat version` && sed \ 8161.56Schristos -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 8171.56Schristos -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 8181.56Schristos -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 8191.56Schristos -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 8201.56Schristos -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 8211.56Schristos -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 8221.56Schristos <$@.ksh >$@.out 8231.35Schristos chmod +x $@.out 8241.35Schristos mv $@.out $@ 8251.1Smlelstv 8261.54Schristoscheck: check_back check_mild 8271.54Schristoscheck_mild: check_character_set check_white_space check_links \ 8281.56Schristos check_name_lengths check_now \ 8291.56Schristos check_slashed_abbrs check_sorted \ 8301.51Schristos check_tables check_web check_ziguard check_zishrink check_tzs 8311.9Schristos 8321.56Schristos# True if UTF8_LOCALE does not work; 8331.56Schristos# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 8341.56SchristosUTF8_LOCALE_MISSING = \ 8351.56Schristos { test ! '$(UTF8_LOCALE)' \ 8361.56Schristos || ! printf 'A\304\200B\n' \ 8371.56Schristos | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 8381.56Schristos || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } 8391.56Schristos 8401.9Schristoscheck_character_set: $(ENCHILADA) 8411.56Schristos $(UTF8_LOCALE_MISSING) || { \ 8421.22Schristos sharp='#' && \ 8431.35Schristos ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 8441.35Schristos $(MISC) $(SOURCES) $(WEB_PAGES) \ 8451.49Schristos CONTRIBUTING LICENSE README SECURITY \ 8461.38Schristos version tzdata.zi && \ 8471.41Schristos ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 8481.40Schristos Makefile && \ 8491.39Schristos ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 8501.46Schristos leapseconds zone.tab && \ 8511.38Schristos ! grep -Env $(OK_LINE) $(ENCHILADA); \ 8521.38Schristos } 8531.41Schristos touch $@ 8541.22Schristos 8551.23Schristoscheck_white_space: $(ENCHILADA) 8561.56Schristos $(UTF8_LOCALE_MISSING) || { \ 8571.35Schristos patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ 8581.56Schristos ! grep -En "$$pat|[$s]\$$" \ 8591.56Schristos $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ 8601.56Schristos } 8611.56Schristos touch $@ 8621.23Schristos 8631.51SchristosPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 8641.51SchristosFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 8651.38Schristos 8661.39Schristoscheck_name_lengths: $(TDATA_TO_CHECK) backzone 8671.39Schristos ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 8681.39Schristos $(TDATA_TO_CHECK) backzone 8691.41Schristos touch $@ 8701.38Schristos 8711.51SchristosPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 8721.51SchristosSTDOFF = [-+]?[0-9:.]+ 8731.51SchristosRULELESS_SAVE = (-|$(STDOFF)[sd]?) 8741.51SchristosRULELESS_SLASHED_ABBRS = \ 8751.51Schristos $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 8761.51Schristos 8771.51Schristoscheck_slashed_abbrs: $(TDATA_TO_CHECK) 8781.51Schristos ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 8791.51Schristos touch $@ 8801.51Schristos 8811.23SchristosCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 8821.23Schristos 8831.55Schristoscheck_sorted: backward backzone 8841.54Schristos $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 8851.53Schristos backward | LC_ALL=C sort -cu 8861.23Schristos $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu 8871.41Schristos touch $@ 8881.23Schristos 8891.54Schristoscheck_back: checklinks.awk $(TDATA_TO_CHECK) 8901.53Schristos $(AWK) \ 8911.53Schristos -v DATAFORM=$(DATAFORM) \ 8921.53Schristos -v backcheck=backward \ 8931.53Schristos -f checklinks.awk $(TDATA_TO_CHECK) 8941.54Schristos touch $@ 8951.54Schristos 8961.54Schristoscheck_links: checklinks.awk tzdata.zi 8971.53Schristos $(AWK) \ 8981.53Schristos -v DATAFORM=$(DATAFORM) \ 8991.53Schristos -f checklinks.awk tzdata.zi 9001.41Schristos touch $@ 9011.26Schristos 9021.56Schristos# Check timestamps from now through 28 years from now, to make sure 9031.56Schristos# that zonenow.tab contains all sequences of planned timestamps, 9041.56Schristos# without any duplicate sequences. In theory this might require 9051.56Schristos# 2800 years but that would take a long time to check. 9061.56SchristosCHECK_NOW_TIMESTAMP = `./date +%s` 9071.56SchristosCHECK_NOW_FUTURE_YEARS = 28 9081.56SchristosCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 9091.56Schristoscheck_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 9101.56Schristos rm -fr $@.dir 9111.56Schristos mkdir $@.dir 9121.56Schristos ./zic -d $@.dir tzdata.zi 9131.56Schristos now=$(CHECK_NOW_TIMESTAMP) && \ 9141.56Schristos future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ 9151.56Schristos ./zdump -i -t $$now,$$future \ 9161.56Schristos $$(find $$PWD/$@.dir/????*/ -type f) \ 9171.56Schristos >$@.dir/zdump.tab 9181.56Schristos $(AWK) \ 9191.56Schristos -v zdump_table=$@.dir/zdump.tab \ 9201.56Schristos -f checknow.awk zonenow.tab 9211.56Schristos rm -fr $@.dir 9221.56Schristos touch $@ 9231.56Schristos 9241.56Schristoscheck_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab 9251.22Schristos for tab in $(ZONETABLES); do \ 9261.49Schristos test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 9271.49Schristos $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 9281.22Schristos || exit; \ 9291.22Schristos done 9301.41Schristos touch $@ 9311.1Smlelstv 9321.34Schristoscheck_tzs: $(TZS) $(TZS_NEW) 9331.41Schristos if test -s $(TZS); then \ 9341.54Schristos $(DIFF_TZS) $(TZS) $(TZS_NEW); \ 9351.41Schristos else \ 9361.41Schristos cp $(TZS_NEW) $(TZS); \ 9371.41Schristos fi 9381.41Schristos touch $@ 9391.34Schristos 9401.42Schristoscheck_web: $(CHECK_WEB_PAGES) 9411.43Schristoscheck_theory.html: theory.html 9421.42Schristoscheck_tz-art.html: tz-art.html 9431.46Schristoscheck_tz-how-to.html: tz-how-to.html 9441.42Schristoscheck_tz-link.html: tz-link.html 9451.46Schristoscheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: 9461.42Schristos $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 9471.42Schristos -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ 9481.42Schristos test ! -s $@.out || { cat $@.out; exit 1; } 9491.42Schristos mv $@.out $@ 9501.38Schristos 9511.51Schristoscheck_ziguard: rearguard.zi vanguard.zi ziguard.awk 9521.51Schristos $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 9531.51Schristos diff -u rearguard.zi - 9541.51Schristos $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 9551.51Schristos diff -u vanguard.zi - 9561.51Schristos touch $@ 9571.51Schristos 9581.40Schristos# Check that zishrink.awk does not alter the data, and that ziguard.awk 9591.40Schristos# preserves main-format data. 9601.41Schristoscheck_zishrink: check_zishrink_posix check_zishrink_right 9611.41Schristoscheck_zishrink_posix check_zishrink_right: \ 9621.51Schristos zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 9631.51Schristos $(TDATA) $(DATAFORM).zi tzdata.zi 9641.41Schristos rm -fr $@.dir $@-t.dir $@-shrunk.dir 9651.41Schristos mkdir $@.dir $@-t.dir $@-shrunk.dir 9661.41Schristos case $@ in \ 9671.41Schristos *_right) leap='-L leapseconds';; \ 9681.41Schristos *) leap=;; \ 9691.41Schristos esac && \ 9701.41Schristos $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ 9711.41Schristos $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ 9721.51Schristos case $(DATAFORM),$(PACKRATLIST) in \ 9731.51Schristos main,) \ 9741.41Schristos $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ 9751.40Schristos $(AWK) '/^Rule/' $(TDATA) | \ 9761.41Schristos $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ 9771.41Schristos diff -r $@.dir $@-t.dir;; \ 9781.41Schristos esac 9791.41Schristos diff -r $@.dir $@-shrunk.dir 9801.41Schristos rm -fr $@.dir $@-t.dir $@-shrunk.dir 9811.41Schristos touch $@ 9821.1Smlelstv 9831.14Schristosclean_misc: 9841.56Schristos rm -fr check_*.dir typecheck_*.dir 9851.41Schristos rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ 9861.41Schristos check_* core typecheck_* \ 9871.56Schristos date tzdir.h tzselect version.h zdump zic libtz.a 9881.14Schristosclean: clean_misc 9891.43Schristos rm -fr *.dir tzdb-*/ 9901.43Schristos rm -f *.zi $(TZS_NEW) 9911.1Smlelstv 9921.1Smlelstvmaintainer-clean: clean 9931.1Smlelstv @echo 'This command is intended for maintainers to use; it' 9941.1Smlelstv @echo 'deletes files that may need special tools to rebuild.' 9951.34Schristos rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 9961.1Smlelstv 9971.1Smlelstvnames: 9981.1Smlelstv @echo $(ENCHILADA) 9991.1Smlelstv 10001.23Schristospublic: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ 10011.16Schristos tarballs signatures 10021.16Schristos 10031.16Schristosdate.1.txt: date.1 10041.16Schristosnewctime.3.txt: newctime.3 10051.16Schristosnewstrftime.3.txt: newstrftime.3 10061.16Schristosnewtzset.3.txt: newtzset.3 10071.16Schristostime2posix.3.txt: time2posix.3 10081.16Schristostzfile.5.txt: tzfile.5 10091.16Schristostzselect.8.txt: tzselect.8 10101.16Schristoszdump.8.txt: zdump.8 10111.16Schristoszic.8.txt: zic.8 10121.16Schristos 10131.16Schristos$(MANTXTS): workman.sh 10141.35Schristos LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out 10151.35Schristos mv $@.out $@ 10161.9Schristos 10171.48Schristos# Set file timestamps deterministically if possible, 10181.48Schristos# so that tarballs containing the timestamps are reproducible. 10191.48Schristos# 10201.48Schristos# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 10211.48Schristos# file DEST to the maximum of the timestamps of the files A B C ..., 10221.48Schristos# plus N if GNU ls and touch are available. 10231.48SchristosSET_TIMESTAMP_N = sh -c '\ 10241.48Schristos n=$$0 dest=$$1; shift; \ 10251.56Schristos <"$$dest" && \ 10261.48Schristos if test $$n != 0 && \ 10271.56Schristos lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ 10281.48Schristos set x $$lsout && \ 10291.56Schristos timestamp=`expr $$7 + $$n` && \ 10301.56Schristos echo "+ touch -md @$$timestamp $$dest" && \ 10311.56Schristos touch -md @$$timestamp "$$dest"; \ 10321.56Schristos else \ 10331.56Schristos newest=`ls -t "$$@" | sed 1q` && \ 10341.56Schristos echo "+ touch -mr $$newest $$dest" && \ 10351.56Schristos touch -mr "$$newest" "$$dest"; \ 10361.56Schristos fi' 10371.48Schristos# If DEST depends on A B C ... in this Makefile, callers should use 10381.48Schristos# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 10391.48Schristos# downstream 'make' that considers equal timestamps to be out of date. 10401.48Schristos# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 10411.48Schristos# If all that matters is that the timestamp be reproducible 10421.48Schristos# and plausible, use $(SET_TIMESTAMP). 10431.48SchristosSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 10441.48SchristosSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 10451.48Schristos 10461.41Schristos# Set the timestamps to those of the git repository, if available, 10471.6Schristos# and if the files have not changed since then. 10481.48Schristos# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 10491.48Schristos# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 10501.48Schristos# If git or GNU is absent, don't bother to sync with git timestamps. 10511.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds' 10521.16Schristos# to be the maximum of the files it depends on. 10531.41Schristosset-timestamps.out: $(EIGHT_YARDS) 10541.16Schristos rm -f $@ 10551.35Schristos if (type git) >/dev/null 2>&1 && \ 10561.41Schristos files=`git ls-files $(EIGHT_YARDS)` && \ 10571.16Schristos touch -md @1 test.out; then \ 10581.16Schristos rm -f test.out && \ 10591.16Schristos for file in $$files; do \ 10601.16Schristos if git diff --quiet $$file; then \ 10611.56Schristos time=`TZ=UTC0 git log -1 \ 10621.56Schristos --format='tformat:%cd' \ 10631.56Schristos --date='format:%Y-%m-%dT%H:%M:%SZ' \ 10641.56Schristos $$file` && \ 10651.56Schristos echo "+ touch -md $$time $$file" && \ 10661.56Schristos touch -md $$time $$file; \ 10671.16Schristos else \ 10681.16Schristos echo >&2 "$$file: warning: does not match repository"; \ 10691.16Schristos fi || exit; \ 10701.16Schristos done; \ 10711.16Schristos fi 10721.48Schristos $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 10731.16Schristos for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ 10741.48Schristos $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ 10751.16Schristos exit; \ 10761.6Schristos done 10771.48Schristos $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 10781.48Schristos $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 10791.41Schristos touch $@ 10801.41Schristosset-tzs-timestamp.out: $(TZS) 10811.48Schristos $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 10821.16Schristos touch $@ 10831.6Schristos 10841.1Smlelstv# The zics below ensure that each data file can stand on its own. 10851.1Smlelstv# We also do an all-files run to catch links to links. 10861.1Smlelstv 10871.41Schristoscheck_public: $(VERSION_DEPS) 10881.41Schristos rm -fr public.dir 10891.41Schristos mkdir public.dir 10901.41Schristos ln $(VERSION_DEPS) public.dir 10911.56Schristos cd public.dir \ 10921.56Schristos && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 10931.48Schristos for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ 10941.48Schristos public.dir/vanguard.zi public.dir/main.zi \ 10951.48Schristos public.dir/rearguard.zi; \ 10961.48Schristos do \ 10971.41Schristos public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \ 10981.9Schristos done 10991.41Schristos public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK) 11001.49Schristos : 11011.49Schristos : Also check 'backzone' syntax. 11021.49Schristos rm public.dir/main.zi 11031.49Schristos cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi 11041.49Schristos public.dir/zic -d public.dir/zoneinfo main.zi 11051.51Schristos rm public.dir/main.zi 11061.51Schristos cd public.dir && \ 11071.51Schristos $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 11081.51Schristos public.dir/zic -d public.dir/zoneinfo main.zi 11091.49Schristos : 11101.34Schristos rm -fr public.dir 11111.41Schristos touch $@ 11121.9Schristos 11131.14Schristos# Check that the code works under various alternative 11141.14Schristos# implementations of time_t. 11151.41Schristoscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES) 11161.41Schristos$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 11171.41Schristos$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 11181.41Schristos rm -fr $@.dir 11191.41Schristos mkdir $@.dir 11201.41Schristos ln $(VERSION_DEPS) $@.dir 11211.41Schristos case $@ in \ 11221.49Schristos int*32_t) range=-2147483648,2147483648;; \ 11231.41Schristos u*) range=0,4294967296;; \ 11241.41Schristos *) range=-4294967296,4294967296;; \ 11251.41Schristos esac && \ 11261.41Schristos wd=`pwd` && \ 11271.41Schristos zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \ 11281.41Schristos if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 11291.41Schristos range_target=; \ 11301.23Schristos else \ 11311.41Schristos range_target=to$$range.tzs; \ 11321.23Schristos fi && \ 11331.41Schristos (cd $@.dir && \ 11341.41Schristos $(MAKE) TOPDIR="$$wd/$@.dir" \ 11351.41Schristos CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \ 11361.23Schristos REDO='$(REDO)' \ 11371.41Schristos D=$$wd/$@.dir \ 11381.41Schristos TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 11391.41Schristos install $$range_target) && \ 11401.41Schristos test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 11411.41Schristos (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \ 11421.41Schristos $(MAKE) TOPDIR="$$wd/$@.dir" \ 11431.41Schristos TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 11441.41Schristos D=$$wd/$@.dir \ 11451.41Schristos to$$range.tzs) && \ 11461.54Schristos $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \ 11471.41Schristos $@.dir/to$$range.tzs && \ 11481.41Schristos if diff -q Makefile Makefile 2>/dev/null; then \ 11491.41Schristos quiet_option='-q'; \ 11501.41Schristos else \ 11511.41Schristos quiet_option=''; \ 11521.41Schristos fi && \ 11531.41Schristos diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \ 11541.41Schristos $@.dir/etc && \ 11551.41Schristos diff $$quiet_option -r \ 11561.41Schristos $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \ 11571.41Schristos $@.dir/usr/share; \ 11581.41Schristos } 11591.41Schristos touch $@ 11601.34Schristos 11611.40SchristosTRADITIONAL_ASC = \ 11621.40Schristos tzcode$(VERSION).tar.gz.asc \ 11631.40Schristos tzdata$(VERSION).tar.gz.asc 11641.41SchristosREARGUARD_ASC = \ 11651.41Schristos tzdata$(VERSION)-rearguard.tar.gz.asc 11661.41SchristosALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 11671.40Schristos tzdb-$(VERSION).tar.lz.asc 11681.40Schristos 11691.51Schristostarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 11701.41Schristossignatures rearguard_signatures traditional_signatures: \ 11711.51Schristos version set-timestamps.out rearguard.zi vanguard.zi 11721.35Schristos VERSION=`cat version` && \ 11731.48Schristos $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 11741.35Schristos 11751.40Schristos# These *_version rules are intended for use if VERSION is set by some 11761.40Schristos# other means. Ordinarily these rules are used only by the above 11771.40Schristos# non-_version rules, which set VERSION on the 'make' command line. 11781.41Schristostarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 11791.40Schristos tzdb-$(VERSION).tar.lz 11801.41Schristosrearguard_tarballs_version: \ 11811.41Schristos tzdata$(VERSION)-rearguard.tar.gz 11821.38Schristostraditional_tarballs_version: \ 11831.38Schristos tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 11841.51Schristostailored_tarballs_version: \ 11851.51Schristos tzdata$(VERSION)-tailored.tar.gz 11861.40Schristossignatures_version: $(ALL_ASC) 11871.41Schristosrearguard_signatures_version: $(REARGUARD_ASC) 11881.40Schristostraditional_signatures_version: $(TRADITIONAL_ASC) 11891.9Schristos 11901.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out 11911.6Schristos LC_ALL=C && export LC_ALL && \ 11921.7Schristos tar $(TARFLAGS) -cf - \ 11931.23Schristos $(COMMON) $(DOCS) $(SOURCES) | \ 11941.38Schristos gzip $(GZIPFLAGS) >$@.out 11951.35Schristos mv $@.out $@ 11961.10Schristos 11971.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out 11981.6Schristos LC_ALL=C && export LC_ALL && \ 11991.51Schristos tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \ 12001.38Schristos gzip $(GZIPFLAGS) >$@.out 12011.35Schristos mv $@.out $@ 12021.9Schristos 12031.51Schristos# Create empty files with a reproducible timestamp. 12041.51SchristosCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 12051.51Schristos 12061.51Schristos# The obsolescent *rearguard* targets and related macros are present 12071.51Schristos# for backwards compatibility with tz releases 2018e through 2022a. 12081.51Schristos# They should go away eventually. To build rearguard tarballs you 12091.51Schristos# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 12101.40Schristostzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 12111.51Schristos rm -fr $@.dir 12121.51Schristos mkdir $@.dir 12131.51Schristos ln $(TZDATA_DIST) $@.dir 12141.51Schristos cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 12151.40Schristos for f in $(TDATA) $(PACKRATDATA); do \ 12161.51Schristos rearf=$@.dir/$$f; \ 12171.40Schristos $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 12181.48Schristos $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 12191.40Schristos done 12201.51Schristos sed '1s/$$/-rearguard/' <version >$@.dir/version 12211.47Schristos : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12221.51Schristos $(CREATE_EMPTY) $@.dir/pacificnew 12231.56Schristos touch -mr version $@.dir/version 12241.40Schristos LC_ALL=C && export LC_ALL && \ 12251.51Schristos (cd $@.dir && \ 12261.47Schristos tar $(TARFLAGS) -cf - \ 12271.51Schristos $(TZDATA_DIST) pacificnew | \ 12281.40Schristos gzip $(GZIPFLAGS)) >$@.out 12291.40Schristos mv $@.out $@ 12301.40Schristos 12311.51Schristos# Create a tailored tarball suitable for TZUpdater and compatible tools. 12321.51Schristos# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 12331.51Schristos# useful for testing whether TZUpdater supports vanguard form. 12341.51Schristos# The generated tarball is not byte-for-byte equivalent to a hand-tailored 12351.51Schristos# traditional tarball, as data entries are put into 'etcetera' even if they 12361.51Schristos# came from some other source file. However, the effect should be the same 12371.51Schristos# for ordinary use, which reads all the source files. 12381.51Schristostzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 12391.51Schristos rm -fr $@.dir 12401.51Schristos mkdir $@.dir 12411.51Schristos : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12421.51Schristos cd $@.dir && \ 12431.51Schristos $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 12441.51Schristos `test $(DATAFORM) = vanguard || echo pacificnew` 12451.51Schristos (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 12461.51Schristos >$@.dir/etcetera 12471.56Schristos touch -mr tzdata.zi $@.dir/etcetera 12481.51Schristos sed -n \ 12491.51Schristos -e '/^# *version *\(.*\)/h' \ 12501.51Schristos -e '/^# *ddeps */H' \ 12511.51Schristos -e '$$!d' \ 12521.51Schristos -e 'g' \ 12531.51Schristos -e 's/^# *version *//' \ 12541.51Schristos -e 's/\n# *ddeps */-/' \ 12551.51Schristos -e 's/ /-/g' \ 12561.51Schristos -e 'p' \ 12571.51Schristos <tzdata.zi >$@.dir/version 12581.56Schristos touch -mr version $@.dir/version 12591.51Schristos links= && \ 12601.51Schristos for file in $(TZDATA_DIST); do \ 12611.51Schristos test -f $@.dir/$$file || links="$$links $$file"; \ 12621.51Schristos done && \ 12631.51Schristos ln $$links $@.dir 12641.51Schristos LC_ALL=C && export LC_ALL && \ 12651.51Schristos (cd $@.dir && \ 12661.51Schristos tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out 12671.51Schristos mv $@.out $@ 12681.51Schristos 12691.41Schristostzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 12701.34Schristos rm -fr tzdb-$(VERSION) 12711.34Schristos mkdir tzdb-$(VERSION) 12721.34Schristos ln $(ENCHILADA) tzdb-$(VERSION) 12731.48Schristos $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 12741.34Schristos LC_ALL=C && export LC_ALL && \ 12751.35Schristos tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out 12761.35Schristos mv $@.out $@ 12771.9Schristos 12781.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 12791.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 12801.40Schristostzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 12811.34Schristostzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 12821.40Schristos$(ALL_ASC): 12831.44Schristos $(GPG) --armor --detach-sign $? 12841.34Schristos 12851.41SchristosTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 12861.41Schristostypecheck: typecheck_long_long typecheck_unsigned 12871.41Schristostypecheck_long_long typecheck_unsigned: $(VERSION_DEPS) 12881.41Schristos rm -fr $@.dir 12891.41Schristos mkdir $@.dir 12901.41Schristos ln $(VERSION_DEPS) $@.dir 12911.41Schristos cd $@.dir && \ 12921.41Schristos case $@ in \ 12931.41Schristos *_long_long) i="long long";; \ 12941.41Schristos *_unsigned ) i="unsigned" ;; \ 12951.41Schristos esac && \ 12961.41Schristos typecheck_cflags='' && \ 12971.41Schristos $(MAKE) \ 12981.41Schristos CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 12991.41Schristos TOPDIR="`pwd`" \ 13001.41Schristos install 13011.41Schristos $@.dir/zdump -i -c 1970,1971 Europe/Rome 13021.41Schristos touch $@ 13031.1Smlelstv 13041.38Schristoszonenames: tzdata.zi 13051.38Schristos @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 13061.1Smlelstv 13071.1Smlelstvasctime.o: private.h tzfile.h 13081.1Smlelstvdate.o: private.h 13091.1Smlelstvdifftime.o: private.h 13101.56Schristoslocaltime.o: private.h tzfile.h tzdir.h 13111.23Schristosstrftime.o: private.h tzfile.h 13121.6Schristoszdump.o: version.h 13131.56Schristoszic.o: private.h tzfile.h tzdir.h version.h 13141.1Smlelstv 13151.22Schristos.PHONY: ALL INSTALL all 13161.54Schristos.PHONY: check check_mild check_time_t_alternatives 13171.42Schristos.PHONY: check_web check_zishrink 13181.40Schristos.PHONY: clean clean_misc dummy.zd force_tzs 13191.32Schristos.PHONY: install install_data maintainer-clean names 13201.51Schristos.PHONY: posix_only posix_right public 13211.41Schristos.PHONY: rearguard_signatures rearguard_signatures_version 13221.41Schristos.PHONY: rearguard_tarballs rearguard_tarballs_version 13231.41Schristos.PHONY: right_only right_posix signatures signatures_version 13241.40Schristos.PHONY: tarballs tarballs_version 13251.40Schristos.PHONY: traditional_signatures traditional_signatures_version 13261.40Schristos.PHONY: traditional_tarballs traditional_tarballs_version 13271.51Schristos.PHONY: tailored_tarballs tailored_tarballs_version 13281.40Schristos.PHONY: typecheck 13291.22Schristos.PHONY: zonenames zones 13301.40Schristos.PHONY: $(ZDS) 1331