1 # This file is in the public domain, so clarified as of
2 # 2009-05-17 by Arthur David Olson.
4 # Package name for the code distribution.
7 # Version number for the distribution, overridden in the 'tarballs' rule below.
10 # Email address for bug reports.
13 # Choose source data features. To get new features right away, use:
15 # To wait a while before using new features, to give downstream users
16 # time to upgrade zic (the default), use:
18 # To wait even longer for new features, use:
22 # Change the line below for your time zone (after finding the zone you want in
23 # the time zone files, or adding it to a time zone file).
24 # Alternately, if you discover you've got the wrong time zone, you can just
29 # to get a list of the values you can use for LOCALTIME.
33 # If you want something other than Eastern United States time as a template
34 # for handling POSIX-style time zone environment variables,
35 # change the line below (after finding the zone you want in the
36 # time zone files, or adding it to a time zone file).
37 # When a POSIX-style environment variable is handled, the rules in the
38 # template file are used to determine "spring forward" and "fall back" days and
39 # times; the environment variable itself specifies UT offsets of standard and
40 # daylight saving time.
41 # Alternately, if you discover you've got the wrong time zone, you can just
46 # to get a list of the values you can use for POSIXRULES.
47 # If you want POSIX compatibility, use "America/New_York".
49 POSIXRULES= America/New_York
51 # Also see TZDEFRULESTRING below, which takes effect only
52 # if the time zone files cannot be accessed.
55 # Installation locations.
57 # The defaults are suitable for Debian, except that if REDO is
58 # posix_right or right_posix then files that Debian puts under
59 # /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
60 # put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
61 # respectively. Problems with the Debian approach are discussed in
62 # the commentary for the right_posix rule (below).
64 # Destination directory, which can be used for staging.
65 # 'make DESTDIR=/stage install' installs under /stage (e.g., to
66 # /stage/etc/localtime instead of to /etc/localtime). Files under
67 # /stage are not intended to work as-is, but can be copied by hand to
68 # the root directory later. If DESTDIR is empty, 'make install' does
69 # not stage, but installs directly into production locations.
72 # Everything is installed into subdirectories of TOPDIR, and used there.
73 # TOPDIR should be empty (meaning the root directory),
74 # or a directory name that does not end in "/".
75 # TOPDIR should be empty or an absolute name unless you're just testing.
78 # The default local time zone is taken from the file TZDEFAULT.
79 TZDEFAULT = $(TOPDIR)/etc/localtime
81 # The subdirectory containing installed program and data files, and
82 # likewise for installed files that can be shared among architectures.
83 # These should be relative file names.
85 USRSHAREDIR = $(USRDIR)/share
87 # "Compiled" time zone information is placed in the "TZDIR" directory
88 # (and subdirectories).
89 # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
90 TZDIR_BASENAME= zoneinfo
91 TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
93 # The "tzselect" and (if you do "make INSTALL") "date" commands go in:
94 BINDIR = $(TOPDIR)/$(USRDIR)/bin
96 # The "zdump" command goes in:
99 # The "zic" command goes in:
100 ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
102 # Manual pages go in subdirectories of. . .
103 MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
105 # Library functions are put in an archive in LIBDIR.
106 LIBDIR = $(TOPDIR)/$(USRDIR)/lib
109 # Types to try, as an alternative to time_t. int64_t should be first.
110 TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
112 # If you want only POSIX time, with time values interpreted as
113 # seconds since the epoch (not counting leap seconds), use
115 # below. If you want only "right" time, with values interpreted
116 # as seconds since the epoch (counting leap seconds), use
118 # below. If you want both sets of data available, with leap seconds not
119 # counted normally, use
121 # below. If you want both sets of data available, with leap seconds counted
124 # below. POSIX mandates that leap seconds not be counted; for compatibility
125 # with it, use "posix_only" or "posix_right". Use POSIX time on systems with
126 # leap smearing; this can work better than unsmeared "right" time with
127 # applications that are not leap second aware, and is closer to unsmeared
128 # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
132 # To install data in text form that has all the information of the binary data,
133 # (optionally incorporating leap second information), use
134 # TZDATA_TEXT= tzdata.zi leapseconds
135 # To install text data without leap second information (e.g., because
136 # REDO='posix_only'), use
137 # TZDATA_TEXT= tzdata.zi
138 # To avoid installing text data, use
141 TZDATA_TEXT= leapseconds tzdata.zi
143 # For backward-compatibility links for old zone names, use
145 # If you also want the link US/Pacific-New, even though it is confusing
146 # and is planned to be removed from the database eventually, use
147 # BACKWARD= backward pacificnew
148 # To omit these links, use
153 # If you want out-of-scope and often-wrong data from the file 'backzone', use
154 # PACKRATDATA= backzone
155 # To omit this data, use
160 # The name of a locale using the UTF-8 encoding, used during self-tests.
161 # The tests are skipped if the name does not appear to work on this system.
163 UTF8_LOCALE= en_US.utf8
165 # Since "." may not be in PATH...
167 YEARISTYPE= ./yearistype
169 # Non-default libraries needed to link.
172 # Add the following to the end of the "CFLAGS=" line as needed to override
173 # defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1".
174 # -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
175 # -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
176 # formats that generate only the last two digits of year numbers
177 # -DEPOCH_LOCAL if the 'time' function returns local time not UT
178 # -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
179 # than what POSIX specifies, assuming local time is UT.
180 # For example, N is 252460800 on AmigaOS.
181 # -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
182 # -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
183 # -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
184 # -DHAVE_GENERIC=0 if _Generic does not work
185 # -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
186 # -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
187 # ctime_r and asctime_r incompatibly with the POSIX standard
188 # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
189 # -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
190 # -DHAVE_LINK=0 if your system lacks a link function
191 # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
192 # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
193 # localtime_rz can make zdump significantly faster, but is nonstandard.
194 # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
195 # functions like 'link' or variables like 'tzname' required by POSIX
196 # -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
197 # -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
198 # -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
199 # -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
200 # -DHAVE_STRDUP=0 if your system lacks the strdup function
201 # -DHAVE_STRTOLL=0 if your system lacks the strtoll function
202 # -DHAVE_SYMLINK=0 if your system lacks the symlink function
203 # -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
204 # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
205 # -DHAVE_TZSET=0 if your system lacks a tzset function
206 # -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
207 # -Dlocale_t=XXX if your system uses XXX instead of locale_t
208 # -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
209 # with external linkage, e.g., applications cannot define 'localtime'.
210 # -Dssize_t=long on hosts like MS-Windows that lack ssize_t
211 # -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
212 # security implications and is not recommended for general use
213 # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
214 # not needed by the main-program tz code, which is single-threaded.
215 # Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
216 # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
217 # This is intended for internal use only; it mangles external names.
218 # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
219 # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
220 # the default is system-supplied, typically "/usr/lib/locale"
221 # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
222 # DST transitions if the time zone files cannot be accessed
223 # -DUNINIT_TRAP if reading uninitialized storage can cause problems
224 # other than simply getting garbage data
225 # -DUSE_LTZ=0 to build zdump with the system time zone library
226 # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
227 # -DZIC_MAX_ABBR_LEN_WO_WARN=3
228 # (or some other number) to set the maximum time zone abbreviation length
229 # that zic will accept without a warning (the default is 6)
230 # $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
231 # Select instrumentation via "make GCC_INSTRUMENT='whatever'".
233 -fsanitize=undefined -fsanitize-address-use-after-scope \
234 -fsanitize-undefined-trap-on-error -fstack-protector
235 GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
238 -Walloc-size-larger-than=100000 -Warray-bounds=2 \
239 -Wbad-function-cast -Wcast-align -Wdate-time \
240 -Wdeclaration-after-statement -Wdouble-promotion \
241 -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
242 -Winit-self -Wjump-misses-init -Wlogical-op \
243 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
244 -Wold-style-definition -Woverlength-strings -Wpointer-arith \
245 -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
246 -Wsuggest-attribute=const -Wsuggest-attribute=format \
247 -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
248 -Wtrampolines -Wundef -Wuninitialized -Wunused \
249 -Wvariadic-macros -Wvla -Wwrite-strings \
250 -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
251 -Wno-type-limits -Wno-unused-parameter
253 # If your system has a "GMT offset" field in its "struct tm"s
254 # (or if you decide to add such a field in your system's "time.h" file),
255 # add the name to a define such as
256 # -DTM_GMTOFF=tm_gmtoff
257 # to the end of the "CFLAGS=" line. If not defined, the code attempts to
258 # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
259 # Similarly, if your system has a "zone abbreviation" field, define
261 # and define NO_TM_ZONE to suppress any guessing. These two fields are not
262 # required by POSIX, but are widely available on GNU/Linux and BSD systems.
264 # The next batch of options control support for external variables
265 # exported by tzcode. In practice these variables are less useful
266 # than TM_GMTOFF and TM_ZONE. However, most of them are standardized.
268 # # To omit or support the external variable "tzname", add one of:
271 # # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later.
272 # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
273 # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
274 # # crashes when combined with some platforms' standard libraries,
275 # # presumably due to memory allocation issues.
277 # # To omit or support the external variables "timezone" and "daylight", add
280 # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
281 # # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
282 # # If not defined, the code attempts to guess USG_COMPAT from other macros.
284 # # To support the external variable "altzone", add
286 # # to the end of the "CFLAGS=" line; although "altzone" appeared in
287 # # System V Release 3.1 it has not been standardized.
289 # If you want functions that were inspired by early versions of X3J11's work,
292 # to the end of the "CFLAGS=" line. This arranges for the functions
293 # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
294 # "posix2time", and "time2posix" to be added to the time conversion library.
295 # "tzsetwall" is like "tzset" except that it arranges for local wall clock
296 # time (rather than the time specified in the TZ environment variable)
298 # "offtime" is like "gmtime" except that it accepts a second (long) argument
299 # that gives an offset to add to the time_t when converting it.
300 # "timelocal" is equivalent to "mktime".
301 # "timegm" is like "timelocal" except that it turns a struct tm into
302 # a time_t using UT (rather than local time as "timelocal" does).
303 # "timeoff" is like "timegm" except that it accepts a second (long) argument
304 # that gives an offset to use when converting to a time_t.
305 # "posix2time" and "time2posix" are described in an included manual page.
306 # X3J11's work does not describe any of these functions.
307 # Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
308 # These functions may well disappear in future releases of the time
309 # conversion package.
311 # If you don't want functions that were inspired by NetBSD, add
312 # -DNETBSD_INSPIRED=0
313 # to the end of the "CFLAGS=" line. Otherwise, the functions
314 # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
315 # time library, and if STD_INSPIRED is also defined the functions
316 # "posix2time_z" and "time2posix_z" are added as well.
317 # The functions ending in "_z" (or "_rz") are like their unsuffixed
318 # (or suffixed-by-"_r") counterparts, except with an extra first
319 # argument of opaque type timezone_t that specifies the time zone.
320 # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
322 # If you want to allocate state structures in localtime, add
324 # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
326 # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
327 # out by the National Institute of Standards and Technology
328 # which claims to test C and Posix conformance. If you want to pass PCTS, add
330 # to the end of the "CFLAGS=" line.
332 # If you want strict compliance with XPG4 as of 1994-04-09, add
334 # to the end of the "CFLAGS=" line. This causes "strftime" to always return
335 # 53 as a week number (rather than 52 or 53) for January days before
336 # January's first Monday when a "%V" format is used and January 1
337 # falls on a Friday, Saturday, or Sunday.
341 # Linker flags. Default to $(LFLAGS) for backwards compatibility
342 # to release 2012h and earlier.
346 # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
347 # submake command lines. The default is no leap seconds.
351 # The zic command and its arguments.
354 ZIC= $(zic) $(ZFLAGS)
358 # How to use zic to install tz binary files.
360 ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
362 # The name of a Posix-compliant 'awk' on your system.
365 # The full path name of a Posix-compliant shell, preferably one that supports
366 # the Korn shell's 'select' statement as an extension.
367 # These days, Bash is the most popular.
368 # It should be OK to set this to /bin/sh, on platforms where /bin/sh
369 # lacks 'select' or doesn't completely conform to Posix, but /bin/bash
370 # is typically nicer if it works.
373 # The path where SGML DTDs are kept and the catalog file(s) to use when
374 # validating. The default should work on both Debian and Red Hat.
376 SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
377 SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
378 SGML_CATALOG_FILES= \
379 $(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
381 # The name, arguments and environment of a program to validate your web pages.
382 # See <http://openjade.sourceforge.net/doc/> for a validator, and
383 # <https://validator.w3.org/source/> for a validation library.
384 # Set VALIDATE=':' if you do not have such a program.
386 VALIDATE_FLAGS = -s -B -wall -wno-unused-param
388 SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \
389 SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \
390 SP_CHARSET_FIXED=YES \
393 # This expensive test requires USE_LTZ.
394 # To suppress it, define this macro to be empty.
395 CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
397 # SAFE_CHAR is a regular expression that matches a safe character.
398 # Some parts of this distribution are limited to safe characters;
399 # others can use any UTF-8 character.
400 # For now, the safe characters are a safe subset of ASCII.
401 # The caller must set the shell variable 'sharp' to the character '#',
402 # since Makefile macros cannot contain '#'.
403 # TAB_CHAR is a single tab character, in single quotes.
405 SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
406 SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
407 SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
408 SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
409 SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]'
411 # Non-ASCII non-letters that OK_CHAR allows, as these characters are
412 # useful in commentary. XEmacs 21.5.34 displays them correctly,
413 # presumably because they are Latin-1.
414 UNUSUAL_OK_CHARSET= °±½¾×
416 # OK_CHAR matches any character allowed in the distributed files.
417 # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
418 # multibyte letters are also allowed so that commentary can contain a
419 # few safe symbols and people's names and can quote non-English sources.
420 # Other non-letters are limited to ASCII renderings for the
421 # convenience of maintainers using XEmacs 21.5.34, which by default
422 # mishandles Unicode characters U+0100 and greater.
423 OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
425 # SAFE_LINE matches a line of safe characters.
426 # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
427 # this is so that comments can contain non-ASCII characters.
428 # OK_LINE matches a line of OK characters.
429 SAFE_LINE= '^'$(SAFE_CHAR)'*$$'
430 SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
431 OK_LINE= '^'$(OK_CHAR)'*$$'
433 # Flags to give 'tar' when making a distribution.
434 # Try to use flags appropriate for GNU tar.
435 GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
436 TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
437 then echo $(GNUTARFLAGS); \
441 # Flags to give 'gzip' when making a distribution.
444 ###############################################################################
449 CC= $(cc) -DTZDIR='"$(TZDIR)"'
453 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
457 TZDOBJS= zdump.o localtime.o asctime.o strftime.o
458 DATEOBJS= date.o localtime.o strftime.o asctime.o
459 LIBSRCS= localtime.c asctime.c difftime.c
460 LIBOBJS= localtime.o asctime.o difftime.o
461 HEADERS= tzfile.h private.h
462 NONLIBSRCS= zic.c zdump.c
463 NEWUCBSRCS= date.c strftime.c
464 SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
465 tzselect.ksh workman.sh
466 MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
467 tzfile.5 tzselect.8 zic.8 zdump.8
468 MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
470 tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
472 COMMON= calendars CONTRIBUTING LICENSE Makefile \
473 NEWS README theory.html version
474 WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
475 DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
476 PRIMARY_YDATA= africa antarctica asia australasia \
477 europe northamerica southamerica
478 YDATA= $(PRIMARY_YDATA) etcetera
479 NDATA= systemv factory
480 TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew
481 TDATA= $(YDATA) $(NDATA) $(BACKWARD)
482 ZONETABLES= zone1970.tab zone.tab
483 TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
484 LEAP_DEPS= leapseconds.awk leap-seconds.list
485 TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
486 DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
487 DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
488 leapseconds yearistype.sh $(ZONETABLES)
489 AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \
490 ziguard.awk zishrink.awk
491 MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl
493 TZS= to$(TZS_YEAR).tzs
494 TZS_NEW= to$(TZS_YEAR)new.tzs
495 TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \
496 private.h tzfile.h zdump.c zic.c
497 ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
499 # Consult these files when deciding whether to rebuild the 'version' file.
500 # This list is not the same as the output of 'git ls-files', since
501 # .gitignore is not distributed.
503 calendars CONTRIBUTING LICENSE Makefile NEWS README \
504 africa antarctica asctime.c asia australasia \
506 checklinks.awk checktab.awk \
507 date.1 date.c difftime.c \
508 etcetera europe factory iso3166.tab \
509 leap-seconds.list leapseconds.awk localtime.c \
510 newctime.3 newstrftime.3 newtzset.3 northamerica \
511 pacificnew private.h \
512 southamerica strftime.c systemv theory.html \
513 time2posix.3 tz-art.html tz-how-to.html tz-link.html \
514 tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
515 workman.sh yearistype.sh \
516 zdump.8 zdump.c zic.8 zic.c \
517 zone.tab zone1970.tab zoneinfo2tdf.pl
519 # And for the benefit of csh users on systems that assume the user
520 # shell should be used to handle commands in Makefiles. . .
524 all: tzselect yearistype zic zdump libtz.a $(TABDATA) \
525 vanguard.zi main.zi rearguard.zi
527 ALL: all date $(ENCHILADA)
529 install: all $(DATA) $(REDO) $(MANS)
530 mkdir -p '$(DESTDIR)$(BINDIR)' \
531 '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
532 '$(DESTDIR)$(LIBDIR)' \
533 '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
534 '$(DESTDIR)$(MANDIR)/man8'
535 $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \
536 -t '$(DESTDIR)$(TZDEFAULT)'
537 cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
538 cp tzselect '$(DESTDIR)$(BINDIR)/.'
539 cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
540 cp zic '$(DESTDIR)$(ZICDIR)/.'
541 cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
542 $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
543 cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
544 cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
545 cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
547 INSTALL: ALL install date.1
548 mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
549 cp date '$(DESTDIR)$(BINDIR)/.'
550 cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
552 version: $(VERSION_DEPS)
553 { (type git) >/dev/null 2>&1 && \
554 V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
555 --abbrev=7 --dirty` || \
556 V='$(VERSION)'; } && \
557 printf '%s\n' "$$V" >$@.out
560 # These files can be tailored by setting BACKWARD, PACKRATDATA, etc.
561 vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
562 $(AWK) -v outfile='$@' -f ziguard.awk $(TDATA) $(PACKRATDATA) \
565 tzdata.zi: $(DATAFORM).zi version
566 version=`sed 1q version` && \
567 LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
568 $(DATAFORM).zi >$@.out
572 VERSION=`cat version` && printf '%s\n' \
573 'static char const PKGVERSION[]="($(PACKAGE)) ";' \
574 "static char const TZVERSION[]=\"$$VERSION\";" \
575 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
580 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
583 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
585 yearistype: yearistype.sh
586 cp yearistype.sh yearistype
589 leapseconds: $(LEAP_DEPS)
590 $(AWK) -f leapseconds.awk leap-seconds.list >$@.out
593 # Arguments to pass to submakes of install_data.
594 # They can be overridden by later submake arguments.
596 BACKWARD='$(BACKWARD)' \
597 DESTDIR='$(DESTDIR)' \
598 LEAPSECONDS='$(LEAPSECONDS)' \
599 PACKRATDATA='$(PACKRATDATA)' \
600 TZDEFAULT='$(TZDEFAULT)' \
602 YEARISTYPE='$(YEARISTYPE)' \
605 # 'make install_data' installs one set of tz binary files.
606 install_data: zic leapseconds yearistype tzdata.zi
607 $(ZIC_INSTALL) tzdata.zi
610 $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
613 $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
616 # In earlier versions of this makefile, the other two directories were
617 # subdirectories of $(TZDIR). However, this led to configuration errors.
618 # For example, with posix_right under the earlier scheme,
619 # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
620 # but gmtime without leap seconds, which led to problems with applications
621 # like sendmail that subtract gmtime from localtime.
622 # Therefore, the other two directories are now siblings of $(TZDIR).
623 # You must replace all of $(TZDIR) to switch from not using leap seconds
624 # to using them, or vice versa.
625 right_posix: right_only
626 rm -fr '$(DESTDIR)$(TZDIR)-leaps'
627 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
628 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
629 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
631 posix_right: posix_only
632 rm -fr '$(DESTDIR)$(TZDIR)-posix'
633 ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
634 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
635 $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
637 # This obsolescent rule is present for backwards compatibility with
638 # tz releases 2014g through 2015g. It should go away eventually.
640 $(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
644 # dummy.zd is not a real file; it is mentioned here only so that the
645 # top-level 'make' does not have a syntax error.
647 # Rule used only by submakes invoked by the $(TZS_NEW) rule.
648 # It is separate so that GNU 'make -j' can run instances in parallel.
650 ./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@
652 $(TZS_NEW): tzdata.zi zdump zic
655 $(zic) -d tzs.dir tzdata.zi
656 $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
657 tzdata.zi | LC_ALL=C sort >$@.out
659 set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \
660 | LC_ALL=C sort -t . -k 2,2` && \
663 $(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \
664 sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out
668 # If $(TZS) does not already exist (e.g., old-format tarballs), create it.
669 # If it exists but 'make check_tzs' fails, a maintainer should inspect the
670 # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
674 force_tzs: $(TZS_NEW)
679 $(AR) -rc $@ $(LIBOBJS)
683 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
685 tzselect: tzselect.ksh version
686 VERSION=`cat version` && sed \
687 -e 's|#!/bin/bash|#!$(KSHELL)|g' \
688 -e 's|AWK=[^}]*|AWK=$(AWK)|g' \
689 -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
690 -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
691 -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
692 -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
697 check: check_character_set check_white_space check_links \
698 check_name_lengths check_sorted \
699 check_tables check_web check_zishrink check_tzs
701 check_character_set: $(ENCHILADA)
702 test ! '$(UTF8_LOCALE)' || \
703 ! printf 'A\304\200B\n' | \
704 LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
705 LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
707 ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
708 $(MISC) $(SOURCES) $(WEB_PAGES) \
709 CONTRIBUTING LICENSE README \
710 version tzdata.zi && \
711 ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \
713 ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
714 leapseconds yearistype.sh zone.tab && \
715 ! grep -Env $(OK_LINE) $(ENCHILADA); \
718 check_white_space: $(ENCHILADA)
719 patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
720 ! grep -En "$$pat" $(ENCHILADA)
721 ! grep -n '[[:space:]]$$' \
722 $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
724 PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
725 FILE_NAME_COMPONENT_TOO_LONG = \
726 $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
728 check_name_lengths: $(TDATA_TO_CHECK) backzone
729 ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
730 $(TDATA_TO_CHECK) backzone
732 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
734 check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
735 $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
736 $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
737 $(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
738 $(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
739 $(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
741 $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
744 check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
745 $(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
746 $(AWK) -f checklinks.awk tzdata.zi
748 check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
749 for tab in $(ZONETABLES); do \
750 $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
754 check_tzs: $(TZS) $(TZS_NEW)
755 diff -u $(TZS) $(TZS_NEW)
757 # This checks only the HTML 4.01 strict page.
758 # To check the the other pages, use <https://validator.w3.org/>.
759 check_web: tz-how-to.html
760 $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
762 # Check that zishrink.awk does not alter the data, and that ziguard.awk
763 # preserves main-format data.
764 check_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \
765 $(DATAFORM).zi tzdata.zi
766 for type in posix right; do \
767 mkdir -p time_t.dir/$$type time_t.dir/$$type-t \
768 time_t.dir/$$type-shrunk && \
770 right) leap='-L leapseconds';; \
773 $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \
774 case $(DATAFORM) in \
776 $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \
777 $(AWK) '/^Rule/' $(TDATA) | \
778 $(ZIC) $$leap -d time_t.dir/$$type-t - \
780 diff -r time_t.dir/$$type time_t.dir/$$type-t;; \
782 $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
783 diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
788 rm -f core *.o *.out \
789 date tzselect version.h zdump zic yearistype libtz.a
791 rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW)
793 maintainer-clean: clean
794 @echo 'This command is intended for maintainers to use; it'
795 @echo 'deletes files that may need special tools to rebuild.'
796 rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
801 public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \
805 newctime.3.txt: newctime.3
806 newstrftime.3.txt: newstrftime.3
807 newtzset.3.txt: newtzset.3
808 time2posix.3.txt: time2posix.3
809 tzfile.5.txt: tzfile.5
810 tzselect.8.txt: tzselect.8
814 $(MANTXTS): workman.sh
815 LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
818 # Set the time stamps to those of the git repository, if available,
819 # and if the files have not changed since then.
820 # This uses GNU 'touch' syntax 'touch -d@N FILE',
821 # where N is the number of seconds since 1970.
822 # If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
823 # Also, set the timestamp of each prebuilt file like 'leapseconds'
824 # to be the maximum of the files it depends on.
825 set-timestamps.out: $(ENCHILADA)
827 if (type git) >/dev/null 2>&1 && \
828 files=`git ls-files $(ENCHILADA)` && \
829 touch -md @1 test.out; then \
831 for file in $$files; do \
832 if git diff --quiet $$file; then \
833 time=`git log -1 --format='tformat:%ct' $$file` && \
834 touch -cmd @$$time $$file; \
836 echo >&2 "$$file: warning: does not match repository"; \
840 touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
841 for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
842 touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
845 touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
846 touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
847 touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
850 # The zics below ensure that each data file can stand on its own.
851 # We also do an all-files run to catch links to links.
854 $(MAKE) maintainer-clean
855 $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
857 for i in $(TDATA_TO_CHECK) tzdata.zi; do \
858 $(zic) -v -d public.dir $$i 2>&1 || exit; \
860 $(zic) -v -d public.dir $(TDATA_TO_CHECK)
863 # Check that the code works under various alternative
864 # implementations of time_t.
865 check_time_t_alternatives:
866 if diff -q Makefile Makefile 2>/dev/null; then \
872 zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
873 for type in $(TIME_T_ALTERNATIVES); do \
874 mkdir -p time_t.dir/$$type && \
875 $(MAKE) clean_misc && \
876 $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
877 CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
880 diff $$quiet_option -r \
881 time_t.dir/int64_t/etc \
882 time_t.dir/$$type/etc && \
883 diff $$quiet_option -r \
884 time_t.dir/int64_t/usr/share \
885 time_t.dir/$$type/usr/share && \
887 int32_t) range=-2147483648,2147483647;; \
888 uint32_t) range=0,4294967296;; \
889 int64_t) continue;; \
890 *u*) range=0,10000000000;; \
891 *) range=-10000000000,10000000000;; \
893 echo checking $$type zones ... && \
894 time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \
895 >time_t.dir/int64_t.out && \
896 time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \
897 >time_t.dir/$$type.out && \
898 diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
903 tarballs traditional_tarballs signatures traditional_signatures: version
904 VERSION=`cat version` && \
905 $(MAKE) VERSION="$$VERSION" $@_version
907 # These *_version rules are intended for use if VERSION is set by some
908 # other means. Ordinarily these rules are used only by the above
909 # non-_version rules, which set VERSION on the 'make' command line.
910 tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
911 traditional_tarballs_version: \
912 tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
913 signatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
914 traditional_signatures_version: \
915 tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
917 tzcode$(VERSION).tar.gz: set-timestamps.out
918 LC_ALL=C && export LC_ALL && \
919 tar $(TARFLAGS) -cf - \
920 $(COMMON) $(DOCS) $(SOURCES) | \
921 gzip $(GZIPFLAGS) >$@.out
924 tzdata$(VERSION).tar.gz: set-timestamps.out
925 LC_ALL=C && export LC_ALL && \
926 tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
927 gzip $(GZIPFLAGS) >$@.out
930 tzdb-$(VERSION).tar.lz: set-timestamps.out
931 rm -fr tzdb-$(VERSION)
932 mkdir tzdb-$(VERSION)
933 ln $(ENCHILADA) tzdb-$(VERSION)
934 touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
935 LC_ALL=C && export LC_ALL && \
936 tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
939 tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
940 gpg --armor --detach-sign $?
942 tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
943 gpg --armor --detach-sign $?
945 tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
946 gpg --armor --detach-sign $?
950 for i in "long long" unsigned; \
952 $(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
953 ./zdump -v Europe/Rome ; \
958 @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
960 asctime.o: private.h tzfile.h
962 difftime.o: private.h
963 localtime.o: private.h tzfile.h
964 strftime.o: private.h tzfile.h
966 zic.o: private.h tzfile.h version.h
970 .PHONY: ALL INSTALL all
971 .PHONY: check check_character_set check_links check_name_lengths
972 .PHONY: check_public check_sorted check_tables
973 .PHONY: check_time_t_alternatives check_tzs check_web check_white_space
974 .PHONY: check_zishrink
975 .PHONY: clean clean_misc dummy.zd force_tzs
976 .PHONY: install install_data maintainer-clean names
977 .PHONY: posix_only posix_packrat posix_right
978 .PHONY: public right_only right_posix signatures signatures_version
979 .PHONY: tarballs tarballs_version
980 .PHONY: traditional_signatures traditional_signatures_version
981 .PHONY: traditional_tarballs traditional_tarballs_version
983 .PHONY: zonenames zones