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: 6e273650fSPhilip Paeps# On older platforms you may need to scrounge for POSIX conformance. 7e273650fSPhilip Paeps# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007), 8e273650fSPhilip 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 13e273650fSPhilip Paeps# make CC='gcc -std=gnu23' "$@" 14eebb9c2cSPhilip Paeps# 15e273650fSPhilip Paeps# This example script is appropriate for a circa 2024 GNU/Linux system 16e273650fSPhilip 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 56e273650fSPhilip 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) 135e273650fSPhilip PaepsTIME_T_ALTERNATIVES_HEAD = int_least64_t.ck 136e273650fSPhilip PaepsTIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ 137e273650fSPhilip Paeps uint_least64_t.ck 138ba2b2efdSGlen Barber 139ad48359aSPhilip Paeps# What kind of TZif data files to generate. (TZif is the binary time 140*46226b01SPhilip Paeps# zone data format that zic generates; see Internet RFC 9636.) 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 223e273650fSPhilip 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 234e273650fSPhilip 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 258*46226b01SPhilip Paeps# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow 259eebb9c2cSPhilip Paeps# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ 260eebb9c2cSPhilip Paeps# Typically it is better to use a later standard. For example, 261eebb9c2cSPhilip Paeps# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. 262eebb9c2cSPhilip Paeps# Even with -DPORT_TO_C89, the code needs at least one C99 263eebb9c2cSPhilip Paeps# feature (integers at least 64 bits wide) and maybe more. 26446bee4edSPhilip Paeps# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers 26546bee4edSPhilip Paeps# with external linkage, e.g., applications cannot define 'localtime'. 266*46226b01SPhilip Paeps# -Dssize_t=int on hosts like MS-Windows that lack ssize_t 267e273650fSPhilip Paeps# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers 268e273650fSPhilip Paeps# Although -DSUPPORT_C89=0 might work around latent bugs in callers, 269e273650fSPhilip Paeps# it does not conform to POSIX. 270e273650fSPhilip Paeps# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+ 271e273650fSPhilip Paeps# However, this might cause problems in POSIX.1-2024-or-later callers. 27246bee4edSPhilip Paeps# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has 27346bee4edSPhilip Paeps# security implications and is not recommended for general use 2748d7edd17SPhilip Paeps# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; 275ba2b2efdSGlen Barber# not needed by the main-program tz code, which is single-threaded. 276ba2b2efdSGlen Barber# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. 277ba2b2efdSGlen Barber# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t 2788d7edd17SPhilip Paeps# This is intended for internal use only; it mangles external names. 279ba2b2efdSGlen Barber# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 280ba2b2efdSGlen Barber# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 281ba2b2efdSGlen Barber# the default is system-supplied, typically "/usr/lib/locale" 282ba2b2efdSGlen Barber# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 283e273650fSPhilip Paeps# DST transitions for proleptic format TZ strings lacking them, 284259e2ad7SPhilip Paeps# in the usual case where POSIXRULES is '-'. If not specified, 285259e2ad7SPhilip Paeps# TZDEFRULESTRING defaults to US rules for future DST transitions. 286259e2ad7SPhilip Paeps# This mishandles some past timestamps, as US DST rules have changed. 287259e2ad7SPhilip Paeps# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, 288259e2ad7SPhilip Paeps# as Europe and US DST rules differ. 289*46226b01SPhilip Paeps# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254) 2908d7edd17SPhilip Paeps# -DUNINIT_TRAP if reading uninitialized storage can cause problems 291ba2b2efdSGlen Barber# other than simply getting garbage data 292ba2b2efdSGlen Barber# -DUSE_LTZ=0 to build zdump with the system time zone library 293ba2b2efdSGlen Barber# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. 29412a899b6SPhilip Paeps# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and 29512a899b6SPhilip Paeps# similarly for "slim". Fat TZif files work around incompatibilities 2969142a2a3SPhilip Paeps# and bugs in some TZif readers, notably older ones that 2979142a2a3SPhilip Paeps# ignore or otherwise mishandle 64-bit data in TZif files; 2989142a2a3SPhilip Paeps# however, fat TZif files may trigger bugs in newer TZif readers. 2999142a2a3SPhilip Paeps# Slim TZif files are more efficient, and are the default. 300ba2b2efdSGlen Barber# -DZIC_MAX_ABBR_LEN_WO_WARN=3 301ba2b2efdSGlen Barber# (or some other number) to set the maximum time zone abbreviation length 302ba2b2efdSGlen Barber# that zic will accept without a warning (the default is 6) 303eebb9c2cSPhilip Paeps# -g to generate symbolic debugging info 304eebb9c2cSPhilip Paeps# -Idir to include from directory 'dir' 305eebb9c2cSPhilip Paeps# -O0 to disable optimization; other -O options to enable more optimization 306eebb9c2cSPhilip Paeps# -Uname to remove any definition of the macro 'name' 307ba2b2efdSGlen Barber# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking 3089142a2a3SPhilip Paeps# 3099142a2a3SPhilip Paeps# * Options marked "*" can be omitted if your compiler is C23 compatible. 310259e2ad7SPhilip Paeps# * Options marked "+" are obsolescent and are planned to be removed 311e273650fSPhilip Paeps# once the code assumes C99 or later (say in the year 2029) 312e273650fSPhilip Paeps# and POSIX.1-2024 or later (say in the year 2034). 3139142a2a3SPhilip Paeps# 3148d7edd17SPhilip Paeps# Select instrumentation via "make GCC_INSTRUMENT='whatever'". 3158d7edd17SPhilip PaepsGCC_INSTRUMENT = \ 3168d7edd17SPhilip Paeps -fsanitize=undefined -fsanitize-address-use-after-scope \ 3178d7edd17SPhilip Paeps -fsanitize-undefined-trap-on-error -fstack-protector 31894c2d487SPhilip Paeps# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. 319e273650fSPhilip PaepsGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ 3208d7edd17SPhilip Paeps $(GCC_INSTRUMENT) \ 321ba2b2efdSGlen Barber -Wall -Wextra \ 3228d7edd17SPhilip Paeps -Walloc-size-larger-than=100000 -Warray-bounds=2 \ 323*46226b01SPhilip Paeps -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \ 324*46226b01SPhilip Paeps -Wdate-time \ 3258d7edd17SPhilip Paeps -Wdeclaration-after-statement -Wdouble-promotion \ 326e273650fSPhilip Paeps -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ 3278d7edd17SPhilip Paeps -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ 328cf1ad535SPhilip Paeps -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ 329e273650fSPhilip Paeps -Wmissing-declarations -Wmissing-prototypes \ 330e273650fSPhilip Paeps -Wmissing-variable-declarations -Wnested-externs \ 33194c2d487SPhilip Paeps -Wnull-dereference \ 332ba2b2efdSGlen Barber -Wold-style-definition -Woverlength-strings -Wpointer-arith \ 33394c2d487SPhilip Paeps -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ 33494c2d487SPhilip Paeps -Wstrict-prototypes -Wstringop-overflow=4 \ 335d81c2dd9SPhilip Paeps -Wstringop-truncation -Wsuggest-attribute=cold \ 3368d7edd17SPhilip Paeps -Wsuggest-attribute=const -Wsuggest-attribute=format \ 337d81c2dd9SPhilip Paeps -Wsuggest-attribute=malloc \ 3388d7edd17SPhilip Paeps -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ 339e273650fSPhilip Paeps -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \ 3408d7edd17SPhilip Paeps -Wvariadic-macros -Wvla -Wwrite-strings \ 341*46226b01SPhilip Paeps -Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits 342ba2b2efdSGlen Barber# 343ba2b2efdSGlen Barber# If your system has a "GMT offset" field in its "struct tm"s 344ba2b2efdSGlen Barber# (or if you decide to add such a field in your system's "time.h" file), 345ba2b2efdSGlen Barber# add the name to a define such as 346ba2b2efdSGlen Barber# -DTM_GMTOFF=tm_gmtoff 347ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. If not defined, the code attempts to 348ba2b2efdSGlen Barber# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. 349ba2b2efdSGlen Barber# Similarly, if your system has a "zone abbreviation" field, define 350ba2b2efdSGlen Barber# -DTM_ZONE=tm_zone 3512723c7ffSPhilip Paeps# and define NO_TM_ZONE to suppress any guessing. 352e273650fSPhilip Paeps# Although POSIX.1-2024 requires these fields and they are widely available 353e273650fSPhilip Paeps# on GNU/Linux and BSD systems, some older systems lack them. 354ba2b2efdSGlen Barber# 3558d7edd17SPhilip Paeps# The next batch of options control support for external variables 3568d7edd17SPhilip Paeps# exported by tzcode. In practice these variables are less useful 3578d7edd17SPhilip Paeps# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 3588d7edd17SPhilip Paeps# # 3598d7edd17SPhilip Paeps# # To omit or support the external variable "tzname", add one of: 360dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=0 # do not support "tzname" 361dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 362dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=2 # support and define "tzname" 363e273650fSPhilip Paeps# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988 364e273650fSPhilip Paeps# # and later, its contents are unspecified if you use a geographical TZ 365e273650fSPhilip Paeps# # and the variable is planned to be removed in a future POSIX edition. 3668d7edd17SPhilip Paeps# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 3678d7edd17SPhilip Paeps# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 3688d7edd17SPhilip Paeps# # crashes when combined with some platforms' standard libraries, 3698d7edd17SPhilip Paeps# # presumably due to memory allocation issues. 3708d7edd17SPhilip Paeps# # 3718d7edd17SPhilip Paeps# # To omit or support the external variables "timezone" and "daylight", add 372dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=0 # do not support 373dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=1 # support, and variables are defined by system library 374dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=2 # support and define variables 3752723c7ffSPhilip Paeps# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix 376e273650fSPhilip Paeps# # Systems Group code and are required by POSIX.1-2008 and later (with XSI), 377e273650fSPhilip Paeps# # although their contents are unspecified if you use a geographical TZ 378e273650fSPhilip Paeps# # and the variables are planned to be removed in a future edition of POSIX. 3798d7edd17SPhilip Paeps# # If not defined, the code attempts to guess USG_COMPAT from other macros. 3808d7edd17SPhilip Paeps# # 3818d7edd17SPhilip Paeps# # To support the external variable "altzone", add 382dd5f96c4SPhilip Paeps# # -DALTZONE=0 # do not support 383dd5f96c4SPhilip Paeps# # -DALTZONE=1 # support "altzone", which is defined by system library 384dd5f96c4SPhilip Paeps# # -DALTZONE=2 # support and define "altzone" 3858d7edd17SPhilip Paeps# # to the end of the "CFLAGS=" line; although "altzone" appeared in 3868d7edd17SPhilip Paeps# # System V Release 3.1 it has not been standardized. 387dd5f96c4SPhilip Paeps# # If not defined, the code attempts to guess ALTZONE from other macros. 3888d7edd17SPhilip Paeps# 389ba2b2efdSGlen Barber# If you want functions that were inspired by early versions of X3J11's work, 390ba2b2efdSGlen Barber# add 391ba2b2efdSGlen Barber# -DSTD_INSPIRED 392cf1ad535SPhilip Paeps# to the end of the "CFLAGS=" line. This arranges for the following 393cf1ad535SPhilip Paeps# functions to be added to the time conversion library. 394ba2b2efdSGlen Barber# "offtime" is like "gmtime" except that it accepts a second (long) argument 395ba2b2efdSGlen Barber# that gives an offset to add to the time_t when converting it. 396eebb9c2cSPhilip Paeps# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 397eebb9c2cSPhilip Paeps# "timelocal" is nearly equivalent to "mktime". 398ba2b2efdSGlen Barber# "timeoff" is like "timegm" except that it accepts a second (long) argument 399ba2b2efdSGlen Barber# that gives an offset to use when converting to a time_t. 400eebb9c2cSPhilip Paeps# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 401ba2b2efdSGlen Barber# "posix2time" and "time2posix" are described in an included manual page. 402ba2b2efdSGlen Barber# X3J11's work does not describe any of these functions. 403ba2b2efdSGlen Barber# These functions may well disappear in future releases of the time 404ba2b2efdSGlen Barber# conversion package. 405ba2b2efdSGlen Barber# 406ba2b2efdSGlen Barber# If you don't want functions that were inspired by NetBSD, add 407ba2b2efdSGlen Barber# -DNETBSD_INSPIRED=0 408ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. Otherwise, the functions 409ba2b2efdSGlen Barber# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 410259e2ad7SPhilip Paeps# time library, and if STD_INSPIRED is also defined to nonzero the functions 411ba2b2efdSGlen Barber# "posix2time_z" and "time2posix_z" are added as well. 412ba2b2efdSGlen Barber# The functions ending in "_z" (or "_rz") are like their unsuffixed 413ba2b2efdSGlen Barber# (or suffixed-by-"_r") counterparts, except with an extra first 414ba2b2efdSGlen Barber# argument of opaque type timezone_t that specifies the timezone. 415ba2b2efdSGlen Barber# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 416ba2b2efdSGlen Barber# 417ba2b2efdSGlen Barber# If you want to allocate state structures in localtime, add 418ba2b2efdSGlen Barber# -DALL_STATE 419ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 420ba2b2efdSGlen Barber# 421ba2b2efdSGlen Barber# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 422ba2b2efdSGlen Barber# out by the National Institute of Standards and Technology 423eebb9c2cSPhilip Paeps# which claims to test C and POSIX conformance. If you want to pass PCTS, add 424ba2b2efdSGlen Barber# -DPCTS 425ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. 426ba2b2efdSGlen Barber# 427ba2b2efdSGlen Barber# If you want strict compliance with XPG4 as of 1994-04-09, add 428ba2b2efdSGlen Barber# -DXPG4_1994_04_09 429ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. This causes "strftime" to always return 4308d7edd17SPhilip Paeps# 53 as a week number (rather than 52 or 53) for January days before 4318d7edd17SPhilip Paeps# January's first Monday when a "%V" format is used and January 1 432ba2b2efdSGlen Barber# falls on a Friday, Saturday, or Sunday. 433eebb9c2cSPhilip Paeps# 434eebb9c2cSPhilip Paeps# POSIX says CFLAGS defaults to "-O 1". 435eebb9c2cSPhilip Paeps# Uncomment the following line and edit its contents as needed. 436ba2b2efdSGlen Barber 437eebb9c2cSPhilip Paeps#CFLAGS= -O 1 438ba2b2efdSGlen Barber 439ba2b2efdSGlen Barber 440eebb9c2cSPhilip Paeps# The name of a POSIX-like library archiver, its flags, C compiler, 441eebb9c2cSPhilip Paeps# linker flags, and 'make' utility. Ordinarily the defaults suffice. 442e273650fSPhilip Paeps# The commented-out values are the defaults specified by POSIX.1-2024. 443eebb9c2cSPhilip Paeps#AR = ar 444eebb9c2cSPhilip Paeps#ARFLAGS = -rv 445eebb9c2cSPhilip Paeps#CC = c17 446eebb9c2cSPhilip Paeps#LDFLAGS = 447eebb9c2cSPhilip Paeps#MAKE = make 448ba2b2efdSGlen Barber 4492723c7ffSPhilip Paeps# Where to fetch leap-seconds.list from. 4502723c7ffSPhilip Paepsleaplist_URI = \ 4512723c7ffSPhilip Paeps https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list 4522723c7ffSPhilip Paeps# The file is generated by the IERS Earth Orientation Centre, in Paris. 4532723c7ffSPhilip Paepsleaplist_TZ = Europe/Paris 4542723c7ffSPhilip Paeps 455ba2b2efdSGlen Barber# The zic command and its arguments. 456ba2b2efdSGlen Barber 457ba2b2efdSGlen Barberzic= ./zic 458ba2b2efdSGlen BarberZIC= $(zic) $(ZFLAGS) 459ba2b2efdSGlen Barber 460ad48359aSPhilip Paeps# To shrink the size of installed TZif files, 461ad48359aSPhilip Paeps# append "-r @N" to omit data before N-seconds-after-the-Epoch. 4629142a2a3SPhilip Paeps# To grow the files and work around bugs in older applications, 4639142a2a3SPhilip Paeps# possibly at the expense of introducing bugs in newer ones, 4649142a2a3SPhilip Paeps# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 4652865ab3fSPhilip Paeps# See the zic man page for more about -b and -r. 466ba2b2efdSGlen BarberZFLAGS= 467ba2b2efdSGlen Barber 46889abb9f8SPhilip Paeps# How to use zic to install TZif files. 469ba2b2efdSGlen Barber 470e273650fSPhilip PaepsZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' 471ba2b2efdSGlen Barber 472eebb9c2cSPhilip Paeps# The name of a POSIX-compliant 'awk' on your system. 4738ea5af2bSPhilip Paeps# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 4748ea5af2bSPhilip Paeps# Also, it is better (though not essential) if 'awk' supports UTF-8, 4758ea5af2bSPhilip Paeps# and unfortunately mawk and busybox awk do not support UTF-8. 4768ea5af2bSPhilip Paeps# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 477ba2b2efdSGlen BarberAWK= awk 478ba2b2efdSGlen Barber 479eebb9c2cSPhilip Paeps# The full path name of a POSIX-compliant shell, preferably one that supports 480ba2b2efdSGlen Barber# the Korn shell's 'select' statement as an extension. 481ba2b2efdSGlen Barber# These days, Bash is the most popular. 482ba2b2efdSGlen Barber# It should be OK to set this to /bin/sh, on platforms where /bin/sh 483eebb9c2cSPhilip Paeps# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 484ba2b2efdSGlen Barber# is typically nicer if it works. 485ba2b2efdSGlen BarberKSHELL= /bin/bash 486ba2b2efdSGlen Barber 4872723c7ffSPhilip Paeps# Name of curl <https://curl.haxx.se/>, used for HTML validation 4882723c7ffSPhilip Paeps# and to fetch leap-seconds.list from upstream. 489e273650fSPhilip Paeps# Set CURL=: to disable use of the Internet. 4902c5e84ccSPhilip PaepsCURL= curl 4912c5e84ccSPhilip Paeps 4922865ab3fSPhilip Paeps# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 4932865ab3fSPhilip PaepsGPG= gpg 4942865ab3fSPhilip Paeps 495ba2b2efdSGlen Barber# This expensive test requires USE_LTZ. 496ba2b2efdSGlen Barber# To suppress it, define this macro to be empty. 497ba2b2efdSGlen BarberCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 498ba2b2efdSGlen Barber 499ba2b2efdSGlen Barber# SAFE_CHAR is a regular expression that matches a safe character. 500ba2b2efdSGlen Barber# Some parts of this distribution are limited to safe characters; 501ba2b2efdSGlen Barber# others can use any UTF-8 character. 502ba2b2efdSGlen Barber# For now, the safe characters are a safe subset of ASCII. 503ba2b2efdSGlen Barber# The caller must set the shell variable 'sharp' to the character '#', 504ba2b2efdSGlen Barber# since Makefile macros cannot contain '#'. 505ba2b2efdSGlen Barber# TAB_CHAR is a single tab character, in single quotes. 506ba2b2efdSGlen BarberTAB_CHAR= ' ' 507ba2b2efdSGlen BarberSAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 508ba2b2efdSGlen BarberSAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 509ba2b2efdSGlen BarberSAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 510ba2b2efdSGlen BarberSAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 511ba2b2efdSGlen BarberSAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 512ba2b2efdSGlen Barber 513259e2ad7SPhilip Paeps# These non-alphabetic, non-ASCII printable characters are Latin-1, 514259e2ad7SPhilip Paeps# and so are likely displayable even in editors like XEmacs 21 515259e2ad7SPhilip Paeps# that have limited display capabilities. 516259e2ad7SPhilip PaepsUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 51746bee4edSPhilip Paeps# Non-ASCII non-letters that OK_CHAR allows, as these characters are 51889abb9f8SPhilip Paeps# useful in commentary. 519259e2ad7SPhilip PaepsUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 52046bee4edSPhilip Paeps 5219f9fc6bbSPhilip Paeps# Put this in a bracket expression to match spaces. 5229f9fc6bbSPhilip Paepss = [:space:] 5239f9fc6bbSPhilip Paeps 524ba2b2efdSGlen Barber# OK_CHAR matches any character allowed in the distributed files. 52546bee4edSPhilip Paeps# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 52646bee4edSPhilip Paeps# multibyte letters are also allowed so that commentary can contain a 52746bee4edSPhilip Paeps# few safe symbols and people's names and can quote non-English sources. 52846bee4edSPhilip Paeps# Other non-letters are limited to ASCII renderings for the 52946bee4edSPhilip Paeps# convenience of maintainers using XEmacs 21.5.34, which by default 53046bee4edSPhilip Paeps# mishandles Unicode characters U+0100 and greater. 53146bee4edSPhilip PaepsOK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 532ba2b2efdSGlen Barber 533ba2b2efdSGlen Barber# SAFE_LINE matches a line of safe characters. 534ba2b2efdSGlen Barber# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 535ba2b2efdSGlen Barber# this is so that comments can contain non-ASCII characters. 536ba2b2efdSGlen Barber# OK_LINE matches a line of OK characters. 537ba2b2efdSGlen BarberSAFE_LINE= '^'$(SAFE_CHAR)'*$$' 538ba2b2efdSGlen BarberSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 539ba2b2efdSGlen BarberOK_LINE= '^'$(OK_CHAR)'*$$' 540ba2b2efdSGlen Barber 541ba2b2efdSGlen Barber# Flags to give 'tar' when making a distribution. 542ba2b2efdSGlen Barber# Try to use flags appropriate for GNU tar. 543e273650fSPhilip PaepsGNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \ 5448ea5af2bSPhilip Paeps --numeric-owner --owner=0 --group=0 \ 5458ea5af2bSPhilip Paeps --mode=go+u,go-w --sort=name 546e273650fSPhilip PaepsSETUP_TAR= \ 547e273650fSPhilip Paeps export LC_ALL=C && \ 548e273650fSPhilip Paeps if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \ 549e273650fSPhilip Paeps TAR='tar $(GNUTARFLAGS)'; \ 550e273650fSPhilip Paeps else \ 551e273650fSPhilip Paeps TAR=tar; \ 552e273650fSPhilip Paeps fi 553ba2b2efdSGlen Barber 554ba2b2efdSGlen Barber# Flags to give 'gzip' when making a distribution. 555ba2b2efdSGlen BarberGZIPFLAGS= -9n 556ba2b2efdSGlen Barber 557cf1ad535SPhilip Paeps# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 558cf1ad535SPhilip Paeps# This makes it easier to see which Zone has been affected. 559e273650fSPhilip PaepsSETUP_DIFF_TZS = \ 560e273650fSPhilip Paeps if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \ 561e273650fSPhilip Paeps DIFF_TZS='diff -u -F^TZ='; \ 562e273650fSPhilip Paeps else \ 563e273650fSPhilip Paeps DIFF_TZS='diff -u'; \ 564e273650fSPhilip Paeps fi 565cf1ad535SPhilip Paeps 566ba2b2efdSGlen Barber# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 567ba2b2efdSGlen BarberRANLIB= : 568ba2b2efdSGlen Barber 569eebb9c2cSPhilip Paeps# POSIX prohibits defining or using SHELL. However, csh users on systems 570eebb9c2cSPhilip Paeps# that use the user shell for Makefile commands may need to define SHELL. 571eebb9c2cSPhilip Paeps#SHELL= /bin/sh 572eebb9c2cSPhilip Paeps 573eebb9c2cSPhilip Paeps# End of macros that one plausibly might want to tailor. 574eebb9c2cSPhilip Paeps############################################################################### 575eebb9c2cSPhilip Paeps 576eebb9c2cSPhilip Paeps 577ba2b2efdSGlen BarberTZCOBJS= zic.o 578e273650fSPhilip PaepsTZDOBJS= zdump.o localtime.o strftime.o 579e273650fSPhilip PaepsDATEOBJS= date.o localtime.o strftime.o 580dd5f96c4SPhilip PaepsLIBSRCS= localtime.c asctime.c difftime.c strftime.c 581dd5f96c4SPhilip PaepsLIBOBJS= localtime.o asctime.o difftime.o strftime.o 582ba2b2efdSGlen BarberHEADERS= tzfile.h private.h 583ba2b2efdSGlen BarberNONLIBSRCS= zic.c zdump.c 584dd5f96c4SPhilip PaepsNEWUCBSRCS= date.c 585ba2b2efdSGlen BarberSOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 586ba2b2efdSGlen Barber tzselect.ksh workman.sh 587ba2b2efdSGlen BarberMANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 588ba2b2efdSGlen Barber tzfile.5 tzselect.8 zic.8 zdump.8 589ba2b2efdSGlen BarberMANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 590ba2b2efdSGlen Barber time2posix.3.txt \ 591ba2b2efdSGlen Barber tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 592ba2b2efdSGlen Barber date.1.txt 5938d7edd17SPhilip PaepsCOMMON= calendars CONTRIBUTING LICENSE Makefile \ 59493d120dbSPhilip Paeps NEWS README SECURITY theory.html version 595f2fcff28SPhilip PaepsWEB_PAGES= tz-art.html tz-how-to.html tz-link.html 596e273650fSPhilip PaepsCHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck 597ba2b2efdSGlen BarberDOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 598ba2b2efdSGlen BarberPRIMARY_YDATA= africa antarctica asia australasia \ 599ba2b2efdSGlen Barber europe northamerica southamerica 600afb91be3SPhilip PaepsYDATA= $(PRIMARY_YDATA) etcetera 60112a899b6SPhilip PaepsNDATA= factory 60212a899b6SPhilip PaepsTDATA_TO_CHECK= $(YDATA) $(NDATA) backward 603afb91be3SPhilip PaepsTDATA= $(YDATA) $(NDATA) $(BACKWARD) 604eebb9c2cSPhilip PaepsZONETABLES= zone.tab zone1970.tab zonenow.tab 6058d7edd17SPhilip PaepsTABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 606ba2b2efdSGlen BarberLEAP_DEPS= leapseconds.awk leap-seconds.list 6079f9fc6bbSPhilip PaepsTZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 6089f9fc6bbSPhilip Paeps $(PACKRATDATA) $(PACKRATLIST) 6099f9fc6bbSPhilip PaepsDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 610afb91be3SPhilip PaepsDATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 61112a899b6SPhilip Paeps leapseconds $(ZONETABLES) 612eebb9c2cSPhilip PaepsAWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 61346bee4edSPhilip Paeps ziguard.awk zishrink.awk 6145f33eb72SPhilip PaepsMISC= $(AWK_SCRIPTS) 615ba2b2efdSGlen BarberTZS_YEAR= 2050 61689abb9f8SPhilip PaepsTZS_CUTOFF_FLAG= -c $(TZS_YEAR) 617ba2b2efdSGlen BarberTZS= to$(TZS_YEAR).tzs 618ba2b2efdSGlen BarberTZS_NEW= to$(TZS_YEAR)new.tzs 619*46226b01SPhilip PaepsTZS_DEPS= $(YDATA) localtime.c private.h \ 620*46226b01SPhilip Paeps strftime.c tzfile.h zdump.c zic.c 6219f9fc6bbSPhilip PaepsTZDATA_DIST = $(COMMON) $(DATA) $(MISC) 62289abb9f8SPhilip Paeps# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 6239f9fc6bbSPhilip PaepsEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 62489abb9f8SPhilip PaepsENCHILADA = $(EIGHT_YARDS) $(TZS) 625ba2b2efdSGlen Barber 626ba2b2efdSGlen Barber# Consult these files when deciding whether to rebuild the 'version' file. 627ba2b2efdSGlen Barber# This list is not the same as the output of 'git ls-files', since 628ba2b2efdSGlen Barber# .gitignore is not distributed. 629ba2b2efdSGlen BarberVERSION_DEPS= \ 63093d120dbSPhilip Paeps calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 631ba2b2efdSGlen Barber africa antarctica asctime.c asia australasia \ 632ba2b2efdSGlen Barber backward backzone \ 633eebb9c2cSPhilip Paeps checklinks.awk checknow.awk checktab.awk \ 634ba2b2efdSGlen Barber date.1 date.c difftime.c \ 635ba2b2efdSGlen Barber etcetera europe factory iso3166.tab \ 636ba2b2efdSGlen Barber leap-seconds.list leapseconds.awk localtime.c \ 637ba2b2efdSGlen Barber newctime.3 newstrftime.3 newtzset.3 northamerica \ 63812a899b6SPhilip Paeps private.h southamerica strftime.c theory.html \ 639f2fcff28SPhilip Paeps time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 640ba2b2efdSGlen Barber tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 64112a899b6SPhilip Paeps workman.sh zdump.8 zdump.c zic.8 zic.c \ 642d81c2dd9SPhilip Paeps ziguard.awk zishrink.awk \ 643eebb9c2cSPhilip Paeps zone.tab zone1970.tab zonenow.tab 644ba2b2efdSGlen Barber 64512a899b6SPhilip Paepsall: tzselect zic zdump libtz.a $(TABDATA) \ 64646bee4edSPhilip Paeps vanguard.zi main.zi rearguard.zi 647ba2b2efdSGlen Barber 648ba2b2efdSGlen BarberALL: all date $(ENCHILADA) 649ba2b2efdSGlen Barber 650ba2b2efdSGlen Barberinstall: all $(DATA) $(REDO) $(MANS) 651f2fcff28SPhilip Paeps mkdir -p '$(DESTDIR)$(BINDIR)' \ 652f2fcff28SPhilip Paeps '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 653f2fcff28SPhilip Paeps '$(DESTDIR)$(LIBDIR)' \ 654f2fcff28SPhilip Paeps '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 655f2fcff28SPhilip Paeps '$(DESTDIR)$(MANDIR)/man8' 6562865ab3fSPhilip Paeps $(ZIC_INSTALL) -l $(LOCALTIME) \ 657e273650fSPhilip Paeps -p $(POSIXRULES) \ 658f2fcff28SPhilip Paeps -t '$(DESTDIR)$(TZDEFAULT)' 659f2fcff28SPhilip Paeps cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 660f2fcff28SPhilip Paeps cp tzselect '$(DESTDIR)$(BINDIR)/.' 661f2fcff28SPhilip Paeps cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 662f2fcff28SPhilip Paeps cp zic '$(DESTDIR)$(ZICDIR)/.' 663f2fcff28SPhilip Paeps cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 664f2fcff28SPhilip Paeps $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 665f2fcff28SPhilip Paeps cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 666f2fcff28SPhilip Paeps cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 667f2fcff28SPhilip Paeps cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 668ba2b2efdSGlen Barber 669ba2b2efdSGlen BarberINSTALL: ALL install date.1 670f2fcff28SPhilip Paeps mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 671f2fcff28SPhilip Paeps cp date '$(DESTDIR)$(BINDIR)/.' 672f2fcff28SPhilip Paeps cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 673ba2b2efdSGlen Barber 674dc505d53SPhilip Paeps# Calculate version number from git, if available. 675dc505d53SPhilip Paeps# Otherwise, use $(VERSION) unless it is "unknown" and there is already 676dc505d53SPhilip Paeps# a 'version' file, in which case reuse the existing 'version' contents 677dc505d53SPhilip Paeps# and append "-dirty" if the contents do not already end in "-dirty". 678ba2b2efdSGlen Barberversion: $(VERSION_DEPS) 679ba2b2efdSGlen Barber { (type git) >/dev/null 2>&1 && \ 680e273650fSPhilip Paeps V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 681e273650fSPhilip Paeps --abbrev=7 --dirty) || \ 682e273650fSPhilip Paeps if test '$(VERSION)' = unknown && read -r V <$@; then \ 683e273650fSPhilip Paeps V=$${V%-dirty}-dirty; \ 684dc505d53SPhilip Paeps else \ 685dc505d53SPhilip Paeps V='$(VERSION)'; \ 686dc505d53SPhilip Paeps fi; } && \ 687ba2b2efdSGlen Barber printf '%s\n' "$$V" >$@.out 688ba2b2efdSGlen Barber mv $@.out $@ 689ba2b2efdSGlen Barber 6909f9fc6bbSPhilip Paeps# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 69146bee4edSPhilip Paepsvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 6929f9fc6bbSPhilip Paeps $(AWK) \ 693e273650fSPhilip Paeps -v DATAFORM=$(@:.zi=) \ 6949f9fc6bbSPhilip Paeps -v PACKRATDATA='$(PACKRATDATA)' \ 6959f9fc6bbSPhilip Paeps -v PACKRATLIST='$(PACKRATLIST)' \ 6969f9fc6bbSPhilip Paeps -f ziguard.awk \ 697d81c2dd9SPhilip Paeps $(TDATA) $(PACKRATDATA) >$@.out 69846bee4edSPhilip Paeps mv $@.out $@ 69989abb9f8SPhilip Paeps# This file has a version comment that attempts to capture any tailoring 7009f9fc6bbSPhilip Paeps# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 70189abb9f8SPhilip Paepstzdata.zi: $(DATAFORM).zi version zishrink.awk 702e273650fSPhilip Paeps read -r version <version && \ 70389abb9f8SPhilip Paeps LC_ALL=C $(AWK) \ 70489abb9f8SPhilip Paeps -v dataform='$(DATAFORM)' \ 70589abb9f8SPhilip Paeps -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 70689abb9f8SPhilip Paeps -v redo='$(REDO)' \ 70789abb9f8SPhilip Paeps -v version="$$version" \ 70889abb9f8SPhilip Paeps -f zishrink.awk \ 70946bee4edSPhilip Paeps $(DATAFORM).zi >$@.out 7108d7edd17SPhilip Paeps mv $@.out $@ 7118d7edd17SPhilip Paeps 712eebb9c2cSPhilip Paepstzdir.h: 713eebb9c2cSPhilip Paeps printf '%s\n' >$@.out \ 714eebb9c2cSPhilip Paeps '#ifndef TZDEFAULT' \ 715eebb9c2cSPhilip Paeps '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 716eebb9c2cSPhilip Paeps '#endif' \ 717eebb9c2cSPhilip Paeps '#ifndef TZDIR' \ 718eebb9c2cSPhilip Paeps '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 719eebb9c2cSPhilip Paeps '#endif' 720eebb9c2cSPhilip Paeps mv $@.out $@ 721eebb9c2cSPhilip Paeps 722ba2b2efdSGlen Barberversion.h: version 723e273650fSPhilip Paeps read -r VERSION <version && printf '%s\n' \ 724ba2b2efdSGlen Barber 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 725ba2b2efdSGlen Barber "static char const TZVERSION[]=\"$$VERSION\";" \ 726ba2b2efdSGlen Barber 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 727ba2b2efdSGlen Barber >$@.out 728ba2b2efdSGlen Barber mv $@.out $@ 729ba2b2efdSGlen Barber 730ba2b2efdSGlen Barberzdump: $(TZDOBJS) 731ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 732ba2b2efdSGlen Barber 733ba2b2efdSGlen Barberzic: $(TZCOBJS) 734ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 735ba2b2efdSGlen Barber 736ba2b2efdSGlen Barberleapseconds: $(LEAP_DEPS) 737dd5f96c4SPhilip Paeps $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 738dd5f96c4SPhilip Paeps -f leapseconds.awk leap-seconds.list >$@.out 739ba2b2efdSGlen Barber mv $@.out $@ 740ba2b2efdSGlen Barber 7412723c7ffSPhilip Paeps# Awk script to extract a Git-style author from leap-seconds.list comments. 7422723c7ffSPhilip PaepsEXTRACT_AUTHOR = \ 7432723c7ffSPhilip Paeps author_line { sub(/^.[[:space:]]*/, ""); \ 7442723c7ffSPhilip Paeps sub(/:[[:space:]]*/, " <"); \ 7452723c7ffSPhilip Paeps printf "%s>\n", $$0; \ 7462723c7ffSPhilip Paeps success = 1; \ 7472723c7ffSPhilip Paeps exit \ 7482723c7ffSPhilip Paeps } \ 7492723c7ffSPhilip Paeps /Questions or comments to:/ { author_line = 1 } \ 7502723c7ffSPhilip Paeps END { exit !success } 7512723c7ffSPhilip Paeps 7522723c7ffSPhilip Paeps# Fetch leap-seconds.list from upstream. 7532723c7ffSPhilip Paepsfetch-leap-seconds.list: 7542723c7ffSPhilip Paeps $(CURL) -OR $(leaplist_URI) 7552723c7ffSPhilip Paeps 7562723c7ffSPhilip Paeps# Fetch leap-seconds.list from upstream and commit it to the local repository. 7572723c7ffSPhilip Paepscommit-leap-seconds.list: fetch-leap-seconds.list 7582723c7ffSPhilip Paeps author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ 7592723c7ffSPhilip Paeps date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ 7602723c7ffSPhilip Paeps git commit --author="$$author" --date="$$date" -m'make $@' \ 7612723c7ffSPhilip Paeps leap-seconds.list 7622723c7ffSPhilip Paeps 763e273650fSPhilip Paeps# Arguments to pass to submakes. 764ba2b2efdSGlen Barber# They can be overridden by later submake arguments. 765ba2b2efdSGlen BarberINSTALLARGS = \ 766f2fcff28SPhilip Paeps BACKWARD='$(BACKWARD)' \ 767f2fcff28SPhilip Paeps DESTDIR='$(DESTDIR)' \ 768ba2b2efdSGlen Barber PACKRATDATA='$(PACKRATDATA)' \ 7699f9fc6bbSPhilip Paeps PACKRATLIST='$(PACKRATLIST)' \ 770f2fcff28SPhilip Paeps TZDEFAULT='$(TZDEFAULT)' \ 771f2fcff28SPhilip Paeps TZDIR='$(TZDIR)' \ 772ba2b2efdSGlen Barber ZIC='$(ZIC)' 773ba2b2efdSGlen Barber 77412a899b6SPhilip PaepsINSTALL_DATA_DEPS = zic leapseconds tzdata.zi 77589abb9f8SPhilip Paeps 776e273650fSPhilip Paepsposix_only: $(INSTALL_DATA_DEPS) 7778d7edd17SPhilip Paeps $(ZIC_INSTALL) tzdata.zi 778ba2b2efdSGlen Barber 77989abb9f8SPhilip Paepsright_only: $(INSTALL_DATA_DEPS) 780e273650fSPhilip Paeps $(ZIC_INSTALL) -L leapseconds tzdata.zi 781ba2b2efdSGlen Barber 782ba2b2efdSGlen Barber# In earlier versions of this makefile, the other two directories were 783ba2b2efdSGlen Barber# subdirectories of $(TZDIR). However, this led to configuration errors. 784ba2b2efdSGlen Barber# For example, with posix_right under the earlier scheme, 785ba2b2efdSGlen Barber# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 786ba2b2efdSGlen Barber# but gmtime without leap seconds, which led to problems with applications 787ba2b2efdSGlen Barber# like sendmail that subtract gmtime from localtime. 788ba2b2efdSGlen Barber# Therefore, the other two directories are now siblings of $(TZDIR). 789ba2b2efdSGlen Barber# You must replace all of $(TZDIR) to switch from not using leap seconds 790ba2b2efdSGlen Barber# to using them, or vice versa. 791ba2b2efdSGlen Barberright_posix: right_only 792f2fcff28SPhilip Paeps rm -fr '$(DESTDIR)$(TZDIR)-leaps' 793f2fcff28SPhilip Paeps ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 794f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 795f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 796ba2b2efdSGlen Barber 797ba2b2efdSGlen Barberposix_right: posix_only 798f2fcff28SPhilip Paeps rm -fr '$(DESTDIR)$(TZDIR)-posix' 799f2fcff28SPhilip Paeps ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 800f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 801f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 802ba2b2efdSGlen Barber 803ba2b2efdSGlen Barberzones: $(REDO) 804ba2b2efdSGlen Barber 80546bee4edSPhilip Paeps# dummy.zd is not a real file; it is mentioned here only so that the 80646bee4edSPhilip Paeps# top-level 'make' does not have a syntax error. 80746bee4edSPhilip PaepsZDS = dummy.zd 80846bee4edSPhilip Paeps# Rule used only by submakes invoked by the $(TZS_NEW) rule. 80946bee4edSPhilip Paeps# It is separate so that GNU 'make -j' can run instances in parallel. 81046bee4edSPhilip Paeps$(ZDS): zdump 811e273650fSPhilip Paeps ./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@ 81246bee4edSPhilip Paeps 81389abb9f8SPhilip PaepsTZS_NEW_DEPS = tzdata.zi zdump zic 81489abb9f8SPhilip Paeps$(TZS_NEW): $(TZS_NEW_DEPS) 81589abb9f8SPhilip Paeps rm -fr tzs$(TZS_YEAR).dir 81689abb9f8SPhilip Paeps mkdir tzs$(TZS_YEAR).dir 81789abb9f8SPhilip Paeps $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 8188d7edd17SPhilip Paeps $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 8198d7edd17SPhilip Paeps tzdata.zi | LC_ALL=C sort >$@.out 820e273650fSPhilip Paeps x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 82189abb9f8SPhilip Paeps tzdata.zi \ 822e273650fSPhilip Paeps | LC_ALL=C sort -t . -k 2,2) && \ 82389abb9f8SPhilip Paeps set x $$x && \ 82446bee4edSPhilip Paeps shift && \ 82546bee4edSPhilip Paeps ZDS=$$* && \ 826e273650fSPhilip Paeps $(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 82789abb9f8SPhilip Paeps ZDS="$$ZDS" $$ZDS && \ 82889abb9f8SPhilip Paeps sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 82989abb9f8SPhilip Paeps rm -fr tzs$(TZS_YEAR).dir 83046bee4edSPhilip Paeps mv $@.out $@ 831ba2b2efdSGlen Barber 832e273650fSPhilip Paeps# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the 833ba2b2efdSGlen Barber# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 834ba2b2efdSGlen Barber$(TZS): 83589abb9f8SPhilip Paeps touch $@ 836ba2b2efdSGlen Barber 837ba2b2efdSGlen Barberforce_tzs: $(TZS_NEW) 838ba2b2efdSGlen Barber cp $(TZS_NEW) $(TZS) 839ba2b2efdSGlen Barber 840ba2b2efdSGlen Barberlibtz.a: $(LIBOBJS) 841e350c46aSBaptiste Daroussin rm -f $@ 842eebb9c2cSPhilip Paeps $(AR) $(ARFLAGS) $@ $(LIBOBJS) 843ba2b2efdSGlen Barber $(RANLIB) $@ 844ba2b2efdSGlen Barber 845ba2b2efdSGlen Barberdate: $(DATEOBJS) 846ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 847ba2b2efdSGlen Barber 848ba2b2efdSGlen Barbertzselect: tzselect.ksh version 849e273650fSPhilip Paeps read -r VERSION <version && sed \ 850eebb9c2cSPhilip Paeps -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 851eebb9c2cSPhilip Paeps -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 852eebb9c2cSPhilip Paeps -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 853eebb9c2cSPhilip Paeps -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 854eebb9c2cSPhilip Paeps -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 855eebb9c2cSPhilip Paeps -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 856ba2b2efdSGlen Barber <$@.ksh >$@.out 857ba2b2efdSGlen Barber chmod +x $@.out 858ba2b2efdSGlen Barber mv $@.out $@ 859ba2b2efdSGlen Barber 860*46226b01SPhilip Paepscheck: check_mild back.ck now.ck 861e273650fSPhilip Paepscheck_mild: check_web check_zishrink \ 862e273650fSPhilip Paeps character-set.ck white-space.ck links.ck mainguard.ck \ 863*46226b01SPhilip Paeps name-lengths.ck slashed-abbrs.ck sorted.ck \ 864e273650fSPhilip Paeps tables.ck ziguard.ck tzs.ck 865ba2b2efdSGlen Barber 866eebb9c2cSPhilip Paeps# True if UTF8_LOCALE does not work; 867eebb9c2cSPhilip Paeps# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 868eebb9c2cSPhilip PaepsUTF8_LOCALE_MISSING = \ 869eebb9c2cSPhilip Paeps { test ! '$(UTF8_LOCALE)' \ 870eebb9c2cSPhilip Paeps || ! printf 'A\304\200B\n' \ 871eebb9c2cSPhilip Paeps | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 872e273650fSPhilip Paeps || { export LC_ALL='$(UTF8_LOCALE)'; false; }; } 873eebb9c2cSPhilip Paeps 874e273650fSPhilip Paepscharacter-set.ck: $(ENCHILADA) 875eebb9c2cSPhilip Paeps $(UTF8_LOCALE_MISSING) || { \ 876ba2b2efdSGlen Barber sharp='#' && \ 877ba2b2efdSGlen Barber ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 878ba2b2efdSGlen Barber $(MISC) $(SOURCES) $(WEB_PAGES) \ 87993d120dbSPhilip Paeps CONTRIBUTING LICENSE README SECURITY \ 8808d7edd17SPhilip Paeps version tzdata.zi && \ 88189abb9f8SPhilip Paeps ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 88246bee4edSPhilip Paeps Makefile && \ 883afb91be3SPhilip Paeps ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 88412a899b6SPhilip Paeps leapseconds zone.tab && \ 8858d7edd17SPhilip Paeps ! grep -Env $(OK_LINE) $(ENCHILADA); \ 8868d7edd17SPhilip Paeps } 88789abb9f8SPhilip Paeps touch $@ 888ba2b2efdSGlen Barber 889e273650fSPhilip Paepswhite-space.ck: $(ENCHILADA) 890eebb9c2cSPhilip Paeps $(UTF8_LOCALE_MISSING) || { \ 891e273650fSPhilip Paeps enchilada='$(ENCHILADA)' && \ 892e273650fSPhilip Paeps patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \ 893eebb9c2cSPhilip Paeps ! grep -En "$$pat|[$s]\$$" \ 894e273650fSPhilip Paeps $${enchilada%leap-seconds.list*} \ 895e273650fSPhilip Paeps $${enchilada#*leap-seconds.list}; \ 896eebb9c2cSPhilip Paeps } 89789abb9f8SPhilip Paeps touch $@ 898ba2b2efdSGlen Barber 8999f9fc6bbSPhilip PaepsPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 9009f9fc6bbSPhilip PaepsFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 9018d7edd17SPhilip Paeps 902e273650fSPhilip Paepsname-lengths.ck: $(TDATA_TO_CHECK) backzone 903e273650fSPhilip Paeps :;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 904afb91be3SPhilip Paeps $(TDATA_TO_CHECK) backzone 90589abb9f8SPhilip Paeps touch $@ 9068d7edd17SPhilip Paeps 907e273650fSPhilip Paepsmainguard.ck: main.zi 908e273650fSPhilip Paeps test '$(PACKRATLIST)' || \ 909e273650fSPhilip Paeps cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi 910e273650fSPhilip Paeps touch $@ 911e273650fSPhilip Paeps 9129f9fc6bbSPhilip PaepsPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 9139f9fc6bbSPhilip PaepsSTDOFF = [-+]?[0-9:.]+ 9149f9fc6bbSPhilip PaepsRULELESS_SAVE = (-|$(STDOFF)[sd]?) 9159f9fc6bbSPhilip PaepsRULELESS_SLASHED_ABBRS = \ 9169f9fc6bbSPhilip Paeps $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 9179f9fc6bbSPhilip Paeps 918e273650fSPhilip Paepsslashed-abbrs.ck: $(TDATA_TO_CHECK) 919e273650fSPhilip Paeps :;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 9209f9fc6bbSPhilip Paeps touch $@ 9219f9fc6bbSPhilip Paeps 922ba2b2efdSGlen BarberCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 923ba2b2efdSGlen Barber 924e273650fSPhilip Paepssorted.ck: backward backzone 925cf1ad535SPhilip Paeps $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 9269142a2a3SPhilip Paeps backward | LC_ALL=C sort -cu 927e273650fSPhilip Paeps $(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu 92889abb9f8SPhilip Paeps touch $@ 929ba2b2efdSGlen Barber 930e273650fSPhilip Paepsback.ck: checklinks.awk $(TDATA_TO_CHECK) 9319142a2a3SPhilip Paeps $(AWK) \ 9329142a2a3SPhilip Paeps -v DATAFORM=$(DATAFORM) \ 9339142a2a3SPhilip Paeps -v backcheck=backward \ 9349142a2a3SPhilip Paeps -f checklinks.awk $(TDATA_TO_CHECK) 935cf1ad535SPhilip Paeps touch $@ 936cf1ad535SPhilip Paeps 937e273650fSPhilip Paepslinks.ck: checklinks.awk tzdata.zi 9389142a2a3SPhilip Paeps $(AWK) \ 9399142a2a3SPhilip Paeps -v DATAFORM=$(DATAFORM) \ 9409142a2a3SPhilip Paeps -f checklinks.awk tzdata.zi 94189abb9f8SPhilip Paeps touch $@ 942ba2b2efdSGlen Barber 943eebb9c2cSPhilip Paeps# Check timestamps from now through 28 years from now, to make sure 944eebb9c2cSPhilip Paeps# that zonenow.tab contains all sequences of planned timestamps, 945eebb9c2cSPhilip Paeps# without any duplicate sequences. In theory this might require 946e273650fSPhilip Paeps# 2800+ years but that would take a long time to check. 947e273650fSPhilip PaepsCHECK_NOW_TIMESTAMP = $$(./date +%s) 948eebb9c2cSPhilip PaepsCHECK_NOW_FUTURE_YEARS = 28 949e273650fSPhilip PaepsCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) * 366 * 24 * 60 * 60 950e273650fSPhilip Paepsnow.ck: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 951e273650fSPhilip Paeps rm -fr $@d 952e273650fSPhilip Paeps mkdir $@d 953e273650fSPhilip Paeps ./zic -d $@d tzdata.zi 954eebb9c2cSPhilip Paeps now=$(CHECK_NOW_TIMESTAMP) && \ 955e273650fSPhilip Paeps future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \ 956eebb9c2cSPhilip Paeps ./zdump -i -t $$now,$$future \ 957e273650fSPhilip Paeps $$(find "$$PWD/$@d"/????*/ -type f) \ 958e273650fSPhilip Paeps >$@d/zdump-now.tab && \ 959e273650fSPhilip Paeps ./zdump -i -t 0,$$future \ 960e273650fSPhilip Paeps $$(find "$$PWD/$@d" -name Etc -prune \ 961e273650fSPhilip Paeps -o -type f ! -name '*.tab' -print) \ 962e273650fSPhilip Paeps >$@d/zdump-1970.tab 963eebb9c2cSPhilip Paeps $(AWK) \ 964e273650fSPhilip Paeps -v zdump_table=$@d/zdump-now.tab \ 965eebb9c2cSPhilip Paeps -f checknow.awk zonenow.tab 966e273650fSPhilip Paeps $(AWK) \ 967e273650fSPhilip Paeps 'BEGIN {print "-\t-\tUTC"} /^Zone/ {print "-\t-\t" $$2}' \ 968e273650fSPhilip Paeps $(PRIMARY_YDATA) backward factory | \ 969e273650fSPhilip Paeps $(AWK) \ 970e273650fSPhilip Paeps -v zdump_table=$@d/zdump-1970.tab \ 971e273650fSPhilip Paeps -f checknow.awk 972e273650fSPhilip Paeps rm -fr $@d 973eebb9c2cSPhilip Paeps touch $@ 974eebb9c2cSPhilip Paeps 975e273650fSPhilip Paepstables.ck: checktab.awk $(YDATA) backward zone.tab zone1970.tab 976ba2b2efdSGlen Barber for tab in $(ZONETABLES); do \ 97794c2d487SPhilip Paeps test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 97894c2d487SPhilip Paeps $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 979ba2b2efdSGlen Barber || exit; \ 980ba2b2efdSGlen Barber done 98189abb9f8SPhilip Paeps touch $@ 982ba2b2efdSGlen Barber 983e273650fSPhilip Paepstzs.ck: $(TZS) $(TZS_NEW) 98489abb9f8SPhilip Paeps if test -s $(TZS); then \ 985e273650fSPhilip Paeps $(SETUP_DIFF_TZS) && $$DIFF_TZS $(TZS) $(TZS_NEW); \ 98689abb9f8SPhilip Paeps else \ 98789abb9f8SPhilip Paeps cp $(TZS_NEW) $(TZS); \ 98889abb9f8SPhilip Paeps fi 98989abb9f8SPhilip Paeps touch $@ 990ba2b2efdSGlen Barber 9912c5e84ccSPhilip Paepscheck_web: $(CHECK_WEB_PAGES) 992e273650fSPhilip Paeps.SUFFIXES: .ck .html 993e273650fSPhilip Paeps.html.ck: 994e273650fSPhilip Paeps { ! ($(CURL) --version) >/dev/null 2>&1 || \ 9952c5e84ccSPhilip Paeps $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 996e273650fSPhilip Paeps -F file=@$<; } >$@.out && \ 9972c5e84ccSPhilip Paeps test ! -s $@.out || { cat $@.out; exit 1; } 9982c5e84ccSPhilip Paeps mv $@.out $@ 9998d7edd17SPhilip Paeps 1000e273650fSPhilip Paepsziguard.ck: rearguard.zi vanguard.zi ziguard.awk 10019f9fc6bbSPhilip Paeps $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 10029f9fc6bbSPhilip Paeps diff -u rearguard.zi - 10039f9fc6bbSPhilip Paeps $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 10049f9fc6bbSPhilip Paeps diff -u vanguard.zi - 10059f9fc6bbSPhilip Paeps touch $@ 10069f9fc6bbSPhilip Paeps 100746bee4edSPhilip Paeps# Check that zishrink.awk does not alter the data, and that ziguard.awk 100846bee4edSPhilip Paeps# preserves main-format data. 1009e273650fSPhilip Paepscheck_zishrink: zishrink-posix.ck zishrink-right.ck 1010e273650fSPhilip Paepszishrink-posix.ck zishrink-right.ck: \ 10119f9fc6bbSPhilip Paeps zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 10129f9fc6bbSPhilip Paeps $(TDATA) $(DATAFORM).zi tzdata.zi 1013e273650fSPhilip Paeps rm -fr $@d t-$@d shrunk-$@d 1014e273650fSPhilip Paeps mkdir $@d t-$@d shrunk-$@d 101589abb9f8SPhilip Paeps case $@ in \ 1016e273650fSPhilip Paeps *right*) leap='-L leapseconds';; \ 10178d7edd17SPhilip Paeps *) leap=;; \ 10188d7edd17SPhilip Paeps esac && \ 1019e273650fSPhilip Paeps $(ZIC) $$leap -d $@d $(DATAFORM).zi && \ 1020e273650fSPhilip Paeps $(ZIC) $$leap -d shrunk-$@d tzdata.zi && \ 10219f9fc6bbSPhilip Paeps case $(DATAFORM),$(PACKRATLIST) in \ 10229f9fc6bbSPhilip Paeps main,) \ 1023e273650fSPhilip Paeps $(ZIC) $$leap -d t-$@d $(TDATA) && \ 10248d7edd17SPhilip Paeps $(AWK) '/^Rule/' $(TDATA) | \ 1025e273650fSPhilip Paeps $(ZIC) $$leap -d t-$@d - $(PACKRATDATA) && \ 1026e273650fSPhilip Paeps diff -r $@d t-$@d;; \ 102789abb9f8SPhilip Paeps esac 1028e273650fSPhilip Paeps diff -r $@d shrunk-$@d 1029e273650fSPhilip Paeps rm -fr $@d t-$@d shrunk-$@d 103089abb9f8SPhilip Paeps touch $@ 1031ba2b2efdSGlen Barber 1032ba2b2efdSGlen Barberclean_misc: 1033e273650fSPhilip Paeps rm -fr *.ckd *.dir 1034e273650fSPhilip Paeps rm -f *.ck *.core *.o *.out core core.* \ 1035eebb9c2cSPhilip Paeps date tzdir.h tzselect version.h zdump zic libtz.a 1036ba2b2efdSGlen Barberclean: clean_misc 1037e273650fSPhilip Paeps rm -fr tzdb-*/ 1038ad48359aSPhilip Paeps rm -f *.zi $(TZS_NEW) 1039ba2b2efdSGlen Barber 1040ba2b2efdSGlen Barbermaintainer-clean: clean 1041ba2b2efdSGlen Barber @echo 'This command is intended for maintainers to use; it' 1042ba2b2efdSGlen Barber @echo 'deletes files that may need special tools to rebuild.' 1043ba2b2efdSGlen Barber rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 1044ba2b2efdSGlen Barber 1045ba2b2efdSGlen Barbernames: 1046ba2b2efdSGlen Barber @echo $(ENCHILADA) 1047ba2b2efdSGlen Barber 1048e273650fSPhilip Paepspublic: check public.ck $(CHECK_TIME_T_ALTERNATIVES) \ 1049ba2b2efdSGlen Barber tarballs signatures 1050ba2b2efdSGlen Barber 1051ba2b2efdSGlen Barberdate.1.txt: date.1 1052ba2b2efdSGlen Barbernewctime.3.txt: newctime.3 1053ba2b2efdSGlen Barbernewstrftime.3.txt: newstrftime.3 1054ba2b2efdSGlen Barbernewtzset.3.txt: newtzset.3 1055ba2b2efdSGlen Barbertime2posix.3.txt: time2posix.3 1056ba2b2efdSGlen Barbertzfile.5.txt: tzfile.5 1057ba2b2efdSGlen Barbertzselect.8.txt: tzselect.8 1058ba2b2efdSGlen Barberzdump.8.txt: zdump.8 1059ba2b2efdSGlen Barberzic.8.txt: zic.8 1060ba2b2efdSGlen Barber 1061ba2b2efdSGlen Barber$(MANTXTS): workman.sh 1062e273650fSPhilip Paeps LC_ALL=C sh workman.sh $(@:.txt=) >$@.out 1063ba2b2efdSGlen Barber mv $@.out $@ 1064ba2b2efdSGlen Barber 1065dc505d53SPhilip Paeps# Set file timestamps deterministically if possible, 1066dc505d53SPhilip Paeps# so that tarballs containing the timestamps are reproducible. 1067dc505d53SPhilip Paeps# 1068dc505d53SPhilip Paeps# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 1069dc505d53SPhilip Paeps# file DEST to the maximum of the timestamps of the files A B C ..., 1070dc505d53SPhilip Paeps# plus N if GNU ls and touch are available. 1071dc505d53SPhilip PaepsSET_TIMESTAMP_N = sh -c '\ 1072dc505d53SPhilip Paeps n=$$0 dest=$$1; shift; \ 1073eebb9c2cSPhilip Paeps <"$$dest" && \ 1074dc505d53SPhilip Paeps if test $$n != 0 && \ 1075e273650fSPhilip Paeps lsout=$$(ls -nt --time-style="+%s" "$$@" 2>/dev/null); then \ 1076dc505d53SPhilip Paeps set x $$lsout && \ 1077e273650fSPhilip Paeps timestamp=$$(($$7 + $$n)) && \ 1078eebb9c2cSPhilip Paeps echo "+ touch -md @$$timestamp $$dest" && \ 1079eebb9c2cSPhilip Paeps touch -md @$$timestamp "$$dest"; \ 1080eebb9c2cSPhilip Paeps else \ 1081e273650fSPhilip Paeps newest=$$(ls -t "$$@" | sed 1q) && \ 1082eebb9c2cSPhilip Paeps echo "+ touch -mr $$newest $$dest" && \ 1083eebb9c2cSPhilip Paeps touch -mr "$$newest" "$$dest"; \ 1084eebb9c2cSPhilip Paeps fi' 1085dc505d53SPhilip Paeps# If DEST depends on A B C ... in this Makefile, callers should use 1086dc505d53SPhilip Paeps# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 1087dc505d53SPhilip Paeps# downstream 'make' that considers equal timestamps to be out of date. 1088dc505d53SPhilip Paeps# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 1089dc505d53SPhilip Paeps# If all that matters is that the timestamp be reproducible 1090dc505d53SPhilip Paeps# and plausible, use $(SET_TIMESTAMP). 1091dc505d53SPhilip PaepsSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 1092dc505d53SPhilip PaepsSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 1093dc505d53SPhilip Paeps 1094ba2b2efdSGlen Barber# Set the timestamps to those of the git repository, if available, 1095ba2b2efdSGlen Barber# and if the files have not changed since then. 1096dc505d53SPhilip Paeps# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 1097dc505d53SPhilip Paeps# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 1098dc505d53SPhilip Paeps# If git or GNU is absent, don't bother to sync with git timestamps. 1099ba2b2efdSGlen Barber# Also, set the timestamp of each prebuilt file like 'leapseconds' 1100ba2b2efdSGlen Barber# to be the maximum of the files it depends on. 110189abb9f8SPhilip Paepsset-timestamps.out: $(EIGHT_YARDS) 1102ba2b2efdSGlen Barber rm -f $@ 1103ba2b2efdSGlen Barber if (type git) >/dev/null 2>&1 && \ 1104e273650fSPhilip Paeps files=$$(git ls-files $(EIGHT_YARDS)) && \ 1105ba2b2efdSGlen Barber touch -md @1 test.out; then \ 1106ba2b2efdSGlen Barber rm -f test.out && \ 1107ba2b2efdSGlen Barber for file in $$files; do \ 1108*46226b01SPhilip Paeps if git diff --quiet HEAD $$file; then \ 1109e273650fSPhilip Paeps time=$$(TZ=UTC0 git log -1 \ 1110eebb9c2cSPhilip Paeps --format='tformat:%cd' \ 1111eebb9c2cSPhilip Paeps --date='format:%Y-%m-%dT%H:%M:%SZ' \ 1112e273650fSPhilip Paeps $$file) && \ 1113eebb9c2cSPhilip Paeps echo "+ touch -md $$time $$file" && \ 1114eebb9c2cSPhilip Paeps touch -md $$time $$file; \ 1115ba2b2efdSGlen Barber else \ 1116ba2b2efdSGlen Barber echo >&2 "$$file: warning: does not match repository"; \ 1117ba2b2efdSGlen Barber fi || exit; \ 1118ba2b2efdSGlen Barber done; \ 1119ba2b2efdSGlen Barber fi 1120dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 1121e273650fSPhilip Paeps for file in $(MANTXTS); do \ 1122e273650fSPhilip Paeps $(SET_TIMESTAMP_DEP) $$file $${file%.txt} workman.sh || \ 1123ba2b2efdSGlen Barber exit; \ 1124ba2b2efdSGlen Barber done 1125dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 1126dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 1127ba2b2efdSGlen Barber touch $@ 112889abb9f8SPhilip Paepsset-tzs-timestamp.out: $(TZS) 1129dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 113089abb9f8SPhilip Paeps touch $@ 1131ba2b2efdSGlen Barber 1132ba2b2efdSGlen Barber# The zics below ensure that each data file can stand on its own. 1133ba2b2efdSGlen Barber# We also do an all-files run to catch links to links. 1134ba2b2efdSGlen Barber 1135e273650fSPhilip Paepspublic.ck: $(VERSION_DEPS) 1136e273650fSPhilip Paeps rm -fr $@d 1137e273650fSPhilip Paeps mkdir $@d 1138e273650fSPhilip Paeps ln $(VERSION_DEPS) $@d 1139e273650fSPhilip Paeps cd $@d \ 1140eebb9c2cSPhilip Paeps && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 1141e273650fSPhilip Paeps for i in $(TDATA_TO_CHECK) \ 1142e273650fSPhilip Paeps tzdata.zi vanguard.zi main.zi rearguard.zi; \ 1143e35a01eeSPhilip Paeps do \ 1144e273650fSPhilip Paeps $@d/zic -v -d $@d/zoneinfo $@d/$$i || exit; \ 114589abb9f8SPhilip Paeps done 1146e273650fSPhilip Paeps $@d/zic -v -d $@d/zoneinfo-all $(TDATA_TO_CHECK) 114794c2d487SPhilip Paeps : 114894c2d487SPhilip Paeps : Also check 'backzone' syntax. 1149e273650fSPhilip Paeps rm $@d/main.zi 1150e273650fSPhilip Paeps cd $@d && $(MAKE) PACKRATDATA=backzone main.zi 1151e273650fSPhilip Paeps $@d/zic -d $@d/zoneinfo main.zi 1152e273650fSPhilip Paeps rm $@d/main.zi 1153e273650fSPhilip Paeps cd $@d && \ 11549f9fc6bbSPhilip Paeps $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 1155e273650fSPhilip Paeps $@d/zic -d $@d/zoneinfo main.zi 115694c2d487SPhilip Paeps : 1157e273650fSPhilip Paeps rm -fr $@d 115889abb9f8SPhilip Paeps touch $@ 1159ba2b2efdSGlen Barber 1160ba2b2efdSGlen Barber# Check that the code works under various alternative 1161ba2b2efdSGlen Barber# implementations of time_t. 116289abb9f8SPhilip Paepscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES) 116389abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 116489abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 1165e273650fSPhilip Paeps rm -fr $@d 1166e273650fSPhilip Paeps mkdir $@d 1167e273650fSPhilip Paeps ln $(VERSION_DEPS) $@d 116889abb9f8SPhilip Paeps case $@ in \ 1169e273650fSPhilip Paeps *32_t*) range=-2147483648,2147483648;; \ 117089abb9f8SPhilip Paeps u*) range=0,4294967296;; \ 117189abb9f8SPhilip Paeps *) range=-4294967296,4294967296;; \ 117289abb9f8SPhilip Paeps esac && \ 1173e273650fSPhilip Paeps wd=$$PWD && \ 1174e273650fSPhilip Paeps zones=$$($(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab) && \ 117589abb9f8SPhilip Paeps if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 117689abb9f8SPhilip Paeps range_target=; \ 117789abb9f8SPhilip Paeps else \ 117889abb9f8SPhilip Paeps range_target=to$$range.tzs; \ 117989abb9f8SPhilip Paeps fi && \ 1180e273650fSPhilip Paeps (cd $@d && \ 1181e273650fSPhilip Paeps $(MAKE) TOPDIR="$$wd/$@d" \ 1182e273650fSPhilip Paeps CFLAGS='$(CFLAGS) -Dtime_tz='"'$(@:.ck=)'" \ 118389abb9f8SPhilip Paeps REDO='$(REDO)' \ 1184e273650fSPhilip Paeps D="$$wd/$@d" \ 118589abb9f8SPhilip Paeps TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 118689abb9f8SPhilip Paeps install $$range_target) && \ 118789abb9f8SPhilip Paeps test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 1188e273650fSPhilip Paeps (cd $(TIME_T_ALTERNATIVES_HEAD)d && \ 1189e273650fSPhilip Paeps $(MAKE) TOPDIR="$$wd/$@d" \ 119089abb9f8SPhilip Paeps TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 1191e273650fSPhilip Paeps D="$$wd/$@d" \ 119289abb9f8SPhilip Paeps to$$range.tzs) && \ 1193e273650fSPhilip Paeps $(SETUP_DIFF_TZS) && \ 1194e273650fSPhilip Paeps $$DIFF_TZS $(TIME_T_ALTERNATIVES_HEAD)d/to$$range.tzs \ 1195e273650fSPhilip Paeps $@d/to$$range.tzs && \ 1196ba2b2efdSGlen Barber if diff -q Makefile Makefile 2>/dev/null; then \ 1197ba2b2efdSGlen Barber quiet_option='-q'; \ 1198ba2b2efdSGlen Barber else \ 1199ba2b2efdSGlen Barber quiet_option=''; \ 1200ba2b2efdSGlen Barber fi && \ 1201e273650fSPhilip Paeps diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD)d/etc \ 1202e273650fSPhilip Paeps $@d/etc && \ 1203ba2b2efdSGlen Barber diff $$quiet_option -r \ 1204e273650fSPhilip Paeps $(TIME_T_ALTERNATIVES_HEAD)d/usr/share \ 1205e273650fSPhilip Paeps $@d/usr/share; \ 120689abb9f8SPhilip Paeps } 120789abb9f8SPhilip Paeps touch $@ 1208ba2b2efdSGlen Barber 1209d81c2dd9SPhilip PaepsTRADITIONAL_ASC = \ 1210d81c2dd9SPhilip Paeps tzcode$(VERSION).tar.gz.asc \ 1211d81c2dd9SPhilip Paeps tzdata$(VERSION).tar.gz.asc 121289abb9f8SPhilip PaepsREARGUARD_ASC = \ 121389abb9f8SPhilip Paeps tzdata$(VERSION)-rearguard.tar.gz.asc 121489abb9f8SPhilip PaepsALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 1215d81c2dd9SPhilip Paeps tzdb-$(VERSION).tar.lz.asc 1216d81c2dd9SPhilip Paeps 12179f9fc6bbSPhilip Paepstarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 121889abb9f8SPhilip Paepssignatures rearguard_signatures traditional_signatures: \ 12199f9fc6bbSPhilip Paeps version set-timestamps.out rearguard.zi vanguard.zi 1220e273650fSPhilip Paeps read -r VERSION <version && \ 1221dc505d53SPhilip Paeps $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 1222ba2b2efdSGlen Barber 122346bee4edSPhilip Paeps# These *_version rules are intended for use if VERSION is set by some 122446bee4edSPhilip Paeps# other means. Ordinarily these rules are used only by the above 122546bee4edSPhilip Paeps# non-_version rules, which set VERSION on the 'make' command line. 122689abb9f8SPhilip Paepstarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 1227d81c2dd9SPhilip Paeps tzdb-$(VERSION).tar.lz 122889abb9f8SPhilip Paepsrearguard_tarballs_version: \ 122989abb9f8SPhilip Paeps tzdata$(VERSION)-rearguard.tar.gz 1230ba2b2efdSGlen Barbertraditional_tarballs_version: \ 1231ba2b2efdSGlen Barber tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 12329f9fc6bbSPhilip Paepstailored_tarballs_version: \ 12339f9fc6bbSPhilip Paeps tzdata$(VERSION)-tailored.tar.gz 1234d81c2dd9SPhilip Paepssignatures_version: $(ALL_ASC) 123589abb9f8SPhilip Paepsrearguard_signatures_version: $(REARGUARD_ASC) 1236d81c2dd9SPhilip Paepstraditional_signatures_version: $(TRADITIONAL_ASC) 1237ba2b2efdSGlen Barber 1238ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz: set-timestamps.out 1239e273650fSPhilip Paeps $(SETUP_TAR) && \ 1240e273650fSPhilip Paeps $$TAR -cf - \ 1241ba2b2efdSGlen Barber $(COMMON) $(DOCS) $(SOURCES) | \ 1242ba2b2efdSGlen Barber gzip $(GZIPFLAGS) >$@.out 1243ba2b2efdSGlen Barber mv $@.out $@ 1244ba2b2efdSGlen Barber 1245ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz: set-timestamps.out 1246e273650fSPhilip Paeps $(SETUP_TAR) && \ 1247e273650fSPhilip Paeps $$TAR -cf - $(TZDATA_DIST) | \ 1248ba2b2efdSGlen Barber gzip $(GZIPFLAGS) >$@.out 1249ba2b2efdSGlen Barber mv $@.out $@ 1250ba2b2efdSGlen Barber 12519f9fc6bbSPhilip Paeps# Create empty files with a reproducible timestamp. 12529f9fc6bbSPhilip PaepsCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 12539f9fc6bbSPhilip Paeps 12549f9fc6bbSPhilip Paeps# The obsolescent *rearguard* targets and related macros are present 12559f9fc6bbSPhilip Paeps# for backwards compatibility with tz releases 2018e through 2022a. 12569f9fc6bbSPhilip Paeps# They should go away eventually. To build rearguard tarballs you 12579f9fc6bbSPhilip Paeps# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 1258d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 12599f9fc6bbSPhilip Paeps rm -fr $@.dir 12609f9fc6bbSPhilip Paeps mkdir $@.dir 12619f9fc6bbSPhilip Paeps ln $(TZDATA_DIST) $@.dir 12629f9fc6bbSPhilip Paeps cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 1263d81c2dd9SPhilip Paeps for f in $(TDATA) $(PACKRATDATA); do \ 12649f9fc6bbSPhilip Paeps rearf=$@.dir/$$f; \ 1265d81c2dd9SPhilip Paeps $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 1266dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 1267d81c2dd9SPhilip Paeps done 12689f9fc6bbSPhilip Paeps sed '1s/$$/-rearguard/' <version >$@.dir/version 1269e7e2d659SPhilip Paeps : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12709f9fc6bbSPhilip Paeps $(CREATE_EMPTY) $@.dir/pacificnew 1271eebb9c2cSPhilip Paeps touch -mr version $@.dir/version 1272e273650fSPhilip Paeps $(SETUP_TAR) && \ 12739f9fc6bbSPhilip Paeps (cd $@.dir && \ 1274e273650fSPhilip Paeps $$TAR -cf - \ 12759f9fc6bbSPhilip Paeps $(TZDATA_DIST) pacificnew | \ 1276d81c2dd9SPhilip Paeps gzip $(GZIPFLAGS)) >$@.out 1277d81c2dd9SPhilip Paeps mv $@.out $@ 1278d81c2dd9SPhilip Paeps 12799f9fc6bbSPhilip Paeps# Create a tailored tarball suitable for TZUpdater and compatible tools. 12809f9fc6bbSPhilip Paeps# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 12819f9fc6bbSPhilip Paeps# useful for testing whether TZUpdater supports vanguard form. 12829f9fc6bbSPhilip Paeps# The generated tarball is not byte-for-byte equivalent to a hand-tailored 12839f9fc6bbSPhilip Paeps# traditional tarball, as data entries are put into 'etcetera' even if they 12849f9fc6bbSPhilip Paeps# came from some other source file. However, the effect should be the same 12859f9fc6bbSPhilip Paeps# for ordinary use, which reads all the source files. 12869f9fc6bbSPhilip Paepstzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 12879f9fc6bbSPhilip Paeps rm -fr $@.dir 12889f9fc6bbSPhilip Paeps mkdir $@.dir 12899f9fc6bbSPhilip Paeps : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 1290e273650fSPhilip Paeps if test $(DATAFORM) = vanguard; then \ 1291e273650fSPhilip Paeps pacificnew=; \ 1292e273650fSPhilip Paeps else \ 1293e273650fSPhilip Paeps pacificnew=pacificnew; \ 1294e273650fSPhilip Paeps fi && \ 12959f9fc6bbSPhilip Paeps cd $@.dir && \ 12969f9fc6bbSPhilip Paeps $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 1297e273650fSPhilip Paeps $$pacificnew 12989f9fc6bbSPhilip Paeps (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 12999f9fc6bbSPhilip Paeps >$@.dir/etcetera 1300eebb9c2cSPhilip Paeps touch -mr tzdata.zi $@.dir/etcetera 13019f9fc6bbSPhilip Paeps sed -n \ 13029f9fc6bbSPhilip Paeps -e '/^# *version *\(.*\)/h' \ 13039f9fc6bbSPhilip Paeps -e '/^# *ddeps */H' \ 13049f9fc6bbSPhilip Paeps -e '$$!d' \ 13059f9fc6bbSPhilip Paeps -e 'g' \ 13069f9fc6bbSPhilip Paeps -e 's/^# *version *//' \ 13079f9fc6bbSPhilip Paeps -e 's/\n# *ddeps */-/' \ 13089f9fc6bbSPhilip Paeps -e 's/ /-/g' \ 13099f9fc6bbSPhilip Paeps -e 'p' \ 13109f9fc6bbSPhilip Paeps <tzdata.zi >$@.dir/version 1311eebb9c2cSPhilip Paeps touch -mr version $@.dir/version 13129f9fc6bbSPhilip Paeps links= && \ 13139f9fc6bbSPhilip Paeps for file in $(TZDATA_DIST); do \ 13149f9fc6bbSPhilip Paeps test -f $@.dir/$$file || links="$$links $$file"; \ 13159f9fc6bbSPhilip Paeps done && \ 13169f9fc6bbSPhilip Paeps ln $$links $@.dir 1317e273650fSPhilip Paeps $(SETUP_TAR) && \ 13189f9fc6bbSPhilip Paeps (cd $@.dir && \ 1319e273650fSPhilip Paeps $$TAR -cf - * | gzip $(GZIPFLAGS)) >$@.out 13209f9fc6bbSPhilip Paeps mv $@.out $@ 13219f9fc6bbSPhilip Paeps 132289abb9f8SPhilip Paepstzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 1323ba2b2efdSGlen Barber rm -fr tzdb-$(VERSION) 1324ba2b2efdSGlen Barber mkdir tzdb-$(VERSION) 1325ba2b2efdSGlen Barber ln $(ENCHILADA) tzdb-$(VERSION) 1326dc505d53SPhilip Paeps $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 1327e273650fSPhilip Paeps $(SETUP_TAR) && \ 1328e273650fSPhilip Paeps $$TAR -cf - tzdb-$(VERSION) | lzip -9 >$@.out 1329ba2b2efdSGlen Barber mv $@.out $@ 1330ba2b2efdSGlen Barber 1331ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 1332ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 1333d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 1334ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 1335d81c2dd9SPhilip Paeps$(ALL_ASC): 13362865ab3fSPhilip Paeps $(GPG) --armor --detach-sign $? 1337ba2b2efdSGlen Barber 133889abb9f8SPhilip PaepsTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 1339e273650fSPhilip Paepstypecheck: long-long.ck unsigned.ck 1340e273650fSPhilip Paepslong-long.ck unsigned.ck: $(VERSION_DEPS) 1341e273650fSPhilip Paeps rm -fr $@d 1342e273650fSPhilip Paeps mkdir $@d 1343e273650fSPhilip Paeps ln $(VERSION_DEPS) $@d 1344e273650fSPhilip Paeps cd $@d && \ 134589abb9f8SPhilip Paeps case $@ in \ 1346e273650fSPhilip Paeps long-long.*) i="long long";; \ 1347e273650fSPhilip Paeps unsigned.* ) i="unsigned" ;; \ 134889abb9f8SPhilip Paeps esac && \ 134989abb9f8SPhilip Paeps $(MAKE) \ 135089abb9f8SPhilip Paeps CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 1351e273650fSPhilip Paeps TOPDIR="$$PWD" \ 135289abb9f8SPhilip Paeps install 1353e273650fSPhilip Paeps $@d/zdump -i -c 1970,1971 Europe/Rome 135489abb9f8SPhilip Paeps touch $@ 1355ba2b2efdSGlen Barber 13568d7edd17SPhilip Paepszonenames: tzdata.zi 13578d7edd17SPhilip Paeps @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 1358ba2b2efdSGlen Barber 1359*46226b01SPhilip Paepsasctime.o: private.h 1360ba2b2efdSGlen Barberdate.o: private.h 1361ba2b2efdSGlen Barberdifftime.o: private.h 1362*46226b01SPhilip Paepslocaltime.o: private.h tzdir.h tzfile.h 1363*46226b01SPhilip Paepsstrftime.o: localtime.c private.h tzdir.h tzfile.h 1364*46226b01SPhilip Paepszdump.o: private.h version.h 1365*46226b01SPhilip Paepszic.o: private.h tzdir.h tzfile.h version.h 1366ba2b2efdSGlen Barber 1367ba2b2efdSGlen Barber.PHONY: ALL INSTALL all 1368cf1ad535SPhilip Paeps.PHONY: check check_mild check_time_t_alternatives 13692c5e84ccSPhilip Paeps.PHONY: check_web check_zishrink 13702723c7ffSPhilip Paeps.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd 13712723c7ffSPhilip Paeps.PHONY: fetch-leap-seconds.list force_tzs 1372e273650fSPhilip Paeps.PHONY: install maintainer-clean names 13739f9fc6bbSPhilip Paeps.PHONY: posix_only posix_right public 137489abb9f8SPhilip Paeps.PHONY: rearguard_signatures rearguard_signatures_version 137589abb9f8SPhilip Paeps.PHONY: rearguard_tarballs rearguard_tarballs_version 137689abb9f8SPhilip Paeps.PHONY: right_only right_posix signatures signatures_version 137746bee4edSPhilip Paeps.PHONY: tarballs tarballs_version 137846bee4edSPhilip Paeps.PHONY: traditional_signatures traditional_signatures_version 137946bee4edSPhilip Paeps.PHONY: traditional_tarballs traditional_tarballs_version 13809f9fc6bbSPhilip Paeps.PHONY: tailored_tarballs tailored_tarballs_version 138146bee4edSPhilip Paeps.PHONY: typecheck 1382ba2b2efdSGlen Barber.PHONY: zonenames zones 138346bee4edSPhilip Paeps.PHONY: $(ZDS) 1384