189abb9f8SPhilip Paeps# Make and install tzdb code and data. 2ba2b2efdSGlen Barber# This file is in the public domain, so clarified as of 3ba2b2efdSGlen Barber# 2009-05-17 by Arthur David Olson. 4eebb9c2cSPhilip Paeps# Request POSIX conformance; this must be the first non-comment line. 5eebb9c2cSPhilip Paeps.POSIX: 6*e273650fSPhilip Paeps# On older platforms you may need to scrounge for POSIX conformance. 7*e273650fSPhilip Paeps# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007), 8*e273650fSPhilip Paeps# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'. 9eebb9c2cSPhilip Paeps 10eebb9c2cSPhilip Paeps# To affect how this Makefile works, you can run a shell script like this: 11eebb9c2cSPhilip Paeps# 12eebb9c2cSPhilip Paeps# #!/bin/sh 13*e273650fSPhilip Paeps# make CC='gcc -std=gnu23' "$@" 14eebb9c2cSPhilip Paeps# 15*e273650fSPhilip Paeps# This example script is appropriate for a circa 2024 GNU/Linux system 16*e273650fSPhilip Paeps# where a non-default setting enables this package's optional use of C23. 17eebb9c2cSPhilip Paeps# 18eebb9c2cSPhilip Paeps# Alternatively, you can simply edit this Makefile to tailor the following 19eebb9c2cSPhilip Paeps# macro definitions. 20eebb9c2cSPhilip Paeps 21eebb9c2cSPhilip Paeps############################################################################### 22eebb9c2cSPhilip Paeps# Start of macros that one plausibly might want to tailor. 23ba2b2efdSGlen Barber 24ba2b2efdSGlen Barber# Package name for the code distribution. 25ba2b2efdSGlen BarberPACKAGE= tzcode 26ba2b2efdSGlen Barber 27ba2b2efdSGlen Barber# Version number for the distribution, overridden in the 'tarballs' rule below. 28ba2b2efdSGlen BarberVERSION= unknown 29ba2b2efdSGlen Barber 30ba2b2efdSGlen Barber# Email address for bug reports. 31ba2b2efdSGlen BarberBUGEMAIL= tz@iana.org 32ba2b2efdSGlen Barber 33ad48359aSPhilip Paeps# DATAFORM selects the data format. 34ad48359aSPhilip Paeps# Available formats represent essentially the same data, albeit 35ad48359aSPhilip Paeps# possibly with minor discrepancies that users are not likely to notice. 36ad48359aSPhilip Paeps# To get new features and the best data right away, use: 3746bee4edSPhilip Paeps# DATAFORM= vanguard 3846bee4edSPhilip Paeps# To wait a while before using new features, to give downstream users 3946bee4edSPhilip Paeps# time to upgrade zic (the default), use: 4046bee4edSPhilip Paeps# DATAFORM= main 4146bee4edSPhilip Paeps# To wait even longer for new features, use: 4246bee4edSPhilip Paeps# DATAFORM= rearguard 4312a899b6SPhilip Paeps# Rearguard users might also want "ZFLAGS = -b fat"; see below. 4446bee4edSPhilip PaepsDATAFORM= main 4546bee4edSPhilip Paeps 4689abb9f8SPhilip Paeps# Change the line below for your timezone (after finding the one you want in 4789abb9f8SPhilip Paeps# one of the $(TDATA) source files, or adding it to a source file). 48d81c2dd9SPhilip Paeps# Alternatively, if you discover you've got the wrong timezone, you can just 4912a899b6SPhilip Paeps# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. 50ba2b2efdSGlen Barber# Use the command 51ba2b2efdSGlen Barber# make zonenames 52ba2b2efdSGlen Barber# to get a list of the values you can use for LOCALTIME. 53ba2b2efdSGlen Barber 549f9fc6bbSPhilip PaepsLOCALTIME= Factory 55ba2b2efdSGlen Barber 56*e273650fSPhilip Paeps# The POSIXRULES macro controls interpretation of POSIX-like TZ 57259e2ad7SPhilip Paeps# settings like TZ='EET-2EEST' that lack DST transition rules. 5812a899b6SPhilip Paeps# If POSIXRULES is '-', no template is installed; this is the default. 5912a899b6SPhilip Paeps# Any other value for POSIXRULES is obsolete and should not be relied on, as: 602865ab3fSPhilip Paeps# * It does not work correctly in popular implementations such as GNU/Linux. 6194c2d487SPhilip Paeps# * It does not work even in tzcode, except for historical timestamps 6294c2d487SPhilip Paeps# that precede the last explicit transition in the POSIXRULES file. 6394c2d487SPhilip Paeps# Hence it typically does not work for current and future timestamps. 6412a899b6SPhilip Paeps# If, despite the above, you want a template for handling these settings, 6512a899b6SPhilip Paeps# you can change the line below (after finding the timezone you want in the 6612a899b6SPhilip Paeps# one of the $(TDATA) source files, or adding it to a source file). 6712a899b6SPhilip Paeps# Alternatively, if you discover you've got the wrong timezone, you can just 6812a899b6SPhilip Paeps# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. 6912a899b6SPhilip Paeps# Use the command 7012a899b6SPhilip Paeps# make zonenames 7112a899b6SPhilip Paeps# to get a list of the values you can use for POSIXRULES. 72ba2b2efdSGlen Barber 7312a899b6SPhilip PaepsPOSIXRULES= - 74ba2b2efdSGlen Barber 75ba2b2efdSGlen Barber# Also see TZDEFRULESTRING below, which takes effect only 76259e2ad7SPhilip Paeps# if POSIXRULES is '-' or if the template file cannot be accessed. 77ba2b2efdSGlen Barber 78ba2b2efdSGlen Barber 79f2fcff28SPhilip Paeps# Installation locations. 80f2fcff28SPhilip Paeps# 81f2fcff28SPhilip Paeps# The defaults are suitable for Debian, except that if REDO is 82f2fcff28SPhilip Paeps# posix_right or right_posix then files that Debian puts under 83f2fcff28SPhilip Paeps# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead 84f2fcff28SPhilip Paeps# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, 85f2fcff28SPhilip Paeps# respectively. Problems with the Debian approach are discussed in 86f2fcff28SPhilip Paeps# the commentary for the right_posix rule (below). 87f2fcff28SPhilip Paeps 88f2fcff28SPhilip Paeps# Destination directory, which can be used for staging. 89f2fcff28SPhilip Paeps# 'make DESTDIR=/stage install' installs under /stage (e.g., to 90f2fcff28SPhilip Paeps# /stage/etc/localtime instead of to /etc/localtime). Files under 91f2fcff28SPhilip Paeps# /stage are not intended to work as-is, but can be copied by hand to 92f2fcff28SPhilip Paeps# the root directory later. If DESTDIR is empty, 'make install' does 93f2fcff28SPhilip Paeps# not stage, but installs directly into production locations. 94f2fcff28SPhilip PaepsDESTDIR = 95f2fcff28SPhilip Paeps 96f2fcff28SPhilip Paeps# Everything is installed into subdirectories of TOPDIR, and used there. 97f2fcff28SPhilip Paeps# TOPDIR should be empty (meaning the root directory), 98f2fcff28SPhilip Paeps# or a directory name that does not end in "/". 99f2fcff28SPhilip Paeps# TOPDIR should be empty or an absolute name unless you're just testing. 100f2fcff28SPhilip PaepsTOPDIR = 101f2fcff28SPhilip Paeps 102f2fcff28SPhilip Paeps# The default local timezone is taken from the file TZDEFAULT. 103f2fcff28SPhilip PaepsTZDEFAULT = $(TOPDIR)/etc/localtime 104f2fcff28SPhilip Paeps 105f2fcff28SPhilip Paeps# The subdirectory containing installed program and data files, and 106f2fcff28SPhilip Paeps# likewise for installed files that can be shared among architectures. 107f2fcff28SPhilip Paeps# These should be relative file names. 108f2fcff28SPhilip PaepsUSRDIR = usr 109f2fcff28SPhilip PaepsUSRSHAREDIR = $(USRDIR)/share 110ba2b2efdSGlen Barber 111ba2b2efdSGlen Barber# "Compiled" timezone information is placed in the "TZDIR" directory 112ba2b2efdSGlen Barber# (and subdirectories). 1138d7edd17SPhilip Paeps# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. 114ba2b2efdSGlen BarberTZDIR_BASENAME= zoneinfo 115f2fcff28SPhilip PaepsTZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) 116f2fcff28SPhilip Paeps 117f2fcff28SPhilip Paeps# The "tzselect" and (if you do "make INSTALL") "date" commands go in: 118f2fcff28SPhilip PaepsBINDIR = $(TOPDIR)/$(USRDIR)/bin 119f2fcff28SPhilip Paeps 120f2fcff28SPhilip Paeps# The "zdump" command goes in: 121f2fcff28SPhilip PaepsZDUMPDIR = $(BINDIR) 122f2fcff28SPhilip Paeps 123f2fcff28SPhilip Paeps# The "zic" command goes in: 124f2fcff28SPhilip PaepsZICDIR = $(TOPDIR)/$(USRDIR)/sbin 125f2fcff28SPhilip Paeps 126f2fcff28SPhilip Paeps# Manual pages go in subdirectories of. . . 127f2fcff28SPhilip PaepsMANDIR = $(TOPDIR)/$(USRSHAREDIR)/man 128f2fcff28SPhilip Paeps 129f2fcff28SPhilip Paeps# Library functions are put in an archive in LIBDIR. 130f2fcff28SPhilip PaepsLIBDIR = $(TOPDIR)/$(USRDIR)/lib 131f2fcff28SPhilip Paeps 132ba2b2efdSGlen Barber 13389abb9f8SPhilip Paeps# Types to try, as an alternative to time_t. 13489abb9f8SPhilip PaepsTIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) 135*e273650fSPhilip PaepsTIME_T_ALTERNATIVES_HEAD = int_least64_t.ck 136*e273650fSPhilip PaepsTIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ 137*e273650fSPhilip Paeps uint_least64_t.ck 138ba2b2efdSGlen Barber 139ad48359aSPhilip Paeps# What kind of TZif data files to generate. (TZif is the binary time 140ad48359aSPhilip Paeps# zone data format that zic generates; see Internet RFC 8536.) 141dc135c6eSBaptiste Daroussin# If you want only POSIX time, with time values interpreted as 142dc135c6eSBaptiste Daroussin# seconds since the epoch (not counting leap seconds), use 143ba2b2efdSGlen Barber# REDO= posix_only 1448d7edd17SPhilip Paeps# below. If you want only "right" time, with values interpreted 145dc135c6eSBaptiste Daroussin# as seconds since the epoch (counting leap seconds), use 146ba2b2efdSGlen Barber# REDO= right_only 147ba2b2efdSGlen Barber# below. If you want both sets of data available, with leap seconds not 148ba2b2efdSGlen Barber# counted normally, use 149ba2b2efdSGlen Barber# REDO= posix_right 150ba2b2efdSGlen Barber# below. If you want both sets of data available, with leap seconds counted 151ba2b2efdSGlen Barber# normally, use 152ba2b2efdSGlen Barber# REDO= right_posix 153ba2b2efdSGlen Barber# below. POSIX mandates that leap seconds not be counted; for compatibility 154dc135c6eSBaptiste Daroussin# with it, use "posix_only" or "posix_right". Use POSIX time on systems with 155dc135c6eSBaptiste Daroussin# leap smearing; this can work better than unsmeared "right" time with 156dc135c6eSBaptiste Daroussin# applications that are not leap second aware, and is closer to unsmeared 157dc135c6eSBaptiste Daroussin# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). 158ba2b2efdSGlen Barber 159ba2b2efdSGlen BarberREDO= posix_right 160ba2b2efdSGlen Barber 161dd5f96c4SPhilip Paeps# Whether to put an "Expires" line in the leapseconds file. 162dd5f96c4SPhilip Paeps# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. 163dd5f96c4SPhilip Paeps# The EXPIRES_LINE value matters only if REDO's value contains "right". 164dd5f96c4SPhilip Paeps# If you change EXPIRES_LINE, remove the leapseconds file before running "make". 165dd5f96c4SPhilip Paeps# zic's support for the Expires line was introduced in tzdb 2020a, 16694c2d487SPhilip Paeps# and was modified in tzdb 2021b to generate version 4 TZif files. 16794c2d487SPhilip Paeps# EXPIRES_LINE defaults to 0 for now so that the leapseconds file 16894c2d487SPhilip Paeps# can be given to pre-2020a zic implementations and so that TZif files 16994c2d487SPhilip Paeps# built by newer zic implementations can be read by pre-2021b libraries. 170dd5f96c4SPhilip PaepsEXPIRES_LINE= 0 171dd5f96c4SPhilip Paeps 17289abb9f8SPhilip Paeps# To install data in text form that has all the information of the TZif data, 1738d7edd17SPhilip Paeps# (optionally incorporating leap second information), use 1748d7edd17SPhilip Paeps# TZDATA_TEXT= tzdata.zi leapseconds 1758d7edd17SPhilip Paeps# To install text data without leap second information (e.g., because 1768d7edd17SPhilip Paeps# REDO='posix_only'), use 1778d7edd17SPhilip Paeps# TZDATA_TEXT= tzdata.zi 1788d7edd17SPhilip Paeps# To avoid installing text data, use 1798d7edd17SPhilip Paeps# TZDATA_TEXT= 1808d7edd17SPhilip Paeps 1818d7edd17SPhilip PaepsTZDATA_TEXT= leapseconds tzdata.zi 1828d7edd17SPhilip Paeps 1838d7edd17SPhilip Paeps# For backward-compatibility links for old zone names, use 184f2fcff28SPhilip Paeps# BACKWARD= backward 1858d7edd17SPhilip Paeps# To omit these links, use 1868d7edd17SPhilip Paeps# BACKWARD= 1878d7edd17SPhilip Paeps 188f2fcff28SPhilip PaepsBACKWARD= backward 1898d7edd17SPhilip Paeps 1909f9fc6bbSPhilip Paeps# If you want out-of-scope and often-wrong data from the file 'backzone', 1919f9fc6bbSPhilip Paeps# but only for entries listed in the backward-compatibility file zone.tab, use 192ba2b2efdSGlen Barber# PACKRATDATA= backzone 1939f9fc6bbSPhilip Paeps# PACKRATLIST= zone.tab 1949f9fc6bbSPhilip Paeps# If you want all the 'backzone' data, use 1959f9fc6bbSPhilip Paeps# PACKRATDATA= backzone 1969f9fc6bbSPhilip Paeps# PACKRATLIST= 197ba2b2efdSGlen Barber# To omit this data, use 198ba2b2efdSGlen Barber# PACKRATDATA= 1999f9fc6bbSPhilip Paeps# PACKRATLIST= 200ba2b2efdSGlen Barber 201ba2b2efdSGlen BarberPACKRATDATA= 2029f9fc6bbSPhilip PaepsPACKRATLIST= 203ba2b2efdSGlen Barber 2048d7edd17SPhilip Paeps# The name of a locale using the UTF-8 encoding, used during self-tests. 2058d7edd17SPhilip Paeps# The tests are skipped if the name does not appear to work on this system. 2068d7edd17SPhilip Paeps 2078d7edd17SPhilip PaepsUTF8_LOCALE= en_US.utf8 2088d7edd17SPhilip Paeps 209ba2b2efdSGlen Barber# Non-default libraries needed to link. 210cf1ad535SPhilip Paeps# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. 211ba2b2efdSGlen BarberLDLIBS= 212ba2b2efdSGlen Barber 213eebb9c2cSPhilip Paeps# Add the following to an uncommented "CFLAGS=" line as needed 214eebb9c2cSPhilip Paeps# to override defaults specified in the source code or by the system. 215eebb9c2cSPhilip Paeps# "-DFOO" is equivalent to "-DFOO=1". 2168d7edd17SPhilip Paeps# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime 2178d7edd17SPhilip Paeps# formats that generate only the last two digits of year numbers 2188d7edd17SPhilip Paeps# -DEPOCH_LOCAL if the 'time' function returns local time not UT 219ba2b2efdSGlen Barber# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater 220ba2b2efdSGlen Barber# than what POSIX specifies, assuming local time is UT. 221ba2b2efdSGlen Barber# For example, N is 252460800 on AmigaOS. 2228d7edd17SPhilip Paeps# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r 223*e273650fSPhilip Paeps# on POSIX platforms predating POSIX.1-2024 2248d7edd17SPhilip Paeps# -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ' 225cf1ad535SPhilip Paeps# -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm 2268d7edd17SPhilip Paeps# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows) 227259e2ad7SPhilip Paeps# -DHAVE__GENERIC=0 if _Generic does not work* 228cf1ad535SPhilip Paeps# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), 229cf1ad535SPhilip Paeps# -DHAVE_GETRANDOM=0 to avoid using getrandom 230cf1ad535SPhilip Paeps# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), 231cf1ad535SPhilip Paeps# where LDLIBS also needs to contain -lintl on some hosts; 232cf1ad535SPhilip Paeps# -DHAVE_GETTEXT=0 to avoid using gettext 2338d7edd17SPhilip Paeps# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares 234*e273650fSPhilip Paeps# ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier 2358d7edd17SPhilip Paeps# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). 236259e2ad7SPhilip Paeps# -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+ 2378d7edd17SPhilip Paeps# -DHAVE_LINK=0 if your system lacks a link function 2388d7edd17SPhilip Paeps# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function 2398d7edd17SPhilip Paeps# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz 2408d7edd17SPhilip Paeps# localtime_rz can make zdump significantly faster, but is nonstandard. 24194c2d487SPhilip Paeps# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. 2428d7edd17SPhilip Paeps# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare 2438d7edd17SPhilip Paeps# functions like 'link' or variables like 'tzname' required by POSIX 2449142a2a3SPhilip Paeps# -DHAVE_SETENV=0 if your system lacks the setenv function 245259e2ad7SPhilip Paeps# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ 246cf1ad535SPhilip Paeps# -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like 247cf1ad535SPhilip Paeps# __builtin_add_overflow work* 248259e2ad7SPhilip Paeps# -DHAVE_STDINT_H=0 if <stdint.h> does not work*+ 2498d7edd17SPhilip Paeps# -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l 2508d7edd17SPhilip Paeps# -DHAVE_STRDUP=0 if your system lacks the strdup function 251259e2ad7SPhilip Paeps# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ 2528d7edd17SPhilip Paeps# -DHAVE_SYMLINK=0 if your system lacks the symlink function 253cf1ad535SPhilip Paeps# -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work* 2548d7edd17SPhilip Paeps# -DHAVE_TZSET=0 if your system lacks a tzset function 255cf1ad535SPhilip Paeps# -DHAVE_UNISTD_H=0 if <unistd.h> does not work* 256cf1ad535SPhilip Paeps# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work* 2578d7edd17SPhilip Paeps# -Dlocale_t=XXX if your system uses XXX instead of locale_t 258eebb9c2cSPhilip Paeps# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ 259eebb9c2cSPhilip Paeps# Typically it is better to use a later standard. For example, 260eebb9c2cSPhilip Paeps# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. 261eebb9c2cSPhilip Paeps# Even with -DPORT_TO_C89, the code needs at least one C99 262eebb9c2cSPhilip Paeps# feature (integers at least 64 bits wide) and maybe more. 26346bee4edSPhilip Paeps# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers 26446bee4edSPhilip Paeps# with external linkage, e.g., applications cannot define 'localtime'. 2658d7edd17SPhilip Paeps# -Dssize_t=long on hosts like MS-Windows that lack ssize_t 266*e273650fSPhilip Paeps# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers 267*e273650fSPhilip Paeps# Although -DSUPPORT_C89=0 might work around latent bugs in callers, 268*e273650fSPhilip Paeps# it does not conform to POSIX. 269*e273650fSPhilip Paeps# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+ 270*e273650fSPhilip Paeps# However, this might cause problems in POSIX.1-2024-or-later callers. 27146bee4edSPhilip Paeps# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has 27246bee4edSPhilip Paeps# security implications and is not recommended for general use 2738d7edd17SPhilip Paeps# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; 274ba2b2efdSGlen Barber# not needed by the main-program tz code, which is single-threaded. 275ba2b2efdSGlen Barber# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. 276ba2b2efdSGlen Barber# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t 2778d7edd17SPhilip Paeps# This is intended for internal use only; it mangles external names. 278ba2b2efdSGlen Barber# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 279ba2b2efdSGlen Barber# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 280ba2b2efdSGlen Barber# the default is system-supplied, typically "/usr/lib/locale" 281ba2b2efdSGlen Barber# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 282*e273650fSPhilip Paeps# DST transitions for proleptic format TZ strings lacking them, 283259e2ad7SPhilip Paeps# in the usual case where POSIXRULES is '-'. If not specified, 284259e2ad7SPhilip Paeps# TZDEFRULESTRING defaults to US rules for future DST transitions. 285259e2ad7SPhilip Paeps# This mishandles some past timestamps, as US DST rules have changed. 286259e2ad7SPhilip Paeps# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, 287259e2ad7SPhilip Paeps# as Europe and US DST rules differ. 288259e2ad7SPhilip Paeps# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) 2898d7edd17SPhilip Paeps# -DUNINIT_TRAP if reading uninitialized storage can cause problems 290ba2b2efdSGlen Barber# other than simply getting garbage data 291ba2b2efdSGlen Barber# -DUSE_LTZ=0 to build zdump with the system time zone library 292ba2b2efdSGlen Barber# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. 29312a899b6SPhilip Paeps# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and 29412a899b6SPhilip Paeps# similarly for "slim". Fat TZif files work around incompatibilities 2959142a2a3SPhilip Paeps# and bugs in some TZif readers, notably older ones that 2969142a2a3SPhilip Paeps# ignore or otherwise mishandle 64-bit data in TZif files; 2979142a2a3SPhilip Paeps# however, fat TZif files may trigger bugs in newer TZif readers. 2989142a2a3SPhilip Paeps# Slim TZif files are more efficient, and are the default. 299ba2b2efdSGlen Barber# -DZIC_MAX_ABBR_LEN_WO_WARN=3 300ba2b2efdSGlen Barber# (or some other number) to set the maximum time zone abbreviation length 301ba2b2efdSGlen Barber# that zic will accept without a warning (the default is 6) 302eebb9c2cSPhilip Paeps# -g to generate symbolic debugging info 303eebb9c2cSPhilip Paeps# -Idir to include from directory 'dir' 304eebb9c2cSPhilip Paeps# -O0 to disable optimization; other -O options to enable more optimization 305eebb9c2cSPhilip Paeps# -Uname to remove any definition of the macro 'name' 306ba2b2efdSGlen Barber# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking 3079142a2a3SPhilip Paeps# 3089142a2a3SPhilip Paeps# * Options marked "*" can be omitted if your compiler is C23 compatible. 309259e2ad7SPhilip Paeps# * Options marked "+" are obsolescent and are planned to be removed 310*e273650fSPhilip Paeps# once the code assumes C99 or later (say in the year 2029) 311*e273650fSPhilip Paeps# and POSIX.1-2024 or later (say in the year 2034). 3129142a2a3SPhilip Paeps# 3138d7edd17SPhilip Paeps# Select instrumentation via "make GCC_INSTRUMENT='whatever'". 3148d7edd17SPhilip PaepsGCC_INSTRUMENT = \ 3158d7edd17SPhilip Paeps -fsanitize=undefined -fsanitize-address-use-after-scope \ 3168d7edd17SPhilip Paeps -fsanitize-undefined-trap-on-error -fstack-protector 31794c2d487SPhilip Paeps# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. 318*e273650fSPhilip PaepsGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ 3198d7edd17SPhilip Paeps $(GCC_INSTRUMENT) \ 320ba2b2efdSGlen Barber -Wall -Wextra \ 3218d7edd17SPhilip Paeps -Walloc-size-larger-than=100000 -Warray-bounds=2 \ 3229f9fc6bbSPhilip Paeps -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \ 3238d7edd17SPhilip Paeps -Wdeclaration-after-statement -Wdouble-promotion \ 324*e273650fSPhilip Paeps -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ 3258d7edd17SPhilip Paeps -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ 326cf1ad535SPhilip Paeps -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ 327*e273650fSPhilip Paeps -Wmissing-declarations -Wmissing-prototypes \ 328*e273650fSPhilip Paeps -Wmissing-variable-declarations -Wnested-externs \ 32994c2d487SPhilip Paeps -Wnull-dereference \ 330ba2b2efdSGlen Barber -Wold-style-definition -Woverlength-strings -Wpointer-arith \ 33194c2d487SPhilip Paeps -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ 33294c2d487SPhilip Paeps -Wstrict-prototypes -Wstringop-overflow=4 \ 333d81c2dd9SPhilip Paeps -Wstringop-truncation -Wsuggest-attribute=cold \ 3348d7edd17SPhilip Paeps -Wsuggest-attribute=const -Wsuggest-attribute=format \ 335d81c2dd9SPhilip Paeps -Wsuggest-attribute=malloc \ 3368d7edd17SPhilip Paeps -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ 337*e273650fSPhilip Paeps -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \ 3388d7edd17SPhilip Paeps -Wvariadic-macros -Wvla -Wwrite-strings \ 339*e273650fSPhilip Paeps -Wno-format-nonliteral -Wno-sign-compare 340ba2b2efdSGlen Barber# 341ba2b2efdSGlen Barber# If your system has a "GMT offset" field in its "struct tm"s 342ba2b2efdSGlen Barber# (or if you decide to add such a field in your system's "time.h" file), 343ba2b2efdSGlen Barber# add the name to a define such as 344ba2b2efdSGlen Barber# -DTM_GMTOFF=tm_gmtoff 345ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. If not defined, the code attempts to 346ba2b2efdSGlen Barber# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. 347ba2b2efdSGlen Barber# Similarly, if your system has a "zone abbreviation" field, define 348ba2b2efdSGlen Barber# -DTM_ZONE=tm_zone 3492723c7ffSPhilip Paeps# and define NO_TM_ZONE to suppress any guessing. 350*e273650fSPhilip Paeps# Although POSIX.1-2024 requires these fields and they are widely available 351*e273650fSPhilip Paeps# on GNU/Linux and BSD systems, some older systems lack them. 352ba2b2efdSGlen Barber# 3538d7edd17SPhilip Paeps# The next batch of options control support for external variables 3548d7edd17SPhilip Paeps# exported by tzcode. In practice these variables are less useful 3558d7edd17SPhilip Paeps# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 3568d7edd17SPhilip Paeps# # 3578d7edd17SPhilip Paeps# # To omit or support the external variable "tzname", add one of: 358dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=0 # do not support "tzname" 359dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 360dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=2 # support and define "tzname" 361*e273650fSPhilip Paeps# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988 362*e273650fSPhilip Paeps# # and later, its contents are unspecified if you use a geographical TZ 363*e273650fSPhilip Paeps# # and the variable is planned to be removed in a future POSIX edition. 3648d7edd17SPhilip Paeps# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 3658d7edd17SPhilip Paeps# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 3668d7edd17SPhilip Paeps# # crashes when combined with some platforms' standard libraries, 3678d7edd17SPhilip Paeps# # presumably due to memory allocation issues. 3688d7edd17SPhilip Paeps# # 3698d7edd17SPhilip Paeps# # To omit or support the external variables "timezone" and "daylight", add 370dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=0 # do not support 371dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=1 # support, and variables are defined by system library 372dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=2 # support and define variables 3732723c7ffSPhilip Paeps# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix 374*e273650fSPhilip Paeps# # Systems Group code and are required by POSIX.1-2008 and later (with XSI), 375*e273650fSPhilip Paeps# # although their contents are unspecified if you use a geographical TZ 376*e273650fSPhilip Paeps# # and the variables are planned to be removed in a future edition of POSIX. 3778d7edd17SPhilip Paeps# # If not defined, the code attempts to guess USG_COMPAT from other macros. 3788d7edd17SPhilip Paeps# # 3798d7edd17SPhilip Paeps# # To support the external variable "altzone", add 380dd5f96c4SPhilip Paeps# # -DALTZONE=0 # do not support 381dd5f96c4SPhilip Paeps# # -DALTZONE=1 # support "altzone", which is defined by system library 382dd5f96c4SPhilip Paeps# # -DALTZONE=2 # support and define "altzone" 3838d7edd17SPhilip Paeps# # to the end of the "CFLAGS=" line; although "altzone" appeared in 3848d7edd17SPhilip Paeps# # System V Release 3.1 it has not been standardized. 385dd5f96c4SPhilip Paeps# # If not defined, the code attempts to guess ALTZONE from other macros. 3868d7edd17SPhilip Paeps# 387ba2b2efdSGlen Barber# If you want functions that were inspired by early versions of X3J11's work, 388ba2b2efdSGlen Barber# add 389ba2b2efdSGlen Barber# -DSTD_INSPIRED 390cf1ad535SPhilip Paeps# to the end of the "CFLAGS=" line. This arranges for the following 391cf1ad535SPhilip Paeps# functions to be added to the time conversion library. 392ba2b2efdSGlen Barber# "offtime" is like "gmtime" except that it accepts a second (long) argument 393ba2b2efdSGlen Barber# that gives an offset to add to the time_t when converting it. 394eebb9c2cSPhilip Paeps# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 395eebb9c2cSPhilip Paeps# "timelocal" is nearly equivalent to "mktime". 396ba2b2efdSGlen Barber# "timeoff" is like "timegm" except that it accepts a second (long) argument 397ba2b2efdSGlen Barber# that gives an offset to use when converting to a time_t. 398eebb9c2cSPhilip Paeps# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 399ba2b2efdSGlen Barber# "posix2time" and "time2posix" are described in an included manual page. 400ba2b2efdSGlen Barber# X3J11's work does not describe any of these functions. 401ba2b2efdSGlen Barber# These functions may well disappear in future releases of the time 402ba2b2efdSGlen Barber# conversion package. 403ba2b2efdSGlen Barber# 404ba2b2efdSGlen Barber# If you don't want functions that were inspired by NetBSD, add 405ba2b2efdSGlen Barber# -DNETBSD_INSPIRED=0 406ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. Otherwise, the functions 407ba2b2efdSGlen Barber# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 408259e2ad7SPhilip Paeps# time library, and if STD_INSPIRED is also defined to nonzero the functions 409ba2b2efdSGlen Barber# "posix2time_z" and "time2posix_z" are added as well. 410ba2b2efdSGlen Barber# The functions ending in "_z" (or "_rz") are like their unsuffixed 411ba2b2efdSGlen Barber# (or suffixed-by-"_r") counterparts, except with an extra first 412ba2b2efdSGlen Barber# argument of opaque type timezone_t that specifies the timezone. 413ba2b2efdSGlen Barber# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 414ba2b2efdSGlen Barber# 415ba2b2efdSGlen Barber# If you want to allocate state structures in localtime, add 416ba2b2efdSGlen Barber# -DALL_STATE 417ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 418ba2b2efdSGlen Barber# 419ba2b2efdSGlen Barber# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 420ba2b2efdSGlen Barber# out by the National Institute of Standards and Technology 421eebb9c2cSPhilip Paeps# which claims to test C and POSIX conformance. If you want to pass PCTS, add 422ba2b2efdSGlen Barber# -DPCTS 423ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. 424ba2b2efdSGlen Barber# 425ba2b2efdSGlen Barber# If you want strict compliance with XPG4 as of 1994-04-09, add 426ba2b2efdSGlen Barber# -DXPG4_1994_04_09 427ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. This causes "strftime" to always return 4288d7edd17SPhilip Paeps# 53 as a week number (rather than 52 or 53) for January days before 4298d7edd17SPhilip Paeps# January's first Monday when a "%V" format is used and January 1 430ba2b2efdSGlen Barber# falls on a Friday, Saturday, or Sunday. 431eebb9c2cSPhilip Paeps# 432eebb9c2cSPhilip Paeps# POSIX says CFLAGS defaults to "-O 1". 433eebb9c2cSPhilip Paeps# Uncomment the following line and edit its contents as needed. 434ba2b2efdSGlen Barber 435eebb9c2cSPhilip Paeps#CFLAGS= -O 1 436ba2b2efdSGlen Barber 437ba2b2efdSGlen Barber 438eebb9c2cSPhilip Paeps# The name of a POSIX-like library archiver, its flags, C compiler, 439eebb9c2cSPhilip Paeps# linker flags, and 'make' utility. Ordinarily the defaults suffice. 440*e273650fSPhilip Paeps# The commented-out values are the defaults specified by POSIX.1-2024. 441eebb9c2cSPhilip Paeps#AR = ar 442eebb9c2cSPhilip Paeps#ARFLAGS = -rv 443eebb9c2cSPhilip Paeps#CC = c17 444eebb9c2cSPhilip Paeps#LDFLAGS = 445eebb9c2cSPhilip Paeps#MAKE = make 446ba2b2efdSGlen Barber 4472723c7ffSPhilip Paeps# Where to fetch leap-seconds.list from. 4482723c7ffSPhilip Paepsleaplist_URI = \ 4492723c7ffSPhilip Paeps https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list 4502723c7ffSPhilip Paeps# The file is generated by the IERS Earth Orientation Centre, in Paris. 4512723c7ffSPhilip Paepsleaplist_TZ = Europe/Paris 4522723c7ffSPhilip Paeps 453ba2b2efdSGlen Barber# The zic command and its arguments. 454ba2b2efdSGlen Barber 455ba2b2efdSGlen Barberzic= ./zic 456ba2b2efdSGlen BarberZIC= $(zic) $(ZFLAGS) 457ba2b2efdSGlen Barber 458ad48359aSPhilip Paeps# To shrink the size of installed TZif files, 459ad48359aSPhilip Paeps# append "-r @N" to omit data before N-seconds-after-the-Epoch. 4609142a2a3SPhilip Paeps# To grow the files and work around bugs in older applications, 4619142a2a3SPhilip Paeps# possibly at the expense of introducing bugs in newer ones, 4629142a2a3SPhilip Paeps# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 4632865ab3fSPhilip Paeps# See the zic man page for more about -b and -r. 464ba2b2efdSGlen BarberZFLAGS= 465ba2b2efdSGlen Barber 46689abb9f8SPhilip Paeps# How to use zic to install TZif files. 467ba2b2efdSGlen Barber 468*e273650fSPhilip PaepsZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' 469ba2b2efdSGlen Barber 470eebb9c2cSPhilip Paeps# The name of a POSIX-compliant 'awk' on your system. 4718ea5af2bSPhilip Paeps# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 4728ea5af2bSPhilip Paeps# Also, it is better (though not essential) if 'awk' supports UTF-8, 4738ea5af2bSPhilip Paeps# and unfortunately mawk and busybox awk do not support UTF-8. 4748ea5af2bSPhilip Paeps# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 475ba2b2efdSGlen BarberAWK= awk 476ba2b2efdSGlen Barber 477eebb9c2cSPhilip Paeps# The full path name of a POSIX-compliant shell, preferably one that supports 478ba2b2efdSGlen Barber# the Korn shell's 'select' statement as an extension. 479ba2b2efdSGlen Barber# These days, Bash is the most popular. 480ba2b2efdSGlen Barber# It should be OK to set this to /bin/sh, on platforms where /bin/sh 481eebb9c2cSPhilip Paeps# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 482ba2b2efdSGlen Barber# is typically nicer if it works. 483ba2b2efdSGlen BarberKSHELL= /bin/bash 484ba2b2efdSGlen Barber 4852723c7ffSPhilip Paeps# Name of curl <https://curl.haxx.se/>, used for HTML validation 4862723c7ffSPhilip Paeps# and to fetch leap-seconds.list from upstream. 487*e273650fSPhilip Paeps# Set CURL=: to disable use of the Internet. 4882c5e84ccSPhilip PaepsCURL= curl 4892c5e84ccSPhilip Paeps 4902865ab3fSPhilip Paeps# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 4912865ab3fSPhilip PaepsGPG= gpg 4922865ab3fSPhilip Paeps 493ba2b2efdSGlen Barber# This expensive test requires USE_LTZ. 494ba2b2efdSGlen Barber# To suppress it, define this macro to be empty. 495ba2b2efdSGlen BarberCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 496ba2b2efdSGlen Barber 497ba2b2efdSGlen Barber# SAFE_CHAR is a regular expression that matches a safe character. 498ba2b2efdSGlen Barber# Some parts of this distribution are limited to safe characters; 499ba2b2efdSGlen Barber# others can use any UTF-8 character. 500ba2b2efdSGlen Barber# For now, the safe characters are a safe subset of ASCII. 501ba2b2efdSGlen Barber# The caller must set the shell variable 'sharp' to the character '#', 502ba2b2efdSGlen Barber# since Makefile macros cannot contain '#'. 503ba2b2efdSGlen Barber# TAB_CHAR is a single tab character, in single quotes. 504ba2b2efdSGlen BarberTAB_CHAR= ' ' 505ba2b2efdSGlen BarberSAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 506ba2b2efdSGlen BarberSAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 507ba2b2efdSGlen BarberSAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 508ba2b2efdSGlen BarberSAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 509ba2b2efdSGlen BarberSAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 510ba2b2efdSGlen Barber 511259e2ad7SPhilip Paeps# These non-alphabetic, non-ASCII printable characters are Latin-1, 512259e2ad7SPhilip Paeps# and so are likely displayable even in editors like XEmacs 21 513259e2ad7SPhilip Paeps# that have limited display capabilities. 514259e2ad7SPhilip PaepsUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 51546bee4edSPhilip Paeps# Non-ASCII non-letters that OK_CHAR allows, as these characters are 51689abb9f8SPhilip Paeps# useful in commentary. 517259e2ad7SPhilip PaepsUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 51846bee4edSPhilip Paeps 5199f9fc6bbSPhilip Paeps# Put this in a bracket expression to match spaces. 5209f9fc6bbSPhilip Paepss = [:space:] 5219f9fc6bbSPhilip Paeps 522ba2b2efdSGlen Barber# OK_CHAR matches any character allowed in the distributed files. 52346bee4edSPhilip Paeps# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 52446bee4edSPhilip Paeps# multibyte letters are also allowed so that commentary can contain a 52546bee4edSPhilip Paeps# few safe symbols and people's names and can quote non-English sources. 52646bee4edSPhilip Paeps# Other non-letters are limited to ASCII renderings for the 52746bee4edSPhilip Paeps# convenience of maintainers using XEmacs 21.5.34, which by default 52846bee4edSPhilip Paeps# mishandles Unicode characters U+0100 and greater. 52946bee4edSPhilip PaepsOK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 530ba2b2efdSGlen Barber 531ba2b2efdSGlen Barber# SAFE_LINE matches a line of safe characters. 532ba2b2efdSGlen Barber# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 533ba2b2efdSGlen Barber# this is so that comments can contain non-ASCII characters. 534ba2b2efdSGlen Barber# OK_LINE matches a line of OK characters. 535ba2b2efdSGlen BarberSAFE_LINE= '^'$(SAFE_CHAR)'*$$' 536ba2b2efdSGlen BarberSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 537ba2b2efdSGlen BarberOK_LINE= '^'$(OK_CHAR)'*$$' 538ba2b2efdSGlen Barber 539ba2b2efdSGlen Barber# Flags to give 'tar' when making a distribution. 540ba2b2efdSGlen Barber# Try to use flags appropriate for GNU tar. 541*e273650fSPhilip PaepsGNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \ 5428ea5af2bSPhilip Paeps --numeric-owner --owner=0 --group=0 \ 5438ea5af2bSPhilip Paeps --mode=go+u,go-w --sort=name 544*e273650fSPhilip PaepsSETUP_TAR= \ 545*e273650fSPhilip Paeps export LC_ALL=C && \ 546*e273650fSPhilip Paeps if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \ 547*e273650fSPhilip Paeps TAR='tar $(GNUTARFLAGS)'; \ 548*e273650fSPhilip Paeps else \ 549*e273650fSPhilip Paeps TAR=tar; \ 550*e273650fSPhilip Paeps fi 551ba2b2efdSGlen Barber 552ba2b2efdSGlen Barber# Flags to give 'gzip' when making a distribution. 553ba2b2efdSGlen BarberGZIPFLAGS= -9n 554ba2b2efdSGlen Barber 555cf1ad535SPhilip Paeps# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 556cf1ad535SPhilip Paeps# This makes it easier to see which Zone has been affected. 557*e273650fSPhilip PaepsSETUP_DIFF_TZS = \ 558*e273650fSPhilip Paeps if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \ 559*e273650fSPhilip Paeps DIFF_TZS='diff -u -F^TZ='; \ 560*e273650fSPhilip Paeps else \ 561*e273650fSPhilip Paeps DIFF_TZS='diff -u'; \ 562*e273650fSPhilip Paeps fi 563cf1ad535SPhilip Paeps 564ba2b2efdSGlen Barber# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 565ba2b2efdSGlen BarberRANLIB= : 566ba2b2efdSGlen Barber 567eebb9c2cSPhilip Paeps# POSIX prohibits defining or using SHELL. However, csh users on systems 568eebb9c2cSPhilip Paeps# that use the user shell for Makefile commands may need to define SHELL. 569eebb9c2cSPhilip Paeps#SHELL= /bin/sh 570eebb9c2cSPhilip Paeps 571eebb9c2cSPhilip Paeps# End of macros that one plausibly might want to tailor. 572eebb9c2cSPhilip Paeps############################################################################### 573eebb9c2cSPhilip Paeps 574eebb9c2cSPhilip Paeps 575ba2b2efdSGlen BarberTZCOBJS= zic.o 576*e273650fSPhilip PaepsTZDOBJS= zdump.o localtime.o strftime.o 577*e273650fSPhilip PaepsDATEOBJS= date.o localtime.o strftime.o 578dd5f96c4SPhilip PaepsLIBSRCS= localtime.c asctime.c difftime.c strftime.c 579dd5f96c4SPhilip PaepsLIBOBJS= localtime.o asctime.o difftime.o strftime.o 580ba2b2efdSGlen BarberHEADERS= tzfile.h private.h 581ba2b2efdSGlen BarberNONLIBSRCS= zic.c zdump.c 582dd5f96c4SPhilip PaepsNEWUCBSRCS= date.c 583ba2b2efdSGlen BarberSOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 584ba2b2efdSGlen Barber tzselect.ksh workman.sh 585ba2b2efdSGlen BarberMANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 586ba2b2efdSGlen Barber tzfile.5 tzselect.8 zic.8 zdump.8 587ba2b2efdSGlen BarberMANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 588ba2b2efdSGlen Barber time2posix.3.txt \ 589ba2b2efdSGlen Barber tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 590ba2b2efdSGlen Barber date.1.txt 5918d7edd17SPhilip PaepsCOMMON= calendars CONTRIBUTING LICENSE Makefile \ 59293d120dbSPhilip Paeps NEWS README SECURITY theory.html version 593f2fcff28SPhilip PaepsWEB_PAGES= tz-art.html tz-how-to.html tz-link.html 594*e273650fSPhilip PaepsCHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck 595ba2b2efdSGlen BarberDOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 596ba2b2efdSGlen BarberPRIMARY_YDATA= africa antarctica asia australasia \ 597ba2b2efdSGlen Barber europe northamerica southamerica 598afb91be3SPhilip PaepsYDATA= $(PRIMARY_YDATA) etcetera 59912a899b6SPhilip PaepsNDATA= factory 60012a899b6SPhilip PaepsTDATA_TO_CHECK= $(YDATA) $(NDATA) backward 601afb91be3SPhilip PaepsTDATA= $(YDATA) $(NDATA) $(BACKWARD) 602eebb9c2cSPhilip PaepsZONETABLES= zone.tab zone1970.tab zonenow.tab 6038d7edd17SPhilip PaepsTABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 604ba2b2efdSGlen BarberLEAP_DEPS= leapseconds.awk leap-seconds.list 6059f9fc6bbSPhilip PaepsTZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 6069f9fc6bbSPhilip Paeps $(PACKRATDATA) $(PACKRATLIST) 6079f9fc6bbSPhilip PaepsDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 608afb91be3SPhilip PaepsDATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 60912a899b6SPhilip Paeps leapseconds $(ZONETABLES) 610eebb9c2cSPhilip PaepsAWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 61146bee4edSPhilip Paeps ziguard.awk zishrink.awk 6125f33eb72SPhilip PaepsMISC= $(AWK_SCRIPTS) 613ba2b2efdSGlen BarberTZS_YEAR= 2050 61489abb9f8SPhilip PaepsTZS_CUTOFF_FLAG= -c $(TZS_YEAR) 615ba2b2efdSGlen BarberTZS= to$(TZS_YEAR).tzs 616ba2b2efdSGlen BarberTZS_NEW= to$(TZS_YEAR)new.tzs 61794c2d487SPhilip PaepsTZS_DEPS= $(YDATA) asctime.c localtime.c \ 618ba2b2efdSGlen Barber private.h tzfile.h zdump.c zic.c 6199f9fc6bbSPhilip PaepsTZDATA_DIST = $(COMMON) $(DATA) $(MISC) 62089abb9f8SPhilip Paeps# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 6219f9fc6bbSPhilip PaepsEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 62289abb9f8SPhilip PaepsENCHILADA = $(EIGHT_YARDS) $(TZS) 623ba2b2efdSGlen Barber 624ba2b2efdSGlen Barber# Consult these files when deciding whether to rebuild the 'version' file. 625ba2b2efdSGlen Barber# This list is not the same as the output of 'git ls-files', since 626ba2b2efdSGlen Barber# .gitignore is not distributed. 627ba2b2efdSGlen BarberVERSION_DEPS= \ 62893d120dbSPhilip Paeps calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 629ba2b2efdSGlen Barber africa antarctica asctime.c asia australasia \ 630ba2b2efdSGlen Barber backward backzone \ 631eebb9c2cSPhilip Paeps checklinks.awk checknow.awk checktab.awk \ 632ba2b2efdSGlen Barber date.1 date.c difftime.c \ 633ba2b2efdSGlen Barber etcetera europe factory iso3166.tab \ 634ba2b2efdSGlen Barber leap-seconds.list leapseconds.awk localtime.c \ 635ba2b2efdSGlen Barber newctime.3 newstrftime.3 newtzset.3 northamerica \ 63612a899b6SPhilip Paeps private.h southamerica strftime.c theory.html \ 637f2fcff28SPhilip Paeps time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 638ba2b2efdSGlen Barber tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 63912a899b6SPhilip Paeps workman.sh zdump.8 zdump.c zic.8 zic.c \ 640d81c2dd9SPhilip Paeps ziguard.awk zishrink.awk \ 641eebb9c2cSPhilip Paeps zone.tab zone1970.tab zonenow.tab 642ba2b2efdSGlen Barber 64312a899b6SPhilip Paepsall: tzselect zic zdump libtz.a $(TABDATA) \ 64446bee4edSPhilip Paeps vanguard.zi main.zi rearguard.zi 645ba2b2efdSGlen Barber 646ba2b2efdSGlen BarberALL: all date $(ENCHILADA) 647ba2b2efdSGlen Barber 648ba2b2efdSGlen Barberinstall: all $(DATA) $(REDO) $(MANS) 649f2fcff28SPhilip Paeps mkdir -p '$(DESTDIR)$(BINDIR)' \ 650f2fcff28SPhilip Paeps '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 651f2fcff28SPhilip Paeps '$(DESTDIR)$(LIBDIR)' \ 652f2fcff28SPhilip Paeps '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 653f2fcff28SPhilip Paeps '$(DESTDIR)$(MANDIR)/man8' 6542865ab3fSPhilip Paeps $(ZIC_INSTALL) -l $(LOCALTIME) \ 655*e273650fSPhilip Paeps -p $(POSIXRULES) \ 656f2fcff28SPhilip Paeps -t '$(DESTDIR)$(TZDEFAULT)' 657f2fcff28SPhilip Paeps cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 658f2fcff28SPhilip Paeps cp tzselect '$(DESTDIR)$(BINDIR)/.' 659f2fcff28SPhilip Paeps cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 660f2fcff28SPhilip Paeps cp zic '$(DESTDIR)$(ZICDIR)/.' 661f2fcff28SPhilip Paeps cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 662f2fcff28SPhilip Paeps $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 663f2fcff28SPhilip Paeps cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 664f2fcff28SPhilip Paeps cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 665f2fcff28SPhilip Paeps cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 666ba2b2efdSGlen Barber 667ba2b2efdSGlen BarberINSTALL: ALL install date.1 668f2fcff28SPhilip Paeps mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 669f2fcff28SPhilip Paeps cp date '$(DESTDIR)$(BINDIR)/.' 670f2fcff28SPhilip Paeps cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 671ba2b2efdSGlen Barber 672dc505d53SPhilip Paeps# Calculate version number from git, if available. 673dc505d53SPhilip Paeps# Otherwise, use $(VERSION) unless it is "unknown" and there is already 674dc505d53SPhilip Paeps# a 'version' file, in which case reuse the existing 'version' contents 675dc505d53SPhilip Paeps# and append "-dirty" if the contents do not already end in "-dirty". 676ba2b2efdSGlen Barberversion: $(VERSION_DEPS) 677ba2b2efdSGlen Barber { (type git) >/dev/null 2>&1 && \ 678*e273650fSPhilip Paeps V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 679*e273650fSPhilip Paeps --abbrev=7 --dirty) || \ 680*e273650fSPhilip Paeps if test '$(VERSION)' = unknown && read -r V <$@; then \ 681*e273650fSPhilip Paeps V=$${V%-dirty}-dirty; \ 682dc505d53SPhilip Paeps else \ 683dc505d53SPhilip Paeps V='$(VERSION)'; \ 684dc505d53SPhilip Paeps fi; } && \ 685ba2b2efdSGlen Barber printf '%s\n' "$$V" >$@.out 686ba2b2efdSGlen Barber mv $@.out $@ 687ba2b2efdSGlen Barber 6889f9fc6bbSPhilip Paeps# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 68946bee4edSPhilip Paepsvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 6909f9fc6bbSPhilip Paeps $(AWK) \ 691*e273650fSPhilip Paeps -v DATAFORM=$(@:.zi=) \ 6929f9fc6bbSPhilip Paeps -v PACKRATDATA='$(PACKRATDATA)' \ 6939f9fc6bbSPhilip Paeps -v PACKRATLIST='$(PACKRATLIST)' \ 6949f9fc6bbSPhilip Paeps -f ziguard.awk \ 695d81c2dd9SPhilip Paeps $(TDATA) $(PACKRATDATA) >$@.out 69646bee4edSPhilip Paeps mv $@.out $@ 69789abb9f8SPhilip Paeps# This file has a version comment that attempts to capture any tailoring 6989f9fc6bbSPhilip Paeps# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 69989abb9f8SPhilip Paepstzdata.zi: $(DATAFORM).zi version zishrink.awk 700*e273650fSPhilip Paeps read -r version <version && \ 70189abb9f8SPhilip Paeps LC_ALL=C $(AWK) \ 70289abb9f8SPhilip Paeps -v dataform='$(DATAFORM)' \ 70389abb9f8SPhilip Paeps -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 70489abb9f8SPhilip Paeps -v redo='$(REDO)' \ 70589abb9f8SPhilip Paeps -v version="$$version" \ 70689abb9f8SPhilip Paeps -f zishrink.awk \ 70746bee4edSPhilip Paeps $(DATAFORM).zi >$@.out 7088d7edd17SPhilip Paeps mv $@.out $@ 7098d7edd17SPhilip Paeps 710eebb9c2cSPhilip Paepstzdir.h: 711eebb9c2cSPhilip Paeps printf '%s\n' >$@.out \ 712eebb9c2cSPhilip Paeps '#ifndef TZDEFAULT' \ 713eebb9c2cSPhilip Paeps '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 714eebb9c2cSPhilip Paeps '#endif' \ 715eebb9c2cSPhilip Paeps '#ifndef TZDIR' \ 716eebb9c2cSPhilip Paeps '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 717eebb9c2cSPhilip Paeps '#endif' 718eebb9c2cSPhilip Paeps mv $@.out $@ 719eebb9c2cSPhilip Paeps 720ba2b2efdSGlen Barberversion.h: version 721*e273650fSPhilip Paeps read -r VERSION <version && printf '%s\n' \ 722ba2b2efdSGlen Barber 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 723ba2b2efdSGlen Barber "static char const TZVERSION[]=\"$$VERSION\";" \ 724ba2b2efdSGlen Barber 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 725ba2b2efdSGlen Barber >$@.out 726ba2b2efdSGlen Barber mv $@.out $@ 727ba2b2efdSGlen Barber 728ba2b2efdSGlen Barberzdump: $(TZDOBJS) 729ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 730ba2b2efdSGlen Barber 731ba2b2efdSGlen Barberzic: $(TZCOBJS) 732ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 733ba2b2efdSGlen Barber 734ba2b2efdSGlen Barberleapseconds: $(LEAP_DEPS) 735dd5f96c4SPhilip Paeps $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 736dd5f96c4SPhilip Paeps -f leapseconds.awk leap-seconds.list >$@.out 737ba2b2efdSGlen Barber mv $@.out $@ 738ba2b2efdSGlen Barber 7392723c7ffSPhilip Paeps# Awk script to extract a Git-style author from leap-seconds.list comments. 7402723c7ffSPhilip PaepsEXTRACT_AUTHOR = \ 7412723c7ffSPhilip Paeps author_line { sub(/^.[[:space:]]*/, ""); \ 7422723c7ffSPhilip Paeps sub(/:[[:space:]]*/, " <"); \ 7432723c7ffSPhilip Paeps printf "%s>\n", $$0; \ 7442723c7ffSPhilip Paeps success = 1; \ 7452723c7ffSPhilip Paeps exit \ 7462723c7ffSPhilip Paeps } \ 7472723c7ffSPhilip Paeps /Questions or comments to:/ { author_line = 1 } \ 7482723c7ffSPhilip Paeps END { exit !success } 7492723c7ffSPhilip Paeps 7502723c7ffSPhilip Paeps# Fetch leap-seconds.list from upstream. 7512723c7ffSPhilip Paepsfetch-leap-seconds.list: 7522723c7ffSPhilip Paeps $(CURL) -OR $(leaplist_URI) 7532723c7ffSPhilip Paeps 7542723c7ffSPhilip Paeps# Fetch leap-seconds.list from upstream and commit it to the local repository. 7552723c7ffSPhilip Paepscommit-leap-seconds.list: fetch-leap-seconds.list 7562723c7ffSPhilip Paeps author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ 7572723c7ffSPhilip Paeps date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ 7582723c7ffSPhilip Paeps git commit --author="$$author" --date="$$date" -m'make $@' \ 7592723c7ffSPhilip Paeps leap-seconds.list 7602723c7ffSPhilip Paeps 761*e273650fSPhilip Paeps# Arguments to pass to submakes. 762ba2b2efdSGlen Barber# They can be overridden by later submake arguments. 763ba2b2efdSGlen BarberINSTALLARGS = \ 764f2fcff28SPhilip Paeps BACKWARD='$(BACKWARD)' \ 765f2fcff28SPhilip Paeps DESTDIR='$(DESTDIR)' \ 766ba2b2efdSGlen Barber PACKRATDATA='$(PACKRATDATA)' \ 7679f9fc6bbSPhilip Paeps PACKRATLIST='$(PACKRATLIST)' \ 768f2fcff28SPhilip Paeps TZDEFAULT='$(TZDEFAULT)' \ 769f2fcff28SPhilip Paeps TZDIR='$(TZDIR)' \ 770ba2b2efdSGlen Barber ZIC='$(ZIC)' 771ba2b2efdSGlen Barber 77212a899b6SPhilip PaepsINSTALL_DATA_DEPS = zic leapseconds tzdata.zi 77389abb9f8SPhilip Paeps 774*e273650fSPhilip Paepsposix_only: $(INSTALL_DATA_DEPS) 7758d7edd17SPhilip Paeps $(ZIC_INSTALL) tzdata.zi 776ba2b2efdSGlen Barber 77789abb9f8SPhilip Paepsright_only: $(INSTALL_DATA_DEPS) 778*e273650fSPhilip Paeps $(ZIC_INSTALL) -L leapseconds tzdata.zi 779ba2b2efdSGlen Barber 780ba2b2efdSGlen Barber# In earlier versions of this makefile, the other two directories were 781ba2b2efdSGlen Barber# subdirectories of $(TZDIR). However, this led to configuration errors. 782ba2b2efdSGlen Barber# For example, with posix_right under the earlier scheme, 783ba2b2efdSGlen Barber# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 784ba2b2efdSGlen Barber# but gmtime without leap seconds, which led to problems with applications 785ba2b2efdSGlen Barber# like sendmail that subtract gmtime from localtime. 786ba2b2efdSGlen Barber# Therefore, the other two directories are now siblings of $(TZDIR). 787ba2b2efdSGlen Barber# You must replace all of $(TZDIR) to switch from not using leap seconds 788ba2b2efdSGlen Barber# to using them, or vice versa. 789ba2b2efdSGlen Barberright_posix: right_only 790f2fcff28SPhilip Paeps rm -fr '$(DESTDIR)$(TZDIR)-leaps' 791f2fcff28SPhilip Paeps ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 792f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 793f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 794ba2b2efdSGlen Barber 795ba2b2efdSGlen Barberposix_right: posix_only 796f2fcff28SPhilip Paeps rm -fr '$(DESTDIR)$(TZDIR)-posix' 797f2fcff28SPhilip Paeps ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 798f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 799f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 800ba2b2efdSGlen Barber 801ba2b2efdSGlen Barberzones: $(REDO) 802ba2b2efdSGlen Barber 80346bee4edSPhilip Paeps# dummy.zd is not a real file; it is mentioned here only so that the 80446bee4edSPhilip Paeps# top-level 'make' does not have a syntax error. 80546bee4edSPhilip PaepsZDS = dummy.zd 80646bee4edSPhilip Paeps# Rule used only by submakes invoked by the $(TZS_NEW) rule. 80746bee4edSPhilip Paeps# It is separate so that GNU 'make -j' can run instances in parallel. 80846bee4edSPhilip Paeps$(ZDS): zdump 809*e273650fSPhilip Paeps ./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@ 81046bee4edSPhilip Paeps 81189abb9f8SPhilip PaepsTZS_NEW_DEPS = tzdata.zi zdump zic 81289abb9f8SPhilip Paeps$(TZS_NEW): $(TZS_NEW_DEPS) 81389abb9f8SPhilip Paeps rm -fr tzs$(TZS_YEAR).dir 81489abb9f8SPhilip Paeps mkdir tzs$(TZS_YEAR).dir 81589abb9f8SPhilip Paeps $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 8168d7edd17SPhilip Paeps $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 8178d7edd17SPhilip Paeps tzdata.zi | LC_ALL=C sort >$@.out 818*e273650fSPhilip Paeps x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 81989abb9f8SPhilip Paeps tzdata.zi \ 820*e273650fSPhilip Paeps | LC_ALL=C sort -t . -k 2,2) && \ 82189abb9f8SPhilip Paeps set x $$x && \ 82246bee4edSPhilip Paeps shift && \ 82346bee4edSPhilip Paeps ZDS=$$* && \ 824*e273650fSPhilip Paeps $(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 82589abb9f8SPhilip Paeps ZDS="$$ZDS" $$ZDS && \ 82689abb9f8SPhilip Paeps sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 82789abb9f8SPhilip Paeps rm -fr tzs$(TZS_YEAR).dir 82846bee4edSPhilip Paeps mv $@.out $@ 829ba2b2efdSGlen Barber 830*e273650fSPhilip Paeps# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the 831ba2b2efdSGlen Barber# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 832ba2b2efdSGlen Barber$(TZS): 83389abb9f8SPhilip Paeps touch $@ 834ba2b2efdSGlen Barber 835ba2b2efdSGlen Barberforce_tzs: $(TZS_NEW) 836ba2b2efdSGlen Barber cp $(TZS_NEW) $(TZS) 837ba2b2efdSGlen Barber 838ba2b2efdSGlen Barberlibtz.a: $(LIBOBJS) 839e350c46aSBaptiste Daroussin rm -f $@ 840eebb9c2cSPhilip Paeps $(AR) $(ARFLAGS) $@ $(LIBOBJS) 841ba2b2efdSGlen Barber $(RANLIB) $@ 842ba2b2efdSGlen Barber 843ba2b2efdSGlen Barberdate: $(DATEOBJS) 844ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 845ba2b2efdSGlen Barber 846ba2b2efdSGlen Barbertzselect: tzselect.ksh version 847*e273650fSPhilip Paeps read -r VERSION <version && sed \ 848eebb9c2cSPhilip Paeps -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 849eebb9c2cSPhilip Paeps -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 850eebb9c2cSPhilip Paeps -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 851eebb9c2cSPhilip Paeps -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 852eebb9c2cSPhilip Paeps -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 853eebb9c2cSPhilip Paeps -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 854ba2b2efdSGlen Barber <$@.ksh >$@.out 855ba2b2efdSGlen Barber chmod +x $@.out 856ba2b2efdSGlen Barber mv $@.out $@ 857ba2b2efdSGlen Barber 858*e273650fSPhilip Paepscheck: check_mild back.ck 859*e273650fSPhilip Paepscheck_mild: check_web check_zishrink \ 860*e273650fSPhilip Paeps character-set.ck white-space.ck links.ck mainguard.ck \ 861*e273650fSPhilip Paeps name-lengths.ck now.ck slashed-abbrs.ck sorted.ck \ 862*e273650fSPhilip Paeps tables.ck ziguard.ck tzs.ck 863ba2b2efdSGlen Barber 864eebb9c2cSPhilip Paeps# True if UTF8_LOCALE does not work; 865eebb9c2cSPhilip Paeps# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 866eebb9c2cSPhilip PaepsUTF8_LOCALE_MISSING = \ 867eebb9c2cSPhilip Paeps { test ! '$(UTF8_LOCALE)' \ 868eebb9c2cSPhilip Paeps || ! printf 'A\304\200B\n' \ 869eebb9c2cSPhilip Paeps | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 870*e273650fSPhilip Paeps || { export LC_ALL='$(UTF8_LOCALE)'; false; }; } 871eebb9c2cSPhilip Paeps 872*e273650fSPhilip Paepscharacter-set.ck: $(ENCHILADA) 873eebb9c2cSPhilip Paeps $(UTF8_LOCALE_MISSING) || { \ 874ba2b2efdSGlen Barber sharp='#' && \ 875ba2b2efdSGlen Barber ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 876ba2b2efdSGlen Barber $(MISC) $(SOURCES) $(WEB_PAGES) \ 87793d120dbSPhilip Paeps CONTRIBUTING LICENSE README SECURITY \ 8788d7edd17SPhilip Paeps version tzdata.zi && \ 87989abb9f8SPhilip Paeps ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 88046bee4edSPhilip Paeps Makefile && \ 881afb91be3SPhilip Paeps ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 88212a899b6SPhilip Paeps leapseconds zone.tab && \ 8838d7edd17SPhilip Paeps ! grep -Env $(OK_LINE) $(ENCHILADA); \ 8848d7edd17SPhilip Paeps } 88589abb9f8SPhilip Paeps touch $@ 886ba2b2efdSGlen Barber 887*e273650fSPhilip Paepswhite-space.ck: $(ENCHILADA) 888eebb9c2cSPhilip Paeps $(UTF8_LOCALE_MISSING) || { \ 889*e273650fSPhilip Paeps enchilada='$(ENCHILADA)' && \ 890*e273650fSPhilip Paeps patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \ 891eebb9c2cSPhilip Paeps ! grep -En "$$pat|[$s]\$$" \ 892*e273650fSPhilip Paeps $${enchilada%leap-seconds.list*} \ 893*e273650fSPhilip Paeps $${enchilada#*leap-seconds.list}; \ 894eebb9c2cSPhilip Paeps } 89589abb9f8SPhilip Paeps touch $@ 896ba2b2efdSGlen Barber 8979f9fc6bbSPhilip PaepsPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 8989f9fc6bbSPhilip PaepsFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 8998d7edd17SPhilip Paeps 900*e273650fSPhilip Paepsname-lengths.ck: $(TDATA_TO_CHECK) backzone 901*e273650fSPhilip Paeps :;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 902afb91be3SPhilip Paeps $(TDATA_TO_CHECK) backzone 90389abb9f8SPhilip Paeps touch $@ 9048d7edd17SPhilip Paeps 905*e273650fSPhilip Paepsmainguard.ck: main.zi 906*e273650fSPhilip Paeps test '$(PACKRATLIST)' || \ 907*e273650fSPhilip Paeps cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi 908*e273650fSPhilip Paeps touch $@ 909*e273650fSPhilip Paeps 9109f9fc6bbSPhilip PaepsPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 9119f9fc6bbSPhilip PaepsSTDOFF = [-+]?[0-9:.]+ 9129f9fc6bbSPhilip PaepsRULELESS_SAVE = (-|$(STDOFF)[sd]?) 9139f9fc6bbSPhilip PaepsRULELESS_SLASHED_ABBRS = \ 9149f9fc6bbSPhilip Paeps $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 9159f9fc6bbSPhilip Paeps 916*e273650fSPhilip Paepsslashed-abbrs.ck: $(TDATA_TO_CHECK) 917*e273650fSPhilip Paeps :;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 9189f9fc6bbSPhilip Paeps touch $@ 9199f9fc6bbSPhilip Paeps 920ba2b2efdSGlen BarberCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 921ba2b2efdSGlen Barber 922*e273650fSPhilip Paepssorted.ck: backward backzone 923cf1ad535SPhilip Paeps $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 9249142a2a3SPhilip Paeps backward | LC_ALL=C sort -cu 925*e273650fSPhilip Paeps $(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu 92689abb9f8SPhilip Paeps touch $@ 927ba2b2efdSGlen Barber 928*e273650fSPhilip Paepsback.ck: checklinks.awk $(TDATA_TO_CHECK) 9299142a2a3SPhilip Paeps $(AWK) \ 9309142a2a3SPhilip Paeps -v DATAFORM=$(DATAFORM) \ 9319142a2a3SPhilip Paeps -v backcheck=backward \ 9329142a2a3SPhilip Paeps -f checklinks.awk $(TDATA_TO_CHECK) 933cf1ad535SPhilip Paeps touch $@ 934cf1ad535SPhilip Paeps 935*e273650fSPhilip Paepslinks.ck: checklinks.awk tzdata.zi 9369142a2a3SPhilip Paeps $(AWK) \ 9379142a2a3SPhilip Paeps -v DATAFORM=$(DATAFORM) \ 9389142a2a3SPhilip Paeps -f checklinks.awk tzdata.zi 93989abb9f8SPhilip Paeps touch $@ 940ba2b2efdSGlen Barber 941eebb9c2cSPhilip Paeps# Check timestamps from now through 28 years from now, to make sure 942eebb9c2cSPhilip Paeps# that zonenow.tab contains all sequences of planned timestamps, 943eebb9c2cSPhilip Paeps# without any duplicate sequences. In theory this might require 944*e273650fSPhilip Paeps# 2800+ years but that would take a long time to check. 945*e273650fSPhilip PaepsCHECK_NOW_TIMESTAMP = $$(./date +%s) 946eebb9c2cSPhilip PaepsCHECK_NOW_FUTURE_YEARS = 28 947*e273650fSPhilip PaepsCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) * 366 * 24 * 60 * 60 948*e273650fSPhilip Paepsnow.ck: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 949*e273650fSPhilip Paeps rm -fr $@d 950*e273650fSPhilip Paeps mkdir $@d 951*e273650fSPhilip Paeps ./zic -d $@d tzdata.zi 952eebb9c2cSPhilip Paeps now=$(CHECK_NOW_TIMESTAMP) && \ 953*e273650fSPhilip Paeps future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \ 954eebb9c2cSPhilip Paeps ./zdump -i -t $$now,$$future \ 955*e273650fSPhilip Paeps $$(find "$$PWD/$@d"/????*/ -type f) \ 956*e273650fSPhilip Paeps >$@d/zdump-now.tab && \ 957*e273650fSPhilip Paeps ./zdump -i -t 0,$$future \ 958*e273650fSPhilip Paeps $$(find "$$PWD/$@d" -name Etc -prune \ 959*e273650fSPhilip Paeps -o -type f ! -name '*.tab' -print) \ 960*e273650fSPhilip Paeps >$@d/zdump-1970.tab 961eebb9c2cSPhilip Paeps $(AWK) \ 962*e273650fSPhilip Paeps -v zdump_table=$@d/zdump-now.tab \ 963eebb9c2cSPhilip Paeps -f checknow.awk zonenow.tab 964*e273650fSPhilip Paeps $(AWK) \ 965*e273650fSPhilip Paeps 'BEGIN {print "-\t-\tUTC"} /^Zone/ {print "-\t-\t" $$2}' \ 966*e273650fSPhilip Paeps $(PRIMARY_YDATA) backward factory | \ 967*e273650fSPhilip Paeps $(AWK) \ 968*e273650fSPhilip Paeps -v zdump_table=$@d/zdump-1970.tab \ 969*e273650fSPhilip Paeps -f checknow.awk 970*e273650fSPhilip Paeps rm -fr $@d 971eebb9c2cSPhilip Paeps touch $@ 972eebb9c2cSPhilip Paeps 973*e273650fSPhilip Paepstables.ck: checktab.awk $(YDATA) backward zone.tab zone1970.tab 974ba2b2efdSGlen Barber for tab in $(ZONETABLES); do \ 97594c2d487SPhilip Paeps test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 97694c2d487SPhilip Paeps $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 977ba2b2efdSGlen Barber || exit; \ 978ba2b2efdSGlen Barber done 97989abb9f8SPhilip Paeps touch $@ 980ba2b2efdSGlen Barber 981*e273650fSPhilip Paepstzs.ck: $(TZS) $(TZS_NEW) 98289abb9f8SPhilip Paeps if test -s $(TZS); then \ 983*e273650fSPhilip Paeps $(SETUP_DIFF_TZS) && $$DIFF_TZS $(TZS) $(TZS_NEW); \ 98489abb9f8SPhilip Paeps else \ 98589abb9f8SPhilip Paeps cp $(TZS_NEW) $(TZS); \ 98689abb9f8SPhilip Paeps fi 98789abb9f8SPhilip Paeps touch $@ 988ba2b2efdSGlen Barber 9892c5e84ccSPhilip Paepscheck_web: $(CHECK_WEB_PAGES) 990*e273650fSPhilip Paeps.SUFFIXES: .ck .html 991*e273650fSPhilip Paeps.html.ck: 992*e273650fSPhilip Paeps { ! ($(CURL) --version) >/dev/null 2>&1 || \ 9932c5e84ccSPhilip Paeps $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 994*e273650fSPhilip Paeps -F file=@$<; } >$@.out && \ 9952c5e84ccSPhilip Paeps test ! -s $@.out || { cat $@.out; exit 1; } 9962c5e84ccSPhilip Paeps mv $@.out $@ 9978d7edd17SPhilip Paeps 998*e273650fSPhilip Paepsziguard.ck: rearguard.zi vanguard.zi ziguard.awk 9999f9fc6bbSPhilip Paeps $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 10009f9fc6bbSPhilip Paeps diff -u rearguard.zi - 10019f9fc6bbSPhilip Paeps $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 10029f9fc6bbSPhilip Paeps diff -u vanguard.zi - 10039f9fc6bbSPhilip Paeps touch $@ 10049f9fc6bbSPhilip Paeps 100546bee4edSPhilip Paeps# Check that zishrink.awk does not alter the data, and that ziguard.awk 100646bee4edSPhilip Paeps# preserves main-format data. 1007*e273650fSPhilip Paepscheck_zishrink: zishrink-posix.ck zishrink-right.ck 1008*e273650fSPhilip Paepszishrink-posix.ck zishrink-right.ck: \ 10099f9fc6bbSPhilip Paeps zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 10109f9fc6bbSPhilip Paeps $(TDATA) $(DATAFORM).zi tzdata.zi 1011*e273650fSPhilip Paeps rm -fr $@d t-$@d shrunk-$@d 1012*e273650fSPhilip Paeps mkdir $@d t-$@d shrunk-$@d 101389abb9f8SPhilip Paeps case $@ in \ 1014*e273650fSPhilip Paeps *right*) leap='-L leapseconds';; \ 10158d7edd17SPhilip Paeps *) leap=;; \ 10168d7edd17SPhilip Paeps esac && \ 1017*e273650fSPhilip Paeps $(ZIC) $$leap -d $@d $(DATAFORM).zi && \ 1018*e273650fSPhilip Paeps $(ZIC) $$leap -d shrunk-$@d tzdata.zi && \ 10199f9fc6bbSPhilip Paeps case $(DATAFORM),$(PACKRATLIST) in \ 10209f9fc6bbSPhilip Paeps main,) \ 1021*e273650fSPhilip Paeps $(ZIC) $$leap -d t-$@d $(TDATA) && \ 10228d7edd17SPhilip Paeps $(AWK) '/^Rule/' $(TDATA) | \ 1023*e273650fSPhilip Paeps $(ZIC) $$leap -d t-$@d - $(PACKRATDATA) && \ 1024*e273650fSPhilip Paeps diff -r $@d t-$@d;; \ 102589abb9f8SPhilip Paeps esac 1026*e273650fSPhilip Paeps diff -r $@d shrunk-$@d 1027*e273650fSPhilip Paeps rm -fr $@d t-$@d shrunk-$@d 102889abb9f8SPhilip Paeps touch $@ 1029ba2b2efdSGlen Barber 1030ba2b2efdSGlen Barberclean_misc: 1031*e273650fSPhilip Paeps rm -fr *.ckd *.dir 1032*e273650fSPhilip Paeps rm -f *.ck *.core *.o *.out core core.* \ 1033eebb9c2cSPhilip Paeps date tzdir.h tzselect version.h zdump zic libtz.a 1034ba2b2efdSGlen Barberclean: clean_misc 1035*e273650fSPhilip Paeps rm -fr tzdb-*/ 1036ad48359aSPhilip Paeps rm -f *.zi $(TZS_NEW) 1037ba2b2efdSGlen Barber 1038ba2b2efdSGlen Barbermaintainer-clean: clean 1039ba2b2efdSGlen Barber @echo 'This command is intended for maintainers to use; it' 1040ba2b2efdSGlen Barber @echo 'deletes files that may need special tools to rebuild.' 1041ba2b2efdSGlen Barber rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 1042ba2b2efdSGlen Barber 1043ba2b2efdSGlen Barbernames: 1044ba2b2efdSGlen Barber @echo $(ENCHILADA) 1045ba2b2efdSGlen Barber 1046*e273650fSPhilip Paepspublic: check public.ck $(CHECK_TIME_T_ALTERNATIVES) \ 1047ba2b2efdSGlen Barber tarballs signatures 1048ba2b2efdSGlen Barber 1049ba2b2efdSGlen Barberdate.1.txt: date.1 1050ba2b2efdSGlen Barbernewctime.3.txt: newctime.3 1051ba2b2efdSGlen Barbernewstrftime.3.txt: newstrftime.3 1052ba2b2efdSGlen Barbernewtzset.3.txt: newtzset.3 1053ba2b2efdSGlen Barbertime2posix.3.txt: time2posix.3 1054ba2b2efdSGlen Barbertzfile.5.txt: tzfile.5 1055ba2b2efdSGlen Barbertzselect.8.txt: tzselect.8 1056ba2b2efdSGlen Barberzdump.8.txt: zdump.8 1057ba2b2efdSGlen Barberzic.8.txt: zic.8 1058ba2b2efdSGlen Barber 1059ba2b2efdSGlen Barber$(MANTXTS): workman.sh 1060*e273650fSPhilip Paeps LC_ALL=C sh workman.sh $(@:.txt=) >$@.out 1061ba2b2efdSGlen Barber mv $@.out $@ 1062ba2b2efdSGlen Barber 1063dc505d53SPhilip Paeps# Set file timestamps deterministically if possible, 1064dc505d53SPhilip Paeps# so that tarballs containing the timestamps are reproducible. 1065dc505d53SPhilip Paeps# 1066dc505d53SPhilip Paeps# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 1067dc505d53SPhilip Paeps# file DEST to the maximum of the timestamps of the files A B C ..., 1068dc505d53SPhilip Paeps# plus N if GNU ls and touch are available. 1069dc505d53SPhilip PaepsSET_TIMESTAMP_N = sh -c '\ 1070dc505d53SPhilip Paeps n=$$0 dest=$$1; shift; \ 1071eebb9c2cSPhilip Paeps <"$$dest" && \ 1072dc505d53SPhilip Paeps if test $$n != 0 && \ 1073*e273650fSPhilip Paeps lsout=$$(ls -nt --time-style="+%s" "$$@" 2>/dev/null); then \ 1074dc505d53SPhilip Paeps set x $$lsout && \ 1075*e273650fSPhilip Paeps timestamp=$$(($$7 + $$n)) && \ 1076eebb9c2cSPhilip Paeps echo "+ touch -md @$$timestamp $$dest" && \ 1077eebb9c2cSPhilip Paeps touch -md @$$timestamp "$$dest"; \ 1078eebb9c2cSPhilip Paeps else \ 1079*e273650fSPhilip Paeps newest=$$(ls -t "$$@" | sed 1q) && \ 1080eebb9c2cSPhilip Paeps echo "+ touch -mr $$newest $$dest" && \ 1081eebb9c2cSPhilip Paeps touch -mr "$$newest" "$$dest"; \ 1082eebb9c2cSPhilip Paeps fi' 1083dc505d53SPhilip Paeps# If DEST depends on A B C ... in this Makefile, callers should use 1084dc505d53SPhilip Paeps# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 1085dc505d53SPhilip Paeps# downstream 'make' that considers equal timestamps to be out of date. 1086dc505d53SPhilip Paeps# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 1087dc505d53SPhilip Paeps# If all that matters is that the timestamp be reproducible 1088dc505d53SPhilip Paeps# and plausible, use $(SET_TIMESTAMP). 1089dc505d53SPhilip PaepsSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 1090dc505d53SPhilip PaepsSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 1091dc505d53SPhilip Paeps 1092ba2b2efdSGlen Barber# Set the timestamps to those of the git repository, if available, 1093ba2b2efdSGlen Barber# and if the files have not changed since then. 1094dc505d53SPhilip Paeps# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 1095dc505d53SPhilip Paeps# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 1096dc505d53SPhilip Paeps# If git or GNU is absent, don't bother to sync with git timestamps. 1097ba2b2efdSGlen Barber# Also, set the timestamp of each prebuilt file like 'leapseconds' 1098ba2b2efdSGlen Barber# to be the maximum of the files it depends on. 109989abb9f8SPhilip Paepsset-timestamps.out: $(EIGHT_YARDS) 1100ba2b2efdSGlen Barber rm -f $@ 1101ba2b2efdSGlen Barber if (type git) >/dev/null 2>&1 && \ 1102*e273650fSPhilip Paeps files=$$(git ls-files $(EIGHT_YARDS)) && \ 1103ba2b2efdSGlen Barber touch -md @1 test.out; then \ 1104ba2b2efdSGlen Barber rm -f test.out && \ 1105ba2b2efdSGlen Barber for file in $$files; do \ 1106ba2b2efdSGlen Barber if git diff --quiet $$file; then \ 1107*e273650fSPhilip Paeps time=$$(TZ=UTC0 git log -1 \ 1108eebb9c2cSPhilip Paeps --format='tformat:%cd' \ 1109eebb9c2cSPhilip Paeps --date='format:%Y-%m-%dT%H:%M:%SZ' \ 1110*e273650fSPhilip Paeps $$file) && \ 1111eebb9c2cSPhilip Paeps echo "+ touch -md $$time $$file" && \ 1112eebb9c2cSPhilip Paeps touch -md $$time $$file; \ 1113ba2b2efdSGlen Barber else \ 1114ba2b2efdSGlen Barber echo >&2 "$$file: warning: does not match repository"; \ 1115ba2b2efdSGlen Barber fi || exit; \ 1116ba2b2efdSGlen Barber done; \ 1117ba2b2efdSGlen Barber fi 1118dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 1119*e273650fSPhilip Paeps for file in $(MANTXTS); do \ 1120*e273650fSPhilip Paeps $(SET_TIMESTAMP_DEP) $$file $${file%.txt} workman.sh || \ 1121ba2b2efdSGlen Barber exit; \ 1122ba2b2efdSGlen Barber done 1123dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 1124dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 1125ba2b2efdSGlen Barber touch $@ 112689abb9f8SPhilip Paepsset-tzs-timestamp.out: $(TZS) 1127dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 112889abb9f8SPhilip Paeps touch $@ 1129ba2b2efdSGlen Barber 1130ba2b2efdSGlen Barber# The zics below ensure that each data file can stand on its own. 1131ba2b2efdSGlen Barber# We also do an all-files run to catch links to links. 1132ba2b2efdSGlen Barber 1133*e273650fSPhilip Paepspublic.ck: $(VERSION_DEPS) 1134*e273650fSPhilip Paeps rm -fr $@d 1135*e273650fSPhilip Paeps mkdir $@d 1136*e273650fSPhilip Paeps ln $(VERSION_DEPS) $@d 1137*e273650fSPhilip Paeps cd $@d \ 1138eebb9c2cSPhilip Paeps && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 1139*e273650fSPhilip Paeps for i in $(TDATA_TO_CHECK) \ 1140*e273650fSPhilip Paeps tzdata.zi vanguard.zi main.zi rearguard.zi; \ 1141e35a01eeSPhilip Paeps do \ 1142*e273650fSPhilip Paeps $@d/zic -v -d $@d/zoneinfo $@d/$$i || exit; \ 114389abb9f8SPhilip Paeps done 1144*e273650fSPhilip Paeps $@d/zic -v -d $@d/zoneinfo-all $(TDATA_TO_CHECK) 114594c2d487SPhilip Paeps : 114694c2d487SPhilip Paeps : Also check 'backzone' syntax. 1147*e273650fSPhilip Paeps rm $@d/main.zi 1148*e273650fSPhilip Paeps cd $@d && $(MAKE) PACKRATDATA=backzone main.zi 1149*e273650fSPhilip Paeps $@d/zic -d $@d/zoneinfo main.zi 1150*e273650fSPhilip Paeps rm $@d/main.zi 1151*e273650fSPhilip Paeps cd $@d && \ 11529f9fc6bbSPhilip Paeps $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 1153*e273650fSPhilip Paeps $@d/zic -d $@d/zoneinfo main.zi 115494c2d487SPhilip Paeps : 1155*e273650fSPhilip Paeps rm -fr $@d 115689abb9f8SPhilip Paeps touch $@ 1157ba2b2efdSGlen Barber 1158ba2b2efdSGlen Barber# Check that the code works under various alternative 1159ba2b2efdSGlen Barber# implementations of time_t. 116089abb9f8SPhilip Paepscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES) 116189abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 116289abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 1163*e273650fSPhilip Paeps rm -fr $@d 1164*e273650fSPhilip Paeps mkdir $@d 1165*e273650fSPhilip Paeps ln $(VERSION_DEPS) $@d 116689abb9f8SPhilip Paeps case $@ in \ 1167*e273650fSPhilip Paeps *32_t*) range=-2147483648,2147483648;; \ 116889abb9f8SPhilip Paeps u*) range=0,4294967296;; \ 116989abb9f8SPhilip Paeps *) range=-4294967296,4294967296;; \ 117089abb9f8SPhilip Paeps esac && \ 1171*e273650fSPhilip Paeps wd=$$PWD && \ 1172*e273650fSPhilip Paeps zones=$$($(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab) && \ 117389abb9f8SPhilip Paeps if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 117489abb9f8SPhilip Paeps range_target=; \ 117589abb9f8SPhilip Paeps else \ 117689abb9f8SPhilip Paeps range_target=to$$range.tzs; \ 117789abb9f8SPhilip Paeps fi && \ 1178*e273650fSPhilip Paeps (cd $@d && \ 1179*e273650fSPhilip Paeps $(MAKE) TOPDIR="$$wd/$@d" \ 1180*e273650fSPhilip Paeps CFLAGS='$(CFLAGS) -Dtime_tz='"'$(@:.ck=)'" \ 118189abb9f8SPhilip Paeps REDO='$(REDO)' \ 1182*e273650fSPhilip Paeps D="$$wd/$@d" \ 118389abb9f8SPhilip Paeps TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 118489abb9f8SPhilip Paeps install $$range_target) && \ 118589abb9f8SPhilip Paeps test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 1186*e273650fSPhilip Paeps (cd $(TIME_T_ALTERNATIVES_HEAD)d && \ 1187*e273650fSPhilip Paeps $(MAKE) TOPDIR="$$wd/$@d" \ 118889abb9f8SPhilip Paeps TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 1189*e273650fSPhilip Paeps D="$$wd/$@d" \ 119089abb9f8SPhilip Paeps to$$range.tzs) && \ 1191*e273650fSPhilip Paeps $(SETUP_DIFF_TZS) && \ 1192*e273650fSPhilip Paeps $$DIFF_TZS $(TIME_T_ALTERNATIVES_HEAD)d/to$$range.tzs \ 1193*e273650fSPhilip Paeps $@d/to$$range.tzs && \ 1194ba2b2efdSGlen Barber if diff -q Makefile Makefile 2>/dev/null; then \ 1195ba2b2efdSGlen Barber quiet_option='-q'; \ 1196ba2b2efdSGlen Barber else \ 1197ba2b2efdSGlen Barber quiet_option=''; \ 1198ba2b2efdSGlen Barber fi && \ 1199*e273650fSPhilip Paeps diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD)d/etc \ 1200*e273650fSPhilip Paeps $@d/etc && \ 1201ba2b2efdSGlen Barber diff $$quiet_option -r \ 1202*e273650fSPhilip Paeps $(TIME_T_ALTERNATIVES_HEAD)d/usr/share \ 1203*e273650fSPhilip Paeps $@d/usr/share; \ 120489abb9f8SPhilip Paeps } 120589abb9f8SPhilip Paeps touch $@ 1206ba2b2efdSGlen Barber 1207d81c2dd9SPhilip PaepsTRADITIONAL_ASC = \ 1208d81c2dd9SPhilip Paeps tzcode$(VERSION).tar.gz.asc \ 1209d81c2dd9SPhilip Paeps tzdata$(VERSION).tar.gz.asc 121089abb9f8SPhilip PaepsREARGUARD_ASC = \ 121189abb9f8SPhilip Paeps tzdata$(VERSION)-rearguard.tar.gz.asc 121289abb9f8SPhilip PaepsALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 1213d81c2dd9SPhilip Paeps tzdb-$(VERSION).tar.lz.asc 1214d81c2dd9SPhilip Paeps 12159f9fc6bbSPhilip Paepstarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 121689abb9f8SPhilip Paepssignatures rearguard_signatures traditional_signatures: \ 12179f9fc6bbSPhilip Paeps version set-timestamps.out rearguard.zi vanguard.zi 1218*e273650fSPhilip Paeps read -r VERSION <version && \ 1219dc505d53SPhilip Paeps $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 1220ba2b2efdSGlen Barber 122146bee4edSPhilip Paeps# These *_version rules are intended for use if VERSION is set by some 122246bee4edSPhilip Paeps# other means. Ordinarily these rules are used only by the above 122346bee4edSPhilip Paeps# non-_version rules, which set VERSION on the 'make' command line. 122489abb9f8SPhilip Paepstarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 1225d81c2dd9SPhilip Paeps tzdb-$(VERSION).tar.lz 122689abb9f8SPhilip Paepsrearguard_tarballs_version: \ 122789abb9f8SPhilip Paeps tzdata$(VERSION)-rearguard.tar.gz 1228ba2b2efdSGlen Barbertraditional_tarballs_version: \ 1229ba2b2efdSGlen Barber tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 12309f9fc6bbSPhilip Paepstailored_tarballs_version: \ 12319f9fc6bbSPhilip Paeps tzdata$(VERSION)-tailored.tar.gz 1232d81c2dd9SPhilip Paepssignatures_version: $(ALL_ASC) 123389abb9f8SPhilip Paepsrearguard_signatures_version: $(REARGUARD_ASC) 1234d81c2dd9SPhilip Paepstraditional_signatures_version: $(TRADITIONAL_ASC) 1235ba2b2efdSGlen Barber 1236ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz: set-timestamps.out 1237*e273650fSPhilip Paeps $(SETUP_TAR) && \ 1238*e273650fSPhilip Paeps $$TAR -cf - \ 1239ba2b2efdSGlen Barber $(COMMON) $(DOCS) $(SOURCES) | \ 1240ba2b2efdSGlen Barber gzip $(GZIPFLAGS) >$@.out 1241ba2b2efdSGlen Barber mv $@.out $@ 1242ba2b2efdSGlen Barber 1243ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz: set-timestamps.out 1244*e273650fSPhilip Paeps $(SETUP_TAR) && \ 1245*e273650fSPhilip Paeps $$TAR -cf - $(TZDATA_DIST) | \ 1246ba2b2efdSGlen Barber gzip $(GZIPFLAGS) >$@.out 1247ba2b2efdSGlen Barber mv $@.out $@ 1248ba2b2efdSGlen Barber 12499f9fc6bbSPhilip Paeps# Create empty files with a reproducible timestamp. 12509f9fc6bbSPhilip PaepsCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 12519f9fc6bbSPhilip Paeps 12529f9fc6bbSPhilip Paeps# The obsolescent *rearguard* targets and related macros are present 12539f9fc6bbSPhilip Paeps# for backwards compatibility with tz releases 2018e through 2022a. 12549f9fc6bbSPhilip Paeps# They should go away eventually. To build rearguard tarballs you 12559f9fc6bbSPhilip Paeps# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 1256d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 12579f9fc6bbSPhilip Paeps rm -fr $@.dir 12589f9fc6bbSPhilip Paeps mkdir $@.dir 12599f9fc6bbSPhilip Paeps ln $(TZDATA_DIST) $@.dir 12609f9fc6bbSPhilip Paeps cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 1261d81c2dd9SPhilip Paeps for f in $(TDATA) $(PACKRATDATA); do \ 12629f9fc6bbSPhilip Paeps rearf=$@.dir/$$f; \ 1263d81c2dd9SPhilip Paeps $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 1264dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 1265d81c2dd9SPhilip Paeps done 12669f9fc6bbSPhilip Paeps sed '1s/$$/-rearguard/' <version >$@.dir/version 1267e7e2d659SPhilip Paeps : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12689f9fc6bbSPhilip Paeps $(CREATE_EMPTY) $@.dir/pacificnew 1269eebb9c2cSPhilip Paeps touch -mr version $@.dir/version 1270*e273650fSPhilip Paeps $(SETUP_TAR) && \ 12719f9fc6bbSPhilip Paeps (cd $@.dir && \ 1272*e273650fSPhilip Paeps $$TAR -cf - \ 12739f9fc6bbSPhilip Paeps $(TZDATA_DIST) pacificnew | \ 1274d81c2dd9SPhilip Paeps gzip $(GZIPFLAGS)) >$@.out 1275d81c2dd9SPhilip Paeps mv $@.out $@ 1276d81c2dd9SPhilip Paeps 12779f9fc6bbSPhilip Paeps# Create a tailored tarball suitable for TZUpdater and compatible tools. 12789f9fc6bbSPhilip Paeps# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 12799f9fc6bbSPhilip Paeps# useful for testing whether TZUpdater supports vanguard form. 12809f9fc6bbSPhilip Paeps# The generated tarball is not byte-for-byte equivalent to a hand-tailored 12819f9fc6bbSPhilip Paeps# traditional tarball, as data entries are put into 'etcetera' even if they 12829f9fc6bbSPhilip Paeps# came from some other source file. However, the effect should be the same 12839f9fc6bbSPhilip Paeps# for ordinary use, which reads all the source files. 12849f9fc6bbSPhilip Paepstzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 12859f9fc6bbSPhilip Paeps rm -fr $@.dir 12869f9fc6bbSPhilip Paeps mkdir $@.dir 12879f9fc6bbSPhilip Paeps : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 1288*e273650fSPhilip Paeps if test $(DATAFORM) = vanguard; then \ 1289*e273650fSPhilip Paeps pacificnew=; \ 1290*e273650fSPhilip Paeps else \ 1291*e273650fSPhilip Paeps pacificnew=pacificnew; \ 1292*e273650fSPhilip Paeps fi && \ 12939f9fc6bbSPhilip Paeps cd $@.dir && \ 12949f9fc6bbSPhilip Paeps $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 1295*e273650fSPhilip Paeps $$pacificnew 12969f9fc6bbSPhilip Paeps (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 12979f9fc6bbSPhilip Paeps >$@.dir/etcetera 1298eebb9c2cSPhilip Paeps touch -mr tzdata.zi $@.dir/etcetera 12999f9fc6bbSPhilip Paeps sed -n \ 13009f9fc6bbSPhilip Paeps -e '/^# *version *\(.*\)/h' \ 13019f9fc6bbSPhilip Paeps -e '/^# *ddeps */H' \ 13029f9fc6bbSPhilip Paeps -e '$$!d' \ 13039f9fc6bbSPhilip Paeps -e 'g' \ 13049f9fc6bbSPhilip Paeps -e 's/^# *version *//' \ 13059f9fc6bbSPhilip Paeps -e 's/\n# *ddeps */-/' \ 13069f9fc6bbSPhilip Paeps -e 's/ /-/g' \ 13079f9fc6bbSPhilip Paeps -e 'p' \ 13089f9fc6bbSPhilip Paeps <tzdata.zi >$@.dir/version 1309eebb9c2cSPhilip Paeps touch -mr version $@.dir/version 13109f9fc6bbSPhilip Paeps links= && \ 13119f9fc6bbSPhilip Paeps for file in $(TZDATA_DIST); do \ 13129f9fc6bbSPhilip Paeps test -f $@.dir/$$file || links="$$links $$file"; \ 13139f9fc6bbSPhilip Paeps done && \ 13149f9fc6bbSPhilip Paeps ln $$links $@.dir 1315*e273650fSPhilip Paeps $(SETUP_TAR) && \ 13169f9fc6bbSPhilip Paeps (cd $@.dir && \ 1317*e273650fSPhilip Paeps $$TAR -cf - * | gzip $(GZIPFLAGS)) >$@.out 13189f9fc6bbSPhilip Paeps mv $@.out $@ 13199f9fc6bbSPhilip Paeps 132089abb9f8SPhilip Paepstzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 1321ba2b2efdSGlen Barber rm -fr tzdb-$(VERSION) 1322ba2b2efdSGlen Barber mkdir tzdb-$(VERSION) 1323ba2b2efdSGlen Barber ln $(ENCHILADA) tzdb-$(VERSION) 1324dc505d53SPhilip Paeps $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 1325*e273650fSPhilip Paeps $(SETUP_TAR) && \ 1326*e273650fSPhilip Paeps $$TAR -cf - tzdb-$(VERSION) | lzip -9 >$@.out 1327ba2b2efdSGlen Barber mv $@.out $@ 1328ba2b2efdSGlen Barber 1329ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 1330ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 1331d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 1332ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 1333d81c2dd9SPhilip Paeps$(ALL_ASC): 13342865ab3fSPhilip Paeps $(GPG) --armor --detach-sign $? 1335ba2b2efdSGlen Barber 133689abb9f8SPhilip PaepsTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 1337*e273650fSPhilip Paepstypecheck: long-long.ck unsigned.ck 1338*e273650fSPhilip Paepslong-long.ck unsigned.ck: $(VERSION_DEPS) 1339*e273650fSPhilip Paeps rm -fr $@d 1340*e273650fSPhilip Paeps mkdir $@d 1341*e273650fSPhilip Paeps ln $(VERSION_DEPS) $@d 1342*e273650fSPhilip Paeps cd $@d && \ 134389abb9f8SPhilip Paeps case $@ in \ 1344*e273650fSPhilip Paeps long-long.*) i="long long";; \ 1345*e273650fSPhilip Paeps unsigned.* ) i="unsigned" ;; \ 134689abb9f8SPhilip Paeps esac && \ 134789abb9f8SPhilip Paeps $(MAKE) \ 134889abb9f8SPhilip Paeps CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 1349*e273650fSPhilip Paeps TOPDIR="$$PWD" \ 135089abb9f8SPhilip Paeps install 1351*e273650fSPhilip Paeps $@d/zdump -i -c 1970,1971 Europe/Rome 135289abb9f8SPhilip Paeps touch $@ 1353ba2b2efdSGlen Barber 13548d7edd17SPhilip Paepszonenames: tzdata.zi 13558d7edd17SPhilip Paeps @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 1356ba2b2efdSGlen Barber 1357ba2b2efdSGlen Barberasctime.o: private.h tzfile.h 1358ba2b2efdSGlen Barberdate.o: private.h 1359ba2b2efdSGlen Barberdifftime.o: private.h 1360eebb9c2cSPhilip Paepslocaltime.o: private.h tzfile.h tzdir.h 1361ba2b2efdSGlen Barberstrftime.o: private.h tzfile.h 1362ba2b2efdSGlen Barberzdump.o: version.h 1363eebb9c2cSPhilip Paepszic.o: private.h tzfile.h tzdir.h version.h 1364ba2b2efdSGlen Barber 1365ba2b2efdSGlen Barber.PHONY: ALL INSTALL all 1366cf1ad535SPhilip Paeps.PHONY: check check_mild check_time_t_alternatives 13672c5e84ccSPhilip Paeps.PHONY: check_web check_zishrink 13682723c7ffSPhilip Paeps.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd 13692723c7ffSPhilip Paeps.PHONY: fetch-leap-seconds.list force_tzs 1370*e273650fSPhilip Paeps.PHONY: install maintainer-clean names 13719f9fc6bbSPhilip Paeps.PHONY: posix_only posix_right public 137289abb9f8SPhilip Paeps.PHONY: rearguard_signatures rearguard_signatures_version 137389abb9f8SPhilip Paeps.PHONY: rearguard_tarballs rearguard_tarballs_version 137489abb9f8SPhilip Paeps.PHONY: right_only right_posix signatures signatures_version 137546bee4edSPhilip Paeps.PHONY: tarballs tarballs_version 137646bee4edSPhilip Paeps.PHONY: traditional_signatures traditional_signatures_version 137746bee4edSPhilip Paeps.PHONY: traditional_tarballs traditional_tarballs_version 13789f9fc6bbSPhilip Paeps.PHONY: tailored_tarballs tailored_tarballs_version 137946bee4edSPhilip Paeps.PHONY: typecheck 1380ba2b2efdSGlen Barber.PHONY: zonenames zones 138146bee4edSPhilip Paeps.PHONY: $(ZDS) 1382