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