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