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. 4*eebb9c2cSPhilip Paeps# Request POSIX conformance; this must be the first non-comment line. 5*eebb9c2cSPhilip Paeps.POSIX: 6*eebb9c2cSPhilip Paeps# On older platforms you may need to scrounge for a POSIX-conforming 'make'. 7*eebb9c2cSPhilip Paeps# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or 8*eebb9c2cSPhilip Paeps# /usr/xpg4/bin/make, not /usr/ccs/bin/make. 9*eebb9c2cSPhilip Paeps 10*eebb9c2cSPhilip Paeps# To affect how this Makefile works, you can run a shell script like this: 11*eebb9c2cSPhilip Paeps# 12*eebb9c2cSPhilip Paeps# #!/bin/sh 13*eebb9c2cSPhilip Paeps# make CC='gcc -std=gnu11' "$@" 14*eebb9c2cSPhilip Paeps# 15*eebb9c2cSPhilip Paeps# This example script is appropriate for a pre-2017 GNU/Linux system 16*eebb9c2cSPhilip Paeps# where a non-default setting is needed to support this package's use of C99. 17*eebb9c2cSPhilip Paeps# 18*eebb9c2cSPhilip Paeps# Alternatively, you can simply edit this Makefile to tailor the following 19*eebb9c2cSPhilip Paeps# macro definitions. 20*eebb9c2cSPhilip Paeps 21*eebb9c2cSPhilip Paeps############################################################################### 22*eebb9c2cSPhilip 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 56259e2ad7SPhilip 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) 13594c2d487SPhilip PaepsTIME_T_ALTERNATIVES_HEAD = int_least64_t 13694c2d487SPhilip PaepsTIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t 137ba2b2efdSGlen Barber 138ad48359aSPhilip Paeps# What kind of TZif data files to generate. (TZif is the binary time 139ad48359aSPhilip Paeps# zone data format that zic generates; see Internet RFC 8536.) 140dc135c6eSBaptiste Daroussin# If you want only POSIX time, with time values interpreted as 141dc135c6eSBaptiste Daroussin# seconds since the epoch (not counting leap seconds), use 142ba2b2efdSGlen Barber# REDO= posix_only 1438d7edd17SPhilip Paeps# below. If you want only "right" time, with values interpreted 144dc135c6eSBaptiste Daroussin# as seconds since the epoch (counting leap seconds), use 145ba2b2efdSGlen Barber# REDO= right_only 146ba2b2efdSGlen Barber# below. If you want both sets of data available, with leap seconds not 147ba2b2efdSGlen Barber# counted normally, use 148ba2b2efdSGlen Barber# REDO= posix_right 149ba2b2efdSGlen Barber# below. If you want both sets of data available, with leap seconds counted 150ba2b2efdSGlen Barber# normally, use 151ba2b2efdSGlen Barber# REDO= right_posix 152ba2b2efdSGlen Barber# below. POSIX mandates that leap seconds not be counted; for compatibility 153dc135c6eSBaptiste Daroussin# with it, use "posix_only" or "posix_right". Use POSIX time on systems with 154dc135c6eSBaptiste Daroussin# leap smearing; this can work better than unsmeared "right" time with 155dc135c6eSBaptiste Daroussin# applications that are not leap second aware, and is closer to unsmeared 156dc135c6eSBaptiste Daroussin# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). 157ba2b2efdSGlen Barber 158ba2b2efdSGlen BarberREDO= posix_right 159ba2b2efdSGlen Barber 160dd5f96c4SPhilip Paeps# Whether to put an "Expires" line in the leapseconds file. 161dd5f96c4SPhilip Paeps# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. 162dd5f96c4SPhilip Paeps# The EXPIRES_LINE value matters only if REDO's value contains "right". 163dd5f96c4SPhilip Paeps# If you change EXPIRES_LINE, remove the leapseconds file before running "make". 164dd5f96c4SPhilip Paeps# zic's support for the Expires line was introduced in tzdb 2020a, 16594c2d487SPhilip Paeps# and was modified in tzdb 2021b to generate version 4 TZif files. 16694c2d487SPhilip Paeps# EXPIRES_LINE defaults to 0 for now so that the leapseconds file 16794c2d487SPhilip Paeps# can be given to pre-2020a zic implementations and so that TZif files 16894c2d487SPhilip Paeps# built by newer zic implementations can be read by pre-2021b libraries. 169dd5f96c4SPhilip PaepsEXPIRES_LINE= 0 170dd5f96c4SPhilip Paeps 17189abb9f8SPhilip Paeps# To install data in text form that has all the information of the TZif data, 1728d7edd17SPhilip Paeps# (optionally incorporating leap second information), use 1738d7edd17SPhilip Paeps# TZDATA_TEXT= tzdata.zi leapseconds 1748d7edd17SPhilip Paeps# To install text data without leap second information (e.g., because 1758d7edd17SPhilip Paeps# REDO='posix_only'), use 1768d7edd17SPhilip Paeps# TZDATA_TEXT= tzdata.zi 1778d7edd17SPhilip Paeps# To avoid installing text data, use 1788d7edd17SPhilip Paeps# TZDATA_TEXT= 1798d7edd17SPhilip Paeps 1808d7edd17SPhilip PaepsTZDATA_TEXT= leapseconds tzdata.zi 1818d7edd17SPhilip Paeps 1828d7edd17SPhilip Paeps# For backward-compatibility links for old zone names, use 183f2fcff28SPhilip Paeps# BACKWARD= backward 1848d7edd17SPhilip Paeps# To omit these links, use 1858d7edd17SPhilip Paeps# BACKWARD= 1868d7edd17SPhilip Paeps 187f2fcff28SPhilip PaepsBACKWARD= backward 1888d7edd17SPhilip Paeps 1899f9fc6bbSPhilip Paeps# If you want out-of-scope and often-wrong data from the file 'backzone', 1909f9fc6bbSPhilip Paeps# but only for entries listed in the backward-compatibility file zone.tab, use 191ba2b2efdSGlen Barber# PACKRATDATA= backzone 1929f9fc6bbSPhilip Paeps# PACKRATLIST= zone.tab 1939f9fc6bbSPhilip Paeps# If you want all the 'backzone' data, use 1949f9fc6bbSPhilip Paeps# PACKRATDATA= backzone 1959f9fc6bbSPhilip Paeps# PACKRATLIST= 196ba2b2efdSGlen Barber# To omit this data, use 197ba2b2efdSGlen Barber# PACKRATDATA= 1989f9fc6bbSPhilip Paeps# PACKRATLIST= 199ba2b2efdSGlen Barber 200ba2b2efdSGlen BarberPACKRATDATA= 2019f9fc6bbSPhilip PaepsPACKRATLIST= 202ba2b2efdSGlen Barber 2038d7edd17SPhilip Paeps# The name of a locale using the UTF-8 encoding, used during self-tests. 2048d7edd17SPhilip Paeps# The tests are skipped if the name does not appear to work on this system. 2058d7edd17SPhilip Paeps 2068d7edd17SPhilip PaepsUTF8_LOCALE= en_US.utf8 2078d7edd17SPhilip Paeps 208ba2b2efdSGlen Barber# Non-default libraries needed to link. 209cf1ad535SPhilip Paeps# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. 210ba2b2efdSGlen BarberLDLIBS= 211ba2b2efdSGlen Barber 212*eebb9c2cSPhilip Paeps# Add the following to an uncommented "CFLAGS=" line as needed 213*eebb9c2cSPhilip Paeps# to override defaults specified in the source code or by the system. 214*eebb9c2cSPhilip Paeps# "-DFOO" is equivalent to "-DFOO=1". 2158d7edd17SPhilip Paeps# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime 2168d7edd17SPhilip Paeps# formats that generate only the last two digits of year numbers 2178d7edd17SPhilip Paeps# -DEPOCH_LOCAL if the 'time' function returns local time not UT 218ba2b2efdSGlen Barber# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater 219ba2b2efdSGlen Barber# than what POSIX specifies, assuming local time is UT. 220ba2b2efdSGlen Barber# For example, N is 252460800 on AmigaOS. 2218d7edd17SPhilip Paeps# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r 2228d7edd17SPhilip Paeps# -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ' 223cf1ad535SPhilip Paeps# -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm 2248d7edd17SPhilip Paeps# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows) 225259e2ad7SPhilip Paeps# -DHAVE__GENERIC=0 if _Generic does not work* 226cf1ad535SPhilip Paeps# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), 227cf1ad535SPhilip Paeps# -DHAVE_GETRANDOM=0 to avoid using getrandom 228cf1ad535SPhilip Paeps# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), 229cf1ad535SPhilip Paeps# where LDLIBS also needs to contain -lintl on some hosts; 230cf1ad535SPhilip Paeps# -DHAVE_GETTEXT=0 to avoid using gettext 2318d7edd17SPhilip Paeps# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares 2328d7edd17SPhilip Paeps# ctime_r and asctime_r incompatibly with the POSIX standard 2338d7edd17SPhilip Paeps# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). 234259e2ad7SPhilip Paeps# -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+ 2358d7edd17SPhilip Paeps# -DHAVE_LINK=0 if your system lacks a link function 2368d7edd17SPhilip Paeps# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function 2378d7edd17SPhilip Paeps# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz 2388d7edd17SPhilip Paeps# localtime_rz can make zdump significantly faster, but is nonstandard. 23994c2d487SPhilip Paeps# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. 2408d7edd17SPhilip Paeps# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare 2418d7edd17SPhilip Paeps# functions like 'link' or variables like 'tzname' required by POSIX 2429142a2a3SPhilip Paeps# -DHAVE_SETENV=0 if your system lacks the setenv function 243259e2ad7SPhilip Paeps# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ 244cf1ad535SPhilip Paeps# -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like 245cf1ad535SPhilip Paeps# __builtin_add_overflow work* 246259e2ad7SPhilip Paeps# -DHAVE_STDINT_H=0 if <stdint.h> does not work*+ 2478d7edd17SPhilip Paeps# -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l 2488d7edd17SPhilip Paeps# -DHAVE_STRDUP=0 if your system lacks the strdup function 249259e2ad7SPhilip Paeps# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ 2508d7edd17SPhilip Paeps# -DHAVE_SYMLINK=0 if your system lacks the symlink function 251cf1ad535SPhilip Paeps# -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work* 2528d7edd17SPhilip Paeps# -DHAVE_TZSET=0 if your system lacks a tzset function 253cf1ad535SPhilip Paeps# -DHAVE_UNISTD_H=0 if <unistd.h> does not work* 254cf1ad535SPhilip Paeps# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work* 2558d7edd17SPhilip Paeps# -Dlocale_t=XXX if your system uses XXX instead of locale_t 256*eebb9c2cSPhilip Paeps# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ 257*eebb9c2cSPhilip Paeps# Typically it is better to use a later standard. For example, 258*eebb9c2cSPhilip Paeps# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. 259*eebb9c2cSPhilip Paeps# Even with -DPORT_TO_C89, the code needs at least one C99 260*eebb9c2cSPhilip Paeps# feature (integers at least 64 bits wide) and maybe more. 26146bee4edSPhilip Paeps# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers 26246bee4edSPhilip Paeps# with external linkage, e.g., applications cannot define 'localtime'. 2638d7edd17SPhilip Paeps# -Dssize_t=long on hosts like MS-Windows that lack ssize_t 264259e2ad7SPhilip Paeps# -DSUPPORT_C89 if the tzcode library should support C89 callers+ 265*eebb9c2cSPhilip Paeps# However, this might trigger latent bugs in C99-or-later callers. 26646bee4edSPhilip Paeps# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has 26746bee4edSPhilip Paeps# security implications and is not recommended for general use 2688d7edd17SPhilip Paeps# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; 269ba2b2efdSGlen Barber# not needed by the main-program tz code, which is single-threaded. 270ba2b2efdSGlen Barber# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. 271ba2b2efdSGlen Barber# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t 2728d7edd17SPhilip Paeps# This is intended for internal use only; it mangles external names. 273ba2b2efdSGlen Barber# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 274ba2b2efdSGlen Barber# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 275ba2b2efdSGlen Barber# the default is system-supplied, typically "/usr/lib/locale" 276ba2b2efdSGlen Barber# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 277259e2ad7SPhilip Paeps# DST transitions for POSIX-style TZ strings lacking them, 278259e2ad7SPhilip Paeps# in the usual case where POSIXRULES is '-'. If not specified, 279259e2ad7SPhilip Paeps# TZDEFRULESTRING defaults to US rules for future DST transitions. 280259e2ad7SPhilip Paeps# This mishandles some past timestamps, as US DST rules have changed. 281259e2ad7SPhilip Paeps# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, 282259e2ad7SPhilip Paeps# as Europe and US DST rules differ. 283259e2ad7SPhilip Paeps# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) 2848d7edd17SPhilip Paeps# -DUNINIT_TRAP if reading uninitialized storage can cause problems 285ba2b2efdSGlen Barber# other than simply getting garbage data 286ba2b2efdSGlen Barber# -DUSE_LTZ=0 to build zdump with the system time zone library 287ba2b2efdSGlen Barber# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. 28812a899b6SPhilip Paeps# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and 28912a899b6SPhilip Paeps# similarly for "slim". Fat TZif files work around incompatibilities 2909142a2a3SPhilip Paeps# and bugs in some TZif readers, notably older ones that 2919142a2a3SPhilip Paeps# ignore or otherwise mishandle 64-bit data in TZif files; 2929142a2a3SPhilip Paeps# however, fat TZif files may trigger bugs in newer TZif readers. 2939142a2a3SPhilip Paeps# Slim TZif files are more efficient, and are the default. 294ba2b2efdSGlen Barber# -DZIC_MAX_ABBR_LEN_WO_WARN=3 295ba2b2efdSGlen Barber# (or some other number) to set the maximum time zone abbreviation length 296ba2b2efdSGlen Barber# that zic will accept without a warning (the default is 6) 297*eebb9c2cSPhilip Paeps# -g to generate symbolic debugging info 298*eebb9c2cSPhilip Paeps# -Idir to include from directory 'dir' 299*eebb9c2cSPhilip Paeps# -O0 to disable optimization; other -O options to enable more optimization 300*eebb9c2cSPhilip Paeps# -Uname to remove any definition of the macro 'name' 301ba2b2efdSGlen Barber# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking 3029142a2a3SPhilip Paeps# 3039142a2a3SPhilip Paeps# * Options marked "*" can be omitted if your compiler is C23 compatible. 304259e2ad7SPhilip Paeps# * Options marked "+" are obsolescent and are planned to be removed 305*eebb9c2cSPhilip Paeps# once the code assumes C99 or later, say in the year 2029. 3069142a2a3SPhilip Paeps# 3078d7edd17SPhilip Paeps# Select instrumentation via "make GCC_INSTRUMENT='whatever'". 3088d7edd17SPhilip PaepsGCC_INSTRUMENT = \ 3098d7edd17SPhilip Paeps -fsanitize=undefined -fsanitize-address-use-after-scope \ 3108d7edd17SPhilip Paeps -fsanitize-undefined-trap-on-error -fstack-protector 31194c2d487SPhilip Paeps# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. 3128d7edd17SPhilip PaepsGCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ 3138d7edd17SPhilip Paeps $(GCC_INSTRUMENT) \ 314ba2b2efdSGlen Barber -Wall -Wextra \ 3158d7edd17SPhilip Paeps -Walloc-size-larger-than=100000 -Warray-bounds=2 \ 3169f9fc6bbSPhilip Paeps -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \ 3178d7edd17SPhilip Paeps -Wdeclaration-after-statement -Wdouble-promotion \ 31894c2d487SPhilip Paeps -Wduplicated-branches -Wduplicated-cond \ 3198d7edd17SPhilip Paeps -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ 320cf1ad535SPhilip Paeps -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ 3218d7edd17SPhilip Paeps -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 32294c2d487SPhilip Paeps -Wnull-dereference \ 323ba2b2efdSGlen Barber -Wold-style-definition -Woverlength-strings -Wpointer-arith \ 32494c2d487SPhilip Paeps -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ 32594c2d487SPhilip Paeps -Wstrict-prototypes -Wstringop-overflow=4 \ 326d81c2dd9SPhilip Paeps -Wstringop-truncation -Wsuggest-attribute=cold \ 3278d7edd17SPhilip Paeps -Wsuggest-attribute=const -Wsuggest-attribute=format \ 328d81c2dd9SPhilip Paeps -Wsuggest-attribute=malloc \ 3298d7edd17SPhilip Paeps -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ 3309f9fc6bbSPhilip Paeps -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \ 3318d7edd17SPhilip Paeps -Wvariadic-macros -Wvla -Wwrite-strings \ 332ba2b2efdSGlen Barber -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ 333cf1ad535SPhilip Paeps -Wno-type-limits 334ba2b2efdSGlen Barber# 335ba2b2efdSGlen Barber# If your system has a "GMT offset" field in its "struct tm"s 336ba2b2efdSGlen Barber# (or if you decide to add such a field in your system's "time.h" file), 337ba2b2efdSGlen Barber# add the name to a define such as 338ba2b2efdSGlen Barber# -DTM_GMTOFF=tm_gmtoff 339ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. If not defined, the code attempts to 340ba2b2efdSGlen Barber# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. 341ba2b2efdSGlen Barber# Similarly, if your system has a "zone abbreviation" field, define 342ba2b2efdSGlen Barber# -DTM_ZONE=tm_zone 3435f33eb72SPhilip Paeps# and define NO_TM_ZONE to suppress any guessing. Although these two fields 3445f33eb72SPhilip Paeps# not required by POSIX, a future version of POSIX is planned to require them 3455f33eb72SPhilip Paeps# and they are widely available on GNU/Linux and BSD systems. 346ba2b2efdSGlen Barber# 3478d7edd17SPhilip Paeps# The next batch of options control support for external variables 3488d7edd17SPhilip Paeps# exported by tzcode. In practice these variables are less useful 3498d7edd17SPhilip Paeps# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. 3508d7edd17SPhilip Paeps# # 3518d7edd17SPhilip Paeps# # To omit or support the external variable "tzname", add one of: 352dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=0 # do not support "tzname" 353dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library 354dd5f96c4SPhilip Paeps# # -DHAVE_TZNAME=2 # support and define "tzname" 3558d7edd17SPhilip Paeps# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. 3568d7edd17SPhilip Paeps# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. 3578d7edd17SPhilip Paeps# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause 3588d7edd17SPhilip Paeps# # crashes when combined with some platforms' standard libraries, 3598d7edd17SPhilip Paeps# # presumably due to memory allocation issues. 3608d7edd17SPhilip Paeps# # 3618d7edd17SPhilip Paeps# # To omit or support the external variables "timezone" and "daylight", add 362dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=0 # do not support 363dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=1 # support, and variables are defined by system library 364dd5f96c4SPhilip Paeps# # -DUSG_COMPAT=2 # support and define variables 3658d7edd17SPhilip Paeps# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by 3668d7edd17SPhilip Paeps# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. 3678d7edd17SPhilip Paeps# # If not defined, the code attempts to guess USG_COMPAT from other macros. 3688d7edd17SPhilip Paeps# # 3698d7edd17SPhilip Paeps# # To support the external variable "altzone", add 370dd5f96c4SPhilip Paeps# # -DALTZONE=0 # do not support 371dd5f96c4SPhilip Paeps# # -DALTZONE=1 # support "altzone", which is defined by system library 372dd5f96c4SPhilip Paeps# # -DALTZONE=2 # support and define "altzone" 3738d7edd17SPhilip Paeps# # to the end of the "CFLAGS=" line; although "altzone" appeared in 3748d7edd17SPhilip Paeps# # System V Release 3.1 it has not been standardized. 375dd5f96c4SPhilip Paeps# # If not defined, the code attempts to guess ALTZONE from other macros. 3768d7edd17SPhilip Paeps# 377ba2b2efdSGlen Barber# If you want functions that were inspired by early versions of X3J11's work, 378ba2b2efdSGlen Barber# add 379ba2b2efdSGlen Barber# -DSTD_INSPIRED 380cf1ad535SPhilip Paeps# to the end of the "CFLAGS=" line. This arranges for the following 381cf1ad535SPhilip Paeps# functions to be added to the time conversion library. 382ba2b2efdSGlen Barber# "offtime" is like "gmtime" except that it accepts a second (long) argument 383ba2b2efdSGlen Barber# that gives an offset to add to the time_t when converting it. 384*eebb9c2cSPhilip Paeps# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. 385*eebb9c2cSPhilip Paeps# "timelocal" is nearly equivalent to "mktime". 386ba2b2efdSGlen Barber# "timeoff" is like "timegm" except that it accepts a second (long) argument 387ba2b2efdSGlen Barber# that gives an offset to use when converting to a time_t. 388*eebb9c2cSPhilip Paeps# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. 389ba2b2efdSGlen Barber# "posix2time" and "time2posix" are described in an included manual page. 390ba2b2efdSGlen Barber# X3J11's work does not describe any of these functions. 391ba2b2efdSGlen Barber# These functions may well disappear in future releases of the time 392ba2b2efdSGlen Barber# conversion package. 393ba2b2efdSGlen Barber# 394ba2b2efdSGlen Barber# If you don't want functions that were inspired by NetBSD, add 395ba2b2efdSGlen Barber# -DNETBSD_INSPIRED=0 396ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. Otherwise, the functions 397ba2b2efdSGlen Barber# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the 398259e2ad7SPhilip Paeps# time library, and if STD_INSPIRED is also defined to nonzero the functions 399ba2b2efdSGlen Barber# "posix2time_z" and "time2posix_z" are added as well. 400ba2b2efdSGlen Barber# The functions ending in "_z" (or "_rz") are like their unsuffixed 401ba2b2efdSGlen Barber# (or suffixed-by-"_r") counterparts, except with an extra first 402ba2b2efdSGlen Barber# argument of opaque type timezone_t that specifies the timezone. 403ba2b2efdSGlen Barber# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. 404ba2b2efdSGlen Barber# 405ba2b2efdSGlen Barber# If you want to allocate state structures in localtime, add 406ba2b2efdSGlen Barber# -DALL_STATE 407ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 408ba2b2efdSGlen Barber# 409ba2b2efdSGlen Barber# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 410ba2b2efdSGlen Barber# out by the National Institute of Standards and Technology 411*eebb9c2cSPhilip Paeps# which claims to test C and POSIX conformance. If you want to pass PCTS, add 412ba2b2efdSGlen Barber# -DPCTS 413ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. 414ba2b2efdSGlen Barber# 415ba2b2efdSGlen Barber# If you want strict compliance with XPG4 as of 1994-04-09, add 416ba2b2efdSGlen Barber# -DXPG4_1994_04_09 417ba2b2efdSGlen Barber# to the end of the "CFLAGS=" line. This causes "strftime" to always return 4188d7edd17SPhilip Paeps# 53 as a week number (rather than 52 or 53) for January days before 4198d7edd17SPhilip Paeps# January's first Monday when a "%V" format is used and January 1 420ba2b2efdSGlen Barber# falls on a Friday, Saturday, or Sunday. 421*eebb9c2cSPhilip Paeps# 422*eebb9c2cSPhilip Paeps# POSIX says CFLAGS defaults to "-O 1". 423*eebb9c2cSPhilip Paeps# Uncomment the following line and edit its contents as needed. 424ba2b2efdSGlen Barber 425*eebb9c2cSPhilip Paeps#CFLAGS= -O 1 426ba2b2efdSGlen Barber 427ba2b2efdSGlen Barber 428*eebb9c2cSPhilip Paeps# The name of a POSIX-like library archiver, its flags, C compiler, 429*eebb9c2cSPhilip Paeps# linker flags, and 'make' utility. Ordinarily the defaults suffice. 430*eebb9c2cSPhilip Paeps# The commented-out values are the defaults specified by POSIX 202x/D3. 431*eebb9c2cSPhilip Paeps#AR = ar 432*eebb9c2cSPhilip Paeps#ARFLAGS = -rv 433*eebb9c2cSPhilip Paeps#CC = c17 434*eebb9c2cSPhilip Paeps#LDFLAGS = 435*eebb9c2cSPhilip Paeps#MAKE = make 436ba2b2efdSGlen Barber 437ba2b2efdSGlen Barber# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in 438ba2b2efdSGlen Barber# submake command lines. The default is no leap seconds. 439ba2b2efdSGlen Barber 440ba2b2efdSGlen BarberLEAPSECONDS= 441ba2b2efdSGlen Barber 442ba2b2efdSGlen Barber# The zic command and its arguments. 443ba2b2efdSGlen Barber 444ba2b2efdSGlen Barberzic= ./zic 445ba2b2efdSGlen BarberZIC= $(zic) $(ZFLAGS) 446ba2b2efdSGlen Barber 447ad48359aSPhilip Paeps# To shrink the size of installed TZif files, 448ad48359aSPhilip Paeps# append "-r @N" to omit data before N-seconds-after-the-Epoch. 4499142a2a3SPhilip Paeps# To grow the files and work around bugs in older applications, 4509142a2a3SPhilip Paeps# possibly at the expense of introducing bugs in newer ones, 4519142a2a3SPhilip Paeps# append "-b fat"; see ZIC_BLOAT_DEFAULT above. 4522865ab3fSPhilip Paeps# See the zic man page for more about -b and -r. 453ba2b2efdSGlen BarberZFLAGS= 454ba2b2efdSGlen Barber 45589abb9f8SPhilip Paeps# How to use zic to install TZif files. 456ba2b2efdSGlen Barber 457f2fcff28SPhilip PaepsZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) 458ba2b2efdSGlen Barber 459*eebb9c2cSPhilip Paeps# The name of a POSIX-compliant 'awk' on your system. 4608ea5af2bSPhilip Paeps# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. 4618ea5af2bSPhilip Paeps# Also, it is better (though not essential) if 'awk' supports UTF-8, 4628ea5af2bSPhilip Paeps# and unfortunately mawk and busybox awk do not support UTF-8. 4638ea5af2bSPhilip Paeps# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. 464ba2b2efdSGlen BarberAWK= awk 465ba2b2efdSGlen Barber 466*eebb9c2cSPhilip Paeps# The full path name of a POSIX-compliant shell, preferably one that supports 467ba2b2efdSGlen Barber# the Korn shell's 'select' statement as an extension. 468ba2b2efdSGlen Barber# These days, Bash is the most popular. 469ba2b2efdSGlen Barber# It should be OK to set this to /bin/sh, on platforms where /bin/sh 470*eebb9c2cSPhilip Paeps# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash 471ba2b2efdSGlen Barber# is typically nicer if it works. 472ba2b2efdSGlen BarberKSHELL= /bin/bash 473ba2b2efdSGlen Barber 4742c5e84ccSPhilip Paeps# Name of curl <https://curl.haxx.se/>, used for HTML validation. 4752c5e84ccSPhilip PaepsCURL= curl 4762c5e84ccSPhilip Paeps 4772865ab3fSPhilip Paeps# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. 4782865ab3fSPhilip PaepsGPG= gpg 4792865ab3fSPhilip Paeps 480ba2b2efdSGlen Barber# This expensive test requires USE_LTZ. 481ba2b2efdSGlen Barber# To suppress it, define this macro to be empty. 482ba2b2efdSGlen BarberCHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives 483ba2b2efdSGlen Barber 484ba2b2efdSGlen Barber# SAFE_CHAR is a regular expression that matches a safe character. 485ba2b2efdSGlen Barber# Some parts of this distribution are limited to safe characters; 486ba2b2efdSGlen Barber# others can use any UTF-8 character. 487ba2b2efdSGlen Barber# For now, the safe characters are a safe subset of ASCII. 488ba2b2efdSGlen Barber# The caller must set the shell variable 'sharp' to the character '#', 489ba2b2efdSGlen Barber# since Makefile macros cannot contain '#'. 490ba2b2efdSGlen Barber# TAB_CHAR is a single tab character, in single quotes. 491ba2b2efdSGlen BarberTAB_CHAR= ' ' 492ba2b2efdSGlen BarberSAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 493ba2b2efdSGlen BarberSAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 494ba2b2efdSGlen BarberSAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' 495ba2b2efdSGlen BarberSAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) 496ba2b2efdSGlen BarberSAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' 497ba2b2efdSGlen Barber 498259e2ad7SPhilip Paeps# These non-alphabetic, non-ASCII printable characters are Latin-1, 499259e2ad7SPhilip Paeps# and so are likely displayable even in editors like XEmacs 21 500259e2ad7SPhilip Paeps# that have limited display capabilities. 501259e2ad7SPhilip PaepsUNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ 50246bee4edSPhilip Paeps# Non-ASCII non-letters that OK_CHAR allows, as these characters are 50389abb9f8SPhilip Paeps# useful in commentary. 504259e2ad7SPhilip PaepsUNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) 50546bee4edSPhilip Paeps 5069f9fc6bbSPhilip Paeps# Put this in a bracket expression to match spaces. 5079f9fc6bbSPhilip Paepss = [:space:] 5089f9fc6bbSPhilip Paeps 509ba2b2efdSGlen Barber# OK_CHAR matches any character allowed in the distributed files. 51046bee4edSPhilip Paeps# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and 51146bee4edSPhilip Paeps# multibyte letters are also allowed so that commentary can contain a 51246bee4edSPhilip Paeps# few safe symbols and people's names and can quote non-English sources. 51346bee4edSPhilip Paeps# Other non-letters are limited to ASCII renderings for the 51446bee4edSPhilip Paeps# convenience of maintainers using XEmacs 21.5.34, which by default 51546bee4edSPhilip Paeps# mishandles Unicode characters U+0100 and greater. 51646bee4edSPhilip PaepsOK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' 517ba2b2efdSGlen Barber 518ba2b2efdSGlen Barber# SAFE_LINE matches a line of safe characters. 519ba2b2efdSGlen Barber# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; 520ba2b2efdSGlen Barber# this is so that comments can contain non-ASCII characters. 521ba2b2efdSGlen Barber# OK_LINE matches a line of OK characters. 522ba2b2efdSGlen BarberSAFE_LINE= '^'$(SAFE_CHAR)'*$$' 523ba2b2efdSGlen BarberSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' 524ba2b2efdSGlen BarberOK_LINE= '^'$(OK_CHAR)'*$$' 525ba2b2efdSGlen Barber 526ba2b2efdSGlen Barber# Flags to give 'tar' when making a distribution. 527ba2b2efdSGlen Barber# Try to use flags appropriate for GNU tar. 5288ea5af2bSPhilip PaepsGNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \ 5298ea5af2bSPhilip Paeps --numeric-owner --owner=0 --group=0 \ 5308ea5af2bSPhilip Paeps --mode=go+u,go-w --sort=name 531ba2b2efdSGlen BarberTARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ 532ba2b2efdSGlen Barber then echo $(GNUTARFLAGS); \ 533ba2b2efdSGlen Barber else :; \ 534ba2b2efdSGlen Barber fi` 535ba2b2efdSGlen Barber 536ba2b2efdSGlen Barber# Flags to give 'gzip' when making a distribution. 537ba2b2efdSGlen BarberGZIPFLAGS= -9n 538ba2b2efdSGlen Barber 539cf1ad535SPhilip Paeps# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. 540cf1ad535SPhilip Paeps# This makes it easier to see which Zone has been affected. 541cf1ad535SPhilip PaepsDIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ 542cf1ad535SPhilip Paeps || echo ' -F^TZ=') 543cf1ad535SPhilip Paeps 544ba2b2efdSGlen Barber# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. 545ba2b2efdSGlen BarberRANLIB= : 546ba2b2efdSGlen Barber 547*eebb9c2cSPhilip Paeps# POSIX prohibits defining or using SHELL. However, csh users on systems 548*eebb9c2cSPhilip Paeps# that use the user shell for Makefile commands may need to define SHELL. 549*eebb9c2cSPhilip Paeps#SHELL= /bin/sh 550*eebb9c2cSPhilip Paeps 551*eebb9c2cSPhilip Paeps# End of macros that one plausibly might want to tailor. 552*eebb9c2cSPhilip Paeps############################################################################### 553*eebb9c2cSPhilip Paeps 554*eebb9c2cSPhilip Paeps 555ba2b2efdSGlen BarberTZCOBJS= zic.o 5568d7edd17SPhilip PaepsTZDOBJS= zdump.o localtime.o asctime.o strftime.o 557ba2b2efdSGlen BarberDATEOBJS= date.o localtime.o strftime.o asctime.o 558dd5f96c4SPhilip PaepsLIBSRCS= localtime.c asctime.c difftime.c strftime.c 559dd5f96c4SPhilip PaepsLIBOBJS= localtime.o asctime.o difftime.o strftime.o 560ba2b2efdSGlen BarberHEADERS= tzfile.h private.h 561ba2b2efdSGlen BarberNONLIBSRCS= zic.c zdump.c 562dd5f96c4SPhilip PaepsNEWUCBSRCS= date.c 563ba2b2efdSGlen BarberSOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ 564ba2b2efdSGlen Barber tzselect.ksh workman.sh 565ba2b2efdSGlen BarberMANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 566ba2b2efdSGlen Barber tzfile.5 tzselect.8 zic.8 zdump.8 567ba2b2efdSGlen BarberMANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ 568ba2b2efdSGlen Barber time2posix.3.txt \ 569ba2b2efdSGlen Barber tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ 570ba2b2efdSGlen Barber date.1.txt 5718d7edd17SPhilip PaepsCOMMON= calendars CONTRIBUTING LICENSE Makefile \ 57293d120dbSPhilip Paeps NEWS README SECURITY theory.html version 573f2fcff28SPhilip PaepsWEB_PAGES= tz-art.html tz-how-to.html tz-link.html 574ad48359aSPhilip PaepsCHECK_WEB_PAGES=check_theory.html check_tz-art.html \ 575ad48359aSPhilip Paeps check_tz-how-to.html check_tz-link.html 576ba2b2efdSGlen BarberDOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) 577ba2b2efdSGlen BarberPRIMARY_YDATA= africa antarctica asia australasia \ 578ba2b2efdSGlen Barber europe northamerica southamerica 579afb91be3SPhilip PaepsYDATA= $(PRIMARY_YDATA) etcetera 58012a899b6SPhilip PaepsNDATA= factory 58112a899b6SPhilip PaepsTDATA_TO_CHECK= $(YDATA) $(NDATA) backward 582afb91be3SPhilip PaepsTDATA= $(YDATA) $(NDATA) $(BACKWARD) 583*eebb9c2cSPhilip PaepsZONETABLES= zone.tab zone1970.tab zonenow.tab 5848d7edd17SPhilip PaepsTABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) 585ba2b2efdSGlen BarberLEAP_DEPS= leapseconds.awk leap-seconds.list 5869f9fc6bbSPhilip PaepsTZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ 5879f9fc6bbSPhilip Paeps $(PACKRATDATA) $(PACKRATLIST) 5889f9fc6bbSPhilip PaepsDSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) 589afb91be3SPhilip PaepsDATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ 59012a899b6SPhilip Paeps leapseconds $(ZONETABLES) 591*eebb9c2cSPhilip PaepsAWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ 59246bee4edSPhilip Paeps ziguard.awk zishrink.awk 5935f33eb72SPhilip PaepsMISC= $(AWK_SCRIPTS) 594ba2b2efdSGlen BarberTZS_YEAR= 2050 59589abb9f8SPhilip PaepsTZS_CUTOFF_FLAG= -c $(TZS_YEAR) 596ba2b2efdSGlen BarberTZS= to$(TZS_YEAR).tzs 597ba2b2efdSGlen BarberTZS_NEW= to$(TZS_YEAR)new.tzs 59894c2d487SPhilip PaepsTZS_DEPS= $(YDATA) asctime.c localtime.c \ 599ba2b2efdSGlen Barber private.h tzfile.h zdump.c zic.c 6009f9fc6bbSPhilip PaepsTZDATA_DIST = $(COMMON) $(DATA) $(MISC) 60189abb9f8SPhilip Paeps# EIGHT_YARDS is just a yard short of the whole ENCHILADA. 6029f9fc6bbSPhilip PaepsEIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi 60389abb9f8SPhilip PaepsENCHILADA = $(EIGHT_YARDS) $(TZS) 604ba2b2efdSGlen Barber 605ba2b2efdSGlen Barber# Consult these files when deciding whether to rebuild the 'version' file. 606ba2b2efdSGlen Barber# This list is not the same as the output of 'git ls-files', since 607ba2b2efdSGlen Barber# .gitignore is not distributed. 608ba2b2efdSGlen BarberVERSION_DEPS= \ 60993d120dbSPhilip Paeps calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ 610ba2b2efdSGlen Barber africa antarctica asctime.c asia australasia \ 611ba2b2efdSGlen Barber backward backzone \ 612*eebb9c2cSPhilip Paeps checklinks.awk checknow.awk checktab.awk \ 613ba2b2efdSGlen Barber date.1 date.c difftime.c \ 614ba2b2efdSGlen Barber etcetera europe factory iso3166.tab \ 615ba2b2efdSGlen Barber leap-seconds.list leapseconds.awk localtime.c \ 616ba2b2efdSGlen Barber newctime.3 newstrftime.3 newtzset.3 northamerica \ 61712a899b6SPhilip Paeps private.h southamerica strftime.c theory.html \ 618f2fcff28SPhilip Paeps time2posix.3 tz-art.html tz-how-to.html tz-link.html \ 619ba2b2efdSGlen Barber tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ 62012a899b6SPhilip Paeps workman.sh zdump.8 zdump.c zic.8 zic.c \ 621d81c2dd9SPhilip Paeps ziguard.awk zishrink.awk \ 622*eebb9c2cSPhilip Paeps zone.tab zone1970.tab zonenow.tab 623ba2b2efdSGlen Barber 62412a899b6SPhilip Paepsall: tzselect zic zdump libtz.a $(TABDATA) \ 62546bee4edSPhilip Paeps vanguard.zi main.zi rearguard.zi 626ba2b2efdSGlen Barber 627ba2b2efdSGlen BarberALL: all date $(ENCHILADA) 628ba2b2efdSGlen Barber 629ba2b2efdSGlen Barberinstall: all $(DATA) $(REDO) $(MANS) 630f2fcff28SPhilip Paeps mkdir -p '$(DESTDIR)$(BINDIR)' \ 631f2fcff28SPhilip Paeps '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ 632f2fcff28SPhilip Paeps '$(DESTDIR)$(LIBDIR)' \ 633f2fcff28SPhilip Paeps '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ 634f2fcff28SPhilip Paeps '$(DESTDIR)$(MANDIR)/man8' 6352865ab3fSPhilip Paeps $(ZIC_INSTALL) -l $(LOCALTIME) \ 6362865ab3fSPhilip Paeps `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ 6372865ab3fSPhilip Paeps ` $(POSIXRULES) \ 638f2fcff28SPhilip Paeps -t '$(DESTDIR)$(TZDEFAULT)' 639f2fcff28SPhilip Paeps cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' 640f2fcff28SPhilip Paeps cp tzselect '$(DESTDIR)$(BINDIR)/.' 641f2fcff28SPhilip Paeps cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' 642f2fcff28SPhilip Paeps cp zic '$(DESTDIR)$(ZICDIR)/.' 643f2fcff28SPhilip Paeps cp libtz.a '$(DESTDIR)$(LIBDIR)/.' 644f2fcff28SPhilip Paeps $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' 645f2fcff28SPhilip Paeps cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' 646f2fcff28SPhilip Paeps cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' 647f2fcff28SPhilip Paeps cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' 648ba2b2efdSGlen Barber 649ba2b2efdSGlen BarberINSTALL: ALL install date.1 650f2fcff28SPhilip Paeps mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' 651f2fcff28SPhilip Paeps cp date '$(DESTDIR)$(BINDIR)/.' 652f2fcff28SPhilip Paeps cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' 653ba2b2efdSGlen Barber 654dc505d53SPhilip Paeps# Calculate version number from git, if available. 655dc505d53SPhilip Paeps# Otherwise, use $(VERSION) unless it is "unknown" and there is already 656dc505d53SPhilip Paeps# a 'version' file, in which case reuse the existing 'version' contents 657dc505d53SPhilip Paeps# and append "-dirty" if the contents do not already end in "-dirty". 658ba2b2efdSGlen Barberversion: $(VERSION_DEPS) 659ba2b2efdSGlen Barber { (type git) >/dev/null 2>&1 && \ 660ba2b2efdSGlen Barber V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ 661ba2b2efdSGlen Barber --abbrev=7 --dirty` || \ 662dc505d53SPhilip Paeps if test '$(VERSION)' = unknown && V=`cat $@`; then \ 663dc505d53SPhilip Paeps case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ 664dc505d53SPhilip Paeps else \ 665dc505d53SPhilip Paeps V='$(VERSION)'; \ 666dc505d53SPhilip Paeps fi; } && \ 667ba2b2efdSGlen Barber printf '%s\n' "$$V" >$@.out 668ba2b2efdSGlen Barber mv $@.out $@ 669ba2b2efdSGlen Barber 6709f9fc6bbSPhilip Paeps# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. 67146bee4edSPhilip Paepsvanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) 6729f9fc6bbSPhilip Paeps $(AWK) \ 6739f9fc6bbSPhilip Paeps -v DATAFORM=`expr $@ : '\(.*\).zi'` \ 6749f9fc6bbSPhilip Paeps -v PACKRATDATA='$(PACKRATDATA)' \ 6759f9fc6bbSPhilip Paeps -v PACKRATLIST='$(PACKRATLIST)' \ 6769f9fc6bbSPhilip Paeps -f ziguard.awk \ 677d81c2dd9SPhilip Paeps $(TDATA) $(PACKRATDATA) >$@.out 67846bee4edSPhilip Paeps mv $@.out $@ 67989abb9f8SPhilip Paeps# This file has a version comment that attempts to capture any tailoring 6809f9fc6bbSPhilip Paeps# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. 68189abb9f8SPhilip Paepstzdata.zi: $(DATAFORM).zi version zishrink.awk 682f2fcff28SPhilip Paeps version=`sed 1q version` && \ 68389abb9f8SPhilip Paeps LC_ALL=C $(AWK) \ 68489abb9f8SPhilip Paeps -v dataform='$(DATAFORM)' \ 68589abb9f8SPhilip Paeps -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 68689abb9f8SPhilip Paeps -v redo='$(REDO)' \ 68789abb9f8SPhilip Paeps -v version="$$version" \ 68889abb9f8SPhilip Paeps -f zishrink.awk \ 68946bee4edSPhilip Paeps $(DATAFORM).zi >$@.out 6908d7edd17SPhilip Paeps mv $@.out $@ 6918d7edd17SPhilip Paeps 692*eebb9c2cSPhilip Paepstzdir.h: 693*eebb9c2cSPhilip Paeps printf '%s\n' >$@.out \ 694*eebb9c2cSPhilip Paeps '#ifndef TZDEFAULT' \ 695*eebb9c2cSPhilip Paeps '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ 696*eebb9c2cSPhilip Paeps '#endif' \ 697*eebb9c2cSPhilip Paeps '#ifndef TZDIR' \ 698*eebb9c2cSPhilip Paeps '# define TZDIR "$(TZDIR)" /* TZif directory */' \ 699*eebb9c2cSPhilip Paeps '#endif' 700*eebb9c2cSPhilip Paeps mv $@.out $@ 701*eebb9c2cSPhilip Paeps 702ba2b2efdSGlen Barberversion.h: version 703ba2b2efdSGlen Barber VERSION=`cat version` && printf '%s\n' \ 704ba2b2efdSGlen Barber 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ 705ba2b2efdSGlen Barber "static char const TZVERSION[]=\"$$VERSION\";" \ 706ba2b2efdSGlen Barber 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ 707ba2b2efdSGlen Barber >$@.out 708ba2b2efdSGlen Barber mv $@.out $@ 709ba2b2efdSGlen Barber 710ba2b2efdSGlen Barberzdump: $(TZDOBJS) 711ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 712ba2b2efdSGlen Barber 713ba2b2efdSGlen Barberzic: $(TZCOBJS) 714ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 715ba2b2efdSGlen Barber 716ba2b2efdSGlen Barberleapseconds: $(LEAP_DEPS) 717dd5f96c4SPhilip Paeps $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ 718dd5f96c4SPhilip Paeps -f leapseconds.awk leap-seconds.list >$@.out 719ba2b2efdSGlen Barber mv $@.out $@ 720ba2b2efdSGlen Barber 721ba2b2efdSGlen Barber# Arguments to pass to submakes of install_data. 722ba2b2efdSGlen Barber# They can be overridden by later submake arguments. 723ba2b2efdSGlen BarberINSTALLARGS = \ 724f2fcff28SPhilip Paeps BACKWARD='$(BACKWARD)' \ 725f2fcff28SPhilip Paeps DESTDIR='$(DESTDIR)' \ 726ba2b2efdSGlen Barber LEAPSECONDS='$(LEAPSECONDS)' \ 727ba2b2efdSGlen Barber PACKRATDATA='$(PACKRATDATA)' \ 7289f9fc6bbSPhilip Paeps PACKRATLIST='$(PACKRATLIST)' \ 729f2fcff28SPhilip Paeps TZDEFAULT='$(TZDEFAULT)' \ 730f2fcff28SPhilip Paeps TZDIR='$(TZDIR)' \ 731ba2b2efdSGlen Barber ZIC='$(ZIC)' 732ba2b2efdSGlen Barber 73312a899b6SPhilip PaepsINSTALL_DATA_DEPS = zic leapseconds tzdata.zi 73489abb9f8SPhilip Paeps 73589abb9f8SPhilip Paeps# 'make install_data' installs one set of TZif files. 73689abb9f8SPhilip Paepsinstall_data: $(INSTALL_DATA_DEPS) 7378d7edd17SPhilip Paeps $(ZIC_INSTALL) tzdata.zi 738ba2b2efdSGlen Barber 73989abb9f8SPhilip Paepsposix_only: $(INSTALL_DATA_DEPS) 740ba2b2efdSGlen Barber $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data 741ba2b2efdSGlen Barber 74289abb9f8SPhilip Paepsright_only: $(INSTALL_DATA_DEPS) 743ba2b2efdSGlen Barber $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ 744ba2b2efdSGlen Barber install_data 745ba2b2efdSGlen Barber 746ba2b2efdSGlen Barber# In earlier versions of this makefile, the other two directories were 747ba2b2efdSGlen Barber# subdirectories of $(TZDIR). However, this led to configuration errors. 748ba2b2efdSGlen Barber# For example, with posix_right under the earlier scheme, 749ba2b2efdSGlen Barber# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 750ba2b2efdSGlen Barber# but gmtime without leap seconds, which led to problems with applications 751ba2b2efdSGlen Barber# like sendmail that subtract gmtime from localtime. 752ba2b2efdSGlen Barber# Therefore, the other two directories are now siblings of $(TZDIR). 753ba2b2efdSGlen Barber# You must replace all of $(TZDIR) to switch from not using leap seconds 754ba2b2efdSGlen Barber# to using them, or vice versa. 755ba2b2efdSGlen Barberright_posix: right_only 756f2fcff28SPhilip Paeps rm -fr '$(DESTDIR)$(TZDIR)-leaps' 757f2fcff28SPhilip Paeps ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ 758f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 759f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 760ba2b2efdSGlen Barber 761ba2b2efdSGlen Barberposix_right: posix_only 762f2fcff28SPhilip Paeps rm -fr '$(DESTDIR)$(TZDIR)-posix' 763f2fcff28SPhilip Paeps ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ 764f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only 765f2fcff28SPhilip Paeps $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only 766ba2b2efdSGlen Barber 767ba2b2efdSGlen Barberzones: $(REDO) 768ba2b2efdSGlen Barber 76946bee4edSPhilip Paeps# dummy.zd is not a real file; it is mentioned here only so that the 77046bee4edSPhilip Paeps# top-level 'make' does not have a syntax error. 77146bee4edSPhilip PaepsZDS = dummy.zd 77246bee4edSPhilip Paeps# Rule used only by submakes invoked by the $(TZS_NEW) rule. 77346bee4edSPhilip Paeps# It is separate so that GNU 'make -j' can run instances in parallel. 77446bee4edSPhilip Paeps$(ZDS): zdump 77589abb9f8SPhilip Paeps ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ 77689abb9f8SPhilip Paeps >$@ 77746bee4edSPhilip Paeps 77889abb9f8SPhilip PaepsTZS_NEW_DEPS = tzdata.zi zdump zic 77989abb9f8SPhilip Paeps$(TZS_NEW): $(TZS_NEW_DEPS) 78089abb9f8SPhilip Paeps rm -fr tzs$(TZS_YEAR).dir 78189abb9f8SPhilip Paeps mkdir tzs$(TZS_YEAR).dir 78289abb9f8SPhilip Paeps $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi 7838d7edd17SPhilip Paeps $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ 7848d7edd17SPhilip Paeps tzdata.zi | LC_ALL=C sort >$@.out 785ba2b2efdSGlen Barber wd=`pwd` && \ 78689abb9f8SPhilip Paeps x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ 78789abb9f8SPhilip Paeps tzdata.zi \ 78846bee4edSPhilip Paeps | LC_ALL=C sort -t . -k 2,2` && \ 78989abb9f8SPhilip Paeps set x $$x && \ 79046bee4edSPhilip Paeps shift && \ 79146bee4edSPhilip Paeps ZDS=$$* && \ 79289abb9f8SPhilip Paeps $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ 79389abb9f8SPhilip Paeps ZDS="$$ZDS" $$ZDS && \ 79489abb9f8SPhilip Paeps sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out 79589abb9f8SPhilip Paeps rm -fr tzs$(TZS_YEAR).dir 79646bee4edSPhilip Paeps mv $@.out $@ 797ba2b2efdSGlen Barber 79889abb9f8SPhilip Paeps# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the 799ba2b2efdSGlen Barber# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. 800ba2b2efdSGlen Barber$(TZS): 80189abb9f8SPhilip Paeps touch $@ 802ba2b2efdSGlen Barber 803ba2b2efdSGlen Barberforce_tzs: $(TZS_NEW) 804ba2b2efdSGlen Barber cp $(TZS_NEW) $(TZS) 805ba2b2efdSGlen Barber 806ba2b2efdSGlen Barberlibtz.a: $(LIBOBJS) 807e350c46aSBaptiste Daroussin rm -f $@ 808*eebb9c2cSPhilip Paeps $(AR) $(ARFLAGS) $@ $(LIBOBJS) 809ba2b2efdSGlen Barber $(RANLIB) $@ 810ba2b2efdSGlen Barber 811ba2b2efdSGlen Barberdate: $(DATEOBJS) 812ba2b2efdSGlen Barber $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 813ba2b2efdSGlen Barber 814ba2b2efdSGlen Barbertzselect: tzselect.ksh version 815ba2b2efdSGlen Barber VERSION=`cat version` && sed \ 816*eebb9c2cSPhilip Paeps -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ 817*eebb9c2cSPhilip Paeps -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ 818*eebb9c2cSPhilip Paeps -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ 819*eebb9c2cSPhilip Paeps -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ 820*eebb9c2cSPhilip Paeps -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ 821*eebb9c2cSPhilip Paeps -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ 822ba2b2efdSGlen Barber <$@.ksh >$@.out 823ba2b2efdSGlen Barber chmod +x $@.out 824ba2b2efdSGlen Barber mv $@.out $@ 825ba2b2efdSGlen Barber 826cf1ad535SPhilip Paepscheck: check_back check_mild 827cf1ad535SPhilip Paepscheck_mild: check_character_set check_white_space check_links \ 828*eebb9c2cSPhilip Paeps check_name_lengths check_now \ 829*eebb9c2cSPhilip Paeps check_slashed_abbrs check_sorted \ 8309f9fc6bbSPhilip Paeps check_tables check_web check_ziguard check_zishrink check_tzs 831ba2b2efdSGlen Barber 832*eebb9c2cSPhilip Paeps# True if UTF8_LOCALE does not work; 833*eebb9c2cSPhilip Paeps# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). 834*eebb9c2cSPhilip PaepsUTF8_LOCALE_MISSING = \ 835*eebb9c2cSPhilip Paeps { test ! '$(UTF8_LOCALE)' \ 836*eebb9c2cSPhilip Paeps || ! printf 'A\304\200B\n' \ 837*eebb9c2cSPhilip Paeps | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ 838*eebb9c2cSPhilip Paeps || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } 839*eebb9c2cSPhilip Paeps 840ba2b2efdSGlen Barbercheck_character_set: $(ENCHILADA) 841*eebb9c2cSPhilip Paeps $(UTF8_LOCALE_MISSING) || { \ 842ba2b2efdSGlen Barber sharp='#' && \ 843ba2b2efdSGlen Barber ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ 844ba2b2efdSGlen Barber $(MISC) $(SOURCES) $(WEB_PAGES) \ 84593d120dbSPhilip Paeps CONTRIBUTING LICENSE README SECURITY \ 8468d7edd17SPhilip Paeps version tzdata.zi && \ 84789abb9f8SPhilip Paeps ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ 84846bee4edSPhilip Paeps Makefile && \ 849afb91be3SPhilip Paeps ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ 85012a899b6SPhilip Paeps leapseconds zone.tab && \ 8518d7edd17SPhilip Paeps ! grep -Env $(OK_LINE) $(ENCHILADA); \ 8528d7edd17SPhilip Paeps } 85389abb9f8SPhilip Paeps touch $@ 854ba2b2efdSGlen Barber 855ba2b2efdSGlen Barbercheck_white_space: $(ENCHILADA) 856*eebb9c2cSPhilip Paeps $(UTF8_LOCALE_MISSING) || { \ 857ba2b2efdSGlen Barber patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ 858*eebb9c2cSPhilip Paeps ! grep -En "$$pat|[$s]\$$" \ 859*eebb9c2cSPhilip Paeps $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ 860*eebb9c2cSPhilip Paeps } 86189abb9f8SPhilip Paeps touch $@ 862ba2b2efdSGlen Barber 8639f9fc6bbSPhilip PaepsPRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ 8649f9fc6bbSPhilip PaepsFILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} 8658d7edd17SPhilip Paeps 866afb91be3SPhilip Paepscheck_name_lengths: $(TDATA_TO_CHECK) backzone 867afb91be3SPhilip Paeps ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ 868afb91be3SPhilip Paeps $(TDATA_TO_CHECK) backzone 86989abb9f8SPhilip Paeps touch $@ 8708d7edd17SPhilip Paeps 8719f9fc6bbSPhilip PaepsPRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ 8729f9fc6bbSPhilip PaepsSTDOFF = [-+]?[0-9:.]+ 8739f9fc6bbSPhilip PaepsRULELESS_SAVE = (-|$(STDOFF)[sd]?) 8749f9fc6bbSPhilip PaepsRULELESS_SLASHED_ABBRS = \ 8759f9fc6bbSPhilip Paeps $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ 8769f9fc6bbSPhilip Paeps 8779f9fc6bbSPhilip Paepscheck_slashed_abbrs: $(TDATA_TO_CHECK) 8789f9fc6bbSPhilip Paeps ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) 8799f9fc6bbSPhilip Paeps touch $@ 8809f9fc6bbSPhilip Paeps 881ba2b2efdSGlen BarberCHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } 882ba2b2efdSGlen Barber 883259e2ad7SPhilip Paepscheck_sorted: backward backzone 884cf1ad535SPhilip Paeps $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ 8859142a2a3SPhilip Paeps backward | LC_ALL=C sort -cu 886ba2b2efdSGlen Barber $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu 88789abb9f8SPhilip Paeps touch $@ 888ba2b2efdSGlen Barber 889cf1ad535SPhilip Paepscheck_back: checklinks.awk $(TDATA_TO_CHECK) 8909142a2a3SPhilip Paeps $(AWK) \ 8919142a2a3SPhilip Paeps -v DATAFORM=$(DATAFORM) \ 8929142a2a3SPhilip Paeps -v backcheck=backward \ 8939142a2a3SPhilip Paeps -f checklinks.awk $(TDATA_TO_CHECK) 894cf1ad535SPhilip Paeps touch $@ 895cf1ad535SPhilip Paeps 896cf1ad535SPhilip Paepscheck_links: checklinks.awk tzdata.zi 8979142a2a3SPhilip Paeps $(AWK) \ 8989142a2a3SPhilip Paeps -v DATAFORM=$(DATAFORM) \ 8999142a2a3SPhilip Paeps -f checklinks.awk tzdata.zi 90089abb9f8SPhilip Paeps touch $@ 901ba2b2efdSGlen Barber 902*eebb9c2cSPhilip Paeps# Check timestamps from now through 28 years from now, to make sure 903*eebb9c2cSPhilip Paeps# that zonenow.tab contains all sequences of planned timestamps, 904*eebb9c2cSPhilip Paeps# without any duplicate sequences. In theory this might require 905*eebb9c2cSPhilip Paeps# 2800 years but that would take a long time to check. 906*eebb9c2cSPhilip PaepsCHECK_NOW_TIMESTAMP = `./date +%s` 907*eebb9c2cSPhilip PaepsCHECK_NOW_FUTURE_YEARS = 28 908*eebb9c2cSPhilip PaepsCHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 909*eebb9c2cSPhilip Paepscheck_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab 910*eebb9c2cSPhilip Paeps rm -fr $@.dir 911*eebb9c2cSPhilip Paeps mkdir $@.dir 912*eebb9c2cSPhilip Paeps ./zic -d $@.dir tzdata.zi 913*eebb9c2cSPhilip Paeps now=$(CHECK_NOW_TIMESTAMP) && \ 914*eebb9c2cSPhilip Paeps future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ 915*eebb9c2cSPhilip Paeps ./zdump -i -t $$now,$$future \ 916*eebb9c2cSPhilip Paeps $$(find $$PWD/$@.dir/????*/ -type f) \ 917*eebb9c2cSPhilip Paeps >$@.dir/zdump.tab 918*eebb9c2cSPhilip Paeps $(AWK) \ 919*eebb9c2cSPhilip Paeps -v zdump_table=$@.dir/zdump.tab \ 920*eebb9c2cSPhilip Paeps -f checknow.awk zonenow.tab 921*eebb9c2cSPhilip Paeps rm -fr $@.dir 922*eebb9c2cSPhilip Paeps touch $@ 923*eebb9c2cSPhilip Paeps 924*eebb9c2cSPhilip Paepscheck_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab 925ba2b2efdSGlen Barber for tab in $(ZONETABLES); do \ 92694c2d487SPhilip Paeps test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ 92794c2d487SPhilip Paeps $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ 928ba2b2efdSGlen Barber || exit; \ 929ba2b2efdSGlen Barber done 93089abb9f8SPhilip Paeps touch $@ 931ba2b2efdSGlen Barber 932ba2b2efdSGlen Barbercheck_tzs: $(TZS) $(TZS_NEW) 93389abb9f8SPhilip Paeps if test -s $(TZS); then \ 934cf1ad535SPhilip Paeps $(DIFF_TZS) $(TZS) $(TZS_NEW); \ 93589abb9f8SPhilip Paeps else \ 93689abb9f8SPhilip Paeps cp $(TZS_NEW) $(TZS); \ 93789abb9f8SPhilip Paeps fi 93889abb9f8SPhilip Paeps touch $@ 939ba2b2efdSGlen Barber 9402c5e84ccSPhilip Paepscheck_web: $(CHECK_WEB_PAGES) 941ad48359aSPhilip Paepscheck_theory.html: theory.html 9422c5e84ccSPhilip Paepscheck_tz-art.html: tz-art.html 94312a899b6SPhilip Paepscheck_tz-how-to.html: tz-how-to.html 9442c5e84ccSPhilip Paepscheck_tz-link.html: tz-link.html 94512a899b6SPhilip Paepscheck_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: 9462c5e84ccSPhilip Paeps $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ 9472c5e84ccSPhilip Paeps -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ 9482c5e84ccSPhilip Paeps test ! -s $@.out || { cat $@.out; exit 1; } 9492c5e84ccSPhilip Paeps mv $@.out $@ 9508d7edd17SPhilip Paeps 9519f9fc6bbSPhilip Paepscheck_ziguard: rearguard.zi vanguard.zi ziguard.awk 9529f9fc6bbSPhilip Paeps $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \ 9539f9fc6bbSPhilip Paeps diff -u rearguard.zi - 9549f9fc6bbSPhilip Paeps $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \ 9559f9fc6bbSPhilip Paeps diff -u vanguard.zi - 9569f9fc6bbSPhilip Paeps touch $@ 9579f9fc6bbSPhilip Paeps 95846bee4edSPhilip Paeps# Check that zishrink.awk does not alter the data, and that ziguard.awk 95946bee4edSPhilip Paeps# preserves main-format data. 96089abb9f8SPhilip Paepscheck_zishrink: check_zishrink_posix check_zishrink_right 96189abb9f8SPhilip Paepscheck_zishrink_posix check_zishrink_right: \ 9629f9fc6bbSPhilip Paeps zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \ 9639f9fc6bbSPhilip Paeps $(TDATA) $(DATAFORM).zi tzdata.zi 96489abb9f8SPhilip Paeps rm -fr $@.dir $@-t.dir $@-shrunk.dir 96589abb9f8SPhilip Paeps mkdir $@.dir $@-t.dir $@-shrunk.dir 96689abb9f8SPhilip Paeps case $@ in \ 96789abb9f8SPhilip Paeps *_right) leap='-L leapseconds';; \ 9688d7edd17SPhilip Paeps *) leap=;; \ 9698d7edd17SPhilip Paeps esac && \ 97089abb9f8SPhilip Paeps $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ 97189abb9f8SPhilip Paeps $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ 9729f9fc6bbSPhilip Paeps case $(DATAFORM),$(PACKRATLIST) in \ 9739f9fc6bbSPhilip Paeps main,) \ 97489abb9f8SPhilip Paeps $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ 9758d7edd17SPhilip Paeps $(AWK) '/^Rule/' $(TDATA) | \ 97689abb9f8SPhilip Paeps $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ 97789abb9f8SPhilip Paeps diff -r $@.dir $@-t.dir;; \ 97889abb9f8SPhilip Paeps esac 97989abb9f8SPhilip Paeps diff -r $@.dir $@-shrunk.dir 98089abb9f8SPhilip Paeps rm -fr $@.dir $@-t.dir $@-shrunk.dir 98189abb9f8SPhilip Paeps touch $@ 982ba2b2efdSGlen Barber 983ba2b2efdSGlen Barberclean_misc: 984*eebb9c2cSPhilip Paeps rm -fr check_*.dir typecheck_*.dir 98589abb9f8SPhilip Paeps rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ 98689abb9f8SPhilip Paeps check_* core typecheck_* \ 987*eebb9c2cSPhilip Paeps date tzdir.h tzselect version.h zdump zic libtz.a 988ba2b2efdSGlen Barberclean: clean_misc 989ad48359aSPhilip Paeps rm -fr *.dir tzdb-*/ 990ad48359aSPhilip Paeps rm -f *.zi $(TZS_NEW) 991ba2b2efdSGlen Barber 992ba2b2efdSGlen Barbermaintainer-clean: clean 993ba2b2efdSGlen Barber @echo 'This command is intended for maintainers to use; it' 994ba2b2efdSGlen Barber @echo 'deletes files that may need special tools to rebuild.' 995ba2b2efdSGlen Barber rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* 996ba2b2efdSGlen Barber 997ba2b2efdSGlen Barbernames: 998ba2b2efdSGlen Barber @echo $(ENCHILADA) 999ba2b2efdSGlen Barber 1000ba2b2efdSGlen Barberpublic: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ 1001ba2b2efdSGlen Barber tarballs signatures 1002ba2b2efdSGlen Barber 1003ba2b2efdSGlen Barberdate.1.txt: date.1 1004ba2b2efdSGlen Barbernewctime.3.txt: newctime.3 1005ba2b2efdSGlen Barbernewstrftime.3.txt: newstrftime.3 1006ba2b2efdSGlen Barbernewtzset.3.txt: newtzset.3 1007ba2b2efdSGlen Barbertime2posix.3.txt: time2posix.3 1008ba2b2efdSGlen Barbertzfile.5.txt: tzfile.5 1009ba2b2efdSGlen Barbertzselect.8.txt: tzselect.8 1010ba2b2efdSGlen Barberzdump.8.txt: zdump.8 1011ba2b2efdSGlen Barberzic.8.txt: zic.8 1012ba2b2efdSGlen Barber 1013ba2b2efdSGlen Barber$(MANTXTS): workman.sh 1014ba2b2efdSGlen Barber LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out 1015ba2b2efdSGlen Barber mv $@.out $@ 1016ba2b2efdSGlen Barber 1017dc505d53SPhilip Paeps# Set file timestamps deterministically if possible, 1018dc505d53SPhilip Paeps# so that tarballs containing the timestamps are reproducible. 1019dc505d53SPhilip Paeps# 1020dc505d53SPhilip Paeps# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the 1021dc505d53SPhilip Paeps# file DEST to the maximum of the timestamps of the files A B C ..., 1022dc505d53SPhilip Paeps# plus N if GNU ls and touch are available. 1023dc505d53SPhilip PaepsSET_TIMESTAMP_N = sh -c '\ 1024dc505d53SPhilip Paeps n=$$0 dest=$$1; shift; \ 1025*eebb9c2cSPhilip Paeps <"$$dest" && \ 1026dc505d53SPhilip Paeps if test $$n != 0 && \ 1027*eebb9c2cSPhilip Paeps lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ 1028dc505d53SPhilip Paeps set x $$lsout && \ 1029*eebb9c2cSPhilip Paeps timestamp=`expr $$7 + $$n` && \ 1030*eebb9c2cSPhilip Paeps echo "+ touch -md @$$timestamp $$dest" && \ 1031*eebb9c2cSPhilip Paeps touch -md @$$timestamp "$$dest"; \ 1032*eebb9c2cSPhilip Paeps else \ 1033*eebb9c2cSPhilip Paeps newest=`ls -t "$$@" | sed 1q` && \ 1034*eebb9c2cSPhilip Paeps echo "+ touch -mr $$newest $$dest" && \ 1035*eebb9c2cSPhilip Paeps touch -mr "$$newest" "$$dest"; \ 1036*eebb9c2cSPhilip Paeps fi' 1037dc505d53SPhilip Paeps# If DEST depends on A B C ... in this Makefile, callers should use 1038dc505d53SPhilip Paeps# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any 1039dc505d53SPhilip Paeps# downstream 'make' that considers equal timestamps to be out of date. 1040dc505d53SPhilip Paeps# POSIX allows this 'make' behavior, and HP-UX 'make' does it. 1041dc505d53SPhilip Paeps# If all that matters is that the timestamp be reproducible 1042dc505d53SPhilip Paeps# and plausible, use $(SET_TIMESTAMP). 1043dc505d53SPhilip PaepsSET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 1044dc505d53SPhilip PaepsSET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 1045dc505d53SPhilip Paeps 1046ba2b2efdSGlen Barber# Set the timestamps to those of the git repository, if available, 1047ba2b2efdSGlen Barber# and if the files have not changed since then. 1048dc505d53SPhilip Paeps# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, 1049dc505d53SPhilip Paeps# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. 1050dc505d53SPhilip Paeps# If git or GNU is absent, don't bother to sync with git timestamps. 1051ba2b2efdSGlen Barber# Also, set the timestamp of each prebuilt file like 'leapseconds' 1052ba2b2efdSGlen Barber# to be the maximum of the files it depends on. 105389abb9f8SPhilip Paepsset-timestamps.out: $(EIGHT_YARDS) 1054ba2b2efdSGlen Barber rm -f $@ 1055ba2b2efdSGlen Barber if (type git) >/dev/null 2>&1 && \ 105689abb9f8SPhilip Paeps files=`git ls-files $(EIGHT_YARDS)` && \ 1057ba2b2efdSGlen Barber touch -md @1 test.out; then \ 1058ba2b2efdSGlen Barber rm -f test.out && \ 1059ba2b2efdSGlen Barber for file in $$files; do \ 1060ba2b2efdSGlen Barber if git diff --quiet $$file; then \ 1061*eebb9c2cSPhilip Paeps time=`TZ=UTC0 git log -1 \ 1062*eebb9c2cSPhilip Paeps --format='tformat:%cd' \ 1063*eebb9c2cSPhilip Paeps --date='format:%Y-%m-%dT%H:%M:%SZ' \ 1064*eebb9c2cSPhilip Paeps $$file` && \ 1065*eebb9c2cSPhilip Paeps echo "+ touch -md $$time $$file" && \ 1066*eebb9c2cSPhilip Paeps touch -md $$time $$file; \ 1067ba2b2efdSGlen Barber else \ 1068ba2b2efdSGlen Barber echo >&2 "$$file: warning: does not match repository"; \ 1069ba2b2efdSGlen Barber fi || exit; \ 1070ba2b2efdSGlen Barber done; \ 1071ba2b2efdSGlen Barber fi 1072dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) 1073ba2b2efdSGlen Barber for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ 1074dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ 1075ba2b2efdSGlen Barber exit; \ 1076ba2b2efdSGlen Barber done 1077dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) 1078dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) 1079ba2b2efdSGlen Barber touch $@ 108089abb9f8SPhilip Paepsset-tzs-timestamp.out: $(TZS) 1081dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) 108289abb9f8SPhilip Paeps touch $@ 1083ba2b2efdSGlen Barber 1084ba2b2efdSGlen Barber# The zics below ensure that each data file can stand on its own. 1085ba2b2efdSGlen Barber# We also do an all-files run to catch links to links. 1086ba2b2efdSGlen Barber 108789abb9f8SPhilip Paepscheck_public: $(VERSION_DEPS) 1088ba2b2efdSGlen Barber rm -fr public.dir 108989abb9f8SPhilip Paeps mkdir public.dir 109089abb9f8SPhilip Paeps ln $(VERSION_DEPS) public.dir 1091*eebb9c2cSPhilip Paeps cd public.dir \ 1092*eebb9c2cSPhilip Paeps && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL 1093e35a01eeSPhilip Paeps for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ 1094e35a01eeSPhilip Paeps public.dir/vanguard.zi public.dir/main.zi \ 1095e35a01eeSPhilip Paeps public.dir/rearguard.zi; \ 1096e35a01eeSPhilip Paeps do \ 109789abb9f8SPhilip Paeps public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \ 109889abb9f8SPhilip Paeps done 109989abb9f8SPhilip Paeps public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK) 110094c2d487SPhilip Paeps : 110194c2d487SPhilip Paeps : Also check 'backzone' syntax. 110294c2d487SPhilip Paeps rm public.dir/main.zi 110394c2d487SPhilip Paeps cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi 110494c2d487SPhilip Paeps public.dir/zic -d public.dir/zoneinfo main.zi 11059f9fc6bbSPhilip Paeps rm public.dir/main.zi 11069f9fc6bbSPhilip Paeps cd public.dir && \ 11079f9fc6bbSPhilip Paeps $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi 11089f9fc6bbSPhilip Paeps public.dir/zic -d public.dir/zoneinfo main.zi 110994c2d487SPhilip Paeps : 111089abb9f8SPhilip Paeps rm -fr public.dir 111189abb9f8SPhilip Paeps touch $@ 1112ba2b2efdSGlen Barber 1113ba2b2efdSGlen Barber# Check that the code works under various alternative 1114ba2b2efdSGlen Barber# implementations of time_t. 111589abb9f8SPhilip Paepscheck_time_t_alternatives: $(TIME_T_ALTERNATIVES) 111689abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD) 111789abb9f8SPhilip Paeps$(TIME_T_ALTERNATIVES): $(VERSION_DEPS) 111889abb9f8SPhilip Paeps rm -fr $@.dir 111989abb9f8SPhilip Paeps mkdir $@.dir 112089abb9f8SPhilip Paeps ln $(VERSION_DEPS) $@.dir 112189abb9f8SPhilip Paeps case $@ in \ 112294c2d487SPhilip Paeps int*32_t) range=-2147483648,2147483648;; \ 112389abb9f8SPhilip Paeps u*) range=0,4294967296;; \ 112489abb9f8SPhilip Paeps *) range=-4294967296,4294967296;; \ 112589abb9f8SPhilip Paeps esac && \ 112689abb9f8SPhilip Paeps wd=`pwd` && \ 112789abb9f8SPhilip Paeps zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \ 112889abb9f8SPhilip Paeps if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \ 112989abb9f8SPhilip Paeps range_target=; \ 113089abb9f8SPhilip Paeps else \ 113189abb9f8SPhilip Paeps range_target=to$$range.tzs; \ 113289abb9f8SPhilip Paeps fi && \ 113389abb9f8SPhilip Paeps (cd $@.dir && \ 113489abb9f8SPhilip Paeps $(MAKE) TOPDIR="$$wd/$@.dir" \ 113589abb9f8SPhilip Paeps CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \ 113689abb9f8SPhilip Paeps REDO='$(REDO)' \ 113789abb9f8SPhilip Paeps D=$$wd/$@.dir \ 113889abb9f8SPhilip Paeps TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 113989abb9f8SPhilip Paeps install $$range_target) && \ 114089abb9f8SPhilip Paeps test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \ 114189abb9f8SPhilip Paeps (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \ 114289abb9f8SPhilip Paeps $(MAKE) TOPDIR="$$wd/$@.dir" \ 114389abb9f8SPhilip Paeps TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ 114489abb9f8SPhilip Paeps D=$$wd/$@.dir \ 114589abb9f8SPhilip Paeps to$$range.tzs) && \ 1146cf1ad535SPhilip Paeps $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \ 114789abb9f8SPhilip Paeps $@.dir/to$$range.tzs && \ 1148ba2b2efdSGlen Barber if diff -q Makefile Makefile 2>/dev/null; then \ 1149ba2b2efdSGlen Barber quiet_option='-q'; \ 1150ba2b2efdSGlen Barber else \ 1151ba2b2efdSGlen Barber quiet_option=''; \ 1152ba2b2efdSGlen Barber fi && \ 115389abb9f8SPhilip Paeps diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \ 115489abb9f8SPhilip Paeps $@.dir/etc && \ 1155ba2b2efdSGlen Barber diff $$quiet_option -r \ 115689abb9f8SPhilip Paeps $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \ 115789abb9f8SPhilip Paeps $@.dir/usr/share; \ 115889abb9f8SPhilip Paeps } 115989abb9f8SPhilip Paeps touch $@ 1160ba2b2efdSGlen Barber 1161d81c2dd9SPhilip PaepsTRADITIONAL_ASC = \ 1162d81c2dd9SPhilip Paeps tzcode$(VERSION).tar.gz.asc \ 1163d81c2dd9SPhilip Paeps tzdata$(VERSION).tar.gz.asc 116489abb9f8SPhilip PaepsREARGUARD_ASC = \ 116589abb9f8SPhilip Paeps tzdata$(VERSION)-rearguard.tar.gz.asc 116689abb9f8SPhilip PaepsALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \ 1167d81c2dd9SPhilip Paeps tzdb-$(VERSION).tar.lz.asc 1168d81c2dd9SPhilip Paeps 11699f9fc6bbSPhilip Paepstarballs rearguard_tarballs tailored_tarballs traditional_tarballs \ 117089abb9f8SPhilip Paepssignatures rearguard_signatures traditional_signatures: \ 11719f9fc6bbSPhilip Paeps version set-timestamps.out rearguard.zi vanguard.zi 1172ba2b2efdSGlen Barber VERSION=`cat version` && \ 1173dc505d53SPhilip Paeps $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version 1174ba2b2efdSGlen Barber 117546bee4edSPhilip Paeps# These *_version rules are intended for use if VERSION is set by some 117646bee4edSPhilip Paeps# other means. Ordinarily these rules are used only by the above 117746bee4edSPhilip Paeps# non-_version rules, which set VERSION on the 'make' command line. 117889abb9f8SPhilip Paepstarballs_version: traditional_tarballs_version rearguard_tarballs_version \ 1179d81c2dd9SPhilip Paeps tzdb-$(VERSION).tar.lz 118089abb9f8SPhilip Paepsrearguard_tarballs_version: \ 118189abb9f8SPhilip Paeps tzdata$(VERSION)-rearguard.tar.gz 1182ba2b2efdSGlen Barbertraditional_tarballs_version: \ 1183ba2b2efdSGlen Barber tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 11849f9fc6bbSPhilip Paepstailored_tarballs_version: \ 11859f9fc6bbSPhilip Paeps tzdata$(VERSION)-tailored.tar.gz 1186d81c2dd9SPhilip Paepssignatures_version: $(ALL_ASC) 118789abb9f8SPhilip Paepsrearguard_signatures_version: $(REARGUARD_ASC) 1188d81c2dd9SPhilip Paepstraditional_signatures_version: $(TRADITIONAL_ASC) 1189ba2b2efdSGlen Barber 1190ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz: set-timestamps.out 1191ba2b2efdSGlen Barber LC_ALL=C && export LC_ALL && \ 1192ba2b2efdSGlen Barber tar $(TARFLAGS) -cf - \ 1193ba2b2efdSGlen Barber $(COMMON) $(DOCS) $(SOURCES) | \ 1194ba2b2efdSGlen Barber gzip $(GZIPFLAGS) >$@.out 1195ba2b2efdSGlen Barber mv $@.out $@ 1196ba2b2efdSGlen Barber 1197ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz: set-timestamps.out 1198ba2b2efdSGlen Barber LC_ALL=C && export LC_ALL && \ 11999f9fc6bbSPhilip Paeps tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \ 1200ba2b2efdSGlen Barber gzip $(GZIPFLAGS) >$@.out 1201ba2b2efdSGlen Barber mv $@.out $@ 1202ba2b2efdSGlen Barber 12039f9fc6bbSPhilip Paeps# Create empty files with a reproducible timestamp. 12049f9fc6bbSPhilip PaepsCREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00 12059f9fc6bbSPhilip Paeps 12069f9fc6bbSPhilip Paeps# The obsolescent *rearguard* targets and related macros are present 12079f9fc6bbSPhilip Paeps# for backwards compatibility with tz releases 2018e through 2022a. 12089f9fc6bbSPhilip Paeps# They should go away eventually. To build rearguard tarballs you 12099f9fc6bbSPhilip Paeps# can instead use 'make DATAFORM=rearguard tailored_tarballs'. 1210d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out 12119f9fc6bbSPhilip Paeps rm -fr $@.dir 12129f9fc6bbSPhilip Paeps mkdir $@.dir 12139f9fc6bbSPhilip Paeps ln $(TZDATA_DIST) $@.dir 12149f9fc6bbSPhilip Paeps cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version 1215d81c2dd9SPhilip Paeps for f in $(TDATA) $(PACKRATDATA); do \ 12169f9fc6bbSPhilip Paeps rearf=$@.dir/$$f; \ 1217d81c2dd9SPhilip Paeps $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \ 1218dc505d53SPhilip Paeps $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \ 1219d81c2dd9SPhilip Paeps done 12209f9fc6bbSPhilip Paeps sed '1s/$$/-rearguard/' <version >$@.dir/version 1221e7e2d659SPhilip Paeps : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12229f9fc6bbSPhilip Paeps $(CREATE_EMPTY) $@.dir/pacificnew 1223*eebb9c2cSPhilip Paeps touch -mr version $@.dir/version 1224d81c2dd9SPhilip Paeps LC_ALL=C && export LC_ALL && \ 12259f9fc6bbSPhilip Paeps (cd $@.dir && \ 1226e7e2d659SPhilip Paeps tar $(TARFLAGS) -cf - \ 12279f9fc6bbSPhilip Paeps $(TZDATA_DIST) pacificnew | \ 1228d81c2dd9SPhilip Paeps gzip $(GZIPFLAGS)) >$@.out 1229d81c2dd9SPhilip Paeps mv $@.out $@ 1230d81c2dd9SPhilip Paeps 12319f9fc6bbSPhilip Paeps# Create a tailored tarball suitable for TZUpdater and compatible tools. 12329f9fc6bbSPhilip Paeps# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball 12339f9fc6bbSPhilip Paeps# useful for testing whether TZUpdater supports vanguard form. 12349f9fc6bbSPhilip Paeps# The generated tarball is not byte-for-byte equivalent to a hand-tailored 12359f9fc6bbSPhilip Paeps# traditional tarball, as data entries are put into 'etcetera' even if they 12369f9fc6bbSPhilip Paeps# came from some other source file. However, the effect should be the same 12379f9fc6bbSPhilip Paeps# for ordinary use, which reads all the source files. 12389f9fc6bbSPhilip Paepstzdata$(VERSION)-tailored.tar.gz: set-timestamps.out 12399f9fc6bbSPhilip Paeps rm -fr $@.dir 12409f9fc6bbSPhilip Paeps mkdir $@.dir 12419f9fc6bbSPhilip Paeps : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. 12429f9fc6bbSPhilip Paeps cd $@.dir && \ 12439f9fc6bbSPhilip Paeps $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \ 12449f9fc6bbSPhilip Paeps `test $(DATAFORM) = vanguard || echo pacificnew` 12459f9fc6bbSPhilip Paeps (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ 12469f9fc6bbSPhilip Paeps >$@.dir/etcetera 1247*eebb9c2cSPhilip Paeps touch -mr tzdata.zi $@.dir/etcetera 12489f9fc6bbSPhilip Paeps sed -n \ 12499f9fc6bbSPhilip Paeps -e '/^# *version *\(.*\)/h' \ 12509f9fc6bbSPhilip Paeps -e '/^# *ddeps */H' \ 12519f9fc6bbSPhilip Paeps -e '$$!d' \ 12529f9fc6bbSPhilip Paeps -e 'g' \ 12539f9fc6bbSPhilip Paeps -e 's/^# *version *//' \ 12549f9fc6bbSPhilip Paeps -e 's/\n# *ddeps */-/' \ 12559f9fc6bbSPhilip Paeps -e 's/ /-/g' \ 12569f9fc6bbSPhilip Paeps -e 'p' \ 12579f9fc6bbSPhilip Paeps <tzdata.zi >$@.dir/version 1258*eebb9c2cSPhilip Paeps touch -mr version $@.dir/version 12599f9fc6bbSPhilip Paeps links= && \ 12609f9fc6bbSPhilip Paeps for file in $(TZDATA_DIST); do \ 12619f9fc6bbSPhilip Paeps test -f $@.dir/$$file || links="$$links $$file"; \ 12629f9fc6bbSPhilip Paeps done && \ 12639f9fc6bbSPhilip Paeps ln $$links $@.dir 12649f9fc6bbSPhilip Paeps LC_ALL=C && export LC_ALL && \ 12659f9fc6bbSPhilip Paeps (cd $@.dir && \ 12669f9fc6bbSPhilip Paeps tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out 12679f9fc6bbSPhilip Paeps mv $@.out $@ 12689f9fc6bbSPhilip Paeps 126989abb9f8SPhilip Paepstzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out 1270ba2b2efdSGlen Barber rm -fr tzdb-$(VERSION) 1271ba2b2efdSGlen Barber mkdir tzdb-$(VERSION) 1272ba2b2efdSGlen Barber ln $(ENCHILADA) tzdb-$(VERSION) 1273dc505d53SPhilip Paeps $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/* 1274ba2b2efdSGlen Barber LC_ALL=C && export LC_ALL && \ 1275ba2b2efdSGlen Barber tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out 1276ba2b2efdSGlen Barber mv $@.out $@ 1277ba2b2efdSGlen Barber 1278ba2b2efdSGlen Barbertzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 1279ba2b2efdSGlen Barbertzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 1280d81c2dd9SPhilip Paepstzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz 1281ba2b2efdSGlen Barbertzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz 1282d81c2dd9SPhilip Paeps$(ALL_ASC): 12832865ab3fSPhilip Paeps $(GPG) --armor --detach-sign $? 1284ba2b2efdSGlen Barber 128589abb9f8SPhilip PaepsTYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T 128689abb9f8SPhilip Paepstypecheck: typecheck_long_long typecheck_unsigned 128789abb9f8SPhilip Paepstypecheck_long_long typecheck_unsigned: $(VERSION_DEPS) 128889abb9f8SPhilip Paeps rm -fr $@.dir 128989abb9f8SPhilip Paeps mkdir $@.dir 129089abb9f8SPhilip Paeps ln $(VERSION_DEPS) $@.dir 129189abb9f8SPhilip Paeps cd $@.dir && \ 129289abb9f8SPhilip Paeps case $@ in \ 129389abb9f8SPhilip Paeps *_long_long) i="long long";; \ 129489abb9f8SPhilip Paeps *_unsigned ) i="unsigned" ;; \ 129589abb9f8SPhilip Paeps esac && \ 129689abb9f8SPhilip Paeps typecheck_cflags='' && \ 129789abb9f8SPhilip Paeps $(MAKE) \ 129889abb9f8SPhilip Paeps CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ 129989abb9f8SPhilip Paeps TOPDIR="`pwd`" \ 130089abb9f8SPhilip Paeps install 130189abb9f8SPhilip Paeps $@.dir/zdump -i -c 1970,1971 Europe/Rome 130289abb9f8SPhilip Paeps touch $@ 1303ba2b2efdSGlen Barber 13048d7edd17SPhilip Paepszonenames: tzdata.zi 13058d7edd17SPhilip Paeps @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi 1306ba2b2efdSGlen Barber 1307ba2b2efdSGlen Barberasctime.o: private.h tzfile.h 1308ba2b2efdSGlen Barberdate.o: private.h 1309ba2b2efdSGlen Barberdifftime.o: private.h 1310*eebb9c2cSPhilip Paepslocaltime.o: private.h tzfile.h tzdir.h 1311ba2b2efdSGlen Barberstrftime.o: private.h tzfile.h 1312ba2b2efdSGlen Barberzdump.o: version.h 1313*eebb9c2cSPhilip Paepszic.o: private.h tzfile.h tzdir.h version.h 1314ba2b2efdSGlen Barber 1315ba2b2efdSGlen Barber.PHONY: ALL INSTALL all 1316cf1ad535SPhilip Paeps.PHONY: check check_mild check_time_t_alternatives 13172c5e84ccSPhilip Paeps.PHONY: check_web check_zishrink 131846bee4edSPhilip Paeps.PHONY: clean clean_misc dummy.zd force_tzs 1319ba2b2efdSGlen Barber.PHONY: install install_data maintainer-clean names 13209f9fc6bbSPhilip Paeps.PHONY: posix_only posix_right public 132189abb9f8SPhilip Paeps.PHONY: rearguard_signatures rearguard_signatures_version 132289abb9f8SPhilip Paeps.PHONY: rearguard_tarballs rearguard_tarballs_version 132389abb9f8SPhilip Paeps.PHONY: right_only right_posix signatures signatures_version 132446bee4edSPhilip Paeps.PHONY: tarballs tarballs_version 132546bee4edSPhilip Paeps.PHONY: traditional_signatures traditional_signatures_version 132646bee4edSPhilip Paeps.PHONY: traditional_tarballs traditional_tarballs_version 13279f9fc6bbSPhilip Paeps.PHONY: tailored_tarballs tailored_tarballs_version 132846bee4edSPhilip Paeps.PHONY: typecheck 1329ba2b2efdSGlen Barber.PHONY: zonenames zones 133046bee4edSPhilip Paeps.PHONY: $(ZDS) 1331