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