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-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-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. Although these two fields 344# not required by POSIX, a future version of POSIX is planned to require them 345# and they are widely available on GNU/Linux and BSD systems. 346# 347# The next batch of options control support for external variables 348# exported by tzcode. In practice these variables are less useful 349# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 350# # 351# # To omit or support the external variable "tzname", add one of: 352# # -DHAVE_TZNAME=0 # do not support "tzname" 353# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 354# # -DHAVE_TZNAME=2 # support and define "tzname" 355# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. 356# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 357# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 358# # crashes when combined with some platforms' standard libraries, 359# # presumably due to memory allocation issues. 360# # 361# # To omit or support the external variables "timezone" and "daylight", add 362# # -DUSG_COMPAT=0 # do not support 363# # -DUSG_COMPAT=1 # support, and variables are defined by system library 364# # -DUSG_COMPAT=2 # support and define variables 365# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by 366# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. 367# # If not defined, the code attempts to guess USG_COMPAT from other macros. 368# # 369# # To support the external variable "altzone", add 370# # -DALTZONE=0 # do not support 371# # -DALTZONE=1 # support "altzone", which is defined by system library 372# # -DALTZONE=2 # support and define "altzone" 373# # to the end of the "CFLAGS=" line; although "altzone" appeared in 374# # System V Release 3.1 it has not been standardized. 375# # If not defined, the code attempts to guess ALTZONE from other macros. 376# 377# If you want functions that were inspired by early versions of X3J11's work, 378# add 379# -DSTD_INSPIRED 380# to the end of the "CFLAGS=" line. This arranges for the following 381# functions to be added to the time conversion library. 382# "offtime" is like "gmtime" except that it accepts a second (long) argument 383# that gives an offset to add to the time_t when converting it. 384# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 385# "timelocal" is nearly equivalent to "mktime". 386# "timeoff" is like "timegm" except that it accepts a second (long) argument 387# that gives an offset to use when converting to a time_t. 388# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 389# "posix2time" and "time2posix" are described in an included manual page. 390# X3J11's work does not describe any of these functions. 391# These functions may well disappear in future releases of the time 392# conversion package. 393# 394# If you don't want functions that were inspired by NetBSD, add 395# -DNETBSD_INSPIRED=0 396# to the end of the "CFLAGS=" line. Otherwise, the functions 397# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 398# time library, and if STD_INSPIRED is also defined to nonzero the functions 399# "posix2time_z" and "time2posix_z" are added as well. 400# The functions ending in "_z" (or "_rz") are like their unsuffixed 401# (or suffixed-by-"_r") counterparts, except with an extra first 402# argument of opaque type timezone_t that specifies the timezone. 403# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 404# 405# If you want to allocate state structures in localtime, add 406# -DALL_STATE 407# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 408# 409# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 410# out by the National Institute of Standards and Technology 411# which claims to test C and POSIX conformance. If you want to pass PCTS, add 412# -DPCTS 413# to the end of the "CFLAGS=" line. 414# 415# If you want strict compliance with XPG4 as of 1994-04-09, add 416# -DXPG4_1994_04_09 417# to the end of the "CFLAGS=" line. This causes "strftime" to always return 418# 53 as a week number (rather than 52 or 53) for January days before 419# January's first Monday when a "%V" format is used and January 1 420# falls on a Friday, Saturday, or Sunday. 421# 422# POSIX says CFLAGS defaults to "-O 1". 423# Uncomment the following line and edit its contents as needed. 424 425#CFLAGS= -O 1 426 427 428# The name of a POSIX-like library archiver, its flags, C compiler, 429# linker flags, and 'make' utility. Ordinarily the defaults suffice. 430# The commented-out values are the defaults specified by POSIX 202x/D3. 431#AR = ar 432#ARFLAGS = -rv 433#CC = c17 434#LDFLAGS = 435#MAKE = make 436 437# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in 438# submake command lines. The default is no leap seconds. 439 440LEAPSECONDS= 441 442# The zic command and its arguments. 443 444zic= ./zic 445ZIC= $(zic) $(ZFLAGS) 446 447# To shrink the size of installed TZif files, 448# append "-r @N" to omit data before N-seconds-after-the-Epoch. 449# To grow the files and work around bugs in older applications, 450# possibly at the expense of introducing bugs in newer ones, 451# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 452# See the zic man page for more about -b and -r. 453ZFLAGS= 454 455# How to use zic to install TZif files. 456 457ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) 458 459# The name of a POSIX-compliant 'awk' on your system. 460# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 461# Also, it is better (though not essential) if 'awk' supports UTF-8, 462# and unfortunately mawk and busybox awk do not support UTF-8. 463# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 464AWK= awk 465 466# The full path name of a POSIX-compliant shell, preferably one that supports 467# the Korn shell's 'select' statement as an extension. 468# These days, Bash is the most popular. 469# It should be OK to set this to /bin/sh, on platforms where /bin/sh 470# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 471# is typically nicer if it works. 472KSHELL= /bin/bash 473 474# Name of curl <https://curl.haxx.se/>, used for HTML validation. 475CURL= curl 476 477# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 478GPG= gpg 479 480# This expensive test requires USE_LTZ. 481# To suppress it, define this macro to be empty. 482CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 483 484# SAFE_CHAR is a regular expression that matches a safe character. 485# Some parts of this distribution are limited to safe characters; 486# others can use any UTF-8 character. 487# For now, the safe characters are a safe subset of ASCII. 488# The caller must set the shell variable 'sharp' to the character '#', 489# since Makefile macros cannot contain '#'. 490# TAB_CHAR is a single tab character, in single quotes. 491TAB_CHAR= ' ' 492SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 493SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 494SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 495SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 496SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 497 498# These non-alphabetic, non-ASCII printable characters are Latin-1, 499# and so are likely displayable even in editors like XEmacs 21 500# that have limited display capabilities. 501UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 502# Non-ASCII non-letters that OK_CHAR allows, as these characters are 503# useful in commentary. 504UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 505 506# Put this in a bracket expression to match spaces. 507s = [:space:] 508 509# OK_CHAR matches any character allowed in the distributed files. 510# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 511# multibyte letters are also allowed so that commentary can contain a 512# few safe symbols and people's names and can quote non-English sources. 513# Other non-letters are limited to ASCII renderings for the 514# convenience of maintainers using XEmacs 21.5.34, which by default 515# mishandles Unicode characters U+0100 and greater. 516OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 517 518# SAFE_LINE matches a line of safe characters. 519# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 520# this is so that comments can contain non-ASCII characters. 521# OK_LINE matches a line of OK characters. 522SAFE_LINE= '^'$(SAFE_CHAR)'*$$' 523SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 524OK_LINE= '^'$(OK_CHAR)'*$$' 525 526# Flags to give 'tar' when making a distribution. 527# Try to use flags appropriate for GNU tar. 528GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \ 529 --numeric-owner --owner=0 --group=0 \ 530 --mode=go+u,go-w --sort=name 531TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ 532 then echo $(GNUTARFLAGS); \ 533 else :; \ 534 fi` 535 536# Flags to give 'gzip' when making a distribution. 537GZIPFLAGS= -9n 538 539# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 540# This makes it easier to see which Zone has been affected. 541DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ 542 || echo ' -F^TZ=') 543 544# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 545RANLIB= : 546 547# POSIX prohibits defining or using SHELL. However, csh users on systems 548# that use the user shell for Makefile commands may need to define SHELL. 549#SHELL= /bin/sh 550 551# End of macros that one plausibly might want to tailor. 552############################################################################### 553 554 555TZCOBJS= zic.o 556TZDOBJS= zdump.o localtime.o asctime.o strftime.o 557DATEOBJS= date.o localtime.o strftime.o asctime.o 558LIBSRCS= localtime.c asctime.c difftime.c strftime.c 559LIBOBJS= localtime.o asctime.o difftime.o strftime.o 560HEADERS= tzfile.h private.h 561NONLIBSRCS= zic.c zdump.c 562NEWUCBSRCS= date.c 563SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 564 tzselect.ksh workman.sh 565MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 566 tzfile.5 tzselect.8 zic.8 zdump.8 567MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 568 time2posix.3.txt \ 569 tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 570 date.1.txt 571COMMON= calendars CONTRIBUTING LICENSE Makefile \ 572 NEWS README SECURITY theory.html version 573WEB_PAGES= tz-art.html tz-how-to.html tz-link.html 574CHECK_WEB_PAGES=check_theory.html check_tz-art.html \ 575 check_tz-how-to.html check_tz-link.html 576DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 577PRIMARY_YDATA= africa antarctica asia australasia \ 578 europe northamerica southamerica 579YDATA= $(PRIMARY_YDATA) etcetera 580NDATA= factory 581TDATA_TO_CHECK= $(YDATA) $(NDATA) backward 582TDATA= $(YDATA) $(NDATA) $(BACKWARD) 583ZONETABLES= zone.tab zone1970.tab zonenow.tab 584TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 585LEAP_DEPS= leapseconds.awk leap-seconds.list 586TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 587 $(PACKRATDATA) $(PACKRATLIST) 588DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 589DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 590 leapseconds $(ZONETABLES) 591AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 592 ziguard.awk zishrink.awk 593MISC= $(AWK_SCRIPTS) 594TZS_YEAR= 2050 595TZS_CUTOFF_FLAG= -c $(TZS_YEAR) 596TZS= to$(TZS_YEAR).tzs 597TZS_NEW= to$(TZS_YEAR)new.tzs 598TZS_DEPS= $(YDATA) asctime.c localtime.c \ 599 private.h tzfile.h zdump.c zic.c 600TZDATA_DIST = $(COMMON) $(DATA) $(MISC) 601# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 602EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 603ENCHILADA = $(EIGHT_YARDS) $(TZS) 604 605# Consult these files when deciding whether to rebuild the 'version' file. 606# This list is not the same as the output of 'git ls-files', since 607# .gitignore is not distributed. 608VERSION_DEPS= \ 609 calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 610 africa antarctica asctime.c asia australasia \ 611 backward backzone \ 612 checklinks.awk checknow.awk checktab.awk \ 613 date.1 date.c difftime.c \ 614 etcetera europe factory iso3166.tab \ 615 leap-seconds.list leapseconds.awk localtime.c \ 616 newctime.3 newstrftime.3 newtzset.3 northamerica \ 617 private.h southamerica strftime.c theory.html \ 618 time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 619 tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 620 workman.sh zdump.8 zdump.c zic.8 zic.c \ 621 ziguard.awk zishrink.awk \ 622 zone.tab zone1970.tab zonenow.tab 623 624all: tzselect zic zdump libtz.a $(TABDATA) \ 625 vanguard.zi main.zi rearguard.zi 626 627ALL: all date $(ENCHILADA) 628 629install: all $(DATA) $(REDO) $(MANS) 630 mkdir -p '$(DESTDIR)$(BINDIR)' \ 631 '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 632 '$(DESTDIR)$(LIBDIR)' \ 633 '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 634 '$(DESTDIR)$(MANDIR)/man8' 635 $(ZIC_INSTALL) -l $(LOCALTIME) \ 636 `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ 637 ` $(POSIXRULES) \ 638 -t '$(DESTDIR)$(TZDEFAULT)' 639 cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 640 cp tzselect '$(DESTDIR)$(BINDIR)/.' 641 cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 642 cp zic '$(DESTDIR)$(ZICDIR)/.' 643 cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 644 $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 645 cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 646 cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 647 cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 648 649INSTALL: ALL install date.1 650 mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 651 cp date '$(DESTDIR)$(BINDIR)/.' 652 cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 653 654# Calculate version number from git, if available. 655# Otherwise, use $(VERSION) unless it is "unknown" and there is already 656# a 'version' file, in which case reuse the existing 'version' contents 657# and append "-dirty" if the contents do not already end in "-dirty". 658version: $(VERSION_DEPS) 659 { (type git) >/dev/null 2>&1 && \ 660 V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 661 --abbrev=7 --dirty` || \ 662 if test '$(VERSION)' = unknown && V=`cat $@`; then \ 663 case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ 664 else \ 665 V='$(VERSION)'; \ 666 fi; } && \ 667 printf '%s\n' "$$V" >$@.out 668 mv $@.out $@ 669 670# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 671vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 672 $(AWK) \ 673 -v DATAFORM=`expr $@ : '\(.*\).zi'` \ 674 -v PACKRATDATA='$(PACKRATDATA)' \ 675 -v PACKRATLIST='$(PACKRATLIST)' \ 676 -f ziguard.awk \ 677 $(TDATA) $(PACKRATDATA) >$@.out 678 mv $@.out $@ 679# This file has a version comment that attempts to capture any tailoring 680# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 681tzdata.zi: $(DATAFORM).zi version zishrink.awk 682 version=`sed 1q version` && \ 683 LC_ALL=C $(AWK) \ 684 -v dataform='$(DATAFORM)' \ 685 -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 686 -v redo='$(REDO)' \ 687 -v version="$$version" \ 688 -f zishrink.awk \ 689 $(DATAFORM).zi >$@.out 690 mv $@.out $@ 691 692tzdir.h: 693 printf '%s\n' >$@.out \ 694 '#ifndef TZDEFAULT' \ 695 '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 696 '#endif' \ 697 '#ifndef TZDIR' \ 698 '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 699 '#endif' 700 mv $@.out $@ 701 702version.h: version 703 VERSION=`cat version` && printf '%s\n' \ 704 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 705 "static char const TZVERSION[]=\"$$VERSION\";" \ 706 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 707 >$@.out 708 mv $@.out $@ 709 710zdump: $(TZDOBJS) 711 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 712 713zic: $(TZCOBJS) 714 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 715 716leapseconds: $(LEAP_DEPS) 717 $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 718 -f leapseconds.awk leap-seconds.list >$@.out 719 mv $@.out $@ 720 721# Arguments to pass to submakes of install_data. 722# They can be overridden by later submake arguments. 723INSTALLARGS = \ 724 BACKWARD='$(BACKWARD)' \ 725 DESTDIR='$(DESTDIR)' \ 726 LEAPSECONDS='$(LEAPSECONDS)' \ 727 PACKRATDATA='$(PACKRATDATA)' \ 728 PACKRATLIST='$(PACKRATLIST)' \ 729 TZDEFAULT='$(TZDEFAULT)' \ 730 TZDIR='$(TZDIR)' \ 731 ZIC='$(ZIC)' 732 733INSTALL_DATA_DEPS = zic leapseconds tzdata.zi 734 735# 'make install_data' installs one set of TZif files. 736install_data: $(INSTALL_DATA_DEPS) 737 $(ZIC_INSTALL) tzdata.zi 738 739posix_only: $(INSTALL_DATA_DEPS) 740 $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data 741 742right_only: $(INSTALL_DATA_DEPS) 743 $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ 744 install_data 745 746# In earlier versions of this makefile, the other two directories were 747# subdirectories of $(TZDIR). However, this led to configuration errors. 748# For example, with posix_right under the earlier scheme, 749# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 750# but gmtime without leap seconds, which led to problems with applications 751# like sendmail that subtract gmtime from localtime. 752# Therefore, the other two directories are now siblings of $(TZDIR). 753# You must replace all of $(TZDIR) to switch from not using leap seconds 754# to using them, or vice versa. 755right_posix: right_only 756 rm -fr '$(DESTDIR)$(TZDIR)-leaps' 757 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 758 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 759 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 760 761posix_right: posix_only 762 rm -fr '$(DESTDIR)$(TZDIR)-posix' 763 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 764 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 765 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 766 767zones: $(REDO) 768 769# dummy.zd is not a real file; it is mentioned here only so that the 770# top-level 'make' does not have a syntax error. 771ZDS = dummy.zd 772# Rule used only by submakes invoked by the $(TZS_NEW) rule. 773# It is separate so that GNU 'make -j' can run instances in parallel. 774$(ZDS): zdump 775 ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ 776 >$@ 777 778TZS_NEW_DEPS = tzdata.zi zdump zic 779$(TZS_NEW): $(TZS_NEW_DEPS) 780 rm -fr tzs$(TZS_YEAR).dir 781 mkdir tzs$(TZS_YEAR).dir 782 $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 783 $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 784 tzdata.zi | LC_ALL=C sort >$@.out 785 wd=`pwd` && \ 786 x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 787 tzdata.zi \ 788 | LC_ALL=C sort -t . -k 2,2` && \ 789 set x $$x && \ 790 shift && \ 791 ZDS=$$* && \ 792 $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 793 ZDS="$$ZDS" $$ZDS && \ 794 sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 795 rm -fr tzs$(TZS_YEAR).dir 796 mv $@.out $@ 797 798# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the 799# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 800$(TZS): 801 touch $@ 802 803force_tzs: $(TZS_NEW) 804 cp $(TZS_NEW) $(TZS) 805 806libtz.a: $(LIBOBJS) 807 rm -f $@ 808 $(AR) $(ARFLAGS) $@ $(LIBOBJS) 809 $(RANLIB) $@ 810 811date: $(DATEOBJS) 812 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 813 814tzselect: tzselect.ksh version 815 VERSION=`cat version` && sed \ 816 -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 817 -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 818 -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 819 -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 820 -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 821 -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 822 <$@.ksh >$@.out 823 chmod +x $@.out 824 mv $@.out $@ 825 826check: check_back check_mild 827check_mild: check_character_set check_white_space check_links \ 828 check_name_lengths check_now \ 829 check_slashed_abbrs check_sorted \ 830 check_tables check_web check_ziguard check_zishrink check_tzs 831 832# True if UTF8_LOCALE does not work; 833# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 834UTF8_LOCALE_MISSING = \ 835 { test ! '$(UTF8_LOCALE)' \ 836 || ! printf 'A\304\200B\n' \ 837 | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 838 || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } 839 840check_character_set: $(ENCHILADA) 841 $(UTF8_LOCALE_MISSING) || { \ 842 sharp='#' && \ 843 ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 844 $(MISC) $(SOURCES) $(WEB_PAGES) \ 845 CONTRIBUTING LICENSE README SECURITY \ 846 version tzdata.zi && \ 847 ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 848 Makefile && \ 849 ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 850 leapseconds zone.tab && \ 851 ! grep -Env $(OK_LINE) $(ENCHILADA); \ 852 } 853 touch $@ 854 855check_white_space: $(ENCHILADA) 856 $(UTF8_LOCALE_MISSING) || { \ 857 patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ 858 ! grep -En "$$pat|[$s]\$$" \ 859 $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ 860 } 861 touch $@ 862 863PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 864FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 865 866check_name_lengths: $(TDATA_TO_CHECK) backzone 867 ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 868 $(TDATA_TO_CHECK) backzone 869 touch $@ 870 871PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 872STDOFF = [-+]?[0-9:.]+ 873RULELESS_SAVE = (-|$(STDOFF)[sd]?) 874RULELESS_SLASHED_ABBRS = \ 875 $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 876 877check_slashed_abbrs: $(TDATA_TO_CHECK) 878 ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 879 touch $@ 880 881CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 882 883check_sorted: backward backzone 884 $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 885 backward | LC_ALL=C sort -cu 886 $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu 887 touch $@ 888 889check_back: checklinks.awk $(TDATA_TO_CHECK) 890 $(AWK) \ 891 -v DATAFORM=$(DATAFORM) \ 892 -v backcheck=backward \ 893 -f checklinks.awk $(TDATA_TO_CHECK) 894 touch $@ 895 896check_links: checklinks.awk tzdata.zi 897 $(AWK) \ 898 -v DATAFORM=$(DATAFORM) \ 899 -f checklinks.awk tzdata.zi 900 touch $@ 901 902# Check timestamps from now through 28 years from now, to make sure 903# that zonenow.tab contains all sequences of planned timestamps, 904# without any duplicate sequences. In theory this might require 905# 2800 years but that would take a long time to check. 906CHECK_NOW_TIMESTAMP = `./date +%s` 907CHECK_NOW_FUTURE_YEARS = 28 908CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 909check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 910 rm -fr $@.dir 911 mkdir $@.dir 912 ./zic -d $@.dir tzdata.zi 913 now=$(CHECK_NOW_TIMESTAMP) && \ 914 future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ 915 ./zdump -i -t $$now,$$future \ 916 $$(find $$PWD/$@.dir/????*/ -type f) \ 917 >$@.dir/zdump.tab 918 $(AWK) \ 919 -v zdump_table=$@.dir/zdump.tab \ 920 -f checknow.awk zonenow.tab 921 rm -fr $@.dir 922 touch $@ 923 924check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab 925 for tab in $(ZONETABLES); do \ 926 test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 927 $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 928 || exit; \ 929 done 930 touch $@ 931 932check_tzs: $(TZS) $(TZS_NEW) 933 if test -s $(TZS); then \ 934 $(DIFF_TZS) $(TZS) $(TZS_NEW); \ 935 else \ 936 cp $(TZS_NEW) $(TZS); \ 937 fi 938 touch $@ 939 940check_web: $(CHECK_WEB_PAGES) 941check_theory.html: theory.html 942check_tz-art.html: tz-art.html 943check_tz-how-to.html: tz-how-to.html 944check_tz-link.html: tz-link.html 945check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: 946 $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 947 -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ 948 test ! -s $@.out || { cat $@.out; exit 1; } 949 mv $@.out $@ 950 951check_ziguard: rearguard.zi vanguard.zi ziguard.awk 952 $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 953 diff -u rearguard.zi - 954 $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 955 diff -u vanguard.zi - 956 touch $@ 957 958# Check that zishrink.awk does not alter the data, and that ziguard.awk 959# preserves main-format data. 960check_zishrink: check_zishrink_posix check_zishrink_right 961check_zishrink_posix check_zishrink_right: \ 962 zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 963 $(TDATA) $(DATAFORM).zi tzdata.zi 964 rm -fr $@.dir $@-t.dir $@-shrunk.dir 965 mkdir $@.dir $@-t.dir $@-shrunk.dir 966 case $@ in \ 967 *_right) leap='-L leapseconds';; \ 968 *) leap=;; \ 969 esac && \ 970 $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ 971 $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ 972 case $(DATAFORM),$(PACKRATLIST) in \ 973 main,) \ 974 $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ 975 $(AWK) '/^Rule/' $(TDATA) | \ 976 $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ 977 diff -r $@.dir $@-t.dir;; \ 978 esac 979 diff -r $@.dir $@-shrunk.dir 980 rm -fr $@.dir $@-t.dir $@-shrunk.dir 981 touch $@ 982 983clean_misc: 984 rm -fr check_*.dir typecheck_*.dir 985 rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ 986 check_* core typecheck_* \ 987 date tzdir.h tzselect version.h zdump zic libtz.a 988clean: clean_misc 989 rm -fr *.dir tzdb-*/ 990 rm -f *.zi $(TZS_NEW) 991 992maintainer-clean: clean 993 @echo 'This command is intended for maintainers to use; it' 994 @echo 'deletes files that may need special tools to rebuild.' 995 rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 996 997names: 998 @echo $(ENCHILADA) 999 1000public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ 1001 tarballs signatures 1002 1003date.1.txt: date.1 1004newctime.3.txt: newctime.3 1005newstrftime.3.txt: newstrftime.3 1006newtzset.3.txt: newtzset.3 1007time2posix.3.txt: time2posix.3 1008tzfile.5.txt: tzfile.5 1009tzselect.8.txt: tzselect.8 1010zdump.8.txt: zdump.8 1011zic.8.txt: zic.8 1012 1013$(MANTXTS): workman.sh 1014 LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out 1015 mv $@.out $@ 1016 1017# Set file timestamps deterministically if possible, 1018# so that tarballs containing the timestamps are reproducible. 1019# 1020# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 1021# file DEST to the maximum of the timestamps of the files A B C ..., 1022# plus N if GNU ls and touch are available. 1023SET_TIMESTAMP_N = sh -c '\ 1024 n=$$0 dest=$$1; shift; \ 1025 <"$$dest" && \ 1026 if test $$n != 0 && \ 1027 lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ 1028 set x $$lsout && \ 1029 timestamp=`expr $$7 + $$n` && \ 1030 echo "+ touch -md @$$timestamp $$dest" && \ 1031 touch -md @$$timestamp "$$dest"; \ 1032 else \ 1033 newest=`ls -t "$$@" | sed 1q` && \ 1034 echo "+ touch -mr $$newest $$dest" && \ 1035 touch -mr "$$newest" "$$dest"; \ 1036 fi' 1037# If DEST depends on A B C ... in this Makefile, callers should use 1038# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 1039# downstream 'make' that considers equal timestamps to be out of date. 1040# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 1041# If all that matters is that the timestamp be reproducible 1042# and plausible, use $(SET_TIMESTAMP). 1043SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 1044SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 1045 1046# Set the timestamps to those of the git repository, if available, 1047# and if the files have not changed since then. 1048# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 1049# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 1050# If git or GNU is absent, don't bother to sync with git timestamps. 1051# Also, set the timestamp of each prebuilt file like 'leapseconds' 1052# to be the maximum of the files it depends on. 1053set-timestamps.out: $(EIGHT_YARDS) 1054 rm -f $@ 1055 if (type git) >/dev/null 2>&1 && \ 1056 files=`git ls-files $(EIGHT_YARDS)` && \ 1057 touch -md @1 test.out; then \ 1058 rm -f test.out && \ 1059 for file in $$files; do \ 1060 if git diff --quiet $$file; then \ 1061 time=`TZ=UTC0 git log -1 \ 1062 --format='tformat:%cd' \ 1063 --date='format:%Y-%m-%dT%H:%M:%SZ' \ 1064 $$file` && \ 1065 echo "+ touch -md $$time $$file" && \ 1066 touch -md $$time $$file; \ 1067 else \ 1068 echo >&2 "$$file: warning: does not match repository"; \ 1069 fi || exit; \ 1070 done; \ 1071 fi 1072 $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 1073 for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ 1074 $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ 1075 exit; \ 1076 done 1077 $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 1078 $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 1079 touch $@ 1080set-tzs-timestamp.out: $(TZS) 1081 $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 1082 touch $@ 1083 1084# The zics below ensure that each data file can stand on its own. 1085# We also do an all-files run to catch links to links. 1086 1087check_public: $(VERSION_DEPS) 1088 rm -fr public.dir 1089 mkdir public.dir 1090 ln $(VERSION_DEPS) public.dir 1091 cd public.dir \ 1092 && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 1093 for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ 1094 public.dir/vanguard.zi public.dir/main.zi \ 1095 public.dir/rearguard.zi; \ 1096 do \ 1097 public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \ 1098 done 1099 public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK) 1100 : 1101 : Also check 'backzone' syntax. 1102 rm public.dir/main.zi 1103 cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi 1104 public.dir/zic -d public.dir/zoneinfo main.zi 1105 rm public.dir/main.zi 1106 cd public.dir && \ 1107 $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 1108 public.dir/zic -d public.dir/zoneinfo main.zi 1109 : 1110 rm -fr public.dir 1111 touch $@ 1112 1113# Check that the code works under various alternative 1114# implementations of time_t. 1115check_time_t_alternatives: $(TIME_T_ALTERNATIVES) 1116$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 1117$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 1118 rm -fr $@.dir 1119 mkdir $@.dir 1120 ln $(VERSION_DEPS) $@.dir 1121 case $@ in \ 1122 int*32_t) range=-2147483648,2147483648;; \ 1123 u*) range=0,4294967296;; \ 1124 *) range=-4294967296,4294967296;; \ 1125 esac && \ 1126 wd=`pwd` && \ 1127 zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \ 1128 if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 1129 range_target=; \ 1130 else \ 1131 range_target=to$$range.tzs; \ 1132 fi && \ 1133 (cd $@.dir && \ 1134 $(MAKE) TOPDIR="$$wd/$@.dir" \ 1135 CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \ 1136 REDO='$(REDO)' \ 1137 D=$$wd/$@.dir \ 1138 TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 1139 install $$range_target) && \ 1140 test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 1141 (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \ 1142 $(MAKE) TOPDIR="$$wd/$@.dir" \ 1143 TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 1144 D=$$wd/$@.dir \ 1145 to$$range.tzs) && \ 1146 $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \ 1147 $@.dir/to$$range.tzs && \ 1148 if diff -q Makefile Makefile 2>/dev/null; then \ 1149 quiet_option='-q'; \ 1150 else \ 1151 quiet_option=''; \ 1152 fi && \ 1153 diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \ 1154 $@.dir/etc && \ 1155 diff $$quiet_option -r \ 1156 $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \ 1157 $@.dir/usr/share; \ 1158 } 1159 touch $@ 1160 1161TRADITIONAL_ASC = \ 1162 tzcode$(VERSION).tar.gz.asc \ 1163 tzdata$(VERSION).tar.gz.asc 1164REARGUARD_ASC = \ 1165 tzdata$(VERSION)-rearguard.tar.gz.asc 1166ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 1167 tzdb-$(VERSION).tar.lz.asc 1168 1169tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 1170signatures rearguard_signatures traditional_signatures: \ 1171 version set-timestamps.out rearguard.zi vanguard.zi 1172 VERSION=`cat version` && \ 1173 $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 1174 1175# These *_version rules are intended for use if VERSION is set by some 1176# other means. Ordinarily these rules are used only by the above 1177# non-_version rules, which set VERSION on the 'make' command line. 1178tarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 1179 tzdb-$(VERSION).tar.lz 1180rearguard_tarballs_version: \ 1181 tzdata$(VERSION)-rearguard.tar.gz 1182traditional_tarballs_version: \ 1183 tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 1184tailored_tarballs_version: \ 1185 tzdata$(VERSION)-tailored.tar.gz 1186signatures_version: $(ALL_ASC) 1187rearguard_signatures_version: $(REARGUARD_ASC) 1188traditional_signatures_version: $(TRADITIONAL_ASC) 1189 1190tzcode$(VERSION).tar.gz: set-timestamps.out 1191 LC_ALL=C && export LC_ALL && \ 1192 tar $(TARFLAGS) -cf - \ 1193 $(COMMON) $(DOCS) $(SOURCES) | \ 1194 gzip $(GZIPFLAGS) >$@.out 1195 mv $@.out $@ 1196 1197tzdata$(VERSION).tar.gz: set-timestamps.out 1198 LC_ALL=C && export LC_ALL && \ 1199 tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \ 1200 gzip $(GZIPFLAGS) >$@.out 1201 mv $@.out $@ 1202 1203# Create empty files with a reproducible timestamp. 1204CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 1205 1206# The obsolescent *rearguard* targets and related macros are present 1207# for backwards compatibility with tz releases 2018e through 2022a. 1208# They should go away eventually. To build rearguard tarballs you 1209# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 1210tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 1211 rm -fr $@.dir 1212 mkdir $@.dir 1213 ln $(TZDATA_DIST) $@.dir 1214 cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 1215 for f in $(TDATA) $(PACKRATDATA); do \ 1216 rearf=$@.dir/$$f; \ 1217 $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 1218 $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 1219 done 1220 sed '1s/$$/-rearguard/' <version >$@.dir/version 1221 : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 1222 $(CREATE_EMPTY) $@.dir/pacificnew 1223 touch -mr version $@.dir/version 1224 LC_ALL=C && export LC_ALL && \ 1225 (cd $@.dir && \ 1226 tar $(TARFLAGS) -cf - \ 1227 $(TZDATA_DIST) pacificnew | \ 1228 gzip $(GZIPFLAGS)) >$@.out 1229 mv $@.out $@ 1230 1231# Create a tailored tarball suitable for TZUpdater and compatible tools. 1232# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 1233# useful for testing whether TZUpdater supports vanguard form. 1234# The generated tarball is not byte-for-byte equivalent to a hand-tailored 1235# traditional tarball, as data entries are put into 'etcetera' even if they 1236# came from some other source file. However, the effect should be the same 1237# for ordinary use, which reads all the source files. 1238tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 1239 rm -fr $@.dir 1240 mkdir $@.dir 1241 : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 1242 cd $@.dir && \ 1243 $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 1244 `test $(DATAFORM) = vanguard || echo pacificnew` 1245 (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 1246 >$@.dir/etcetera 1247 touch -mr tzdata.zi $@.dir/etcetera 1248 sed -n \ 1249 -e '/^# *version *\(.*\)/h' \ 1250 -e '/^# *ddeps */H' \ 1251 -e '$$!d' \ 1252 -e 'g' \ 1253 -e 's/^# *version *//' \ 1254 -e 's/\n# *ddeps */-/' \ 1255 -e 's/ /-/g' \ 1256 -e 'p' \ 1257 <tzdata.zi >$@.dir/version 1258 touch -mr version $@.dir/version 1259 links= && \ 1260 for file in $(TZDATA_DIST); do \ 1261 test -f $@.dir/$$file || links="$$links $$file"; \ 1262 done && \ 1263 ln $$links $@.dir 1264 LC_ALL=C && export LC_ALL && \ 1265 (cd $@.dir && \ 1266 tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out 1267 mv $@.out $@ 1268 1269tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 1270 rm -fr tzdb-$(VERSION) 1271 mkdir tzdb-$(VERSION) 1272 ln $(ENCHILADA) tzdb-$(VERSION) 1273 $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 1274 LC_ALL=C && export LC_ALL && \ 1275 tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out 1276 mv $@.out $@ 1277 1278tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 1279tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 1280tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 1281tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 1282$(ALL_ASC): 1283 $(GPG) --armor --detach-sign $? 1284 1285TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 1286typecheck: typecheck_long_long typecheck_unsigned 1287typecheck_long_long typecheck_unsigned: $(VERSION_DEPS) 1288 rm -fr $@.dir 1289 mkdir $@.dir 1290 ln $(VERSION_DEPS) $@.dir 1291 cd $@.dir && \ 1292 case $@ in \ 1293 *_long_long) i="long long";; \ 1294 *_unsigned ) i="unsigned" ;; \ 1295 esac && \ 1296 typecheck_cflags='' && \ 1297 $(MAKE) \ 1298 CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 1299 TOPDIR="`pwd`" \ 1300 install 1301 $@.dir/zdump -i -c 1970,1971 Europe/Rome 1302 touch $@ 1303 1304zonenames: tzdata.zi 1305 @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 1306 1307asctime.o: private.h tzfile.h 1308date.o: private.h 1309difftime.o: private.h 1310localtime.o: private.h tzfile.h tzdir.h 1311strftime.o: private.h tzfile.h 1312zdump.o: version.h 1313zic.o: private.h tzfile.h tzdir.h version.h 1314 1315.PHONY: ALL INSTALL all 1316.PHONY: check check_mild check_time_t_alternatives 1317.PHONY: check_web check_zishrink 1318.PHONY: clean clean_misc dummy.zd force_tzs 1319.PHONY: install install_data maintainer-clean names 1320.PHONY: posix_only posix_right public 1321.PHONY: rearguard_signatures rearguard_signatures_version 1322.PHONY: rearguard_tarballs rearguard_tarballs_version 1323.PHONY: right_only right_posix signatures signatures_version 1324.PHONY: tarballs tarballs_version 1325.PHONY: traditional_signatures traditional_signatures_version 1326.PHONY: traditional_tarballs traditional_tarballs_version 1327.PHONY: tailored_tarballs tailored_tarballs_version 1328.PHONY: typecheck 1329.PHONY: zonenames zones 1330.PHONY: $(ZDS) 1331