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