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