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