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