1# Make and install tzdb code and data. 2# This file is in the public domain, so clarified as of 3# 2009-05-17 by Arthur David Olson. 4# Request POSIX conformance; this must be the first non-comment line. 5.POSIX: 6# On older platforms you may need to scrounge for a POSIX-conforming 'make'. 7# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or 8# /usr/xpg4/bin/make, not /usr/ccs/bin/make. 9 10# To affect how this Makefile works, you can run a shell script like this: 11# 12# #!/bin/sh 13# make CC='gcc -std=gnu11' "$@" 14# 15# This example script is appropriate for a pre-2017 GNU/Linux system 16# where a non-default setting is needed to support this package's use of C99. 17# 18# Alternatively, you can simply edit this Makefile to tailor the following 19# macro definitions. 20 21############################################################################### 22# Start of macros that one plausibly might want to tailor. 23 24# Package name for the code distribution. 25PACKAGE= tzcode 26 27# Version number for the distribution, overridden in the 'tarballs' rule below. 28VERSION= unknown 29 30# Email address for bug reports. 31BUGEMAIL= tz@iana.org 32 33# DATAFORM selects the data format. 34# Available formats represent essentially the same data, albeit 35# possibly with minor discrepancies that users are not likely to notice. 36# To get new features and the best data right away, use: 37# DATAFORM= vanguard 38# To wait a while before using new features, to give downstream users 39# time to upgrade zic (the default), use: 40# DATAFORM= main 41# To wait even longer for new features, use: 42# DATAFORM= rearguard 43# Rearguard users might also want "ZFLAGS = -b fat"; see below. 44DATAFORM= main 45 46# Change the line below for your timezone (after finding the one you want in 47# one of the $(TDATA) source files, or adding it to a source file). 48# Alternatively, if you discover you've got the wrong timezone, you can just 49# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. 50# Use the command 51# make zonenames 52# to get a list of the values you can use for LOCALTIME. 53 54LOCALTIME= Factory 55 56# The POSIXRULES macro controls interpretation of POSIX-2017.1-like TZ 57# settings like TZ='EET-2EEST' that lack DST transition rules. 58# If POSIXRULES is '-', no template is installed; this is the default. 59# Any other value for POSIXRULES is obsolete and should not be relied on, as: 60# * It does not work correctly in popular implementations such as GNU/Linux. 61# * It does not work even in tzcode, except for historical timestamps 62# that precede the last explicit transition in the POSIXRULES file. 63# Hence it typically does not work for current and future timestamps. 64# If, despite the above, you want a template for handling these settings, 65# you can change the line below (after finding the timezone you want in the 66# one of the $(TDATA) source files, or adding it to a source file). 67# Alternatively, if you discover you've got the wrong timezone, you can just 68# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. 69# Use the command 70# make zonenames 71# to get a list of the values you can use for POSIXRULES. 72 73POSIXRULES= - 74 75# Also see TZDEFRULESTRING below, which takes effect only 76# if POSIXRULES is '-' or if the template file cannot be accessed. 77 78 79# Installation locations. 80# 81# The defaults are suitable for Debian, except that if REDO is 82# posix_right or right_posix then files that Debian puts under 83# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead 84# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, 85# respectively. Problems with the Debian approach are discussed in 86# the commentary for the right_posix rule (below). 87 88# Destination directory, which can be used for staging. 89# 'make DESTDIR=/stage install' installs under /stage (e.g., to 90# /stage/etc/localtime instead of to /etc/localtime). Files under 91# /stage are not intended to work as-is, but can be copied by hand to 92# the root directory later. If DESTDIR is empty, 'make install' does 93# not stage, but installs directly into production locations. 94DESTDIR = 95 96# Everything is installed into subdirectories of TOPDIR, and used there. 97# TOPDIR should be empty (meaning the root directory), 98# or a directory name that does not end in "/". 99# TOPDIR should be empty or an absolute name unless you're just testing. 100TOPDIR = 101 102# The default local timezone is taken from the file TZDEFAULT. 103TZDEFAULT = $(TOPDIR)/etc/localtime 104 105# The subdirectory containing installed program and data files, and 106# likewise for installed files that can be shared among architectures. 107# These should be relative file names. 108USRDIR = usr 109USRSHAREDIR = $(USRDIR)/share 110 111# "Compiled" timezone information is placed in the "TZDIR" directory 112# (and subdirectories). 113# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. 114TZDIR_BASENAME= zoneinfo 115TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) 116 117# The "tzselect" and (if you do "make INSTALL") "date" commands go in: 118BINDIR = $(TOPDIR)/$(USRDIR)/bin 119 120# The "zdump" command goes in: 121ZDUMPDIR = $(BINDIR) 122 123# The "zic" command goes in: 124ZICDIR = $(TOPDIR)/$(USRDIR)/sbin 125 126# Manual pages go in subdirectories of. . . 127MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man 128 129# Library functions are put in an archive in LIBDIR. 130LIBDIR = $(TOPDIR)/$(USRDIR)/lib 131 132 133# Types to try, as an alternative to time_t. 134TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) 135TIME_T_ALTERNATIVES_HEAD = int_least64_t 136TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t 137 138# What kind of TZif data files to generate. (TZif is the binary time 139# zone data format that zic generates; see Internet RFC 8536.) 140# If you want only POSIX time, with time values interpreted as 141# seconds since the epoch (not counting leap seconds), use 142# REDO= posix_only 143# below. If you want only "right" time, with values interpreted 144# as seconds since the epoch (counting leap seconds), use 145# REDO= right_only 146# below. If you want both sets of data available, with leap seconds not 147# counted normally, use 148# REDO= posix_right 149# below. If you want both sets of data available, with leap seconds counted 150# normally, use 151# REDO= right_posix 152# below. POSIX mandates that leap seconds not be counted; for compatibility 153# with it, use "posix_only" or "posix_right". Use POSIX time on systems with 154# leap smearing; this can work better than unsmeared "right" time with 155# applications that are not leap second aware, and is closer to unsmeared 156# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). 157 158REDO= posix_right 159 160# Whether to put an "Expires" line in the leapseconds file. 161# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. 162# The EXPIRES_LINE value matters only if REDO's value contains "right". 163# If you change EXPIRES_LINE, remove the leapseconds file before running "make". 164# zic's support for the Expires line was introduced in tzdb 2020a, 165# and was modified in tzdb 2021b to generate version 4 TZif files. 166# EXPIRES_LINE defaults to 0 for now so that the leapseconds file 167# can be given to pre-2020a zic implementations and so that TZif files 168# built by newer zic implementations can be read by pre-2021b libraries. 169EXPIRES_LINE= 0 170 171# To install data in text form that has all the information of the TZif data, 172# (optionally incorporating leap second information), use 173# TZDATA_TEXT= tzdata.zi leapseconds 174# To install text data without leap second information (e.g., because 175# REDO='posix_only'), use 176# TZDATA_TEXT= tzdata.zi 177# To avoid installing text data, use 178# TZDATA_TEXT= 179 180TZDATA_TEXT= leapseconds tzdata.zi 181 182# For backward-compatibility links for old zone names, use 183# BACKWARD= backward 184# To omit these links, use 185# BACKWARD= 186 187BACKWARD= backward 188 189# If you want out-of-scope and often-wrong data from the file 'backzone', 190# but only for entries listed in the backward-compatibility file zone.tab, use 191# PACKRATDATA= backzone 192# PACKRATLIST= zone.tab 193# If you want all the 'backzone' data, use 194# PACKRATDATA= backzone 195# PACKRATLIST= 196# To omit this data, use 197# PACKRATDATA= 198# PACKRATLIST= 199 200PACKRATDATA= 201PACKRATLIST= 202 203# The name of a locale using the UTF-8 encoding, used during self-tests. 204# The tests are skipped if the name does not appear to work on this system. 205 206UTF8_LOCALE= en_US.utf8 207 208# Non-default libraries needed to link. 209# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. 210LDLIBS= 211 212# Add the following to an uncommented "CFLAGS=" line as needed 213# to override defaults specified in the source code or by the system. 214# "-DFOO" is equivalent to "-DFOO=1". 215# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime 216# formats that generate only the last two digits of year numbers 217# -DEPOCH_LOCAL if the 'time' function returns local time not UT 218# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater 219# than what POSIX specifies, assuming local time is UT. 220# For example, N is 252460800 on AmigaOS. 221# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r 222# -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ' 223# -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm 224# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows) 225# -DHAVE__GENERIC=0 if _Generic does not work* 226# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), 227# -DHAVE_GETRANDOM=0 to avoid using getrandom 228# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), 229# where LDLIBS also needs to contain -lintl on some hosts; 230# -DHAVE_GETTEXT=0 to avoid using gettext 231# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares 232# ctime_r and asctime_r incompatibly with the POSIX standard 233# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). 234# -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+ 235# -DHAVE_LINK=0 if your system lacks a link function 236# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function 237# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz 238# localtime_rz can make zdump significantly faster, but is nonstandard. 239# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. 240# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare 241# functions like 'link' or variables like 'tzname' required by POSIX 242# -DHAVE_SETENV=0 if your system lacks the setenv function 243# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ 244# -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like 245# __builtin_add_overflow work* 246# -DHAVE_STDINT_H=0 if <stdint.h> does not work*+ 247# -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l 248# -DHAVE_STRDUP=0 if your system lacks the strdup function 249# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ 250# -DHAVE_SYMLINK=0 if your system lacks the symlink function 251# -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work* 252# -DHAVE_TZSET=0 if your system lacks a tzset function 253# -DHAVE_UNISTD_H=0 if <unistd.h> does not work* 254# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work* 255# -Dlocale_t=XXX if your system uses XXX instead of locale_t 256# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ 257# Typically it is better to use a later standard. For example, 258# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. 259# Even with -DPORT_TO_C89, the code needs at least one C99 260# feature (integers at least 64 bits wide) and maybe more. 261# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers 262# with external linkage, e.g., applications cannot define 'localtime'. 263# -Dssize_t=long on hosts like MS-Windows that lack ssize_t 264# -DSUPPORT_C89 if the tzcode library should support C89 callers+ 265# However, this might trigger latent bugs in C99-or-later callers. 266# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has 267# security implications and is not recommended for general use 268# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; 269# not needed by the main-program tz code, which is single-threaded. 270# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. 271# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t 272# This is intended for internal use only; it mangles external names. 273# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 274# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 275# the default is system-supplied, typically "/usr/lib/locale" 276# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 277# DST transitions for POSIX.1-2017-style TZ strings lacking them, 278# in the usual case where POSIXRULES is '-'. If not specified, 279# TZDEFRULESTRING defaults to US rules for future DST transitions. 280# This mishandles some past timestamps, as US DST rules have changed. 281# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, 282# as Europe and US DST rules differ. 283# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) 284# -DUNINIT_TRAP if reading uninitialized storage can cause problems 285# other than simply getting garbage data 286# -DUSE_LTZ=0 to build zdump with the system time zone library 287# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. 288# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and 289# similarly for "slim". Fat TZif files work around incompatibilities 290# and bugs in some TZif readers, notably older ones that 291# ignore or otherwise mishandle 64-bit data in TZif files; 292# however, fat TZif files may trigger bugs in newer TZif readers. 293# Slim TZif files are more efficient, and are the default. 294# -DZIC_MAX_ABBR_LEN_WO_WARN=3 295# (or some other number) to set the maximum time zone abbreviation length 296# that zic will accept without a warning (the default is 6) 297# -g to generate symbolic debugging info 298# -Idir to include from directory 'dir' 299# -O0 to disable optimization; other -O options to enable more optimization 300# -Uname to remove any definition of the macro 'name' 301# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking 302# 303# * Options marked "*" can be omitted if your compiler is C23 compatible. 304# * Options marked "+" are obsolescent and are planned to be removed 305# once the code assumes C99 or later, say in the year 2029. 306# 307# Select instrumentation via "make GCC_INSTRUMENT='whatever'". 308GCC_INSTRUMENT = \ 309 -fsanitize=undefined -fsanitize-address-use-after-scope \ 310 -fsanitize-undefined-trap-on-error -fstack-protector 311# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. 312GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ 313 $(GCC_INSTRUMENT) \ 314 -Wall -Wextra \ 315 -Walloc-size-larger-than=100000 -Warray-bounds=2 \ 316 -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \ 317 -Wdeclaration-after-statement -Wdouble-promotion \ 318 -Wduplicated-branches -Wduplicated-cond \ 319 -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ 320 -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ 321 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 322 -Wnull-dereference \ 323 -Wold-style-definition -Woverlength-strings -Wpointer-arith \ 324 -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ 325 -Wstrict-prototypes -Wstringop-overflow=4 \ 326 -Wstringop-truncation -Wsuggest-attribute=cold \ 327 -Wsuggest-attribute=const -Wsuggest-attribute=format \ 328 -Wsuggest-attribute=malloc \ 329 -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ 330 -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \ 331 -Wvariadic-macros -Wvla -Wwrite-strings \ 332 -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ 333 -Wno-type-limits 334# 335# If your system has a "GMT offset" field in its "struct tm"s 336# (or if you decide to add such a field in your system's "time.h" file), 337# add the name to a define such as 338# -DTM_GMTOFF=tm_gmtoff 339# to the end of the "CFLAGS=" line. If not defined, the code attempts to 340# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. 341# Similarly, if your system has a "zone abbreviation" field, define 342# -DTM_ZONE=tm_zone 343# and define NO_TM_ZONE to suppress any guessing. 344# Although these two fields are not required by POSIX.1-2017, 345# POSIX 202x/D4 requires them and they are widely available 346# on GNU/Linux and BSD systems. 347# 348# The next batch of options control support for external variables 349# exported by tzcode. In practice these variables are less useful 350# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 351# # 352# # To omit or support the external variable "tzname", add one of: 353# # -DHAVE_TZNAME=0 # do not support "tzname" 354# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 355# # -DHAVE_TZNAME=2 # support and define "tzname" 356# # to the "CFLAGS=" line. "tzname" is required by POSIX.1-1988 and later. 357# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 358# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 359# # crashes when combined with some platforms' standard libraries, 360# # presumably due to memory allocation issues. 361# # 362# # To omit or support the external variables "timezone" and "daylight", add 363# # -DUSG_COMPAT=0 # do not support 364# # -DUSG_COMPAT=1 # support, and variables are defined by system library 365# # -DUSG_COMPAT=2 # support and define variables 366# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix 367# # Systems Group code and are required by POSIX.1-2008 and later (with XSI). 368# # If not defined, the code attempts to guess USG_COMPAT from other macros. 369# # 370# # To support the external variable "altzone", add 371# # -DALTZONE=0 # do not support 372# # -DALTZONE=1 # support "altzone", which is defined by system library 373# # -DALTZONE=2 # support and define "altzone" 374# # to the end of the "CFLAGS=" line; although "altzone" appeared in 375# # System V Release 3.1 it has not been standardized. 376# # If not defined, the code attempts to guess ALTZONE from other macros. 377# 378# If you want functions that were inspired by early versions of X3J11's work, 379# add 380# -DSTD_INSPIRED 381# to the end of the "CFLAGS=" line. This arranges for the following 382# functions to be added to the time conversion library. 383# "offtime" is like "gmtime" except that it accepts a second (long) argument 384# that gives an offset to add to the time_t when converting it. 385# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 386# "timelocal" is nearly equivalent to "mktime". 387# "timeoff" is like "timegm" except that it accepts a second (long) argument 388# that gives an offset to use when converting to a time_t. 389# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 390# "posix2time" and "time2posix" are described in an included manual page. 391# X3J11's work does not describe any of these functions. 392# These functions may well disappear in future releases of the time 393# conversion package. 394# 395# If you don't want functions that were inspired by NetBSD, add 396# -DNETBSD_INSPIRED=0 397# to the end of the "CFLAGS=" line. Otherwise, the functions 398# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 399# time library, and if STD_INSPIRED is also defined to nonzero the functions 400# "posix2time_z" and "time2posix_z" are added as well. 401# The functions ending in "_z" (or "_rz") are like their unsuffixed 402# (or suffixed-by-"_r") counterparts, except with an extra first 403# argument of opaque type timezone_t that specifies the timezone. 404# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 405# 406# If you want to allocate state structures in localtime, add 407# -DALL_STATE 408# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 409# 410# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 411# out by the National Institute of Standards and Technology 412# which claims to test C and POSIX conformance. If you want to pass PCTS, add 413# -DPCTS 414# to the end of the "CFLAGS=" line. 415# 416# If you want strict compliance with XPG4 as of 1994-04-09, add 417# -DXPG4_1994_04_09 418# to the end of the "CFLAGS=" line. This causes "strftime" to always return 419# 53 as a week number (rather than 52 or 53) for January days before 420# January's first Monday when a "%V" format is used and January 1 421# falls on a Friday, Saturday, or Sunday. 422# 423# POSIX says CFLAGS defaults to "-O 1". 424# Uncomment the following line and edit its contents as needed. 425 426#CFLAGS= -O 1 427 428 429# The name of a POSIX-like library archiver, its flags, C compiler, 430# linker flags, and 'make' utility. Ordinarily the defaults suffice. 431# The commented-out values are the defaults specified by POSIX.1-202x/D4. 432#AR = ar 433#ARFLAGS = -rv 434#CC = c17 435#LDFLAGS = 436#MAKE = make 437 438# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in 439# submake command lines. The default is no leap seconds. 440 441LEAPSECONDS= 442 443# Where to fetch leap-seconds.list from. 444leaplist_URI = \ 445 https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list 446# The file is generated by the IERS Earth Orientation Centre, in Paris. 447leaplist_TZ = Europe/Paris 448 449# The zic command and its arguments. 450 451zic= ./zic 452ZIC= $(zic) $(ZFLAGS) 453 454# To shrink the size of installed TZif files, 455# append "-r @N" to omit data before N-seconds-after-the-Epoch. 456# To grow the files and work around bugs in older applications, 457# possibly at the expense of introducing bugs in newer ones, 458# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 459# See the zic man page for more about -b and -r. 460ZFLAGS= 461 462# How to use zic to install TZif files. 463 464ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) 465 466# The name of a POSIX-compliant 'awk' on your system. 467# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 468# Also, it is better (though not essential) if 'awk' supports UTF-8, 469# and unfortunately mawk and busybox awk do not support UTF-8. 470# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 471AWK= awk 472 473# The full path name of a POSIX-compliant shell, preferably one that supports 474# the Korn shell's 'select' statement as an extension. 475# These days, Bash is the most popular. 476# It should be OK to set this to /bin/sh, on platforms where /bin/sh 477# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 478# is typically nicer if it works. 479KSHELL= /bin/bash 480 481# Name of curl <https://curl.haxx.se/>, used for HTML validation 482# and to fetch leap-seconds.list from upstream. 483CURL= curl 484 485# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 486GPG= gpg 487 488# This expensive test requires USE_LTZ. 489# To suppress it, define this macro to be empty. 490CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 491 492# SAFE_CHAR is a regular expression that matches a safe character. 493# Some parts of this distribution are limited to safe characters; 494# others can use any UTF-8 character. 495# For now, the safe characters are a safe subset of ASCII. 496# The caller must set the shell variable 'sharp' to the character '#', 497# since Makefile macros cannot contain '#'. 498# TAB_CHAR is a single tab character, in single quotes. 499TAB_CHAR= ' ' 500SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 501SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 502SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 503SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 504SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 505 506# These non-alphabetic, non-ASCII printable characters are Latin-1, 507# and so are likely displayable even in editors like XEmacs 21 508# that have limited display capabilities. 509UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 510# Non-ASCII non-letters that OK_CHAR allows, as these characters are 511# useful in commentary. 512UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 513 514# Put this in a bracket expression to match spaces. 515s = [:space:] 516 517# OK_CHAR matches any character allowed in the distributed files. 518# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 519# multibyte letters are also allowed so that commentary can contain a 520# few safe symbols and people's names and can quote non-English sources. 521# Other non-letters are limited to ASCII renderings for the 522# convenience of maintainers using XEmacs 21.5.34, which by default 523# mishandles Unicode characters U+0100 and greater. 524OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 525 526# SAFE_LINE matches a line of safe characters. 527# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 528# this is so that comments can contain non-ASCII characters. 529# OK_LINE matches a line of OK characters. 530SAFE_LINE= '^'$(SAFE_CHAR)'*$$' 531SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 532OK_LINE= '^'$(OK_CHAR)'*$$' 533 534# Flags to give 'tar' when making a distribution. 535# Try to use flags appropriate for GNU tar. 536GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \ 537 --numeric-owner --owner=0 --group=0 \ 538 --mode=go+u,go-w --sort=name 539TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ 540 then echo $(GNUTARFLAGS); \ 541 else :; \ 542 fi` 543 544# Flags to give 'gzip' when making a distribution. 545GZIPFLAGS= -9n 546 547# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 548# This makes it easier to see which Zone has been affected. 549DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ 550 || echo ' -F^TZ=') 551 552# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 553RANLIB= : 554 555# POSIX prohibits defining or using SHELL. However, csh users on systems 556# that use the user shell for Makefile commands may need to define SHELL. 557#SHELL= /bin/sh 558 559# End of macros that one plausibly might want to tailor. 560############################################################################### 561 562 563TZCOBJS= zic.o 564TZDOBJS= zdump.o localtime.o asctime.o strftime.o 565DATEOBJS= date.o localtime.o strftime.o asctime.o 566LIBSRCS= localtime.c asctime.c difftime.c strftime.c 567LIBOBJS= localtime.o asctime.o difftime.o strftime.o 568HEADERS= tzfile.h private.h 569NONLIBSRCS= zic.c zdump.c 570NEWUCBSRCS= date.c 571SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 572 tzselect.ksh workman.sh 573MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 574 tzfile.5 tzselect.8 zic.8 zdump.8 575MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 576 time2posix.3.txt \ 577 tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 578 date.1.txt 579COMMON= calendars CONTRIBUTING LICENSE Makefile \ 580 NEWS README SECURITY theory.html version 581WEB_PAGES= tz-art.html tz-how-to.html tz-link.html 582CHECK_WEB_PAGES=check_theory.html check_tz-art.html \ 583 check_tz-how-to.html check_tz-link.html 584DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 585PRIMARY_YDATA= africa antarctica asia australasia \ 586 europe northamerica southamerica 587YDATA= $(PRIMARY_YDATA) etcetera 588NDATA= factory 589TDATA_TO_CHECK= $(YDATA) $(NDATA) backward 590TDATA= $(YDATA) $(NDATA) $(BACKWARD) 591ZONETABLES= zone.tab zone1970.tab zonenow.tab 592TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 593LEAP_DEPS= leapseconds.awk leap-seconds.list 594TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 595 $(PACKRATDATA) $(PACKRATLIST) 596DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 597DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 598 leapseconds $(ZONETABLES) 599AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 600 ziguard.awk zishrink.awk 601MISC= $(AWK_SCRIPTS) 602TZS_YEAR= 2050 603TZS_CUTOFF_FLAG= -c $(TZS_YEAR) 604TZS= to$(TZS_YEAR).tzs 605TZS_NEW= to$(TZS_YEAR)new.tzs 606TZS_DEPS= $(YDATA) asctime.c localtime.c \ 607 private.h tzfile.h zdump.c zic.c 608TZDATA_DIST = $(COMMON) $(DATA) $(MISC) 609# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 610EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 611ENCHILADA = $(EIGHT_YARDS) $(TZS) 612 613# Consult these files when deciding whether to rebuild the 'version' file. 614# This list is not the same as the output of 'git ls-files', since 615# .gitignore is not distributed. 616VERSION_DEPS= \ 617 calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 618 africa antarctica asctime.c asia australasia \ 619 backward backzone \ 620 checklinks.awk checknow.awk checktab.awk \ 621 date.1 date.c difftime.c \ 622 etcetera europe factory iso3166.tab \ 623 leap-seconds.list leapseconds.awk localtime.c \ 624 newctime.3 newstrftime.3 newtzset.3 northamerica \ 625 private.h southamerica strftime.c theory.html \ 626 time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 627 tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 628 workman.sh zdump.8 zdump.c zic.8 zic.c \ 629 ziguard.awk zishrink.awk \ 630 zone.tab zone1970.tab zonenow.tab 631 632all: tzselect zic zdump libtz.a $(TABDATA) \ 633 vanguard.zi main.zi rearguard.zi 634 635ALL: all date $(ENCHILADA) 636 637install: all $(DATA) $(REDO) $(MANS) 638 mkdir -p '$(DESTDIR)$(BINDIR)' \ 639 '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 640 '$(DESTDIR)$(LIBDIR)' \ 641 '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 642 '$(DESTDIR)$(MANDIR)/man8' 643 $(ZIC_INSTALL) -l $(LOCALTIME) \ 644 `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ 645 ` $(POSIXRULES) \ 646 -t '$(DESTDIR)$(TZDEFAULT)' 647 cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 648 cp tzselect '$(DESTDIR)$(BINDIR)/.' 649 cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 650 cp zic '$(DESTDIR)$(ZICDIR)/.' 651 cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 652 $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 653 cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 654 cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 655 cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 656 657INSTALL: ALL install date.1 658 mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 659 cp date '$(DESTDIR)$(BINDIR)/.' 660 cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 661 662# Calculate version number from git, if available. 663# Otherwise, use $(VERSION) unless it is "unknown" and there is already 664# a 'version' file, in which case reuse the existing 'version' contents 665# and append "-dirty" if the contents do not already end in "-dirty". 666version: $(VERSION_DEPS) 667 { (type git) >/dev/null 2>&1 && \ 668 V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 669 --abbrev=7 --dirty` || \ 670 if test '$(VERSION)' = unknown && V=`cat $@`; then \ 671 case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ 672 else \ 673 V='$(VERSION)'; \ 674 fi; } && \ 675 printf '%s\n' "$$V" >$@.out 676 mv $@.out $@ 677 678# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 679vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 680 $(AWK) \ 681 -v DATAFORM=`expr $@ : '\(.*\).zi'` \ 682 -v PACKRATDATA='$(PACKRATDATA)' \ 683 -v PACKRATLIST='$(PACKRATLIST)' \ 684 -f ziguard.awk \ 685 $(TDATA) $(PACKRATDATA) >$@.out 686 mv $@.out $@ 687# This file has a version comment that attempts to capture any tailoring 688# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 689tzdata.zi: $(DATAFORM).zi version zishrink.awk 690 version=`sed 1q version` && \ 691 LC_ALL=C $(AWK) \ 692 -v dataform='$(DATAFORM)' \ 693 -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 694 -v redo='$(REDO)' \ 695 -v version="$$version" \ 696 -f zishrink.awk \ 697 $(DATAFORM).zi >$@.out 698 mv $@.out $@ 699 700tzdir.h: 701 printf '%s\n' >$@.out \ 702 '#ifndef TZDEFAULT' \ 703 '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 704 '#endif' \ 705 '#ifndef TZDIR' \ 706 '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 707 '#endif' 708 mv $@.out $@ 709 710version.h: version 711 VERSION=`cat version` && printf '%s\n' \ 712 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 713 "static char const TZVERSION[]=\"$$VERSION\";" \ 714 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 715 >$@.out 716 mv $@.out $@ 717 718zdump: $(TZDOBJS) 719 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 720 721zic: $(TZCOBJS) 722 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 723 724leapseconds: $(LEAP_DEPS) 725 $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 726 -f leapseconds.awk leap-seconds.list >$@.out 727 mv $@.out $@ 728 729# Awk script to extract a Git-style author from leap-seconds.list comments. 730EXTRACT_AUTHOR = \ 731 author_line { sub(/^.[[:space:]]*/, ""); \ 732 sub(/:[[:space:]]*/, " <"); \ 733 printf "%s>\n", $$0; \ 734 success = 1; \ 735 exit \ 736 } \ 737 /Questions or comments to:/ { author_line = 1 } \ 738 END { exit !success } 739 740# Fetch leap-seconds.list from upstream. 741fetch-leap-seconds.list: 742 $(CURL) -OR $(leaplist_URI) 743 744# Fetch leap-seconds.list from upstream and commit it to the local repository. 745commit-leap-seconds.list: fetch-leap-seconds.list 746 author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ 747 date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ 748 git commit --author="$$author" --date="$$date" -m'make $@' \ 749 leap-seconds.list 750 751# Arguments to pass to submakes of install_data. 752# They can be overridden by later submake arguments. 753INSTALLARGS = \ 754 BACKWARD='$(BACKWARD)' \ 755 DESTDIR='$(DESTDIR)' \ 756 LEAPSECONDS='$(LEAPSECONDS)' \ 757 PACKRATDATA='$(PACKRATDATA)' \ 758 PACKRATLIST='$(PACKRATLIST)' \ 759 TZDEFAULT='$(TZDEFAULT)' \ 760 TZDIR='$(TZDIR)' \ 761 ZIC='$(ZIC)' 762 763INSTALL_DATA_DEPS = zic leapseconds tzdata.zi 764 765# 'make install_data' installs one set of TZif files. 766install_data: $(INSTALL_DATA_DEPS) 767 $(ZIC_INSTALL) tzdata.zi 768 769posix_only: $(INSTALL_DATA_DEPS) 770 $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data 771 772right_only: $(INSTALL_DATA_DEPS) 773 $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ 774 install_data 775 776# In earlier versions of this makefile, the other two directories were 777# subdirectories of $(TZDIR). However, this led to configuration errors. 778# For example, with posix_right under the earlier scheme, 779# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 780# but gmtime without leap seconds, which led to problems with applications 781# like sendmail that subtract gmtime from localtime. 782# Therefore, the other two directories are now siblings of $(TZDIR). 783# You must replace all of $(TZDIR) to switch from not using leap seconds 784# to using them, or vice versa. 785right_posix: right_only 786 rm -fr '$(DESTDIR)$(TZDIR)-leaps' 787 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 788 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 789 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 790 791posix_right: posix_only 792 rm -fr '$(DESTDIR)$(TZDIR)-posix' 793 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 794 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 795 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 796 797zones: $(REDO) 798 799# dummy.zd is not a real file; it is mentioned here only so that the 800# top-level 'make' does not have a syntax error. 801ZDS = dummy.zd 802# Rule used only by submakes invoked by the $(TZS_NEW) rule. 803# It is separate so that GNU 'make -j' can run instances in parallel. 804$(ZDS): zdump 805 ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ 806 >$@ 807 808TZS_NEW_DEPS = tzdata.zi zdump zic 809$(TZS_NEW): $(TZS_NEW_DEPS) 810 rm -fr tzs$(TZS_YEAR).dir 811 mkdir tzs$(TZS_YEAR).dir 812 $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 813 $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 814 tzdata.zi | LC_ALL=C sort >$@.out 815 wd=`pwd` && \ 816 x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 817 tzdata.zi \ 818 | LC_ALL=C sort -t . -k 2,2` && \ 819 set x $$x && \ 820 shift && \ 821 ZDS=$$* && \ 822 $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 823 ZDS="$$ZDS" $$ZDS && \ 824 sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 825 rm -fr tzs$(TZS_YEAR).dir 826 mv $@.out $@ 827 828# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the 829# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 830$(TZS): 831 touch $@ 832 833force_tzs: $(TZS_NEW) 834 cp $(TZS_NEW) $(TZS) 835 836libtz.a: $(LIBOBJS) 837 rm -f $@ 838 $(AR) $(ARFLAGS) $@ $(LIBOBJS) 839 $(RANLIB) $@ 840 841date: $(DATEOBJS) 842 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 843 844tzselect: tzselect.ksh version 845 VERSION=`cat version` && sed \ 846 -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 847 -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 848 -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 849 -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 850 -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 851 -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 852 <$@.ksh >$@.out 853 chmod +x $@.out 854 mv $@.out $@ 855 856check: check_back check_mild 857check_mild: check_character_set check_white_space check_links \ 858 check_name_lengths check_now \ 859 check_slashed_abbrs check_sorted \ 860 check_tables check_web check_ziguard check_zishrink check_tzs 861 862# True if UTF8_LOCALE does not work; 863# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 864UTF8_LOCALE_MISSING = \ 865 { test ! '$(UTF8_LOCALE)' \ 866 || ! printf 'A\304\200B\n' \ 867 | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 868 || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } 869 870check_character_set: $(ENCHILADA) 871 $(UTF8_LOCALE_MISSING) || { \ 872 sharp='#' && \ 873 ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 874 $(MISC) $(SOURCES) $(WEB_PAGES) \ 875 CONTRIBUTING LICENSE README SECURITY \ 876 version tzdata.zi && \ 877 ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 878 Makefile && \ 879 ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 880 leapseconds zone.tab && \ 881 ! grep -Env $(OK_LINE) $(ENCHILADA); \ 882 } 883 touch $@ 884 885check_white_space: $(ENCHILADA) 886 $(UTF8_LOCALE_MISSING) || { \ 887 patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ 888 ! grep -En "$$pat|[$s]\$$" \ 889 $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ 890 } 891 touch $@ 892 893PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 894FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 895 896check_name_lengths: $(TDATA_TO_CHECK) backzone 897 ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 898 $(TDATA_TO_CHECK) backzone 899 touch $@ 900 901PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 902STDOFF = [-+]?[0-9:.]+ 903RULELESS_SAVE = (-|$(STDOFF)[sd]?) 904RULELESS_SLASHED_ABBRS = \ 905 $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 906 907check_slashed_abbrs: $(TDATA_TO_CHECK) 908 ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 909 touch $@ 910 911CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 912 913check_sorted: backward backzone 914 $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 915 backward | LC_ALL=C sort -cu 916 $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu 917 touch $@ 918 919check_back: checklinks.awk $(TDATA_TO_CHECK) 920 $(AWK) \ 921 -v DATAFORM=$(DATAFORM) \ 922 -v backcheck=backward \ 923 -f checklinks.awk $(TDATA_TO_CHECK) 924 touch $@ 925 926check_links: checklinks.awk tzdata.zi 927 $(AWK) \ 928 -v DATAFORM=$(DATAFORM) \ 929 -f checklinks.awk tzdata.zi 930 touch $@ 931 932# Check timestamps from now through 28 years from now, to make sure 933# that zonenow.tab contains all sequences of planned timestamps, 934# without any duplicate sequences. In theory this might require 935# 2800 years but that would take a long time to check. 936CHECK_NOW_TIMESTAMP = `./date +%s` 937CHECK_NOW_FUTURE_YEARS = 28 938CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 939check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 940 rm -fr $@.dir 941 mkdir $@.dir 942 ./zic -d $@.dir tzdata.zi 943 now=$(CHECK_NOW_TIMESTAMP) && \ 944 future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ 945 ./zdump -i -t $$now,$$future \ 946 $$(find $$PWD/$@.dir/????*/ -type f) \ 947 >$@.dir/zdump.tab 948 $(AWK) \ 949 -v zdump_table=$@.dir/zdump.tab \ 950 -f checknow.awk zonenow.tab 951 rm -fr $@.dir 952 touch $@ 953 954check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab 955 for tab in $(ZONETABLES); do \ 956 test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 957 $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 958 || exit; \ 959 done 960 touch $@ 961 962check_tzs: $(TZS) $(TZS_NEW) 963 if test -s $(TZS); then \ 964 $(DIFF_TZS) $(TZS) $(TZS_NEW); \ 965 else \ 966 cp $(TZS_NEW) $(TZS); \ 967 fi 968 touch $@ 969 970check_web: $(CHECK_WEB_PAGES) 971check_theory.html: theory.html 972check_tz-art.html: tz-art.html 973check_tz-how-to.html: tz-how-to.html 974check_tz-link.html: tz-link.html 975check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: 976 $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 977 -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ 978 test ! -s $@.out || { cat $@.out; exit 1; } 979 mv $@.out $@ 980 981check_ziguard: rearguard.zi vanguard.zi ziguard.awk 982 $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 983 diff -u rearguard.zi - 984 $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 985 diff -u vanguard.zi - 986 touch $@ 987 988# Check that zishrink.awk does not alter the data, and that ziguard.awk 989# preserves main-format data. 990check_zishrink: check_zishrink_posix check_zishrink_right 991check_zishrink_posix check_zishrink_right: \ 992 zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 993 $(TDATA) $(DATAFORM).zi tzdata.zi 994 rm -fr $@.dir $@-t.dir $@-shrunk.dir 995 mkdir $@.dir $@-t.dir $@-shrunk.dir 996 case $@ in \ 997 *_right) leap='-L leapseconds';; \ 998 *) leap=;; \ 999 esac && \ 1000 $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ 1001 $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ 1002 case $(DATAFORM),$(PACKRATLIST) in \ 1003 main,) \ 1004 $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ 1005 $(AWK) '/^Rule/' $(TDATA) | \ 1006 $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ 1007 diff -r $@.dir $@-t.dir;; \ 1008 esac 1009 diff -r $@.dir $@-shrunk.dir 1010 rm -fr $@.dir $@-t.dir $@-shrunk.dir 1011 touch $@ 1012 1013clean_misc: 1014 rm -fr check_*.dir typecheck_*.dir 1015 rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ 1016 check_* core typecheck_* \ 1017 date tzdir.h tzselect version.h zdump zic libtz.a 1018clean: clean_misc 1019 rm -fr *.dir tzdb-*/ 1020 rm -f *.zi $(TZS_NEW) 1021 1022maintainer-clean: clean 1023 @echo 'This command is intended for maintainers to use; it' 1024 @echo 'deletes files that may need special tools to rebuild.' 1025 rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 1026 1027names: 1028 @echo $(ENCHILADA) 1029 1030public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ 1031 tarballs signatures 1032 1033date.1.txt: date.1 1034newctime.3.txt: newctime.3 1035newstrftime.3.txt: newstrftime.3 1036newtzset.3.txt: newtzset.3 1037time2posix.3.txt: time2posix.3 1038tzfile.5.txt: tzfile.5 1039tzselect.8.txt: tzselect.8 1040zdump.8.txt: zdump.8 1041zic.8.txt: zic.8 1042 1043$(MANTXTS): workman.sh 1044 LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out 1045 mv $@.out $@ 1046 1047# Set file timestamps deterministically if possible, 1048# so that tarballs containing the timestamps are reproducible. 1049# 1050# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 1051# file DEST to the maximum of the timestamps of the files A B C ..., 1052# plus N if GNU ls and touch are available. 1053SET_TIMESTAMP_N = sh -c '\ 1054 n=$$0 dest=$$1; shift; \ 1055 <"$$dest" && \ 1056 if test $$n != 0 && \ 1057 lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ 1058 set x $$lsout && \ 1059 timestamp=`expr $$7 + $$n` && \ 1060 echo "+ touch -md @$$timestamp $$dest" && \ 1061 touch -md @$$timestamp "$$dest"; \ 1062 else \ 1063 newest=`ls -t "$$@" | sed 1q` && \ 1064 echo "+ touch -mr $$newest $$dest" && \ 1065 touch -mr "$$newest" "$$dest"; \ 1066 fi' 1067# If DEST depends on A B C ... in this Makefile, callers should use 1068# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 1069# downstream 'make' that considers equal timestamps to be out of date. 1070# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 1071# If all that matters is that the timestamp be reproducible 1072# and plausible, use $(SET_TIMESTAMP). 1073SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 1074SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 1075 1076# Set the timestamps to those of the git repository, if available, 1077# and if the files have not changed since then. 1078# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 1079# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 1080# If git or GNU is absent, don't bother to sync with git timestamps. 1081# Also, set the timestamp of each prebuilt file like 'leapseconds' 1082# to be the maximum of the files it depends on. 1083set-timestamps.out: $(EIGHT_YARDS) 1084 rm -f $@ 1085 if (type git) >/dev/null 2>&1 && \ 1086 files=`git ls-files $(EIGHT_YARDS)` && \ 1087 touch -md @1 test.out; then \ 1088 rm -f test.out && \ 1089 for file in $$files; do \ 1090 if git diff --quiet $$file; then \ 1091 time=`TZ=UTC0 git log -1 \ 1092 --format='tformat:%cd' \ 1093 --date='format:%Y-%m-%dT%H:%M:%SZ' \ 1094 $$file` && \ 1095 echo "+ touch -md $$time $$file" && \ 1096 touch -md $$time $$file; \ 1097 else \ 1098 echo >&2 "$$file: warning: does not match repository"; \ 1099 fi || exit; \ 1100 done; \ 1101 fi 1102 $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 1103 for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ 1104 $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ 1105 exit; \ 1106 done 1107 $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 1108 $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 1109 touch $@ 1110set-tzs-timestamp.out: $(TZS) 1111 $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 1112 touch $@ 1113 1114# The zics below ensure that each data file can stand on its own. 1115# We also do an all-files run to catch links to links. 1116 1117check_public: $(VERSION_DEPS) 1118 rm -fr public.dir 1119 mkdir public.dir 1120 ln $(VERSION_DEPS) public.dir 1121 cd public.dir \ 1122 && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 1123 for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ 1124 public.dir/vanguard.zi public.dir/main.zi \ 1125 public.dir/rearguard.zi; \ 1126 do \ 1127 public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \ 1128 done 1129 public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK) 1130 : 1131 : Also check 'backzone' syntax. 1132 rm public.dir/main.zi 1133 cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi 1134 public.dir/zic -d public.dir/zoneinfo main.zi 1135 rm public.dir/main.zi 1136 cd public.dir && \ 1137 $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 1138 public.dir/zic -d public.dir/zoneinfo main.zi 1139 : 1140 rm -fr public.dir 1141 touch $@ 1142 1143# Check that the code works under various alternative 1144# implementations of time_t. 1145check_time_t_alternatives: $(TIME_T_ALTERNATIVES) 1146$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 1147$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 1148 rm -fr $@.dir 1149 mkdir $@.dir 1150 ln $(VERSION_DEPS) $@.dir 1151 case $@ in \ 1152 int*32_t) range=-2147483648,2147483648;; \ 1153 u*) range=0,4294967296;; \ 1154 *) range=-4294967296,4294967296;; \ 1155 esac && \ 1156 wd=`pwd` && \ 1157 zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \ 1158 if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 1159 range_target=; \ 1160 else \ 1161 range_target=to$$range.tzs; \ 1162 fi && \ 1163 (cd $@.dir && \ 1164 $(MAKE) TOPDIR="$$wd/$@.dir" \ 1165 CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \ 1166 REDO='$(REDO)' \ 1167 D=$$wd/$@.dir \ 1168 TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 1169 install $$range_target) && \ 1170 test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 1171 (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \ 1172 $(MAKE) TOPDIR="$$wd/$@.dir" \ 1173 TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 1174 D=$$wd/$@.dir \ 1175 to$$range.tzs) && \ 1176 $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \ 1177 $@.dir/to$$range.tzs && \ 1178 if diff -q Makefile Makefile 2>/dev/null; then \ 1179 quiet_option='-q'; \ 1180 else \ 1181 quiet_option=''; \ 1182 fi && \ 1183 diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \ 1184 $@.dir/etc && \ 1185 diff $$quiet_option -r \ 1186 $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \ 1187 $@.dir/usr/share; \ 1188 } 1189 touch $@ 1190 1191TRADITIONAL_ASC = \ 1192 tzcode$(VERSION).tar.gz.asc \ 1193 tzdata$(VERSION).tar.gz.asc 1194REARGUARD_ASC = \ 1195 tzdata$(VERSION)-rearguard.tar.gz.asc 1196ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 1197 tzdb-$(VERSION).tar.lz.asc 1198 1199tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 1200signatures rearguard_signatures traditional_signatures: \ 1201 version set-timestamps.out rearguard.zi vanguard.zi 1202 VERSION=`cat version` && \ 1203 $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 1204 1205# These *_version rules are intended for use if VERSION is set by some 1206# other means. Ordinarily these rules are used only by the above 1207# non-_version rules, which set VERSION on the 'make' command line. 1208tarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 1209 tzdb-$(VERSION).tar.lz 1210rearguard_tarballs_version: \ 1211 tzdata$(VERSION)-rearguard.tar.gz 1212traditional_tarballs_version: \ 1213 tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 1214tailored_tarballs_version: \ 1215 tzdata$(VERSION)-tailored.tar.gz 1216signatures_version: $(ALL_ASC) 1217rearguard_signatures_version: $(REARGUARD_ASC) 1218traditional_signatures_version: $(TRADITIONAL_ASC) 1219 1220tzcode$(VERSION).tar.gz: set-timestamps.out 1221 LC_ALL=C && export LC_ALL && \ 1222 tar $(TARFLAGS) -cf - \ 1223 $(COMMON) $(DOCS) $(SOURCES) | \ 1224 gzip $(GZIPFLAGS) >$@.out 1225 mv $@.out $@ 1226 1227tzdata$(VERSION).tar.gz: set-timestamps.out 1228 LC_ALL=C && export LC_ALL && \ 1229 tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \ 1230 gzip $(GZIPFLAGS) >$@.out 1231 mv $@.out $@ 1232 1233# Create empty files with a reproducible timestamp. 1234CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 1235 1236# The obsolescent *rearguard* targets and related macros are present 1237# for backwards compatibility with tz releases 2018e through 2022a. 1238# They should go away eventually. To build rearguard tarballs you 1239# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 1240tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 1241 rm -fr $@.dir 1242 mkdir $@.dir 1243 ln $(TZDATA_DIST) $@.dir 1244 cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 1245 for f in $(TDATA) $(PACKRATDATA); do \ 1246 rearf=$@.dir/$$f; \ 1247 $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 1248 $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 1249 done 1250 sed '1s/$$/-rearguard/' <version >$@.dir/version 1251 : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 1252 $(CREATE_EMPTY) $@.dir/pacificnew 1253 touch -mr version $@.dir/version 1254 LC_ALL=C && export LC_ALL && \ 1255 (cd $@.dir && \ 1256 tar $(TARFLAGS) -cf - \ 1257 $(TZDATA_DIST) pacificnew | \ 1258 gzip $(GZIPFLAGS)) >$@.out 1259 mv $@.out $@ 1260 1261# Create a tailored tarball suitable for TZUpdater and compatible tools. 1262# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 1263# useful for testing whether TZUpdater supports vanguard form. 1264# The generated tarball is not byte-for-byte equivalent to a hand-tailored 1265# traditional tarball, as data entries are put into 'etcetera' even if they 1266# came from some other source file. However, the effect should be the same 1267# for ordinary use, which reads all the source files. 1268tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 1269 rm -fr $@.dir 1270 mkdir $@.dir 1271 : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 1272 cd $@.dir && \ 1273 $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 1274 `test $(DATAFORM) = vanguard || echo pacificnew` 1275 (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 1276 >$@.dir/etcetera 1277 touch -mr tzdata.zi $@.dir/etcetera 1278 sed -n \ 1279 -e '/^# *version *\(.*\)/h' \ 1280 -e '/^# *ddeps */H' \ 1281 -e '$$!d' \ 1282 -e 'g' \ 1283 -e 's/^# *version *//' \ 1284 -e 's/\n# *ddeps */-/' \ 1285 -e 's/ /-/g' \ 1286 -e 'p' \ 1287 <tzdata.zi >$@.dir/version 1288 touch -mr version $@.dir/version 1289 links= && \ 1290 for file in $(TZDATA_DIST); do \ 1291 test -f $@.dir/$$file || links="$$links $$file"; \ 1292 done && \ 1293 ln $$links $@.dir 1294 LC_ALL=C && export LC_ALL && \ 1295 (cd $@.dir && \ 1296 tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out 1297 mv $@.out $@ 1298 1299tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 1300 rm -fr tzdb-$(VERSION) 1301 mkdir tzdb-$(VERSION) 1302 ln $(ENCHILADA) tzdb-$(VERSION) 1303 $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 1304 LC_ALL=C && export LC_ALL && \ 1305 tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out 1306 mv $@.out $@ 1307 1308tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 1309tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 1310tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 1311tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 1312$(ALL_ASC): 1313 $(GPG) --armor --detach-sign $? 1314 1315TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 1316typecheck: typecheck_long_long typecheck_unsigned 1317typecheck_long_long typecheck_unsigned: $(VERSION_DEPS) 1318 rm -fr $@.dir 1319 mkdir $@.dir 1320 ln $(VERSION_DEPS) $@.dir 1321 cd $@.dir && \ 1322 case $@ in \ 1323 *_long_long) i="long long";; \ 1324 *_unsigned ) i="unsigned" ;; \ 1325 esac && \ 1326 typecheck_cflags='' && \ 1327 $(MAKE) \ 1328 CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 1329 TOPDIR="`pwd`" \ 1330 install 1331 $@.dir/zdump -i -c 1970,1971 Europe/Rome 1332 touch $@ 1333 1334zonenames: tzdata.zi 1335 @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 1336 1337asctime.o: private.h tzfile.h 1338date.o: private.h 1339difftime.o: private.h 1340localtime.o: private.h tzfile.h tzdir.h 1341strftime.o: private.h tzfile.h 1342zdump.o: version.h 1343zic.o: private.h tzfile.h tzdir.h version.h 1344 1345.PHONY: ALL INSTALL all 1346.PHONY: check check_mild check_time_t_alternatives 1347.PHONY: check_web check_zishrink 1348.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd 1349.PHONY: fetch-leap-seconds.list force_tzs 1350.PHONY: install install_data maintainer-clean names 1351.PHONY: posix_only posix_right public 1352.PHONY: rearguard_signatures rearguard_signatures_version 1353.PHONY: rearguard_tarballs rearguard_tarballs_version 1354.PHONY: right_only right_posix signatures signatures_version 1355.PHONY: tarballs tarballs_version 1356.PHONY: traditional_signatures traditional_signatures_version 1357.PHONY: traditional_tarballs traditional_tarballs_version 1358.PHONY: tailored_tarballs tailored_tarballs_version 1359.PHONY: typecheck 1360.PHONY: zonenames zones 1361.PHONY: $(ZDS) 1362