1 # Make and install tzdb code and data.
2 # This file is in the public domain, so clarified as of
3 # 2009-05-17 by Arthur David Olson.
4 # Request POSIX conformance; this must be the first non-comment line.
6 # On older platforms you may need to scrounge for a POSIX-conforming 'make'.
7 # For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or
8 # /usr/xpg4/bin/make, not /usr/ccs/bin/make.
10 # To affect how this Makefile works, you can run a shell script like this:
13 # make CC='gcc -std=gnu11' "$@"
15 # This example script is appropriate for a pre-2017 GNU/Linux system
16 # where a non-default setting is needed to support this package's use of C99.
18 # Alternatively, you can simply edit this Makefile to tailor the following
21 ###############################################################################
22 # Start of macros that one plausibly might want to tailor.
24 # Package name for the code distribution.
27 # Version number for the distribution, overridden in the 'tarballs' rule below.
30 # Email address for bug reports.
33 # DATAFORM selects the data format.
34 # Available formats represent essentially the same data, albeit
35 # possibly with minor discrepancies that users are not likely to notice.
36 # To get new features and the best data right away, use:
38 # To wait a while before using new features, to give downstream users
39 # time to upgrade zic (the default), use:
41 # To wait even longer for new features, use:
43 # Rearguard users might also want "ZFLAGS = -b fat"; see below.
46 # Change the line below for your timezone (after finding the one you want in
47 # one of the $(TDATA) source files, or adding it to a source file).
48 # Alternatively, if you discover you've got the wrong timezone, you can just
49 # 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
52 # to get a list of the values you can use for LOCALTIME.
56 # The POSIXRULES macro controls interpretation of POSIX-2017.1-like TZ
57 # settings like TZ='EET-2EEST' that lack DST transition rules.
58 # If POSIXRULES is '-', no template is installed; this is the default.
59 # Any other value for POSIXRULES is obsolete and should not be relied on, as:
60 # * It does not work correctly in popular implementations such as GNU/Linux.
61 # * It does not work even in tzcode, except for historical timestamps
62 # that precede the last explicit transition in the POSIXRULES file.
63 # Hence it typically does not work for current and future timestamps.
64 # If, despite the above, you want a template for handling these settings,
65 # you can change the line below (after finding the timezone you want in the
66 # one of the $(TDATA) source files, or adding it to a source file).
67 # Alternatively, if you discover you've got the wrong timezone, you can just
68 # 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
71 # to get a list of the values you can use for POSIXRULES.
75 # Also see TZDEFRULESTRING below, which takes effect only
76 # if POSIXRULES is '-' or if the template file cannot be accessed.
79 # Installation locations.
81 # The defaults are suitable for Debian, except that if REDO is
82 # posix_right or right_posix then files that Debian puts under
83 # /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
84 # put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
85 # respectively. Problems with the Debian approach are discussed in
86 # the commentary for the right_posix rule (below).
88 # Destination directory, which can be used for staging.
89 # 'make DESTDIR=/stage install' installs under /stage (e.g., to
90 # /stage/etc/localtime instead of to /etc/localtime). Files under
91 # /stage are not intended to work as-is, but can be copied by hand to
92 # the root directory later. If DESTDIR is empty, 'make install' does
93 # not stage, but installs directly into production locations.
96 # Everything is installed into subdirectories of TOPDIR, and used there.
97 # TOPDIR should be empty (meaning the root directory),
98 # or a directory name that does not end in "/".
99 # TOPDIR should be empty or an absolute name unless you're just testing.
102 # The default local timezone is taken from the file TZDEFAULT.
103 TZDEFAULT = $(TOPDIR)/etc/localtime
105 # The subdirectory containing installed program and data files, and
106 # likewise for installed files that can be shared among architectures.
107 # These should be relative file names.
109 USRSHAREDIR = $(USRDIR)/share
111 # "Compiled" timezone information is placed in the "TZDIR" directory
112 # (and subdirectories).
113 # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
114 TZDIR_BASENAME= zoneinfo
115 TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
117 # The "tzselect" and (if you do "make INSTALL") "date" commands go in:
118 BINDIR = $(TOPDIR)/$(USRDIR)/bin
120 # The "zdump" command goes in:
123 # The "zic" command goes in:
124 ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
126 # Manual pages go in subdirectories of. . .
127 MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
129 # Library functions are put in an archive in LIBDIR.
130 LIBDIR = $(TOPDIR)/$(USRDIR)/lib
133 # Types to try, as an alternative to time_t.
134 TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
135 TIME_T_ALTERNATIVES_HEAD = int_least64_t
136 TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
138 # What kind of TZif data files to generate. (TZif is the binary time
139 # zone data format that zic generates; see Internet RFC 8536.)
140 # If you want only POSIX time, with time values interpreted as
141 # seconds since the epoch (not counting leap seconds), use
143 # below. If you want only "right" time, with values interpreted
144 # as seconds since the epoch (counting leap seconds), use
146 # below. If you want both sets of data available, with leap seconds not
147 # counted normally, use
149 # below. If you want both sets of data available, with leap seconds counted
152 # below. POSIX mandates that leap seconds not be counted; for compatibility
153 # with it, use "posix_only" or "posix_right". Use POSIX time on systems with
154 # leap smearing; this can work better than unsmeared "right" time with
155 # applications that are not leap second aware, and is closer to unsmeared
156 # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
160 # Whether to put an "Expires" line in the leapseconds file.
161 # Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
162 # The EXPIRES_LINE value matters only if REDO's value contains "right".
163 # If you change EXPIRES_LINE, remove the leapseconds file before running "make".
164 # zic's support for the Expires line was introduced in tzdb 2020a,
165 # and was modified in tzdb 2021b to generate version 4 TZif files.
166 # EXPIRES_LINE defaults to 0 for now so that the leapseconds file
167 # can be given to pre-2020a zic implementations and so that TZif files
168 # built by newer zic implementations can be read by pre-2021b libraries.
171 # To install data in text form that has all the information of the TZif data,
172 # (optionally incorporating leap second information), use
173 # TZDATA_TEXT= tzdata.zi leapseconds
174 # To install text data without leap second information (e.g., because
175 # REDO='posix_only'), use
176 # TZDATA_TEXT= tzdata.zi
177 # To avoid installing text data, use
180 TZDATA_TEXT= leapseconds tzdata.zi
182 # For backward-compatibility links for old zone names, use
184 # To omit these links, use
189 # If you want out-of-scope and often-wrong data from the file 'backzone',
190 # but only for entries listed in the backward-compatibility file zone.tab, use
191 # PACKRATDATA= backzone
192 # PACKRATLIST= zone.tab
193 # If you want all the 'backzone' data, use
194 # PACKRATDATA= backzone
196 # To omit this data, use
203 # The name of a locale using the UTF-8 encoding, used during self-tests.
204 # The tests are skipped if the name does not appear to work on this system.
206 UTF8_LOCALE= en_US.utf8
208 # Non-default libraries needed to link.
209 # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
212 # Add the following to an uncommented "CFLAGS=" line as needed
213 # to override defaults specified in the source code or by the system.
214 # "-DFOO" is equivalent to "-DFOO=1".
215 # -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
216 # formats that generate only the last two digits of year numbers
217 # -DEPOCH_LOCAL if the 'time' function returns local time not UT
218 # -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
219 # than what POSIX specifies, assuming local time is UT.
220 # For example, N is 252460800 on AmigaOS.
221 # -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
222 # -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
223 # -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
224 # -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
225 # -DHAVE__GENERIC=0 if _Generic does not work*
226 # -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
227 # -DHAVE_GETRANDOM=0 to avoid using getrandom
228 # -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
229 # where LDLIBS also needs to contain -lintl on some hosts;
230 # -DHAVE_GETTEXT=0 to avoid using gettext
231 # -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
232 # ctime_r and asctime_r incompatibly with the POSIX standard
233 # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
234 # -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
235 # -DHAVE_LINK=0 if your system lacks a link function
236 # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
237 # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
238 # localtime_rz can make zdump significantly faster, but is nonstandard.
239 # -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
240 # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
241 # functions like 'link' or variables like 'tzname' required by POSIX
242 # -DHAVE_SETENV=0 if your system lacks the setenv function
243 # -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+
244 # -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like
245 # __builtin_add_overflow work*
246 # -DHAVE_STDINT_H=0 if <stdint.h> does not work*+
247 # -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
248 # -DHAVE_STRDUP=0 if your system lacks the strdup function
249 # -DHAVE_STRTOLL=0 if your system lacks the strtoll function+
250 # -DHAVE_SYMLINK=0 if your system lacks the symlink function
251 # -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
252 # -DHAVE_TZSET=0 if your system lacks a tzset function
253 # -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
254 # -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
255 # -Dlocale_t=XXX if your system uses XXX instead of locale_t
256 # -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
257 # Typically it is better to use a later standard. For example,
258 # with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
259 # Even with -DPORT_TO_C89, the code needs at least one C99
260 # feature (integers at least 64 bits wide) and maybe more.
261 # -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
262 # with external linkage, e.g., applications cannot define 'localtime'.
263 # -Dssize_t=long on hosts like MS-Windows that lack ssize_t
264 # -DSUPPORT_C89 if the tzcode library should support C89 callers+
265 # However, this might trigger latent bugs in C99-or-later callers.
266 # -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
267 # security implications and is not recommended for general use
268 # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
269 # not needed by the main-program tz code, which is single-threaded.
270 # Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
271 # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
272 # This is intended for internal use only; it mangles external names.
273 # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
274 # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
275 # the default is system-supplied, typically "/usr/lib/locale"
276 # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
277 # DST transitions for POSIX.1-2017-style TZ strings lacking them,
278 # in the usual case where POSIXRULES is '-'. If not specified,
279 # TZDEFRULESTRING defaults to US rules for future DST transitions.
280 # This mishandles some past timestamps, as US DST rules have changed.
281 # It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
282 # as Europe and US DST rules differ.
283 # -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
284 # -DUNINIT_TRAP if reading uninitialized storage can cause problems
285 # other than simply getting garbage data
286 # -DUSE_LTZ=0 to build zdump with the system time zone library
287 # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
288 # -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
289 # similarly for "slim". Fat TZif files work around incompatibilities
290 # and bugs in some TZif readers, notably older ones that
291 # ignore or otherwise mishandle 64-bit data in TZif files;
292 # however, fat TZif files may trigger bugs in newer TZif readers.
293 # Slim TZif files are more efficient, and are the default.
294 # -DZIC_MAX_ABBR_LEN_WO_WARN=3
295 # (or some other number) to set the maximum time zone abbreviation length
296 # that zic will accept without a warning (the default is 6)
297 # -g to generate symbolic debugging info
298 # -Idir to include from directory 'dir'
299 # -O0 to disable optimization; other -O options to enable more optimization
300 # -Uname to remove any definition of the macro 'name'
301 # $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
303 # * Options marked "*" can be omitted if your compiler is C23 compatible.
304 # * Options marked "+" are obsolescent and are planned to be removed
305 # once the code assumes C99 or later, say in the year 2029.
307 # Select instrumentation via "make GCC_INSTRUMENT='whatever'".
309 -fsanitize=undefined -fsanitize-address-use-after-scope \
310 -fsanitize-undefined-trap-on-error -fstack-protector
311 # Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
312 GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
315 -Walloc-size-larger-than=100000 -Warray-bounds=2 \
316 -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
317 -Wdeclaration-after-statement -Wdouble-promotion \
318 -Wduplicated-branches -Wduplicated-cond \
319 -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
320 -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
321 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
323 -Wold-style-definition -Woverlength-strings -Wpointer-arith \
324 -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
325 -Wstrict-prototypes -Wstringop-overflow=4 \
326 -Wstringop-truncation -Wsuggest-attribute=cold \
327 -Wsuggest-attribute=const -Wsuggest-attribute=format \
328 -Wsuggest-attribute=malloc \
329 -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
330 -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
331 -Wvariadic-macros -Wvla -Wwrite-strings \
332 -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
335 # If your system has a "GMT offset" field in its "struct tm"s
336 # (or if you decide to add such a field in your system's "time.h" file),
337 # add the name to a define such as
338 # -DTM_GMTOFF=tm_gmtoff
339 # to the end of the "CFLAGS=" line. If not defined, the code attempts to
340 # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
341 # Similarly, if your system has a "zone abbreviation" field, define
343 # and define NO_TM_ZONE to suppress any guessing.
344 # Although these two fields are not required by POSIX.1-2017,
345 # POSIX 202x/D4 requires them and they are widely available
346 # on GNU/Linux and BSD systems.
348 # The next batch of options control support for external variables
349 # exported by tzcode. In practice these variables are less useful
350 # than TM_GMTOFF and TM_ZONE. However, most of them are standardized.
352 # # To omit or support the external variable "tzname", add one of:
353 # # -DHAVE_TZNAME=0 # do not support "tzname"
354 # # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library
355 # # -DHAVE_TZNAME=2 # support and define "tzname"
356 # # to the "CFLAGS=" line. "tzname" is required by POSIX.1-1988 and later.
357 # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
358 # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
359 # # crashes when combined with some platforms' standard libraries,
360 # # presumably due to memory allocation issues.
362 # # To omit or support the external variables "timezone" and "daylight", add
363 # # -DUSG_COMPAT=0 # do not support
364 # # -DUSG_COMPAT=1 # support, and variables are defined by system library
365 # # -DUSG_COMPAT=2 # support and define variables
366 # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix
367 # # Systems Group code and are required by POSIX.1-2008 and later (with XSI).
368 # # If not defined, the code attempts to guess USG_COMPAT from other macros.
370 # # To support the external variable "altzone", add
371 # # -DALTZONE=0 # do not support
372 # # -DALTZONE=1 # support "altzone", which is defined by system library
373 # # -DALTZONE=2 # support and define "altzone"
374 # # to the end of the "CFLAGS=" line; although "altzone" appeared in
375 # # System V Release 3.1 it has not been standardized.
376 # # If not defined, the code attempts to guess ALTZONE from other macros.
378 # If you want functions that were inspired by early versions of X3J11's work,
381 # to the end of the "CFLAGS=" line. This arranges for the following
382 # functions to be added to the time conversion library.
383 # "offtime" is like "gmtime" except that it accepts a second (long) argument
384 # that gives an offset to add to the time_t when converting it.
385 # I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone.
386 # "timelocal" is nearly equivalent to "mktime".
387 # "timeoff" is like "timegm" except that it accepts a second (long) argument
388 # that gives an offset to use when converting to a time_t.
389 # I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone.
390 # "posix2time" and "time2posix" are described in an included manual page.
391 # X3J11's work does not describe any of these functions.
392 # These functions may well disappear in future releases of the time
393 # conversion package.
395 # If you don't want functions that were inspired by NetBSD, add
396 # -DNETBSD_INSPIRED=0
397 # to the end of the "CFLAGS=" line. Otherwise, the functions
398 # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
399 # time library, and if STD_INSPIRED is also defined to nonzero the functions
400 # "posix2time_z" and "time2posix_z" are added as well.
401 # The functions ending in "_z" (or "_rz") are like their unsuffixed
402 # (or suffixed-by-"_r") counterparts, except with an extra first
403 # argument of opaque type timezone_t that specifies the timezone.
404 # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
406 # If you want to allocate state structures in localtime, add
408 # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
410 # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
411 # out by the National Institute of Standards and Technology
412 # which claims to test C and POSIX conformance. If you want to pass PCTS, add
414 # to the end of the "CFLAGS=" line.
416 # If you want strict compliance with XPG4 as of 1994-04-09, add
418 # to the end of the "CFLAGS=" line. This causes "strftime" to always return
419 # 53 as a week number (rather than 52 or 53) for January days before
420 # January's first Monday when a "%V" format is used and January 1
421 # falls on a Friday, Saturday, or Sunday.
423 # POSIX says CFLAGS defaults to "-O 1".
424 # Uncomment the following line and edit its contents as needed.
429 # The name of a POSIX-like library archiver, its flags, C compiler,
430 # linker flags, and 'make' utility. Ordinarily the defaults suffice.
431 # The commented-out values are the defaults specified by POSIX.1-202x/D4.
438 # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
439 # submake command lines. The default is no leap seconds.
443 # Where to fetch leap-seconds.list from.
445 https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
446 # The file is generated by the IERS Earth Orientation Centre, in Paris.
447 leaplist_TZ = Europe/Paris
449 # The zic command and its arguments.
452 ZIC= $(zic) $(ZFLAGS)
454 # To shrink the size of installed TZif files,
455 # append "-r @N" to omit data before N-seconds-after-the-Epoch.
456 # To grow the files and work around bugs in older applications,
457 # possibly at the expense of introducing bugs in newer ones,
458 # append "-b fat"; see ZIC_BLOAT_DEFAULT above.
459 # See the zic man page for more about -b and -r.
462 # How to use zic to install TZif files.
464 ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
466 # The name of a POSIX-compliant 'awk' on your system.
467 # mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
468 # Also, it is better (though not essential) if 'awk' supports UTF-8,
469 # and unfortunately mawk and busybox awk do not support UTF-8.
470 # Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
473 # The full path name of a POSIX-compliant shell, preferably one that supports
474 # the Korn shell's 'select' statement as an extension.
475 # These days, Bash is the most popular.
476 # It should be OK to set this to /bin/sh, on platforms where /bin/sh
477 # lacks 'select' or doesn't completely conform to POSIX, but /bin/bash
478 # is typically nicer if it works.
481 # Name of curl <https://curl.haxx.se/>, used for HTML validation
482 # and to fetch leap-seconds.list from upstream.
485 # Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
488 # This expensive test requires USE_LTZ.
489 # To suppress it, define this macro to be empty.
490 CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
492 # SAFE_CHAR is a regular expression that matches a safe character.
493 # Some parts of this distribution are limited to safe characters;
494 # others can use any UTF-8 character.
495 # For now, the safe characters are a safe subset of ASCII.
496 # The caller must set the shell variable 'sharp' to the character '#',
497 # since Makefile macros cannot contain '#'.
498 # TAB_CHAR is a single tab character, in single quotes.
500 SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
501 SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
502 SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
503 SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
504 SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]'
506 # These non-alphabetic, non-ASCII printable characters are Latin-1,
507 # and so are likely displayable even in editors like XEmacs 21
508 # that have limited display capabilities.
509 UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷
510 # Non-ASCII non-letters that OK_CHAR allows, as these characters are
511 # useful in commentary.
512 UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)
514 # Put this in a bracket expression to match spaces.
517 # OK_CHAR matches any character allowed in the distributed files.
518 # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
519 # multibyte letters are also allowed so that commentary can contain a
520 # few safe symbols and people's names and can quote non-English sources.
521 # Other non-letters are limited to ASCII renderings for the
522 # convenience of maintainers using XEmacs 21.5.34, which by default
523 # mishandles Unicode characters U+0100 and greater.
524 OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
526 # SAFE_LINE matches a line of safe characters.
527 # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
528 # this is so that comments can contain non-ASCII characters.
529 # OK_LINE matches a line of OK characters.
530 SAFE_LINE= '^'$(SAFE_CHAR)'*$$'
531 SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
532 OK_LINE= '^'$(OK_CHAR)'*$$'
534 # Flags to give 'tar' when making a distribution.
535 # Try to use flags appropriate for GNU tar.
536 GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
537 --numeric-owner --owner=0 --group=0 \
538 --mode=go+u,go-w --sort=name
539 TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
540 then echo $(GNUTARFLAGS); \
544 # Flags to give 'gzip' when making a distribution.
547 # When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
548 # This makes it easier to see which Zone has been affected.
549 DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \
552 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
555 # POSIX prohibits defining or using SHELL. However, csh users on systems
556 # that use the user shell for Makefile commands may need to define SHELL.
559 # End of macros that one plausibly might want to tailor.
560 ###############################################################################
564 TZDOBJS= zdump.o localtime.o asctime.o strftime.o
565 DATEOBJS= date.o localtime.o strftime.o asctime.o
566 LIBSRCS= localtime.c asctime.c difftime.c strftime.c
567 LIBOBJS= localtime.o asctime.o difftime.o strftime.o
568 HEADERS= tzfile.h private.h
569 NONLIBSRCS= zic.c zdump.c
571 SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
572 tzselect.ksh workman.sh
573 MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
574 tzfile.5 tzselect.8 zic.8 zdump.8
575 MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
577 tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
579 COMMON= calendars CONTRIBUTING LICENSE Makefile \
580 NEWS README SECURITY theory.html version
581 WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
582 CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
583 check_tz-how-to.html check_tz-link.html
584 DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
585 PRIMARY_YDATA= africa antarctica asia australasia \
586 europe northamerica southamerica
587 YDATA= $(PRIMARY_YDATA) etcetera
589 TDATA_TO_CHECK= $(YDATA) $(NDATA) backward
590 TDATA= $(YDATA) $(NDATA) $(BACKWARD)
591 ZONETABLES= zone.tab zone1970.tab zonenow.tab
592 TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
593 LEAP_DEPS= leapseconds.awk leap-seconds.list
594 TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \
595 $(PACKRATDATA) $(PACKRATLIST)
596 DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
597 DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
598 leapseconds $(ZONETABLES)
599 AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \
600 ziguard.awk zishrink.awk
603 TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
604 TZS= to$(TZS_YEAR).tzs
605 TZS_NEW= to$(TZS_YEAR)new.tzs
606 TZS_DEPS= $(YDATA) asctime.c localtime.c \
607 private.h tzfile.h zdump.c zic.c
608 TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
609 # EIGHT_YARDS is just a yard short of the whole ENCHILADA.
610 EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
611 ENCHILADA = $(EIGHT_YARDS) $(TZS)
613 # Consult these files when deciding whether to rebuild the 'version' file.
614 # This list is not the same as the output of 'git ls-files', since
615 # .gitignore is not distributed.
617 calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
618 africa antarctica asctime.c asia australasia \
620 checklinks.awk checknow.awk checktab.awk \
621 date.1 date.c difftime.c \
622 etcetera europe factory iso3166.tab \
623 leap-seconds.list leapseconds.awk localtime.c \
624 newctime.3 newstrftime.3 newtzset.3 northamerica \
625 private.h southamerica strftime.c theory.html \
626 time2posix.3 tz-art.html tz-how-to.html tz-link.html \
627 tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
628 workman.sh zdump.8 zdump.c zic.8 zic.c \
629 ziguard.awk zishrink.awk \
630 zone.tab zone1970.tab zonenow.tab
632 all: tzselect zic zdump libtz.a $(TABDATA) \
633 vanguard.zi main.zi rearguard.zi
635 ALL: all date $(ENCHILADA)
637 install: all $(DATA) $(REDO) $(MANS)
638 mkdir -p '$(DESTDIR)$(BINDIR)' \
639 '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
640 '$(DESTDIR)$(LIBDIR)' \
641 '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
642 '$(DESTDIR)$(MANDIR)/man8'
643 $(ZIC_INSTALL) -l $(LOCALTIME) \
644 `case '$(POSIXRULES)' in ?*) echo '-p';; esac \
646 -t '$(DESTDIR)$(TZDEFAULT)'
647 cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
648 cp tzselect '$(DESTDIR)$(BINDIR)/.'
649 cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
650 cp zic '$(DESTDIR)$(ZICDIR)/.'
651 cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
652 $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
653 cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
654 cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
655 cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
657 INSTALL: ALL install date.1
658 mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
659 cp date '$(DESTDIR)$(BINDIR)/.'
660 cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
662 # Calculate version number from git, if available.
663 # Otherwise, use $(VERSION) unless it is "unknown" and there is already
664 # a 'version' file, in which case reuse the existing 'version' contents
665 # and append "-dirty" if the contents do not already end in "-dirty".
666 version: $(VERSION_DEPS)
667 { (type git) >/dev/null 2>&1 && \
668 V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
669 --abbrev=7 --dirty` || \
670 if test '$(VERSION)' = unknown && V=`cat $@`; then \
671 case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
675 printf '%s\n' "$$V" >$@.out
678 # These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
679 vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
681 -v DATAFORM=`expr $@ : '\(.*\).zi'` \
682 -v PACKRATDATA='$(PACKRATDATA)' \
683 -v PACKRATLIST='$(PACKRATLIST)' \
685 $(TDATA) $(PACKRATDATA) >$@.out
687 # This file has a version comment that attempts to capture any tailoring
688 # via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
689 tzdata.zi: $(DATAFORM).zi version zishrink.awk
690 version=`sed 1q version` && \
692 -v dataform='$(DATAFORM)' \
693 -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
695 -v version="$$version" \
697 $(DATAFORM).zi >$@.out
701 printf '%s\n' >$@.out \
702 '#ifndef TZDEFAULT' \
703 '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \
706 '# define TZDIR "$(TZDIR)" /* TZif directory */' \
711 VERSION=`cat version` && printf '%s\n' \
712 'static char const PKGVERSION[]="($(PACKAGE)) ";' \
713 "static char const TZVERSION[]=\"$$VERSION\";" \
714 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
719 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
722 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
724 leapseconds: $(LEAP_DEPS)
725 $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
726 -f leapseconds.awk leap-seconds.list >$@.out
729 # Awk script to extract a Git-style author from leap-seconds.list comments.
731 author_line { sub(/^.[[:space:]]*/, ""); \
732 sub(/:[[:space:]]*/, " <"); \
733 printf "%s>\n", $$0; \
737 /Questions or comments to:/ { author_line = 1 } \
738 END { exit !success }
740 # Fetch leap-seconds.list from upstream.
741 fetch-leap-seconds.list:
742 $(CURL) -OR $(leaplist_URI)
744 # Fetch leap-seconds.list from upstream and commit it to the local repository.
745 commit-leap-seconds.list: fetch-leap-seconds.list
746 author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \
747 date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \
748 git commit --author="$$author" --date="$$date" -m'make $@' \
751 # Arguments to pass to submakes of install_data.
752 # They can be overridden by later submake arguments.
754 BACKWARD='$(BACKWARD)' \
755 DESTDIR='$(DESTDIR)' \
756 LEAPSECONDS='$(LEAPSECONDS)' \
757 PACKRATDATA='$(PACKRATDATA)' \
758 PACKRATLIST='$(PACKRATLIST)' \
759 TZDEFAULT='$(TZDEFAULT)' \
763 INSTALL_DATA_DEPS = zic leapseconds tzdata.zi
765 # 'make install_data' installs one set of TZif files.
766 install_data: $(INSTALL_DATA_DEPS)
767 $(ZIC_INSTALL) tzdata.zi
769 posix_only: $(INSTALL_DATA_DEPS)
770 $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
772 right_only: $(INSTALL_DATA_DEPS)
773 $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
776 # In earlier versions of this makefile, the other two directories were
777 # subdirectories of $(TZDIR). However, this led to configuration errors.
778 # For example, with posix_right under the earlier scheme,
779 # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
780 # but gmtime without leap seconds, which led to problems with applications
781 # like sendmail that subtract gmtime from localtime.
782 # Therefore, the other two directories are now siblings of $(TZDIR).
783 # You must replace all of $(TZDIR) to switch from not using leap seconds
784 # to using them, or vice versa.
785 right_posix: right_only
786 rm -fr '$(DESTDIR)$(TZDIR)-leaps'
787 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
788 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
789 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
791 posix_right: posix_only
792 rm -fr '$(DESTDIR)$(TZDIR)-posix'
793 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
794 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
795 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
799 # dummy.zd is not a real file; it is mentioned here only so that the
800 # top-level 'make' does not have a syntax error.
802 # Rule used only by submakes invoked by the $(TZS_NEW) rule.
803 # It is separate so that GNU 'make -j' can run instances in parallel.
805 ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
808 TZS_NEW_DEPS = tzdata.zi zdump zic
809 $(TZS_NEW): $(TZS_NEW_DEPS)
810 rm -fr tzs$(TZS_YEAR).dir
811 mkdir tzs$(TZS_YEAR).dir
812 $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
813 $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
814 tzdata.zi | LC_ALL=C sort >$@.out
816 x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
818 | LC_ALL=C sort -t . -k 2,2` && \
822 $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
823 ZDS="$$ZDS" $$ZDS && \
824 sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
825 rm -fr tzs$(TZS_YEAR).dir
828 # If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
829 # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
833 force_tzs: $(TZS_NEW)
838 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
842 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
844 tzselect: tzselect.ksh version
845 VERSION=`cat version` && sed \
846 -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
847 -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
848 -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
849 -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \
850 -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \
851 -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \
856 check: check_back check_mild
857 check_mild: check_character_set check_white_space check_links \
858 check_name_lengths check_now \
859 check_slashed_abbrs check_sorted \
860 check_tables check_web check_ziguard check_zishrink check_tzs
862 # True if UTF8_LOCALE does not work;
863 # otherwise, false but with LC_ALL set to $(UTF8_LOCALE).
864 UTF8_LOCALE_MISSING = \
865 { test ! '$(UTF8_LOCALE)' \
866 || ! printf 'A\304\200B\n' \
867 | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
868 || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; }
870 check_character_set: $(ENCHILADA)
871 $(UTF8_LOCALE_MISSING) || { \
873 ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
874 $(MISC) $(SOURCES) $(WEB_PAGES) \
875 CONTRIBUTING LICENSE README SECURITY \
876 version tzdata.zi && \
877 ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
879 ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
880 leapseconds zone.tab && \
881 ! grep -Env $(OK_LINE) $(ENCHILADA); \
885 check_white_space: $(ENCHILADA)
886 $(UTF8_LOCALE_MISSING) || { \
887 patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
888 ! grep -En "$$pat|[$s]\$$" \
889 $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \
893 PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
894 FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
896 check_name_lengths: $(TDATA_TO_CHECK) backzone
897 ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
898 $(TDATA_TO_CHECK) backzone
901 PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
902 STDOFF = [-+]?[0-9:.]+
903 RULELESS_SAVE = (-|$(STDOFF)[sd]?)
904 RULELESS_SLASHED_ABBRS = \
905 $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
907 check_slashed_abbrs: $(TDATA_TO_CHECK)
908 ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
911 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
913 check_sorted: backward backzone
914 $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
915 backward | LC_ALL=C sort -cu
916 $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
919 check_back: checklinks.awk $(TDATA_TO_CHECK)
921 -v DATAFORM=$(DATAFORM) \
922 -v backcheck=backward \
923 -f checklinks.awk $(TDATA_TO_CHECK)
926 check_links: checklinks.awk tzdata.zi
928 -v DATAFORM=$(DATAFORM) \
929 -f checklinks.awk tzdata.zi
932 # Check timestamps from now through 28 years from now, to make sure
933 # that zonenow.tab contains all sequences of planned timestamps,
934 # without any duplicate sequences. In theory this might require
935 # 2800 years but that would take a long time to check.
936 CHECK_NOW_TIMESTAMP = `./date +%s`
937 CHECK_NOW_FUTURE_YEARS = 28
938 CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60
939 check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
942 ./zic -d $@.dir tzdata.zi
943 now=$(CHECK_NOW_TIMESTAMP) && \
944 future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \
945 ./zdump -i -t $$now,$$future \
946 $$(find $$PWD/$@.dir/????*/ -type f) \
949 -v zdump_table=$@.dir/zdump.tab \
950 -f checknow.awk zonenow.tab
954 check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab
955 for tab in $(ZONETABLES); do \
956 test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
957 $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
962 check_tzs: $(TZS) $(TZS_NEW)
963 if test -s $(TZS); then \
964 $(DIFF_TZS) $(TZS) $(TZS_NEW); \
966 cp $(TZS_NEW) $(TZS); \
970 check_web: $(CHECK_WEB_PAGES)
971 check_theory.html: theory.html
972 check_tz-art.html: tz-art.html
973 check_tz-how-to.html: tz-how-to.html
974 check_tz-link.html: tz-link.html
975 check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
976 $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
977 -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
978 test ! -s $@.out || { cat $@.out; exit 1; }
981 check_ziguard: rearguard.zi vanguard.zi ziguard.awk
982 $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
983 diff -u rearguard.zi -
984 $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
985 diff -u vanguard.zi -
988 # Check that zishrink.awk does not alter the data, and that ziguard.awk
989 # preserves main-format data.
990 check_zishrink: check_zishrink_posix check_zishrink_right
991 check_zishrink_posix check_zishrink_right: \
992 zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
993 $(TDATA) $(DATAFORM).zi tzdata.zi
994 rm -fr $@.dir $@-t.dir $@-shrunk.dir
995 mkdir $@.dir $@-t.dir $@-shrunk.dir
997 *_right) leap='-L leapseconds';; \
1000 $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
1001 $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
1002 case $(DATAFORM),$(PACKRATLIST) in \
1004 $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
1005 $(AWK) '/^Rule/' $(TDATA) | \
1006 $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
1007 diff -r $@.dir $@-t.dir;; \
1009 diff -r $@.dir $@-shrunk.dir
1010 rm -fr $@.dir $@-t.dir $@-shrunk.dir
1014 rm -fr check_*.dir typecheck_*.dir
1015 rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
1016 check_* core typecheck_* \
1017 date tzdir.h tzselect version.h zdump zic libtz.a
1019 rm -fr *.dir tzdb-*/
1020 rm -f *.zi $(TZS_NEW)
1022 maintainer-clean: clean
1023 @echo 'This command is intended for maintainers to use; it'
1024 @echo 'deletes files that may need special tools to rebuild.'
1025 rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
1030 public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \
1034 newctime.3.txt: newctime.3
1035 newstrftime.3.txt: newstrftime.3
1036 newtzset.3.txt: newtzset.3
1037 time2posix.3.txt: time2posix.3
1038 tzfile.5.txt: tzfile.5
1039 tzselect.8.txt: tzselect.8
1040 zdump.8.txt: zdump.8
1043 $(MANTXTS): workman.sh
1044 LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
1047 # Set file timestamps deterministically if possible,
1048 # so that tarballs containing the timestamps are reproducible.
1050 # '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
1051 # file DEST to the maximum of the timestamps of the files A B C ...,
1052 # plus N if GNU ls and touch are available.
1053 SET_TIMESTAMP_N = sh -c '\
1054 n=$$0 dest=$$1; shift; \
1056 if test $$n != 0 && \
1057 lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \
1059 timestamp=`expr $$7 + $$n` && \
1060 echo "+ touch -md @$$timestamp $$dest" && \
1061 touch -md @$$timestamp "$$dest"; \
1063 newest=`ls -t "$$@" | sed 1q` && \
1064 echo "+ touch -mr $$newest $$dest" && \
1065 touch -mr "$$newest" "$$dest"; \
1067 # If DEST depends on A B C ... in this Makefile, callers should use
1068 # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
1069 # downstream 'make' that considers equal timestamps to be out of date.
1070 # POSIX allows this 'make' behavior, and HP-UX 'make' does it.
1071 # If all that matters is that the timestamp be reproducible
1072 # and plausible, use $(SET_TIMESTAMP).
1073 SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
1074 SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
1076 # Set the timestamps to those of the git repository, if available,
1077 # and if the files have not changed since then.
1078 # This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
1079 # and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
1080 # If git or GNU is absent, don't bother to sync with git timestamps.
1081 # Also, set the timestamp of each prebuilt file like 'leapseconds'
1082 # to be the maximum of the files it depends on.
1083 set-timestamps.out: $(EIGHT_YARDS)
1085 if (type git) >/dev/null 2>&1 && \
1086 files=`git ls-files $(EIGHT_YARDS)` && \
1087 touch -md @1 test.out; then \
1089 for file in $$files; do \
1090 if git diff --quiet $$file; then \
1091 time=`TZ=UTC0 git log -1 \
1092 --format='tformat:%cd' \
1093 --date='format:%Y-%m-%dT%H:%M:%SZ' \
1095 echo "+ touch -md $$time $$file" && \
1096 touch -md $$time $$file; \
1098 echo >&2 "$$file: warning: does not match repository"; \
1102 $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
1103 for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
1104 $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
1107 $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
1108 $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
1110 set-tzs-timestamp.out: $(TZS)
1111 $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
1114 # The zics below ensure that each data file can stand on its own.
1115 # We also do an all-files run to catch links to links.
1117 check_public: $(VERSION_DEPS)
1120 ln $(VERSION_DEPS) public.dir
1122 && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL
1123 for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
1124 public.dir/vanguard.zi public.dir/main.zi \
1125 public.dir/rearguard.zi; \
1127 public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
1129 public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
1131 : Also check 'backzone' syntax.
1132 rm public.dir/main.zi
1133 cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
1134 public.dir/zic -d public.dir/zoneinfo main.zi
1135 rm public.dir/main.zi
1137 $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
1138 public.dir/zic -d public.dir/zoneinfo main.zi
1143 # Check that the code works under various alternative
1144 # implementations of time_t.
1145 check_time_t_alternatives: $(TIME_T_ALTERNATIVES)
1146 $(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
1147 $(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
1150 ln $(VERSION_DEPS) $@.dir
1152 int*32_t) range=-2147483648,2147483648;; \
1153 u*) range=0,4294967296;; \
1154 *) range=-4294967296,4294967296;; \
1157 zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
1158 if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
1161 range_target=to$$range.tzs; \
1164 $(MAKE) TOPDIR="$$wd/$@.dir" \
1165 CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
1168 TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
1169 install $$range_target) && \
1170 test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
1171 (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
1172 $(MAKE) TOPDIR="$$wd/$@.dir" \
1173 TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
1176 $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
1177 $@.dir/to$$range.tzs && \
1178 if diff -q Makefile Makefile 2>/dev/null; then \
1179 quiet_option='-q'; \
1183 diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
1185 diff $$quiet_option -r \
1186 $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
1192 tzcode$(VERSION).tar.gz.asc \
1193 tzdata$(VERSION).tar.gz.asc
1195 tzdata$(VERSION)-rearguard.tar.gz.asc
1196 ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
1197 tzdb-$(VERSION).tar.lz.asc
1199 tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
1200 signatures rearguard_signatures traditional_signatures: \
1201 version set-timestamps.out rearguard.zi vanguard.zi
1202 VERSION=`cat version` && \
1203 $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
1205 # These *_version rules are intended for use if VERSION is set by some
1206 # other means. Ordinarily these rules are used only by the above
1207 # non-_version rules, which set VERSION on the 'make' command line.
1208 tarballs_version: traditional_tarballs_version rearguard_tarballs_version \
1209 tzdb-$(VERSION).tar.lz
1210 rearguard_tarballs_version: \
1211 tzdata$(VERSION)-rearguard.tar.gz
1212 traditional_tarballs_version: \
1213 tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
1214 tailored_tarballs_version: \
1215 tzdata$(VERSION)-tailored.tar.gz
1216 signatures_version: $(ALL_ASC)
1217 rearguard_signatures_version: $(REARGUARD_ASC)
1218 traditional_signatures_version: $(TRADITIONAL_ASC)
1220 tzcode$(VERSION).tar.gz: set-timestamps.out
1221 LC_ALL=C && export LC_ALL && \
1222 tar $(TARFLAGS) -cf - \
1223 $(COMMON) $(DOCS) $(SOURCES) | \
1224 gzip $(GZIPFLAGS) >$@.out
1227 tzdata$(VERSION).tar.gz: set-timestamps.out
1228 LC_ALL=C && export LC_ALL && \
1229 tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
1230 gzip $(GZIPFLAGS) >$@.out
1233 # Create empty files with a reproducible timestamp.
1234 CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
1236 # The obsolescent *rearguard* targets and related macros are present
1237 # for backwards compatibility with tz releases 2018e through 2022a.
1238 # They should go away eventually. To build rearguard tarballs you
1239 # can instead use 'make DATAFORM=rearguard tailored_tarballs'.
1240 tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
1243 ln $(TZDATA_DIST) $@.dir
1244 cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
1245 for f in $(TDATA) $(PACKRATDATA); do \
1247 $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
1248 $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
1250 sed '1s/$$/-rearguard/' <version >$@.dir/version
1251 : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1252 $(CREATE_EMPTY) $@.dir/pacificnew
1253 touch -mr version $@.dir/version
1254 LC_ALL=C && export LC_ALL && \
1256 tar $(TARFLAGS) -cf - \
1257 $(TZDATA_DIST) pacificnew | \
1258 gzip $(GZIPFLAGS)) >$@.out
1261 # Create a tailored tarball suitable for TZUpdater and compatible tools.
1262 # For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
1263 # useful for testing whether TZUpdater supports vanguard form.
1264 # The generated tarball is not byte-for-byte equivalent to a hand-tailored
1265 # traditional tarball, as data entries are put into 'etcetera' even if they
1266 # came from some other source file. However, the effect should be the same
1267 # for ordinary use, which reads all the source files.
1268 tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
1271 : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1273 $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
1274 `test $(DATAFORM) = vanguard || echo pacificnew`
1275 (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
1277 touch -mr tzdata.zi $@.dir/etcetera
1279 -e '/^# *version *\(.*\)/h' \
1280 -e '/^# *ddeps */H' \
1283 -e 's/^# *version *//' \
1284 -e 's/\n# *ddeps */-/' \
1287 <tzdata.zi >$@.dir/version
1288 touch -mr version $@.dir/version
1290 for file in $(TZDATA_DIST); do \
1291 test -f $@.dir/$$file || links="$$links $$file"; \
1294 LC_ALL=C && export LC_ALL && \
1296 tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out
1299 tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
1300 rm -fr tzdb-$(VERSION)
1301 mkdir tzdb-$(VERSION)
1302 ln $(ENCHILADA) tzdb-$(VERSION)
1303 $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
1304 LC_ALL=C && export LC_ALL && \
1305 tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
1308 tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
1309 tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
1310 tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
1311 tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
1313 $(GPG) --armor --detach-sign $?
1315 TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
1316 typecheck: typecheck_long_long typecheck_unsigned
1317 typecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
1320 ln $(VERSION_DEPS) $@.dir
1323 *_long_long) i="long long";; \
1324 *_unsigned ) i="unsigned" ;; \
1326 typecheck_cflags='' && \
1328 CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
1331 $@.dir/zdump -i -c 1970,1971 Europe/Rome
1334 zonenames: tzdata.zi
1335 @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
1337 asctime.o: private.h tzfile.h
1339 difftime.o: private.h
1340 localtime.o: private.h tzfile.h tzdir.h
1341 strftime.o: private.h tzfile.h
1343 zic.o: private.h tzfile.h tzdir.h version.h
1345 .PHONY: ALL INSTALL all
1346 .PHONY: check check_mild check_time_t_alternatives
1347 .PHONY: check_web check_zishrink
1348 .PHONY: clean clean_misc commit-leap-seconds.list dummy.zd
1349 .PHONY: fetch-leap-seconds.list force_tzs
1350 .PHONY: install install_data maintainer-clean names
1351 .PHONY: posix_only posix_right public
1352 .PHONY: rearguard_signatures rearguard_signatures_version
1353 .PHONY: rearguard_tarballs rearguard_tarballs_version
1354 .PHONY: right_only right_posix signatures signatures_version
1355 .PHONY: tarballs tarballs_version
1356 .PHONY: traditional_signatures traditional_signatures_version
1357 .PHONY: traditional_tarballs traditional_tarballs_version
1358 .PHONY: tailored_tarballs tailored_tarballs_version
1360 .PHONY: zonenames zones