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