Makefile revision 1.29 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 numbers of the code and data distributions.
8 VERSION= 2015e
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 always want time values interpreted as "seconds since the epoch
76 # (not counting leap seconds)", use
77 # REDO= posix_only
78 # below. If you always want right time values interpreted as "seconds since
79 # 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. If you want just POSIX-compatible time values, but with
88 # out-of-scope and often-wrong data from the file 'backzone', use
89 # REDO= posix_packrat
90 # POSIX mandates that leap seconds not be counted; for compatibility with it,
91 # use "posix_only", "posix_right", or "posix_packrat".
92
93 REDO= posix_right
94
95 # Since "." may not be in PATH...
96
97 YEARISTYPE= ./yearistype
98
99 # Non-default libraries needed to link.
100 # Add -lintl if you want to use 'gettext' on Solaris.
101 LDLIBS=
102
103 # Add the following to the end of the "CFLAGS=" line as needed.
104 # -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
105 # -DHAVE_ADJTIME=0 if 'adjtime' does not exist (SVR0?)
106 # -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
107 # -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
108 # -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
109 # ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
110 # -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
111 # -DHAVE_LINK=0 if your system lacks a link function
112 # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
113 # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
114 # This defaults to 1 if a working localtime_rz seems to be available.
115 # localtime_rz can make zdump significantly faster, but is nonstandard.
116 # -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?)
117 # -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4)
118 # -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
119 # -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
120 # -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
121 # -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
122 # This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
123 # -DHAVE_STRDUP=0 if your system lacks the strdup function
124 # -DHAVE_SYMLINK=0 if your system lacks the symlink function
125 # -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
126 # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
127 # -DHAVE_TZSET=0 if your system lacks a tzset function
128 # -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
129 # -DHAVE_UTMPX_H=1 if your compiler has a "utmpx.h"
130 # -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
131 # if you do not want run time warnings about formats that may cause
132 # year 2000 grief
133 # -Dssize_t=long on ancient hosts that lack ssize_t
134 # -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
135 # not needed by the main-program tz code, which is single-threaded.
136 # Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
137 # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
138 # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
139 # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
140 # the default is system-supplied, typically "/usr/lib/locale"
141 # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
142 # -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems
143 # other than simply getting garbage data
144 # -DUSE_LTZ=0 to build zdump with the system time zone library
145 # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
146 # -DNO_ERROR_IN_DST_GAP=1
147 # if you want mktime() not to return an error in the DST gap.
148 # -DZIC_MAX_ABBR_LEN_WO_WARN=3
149 # (or some other number) to set the maximum time zone abbreviation length
150 # that zic will accept without a warning (the default is 6)
151 # $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
152 GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
153 -Wall -Wextra \
154 -Wbad-function-cast -Wcast-align -Wdate-time \
155 -Wdeclaration-after-statement \
156 -Wdouble-promotion \
157 -Wformat=2 -Winit-self -Wjump-misses-init \
158 -Wlogical-op -Wmissing-prototypes -Wnested-externs \
159 -Wold-style-definition -Woverlength-strings -Wpointer-arith \
160 -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
161 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
162 -Wsuggest-attribute=pure -Wtrampolines \
163 -Wunused -Wwrite-strings \
164 -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
165 -Wno-type-limits -Wno-unused-parameter
166 #
167 # If you want to use System V compatibility code, add
168 # -DUSG_COMPAT
169 # to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight"
170 # variables to be kept up-to-date by the time conversion functions. Neither
171 # "timezone" nor "daylight" is described in X3J11's work.
172 #
173 # If your system has a "GMT offset" field in its "struct tm"s
174 # (or if you decide to add such a field in your system's "time.h" file),
175 # add the name to a define such as
176 # -DTM_GMTOFF=tm_gmtoff
177 # to the end of the "CFLAGS=" line. If not defined, the code attempts to
178 # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
179 # Similarly, if your system has a "zone abbreviation" field, define
180 # -DTM_ZONE=tm_zone
181 # and define NO_TM_ZONE to suppress any guessing. These two fields are not
182 # required by POSIX, but are widely available on GNU/Linux and BSD systems.
183 #
184 # If you want functions that were inspired by early versions of X3J11's work,
185 # add
186 # -DSTD_INSPIRED
187 # to the end of the "CFLAGS=" line. This arranges for the functions
188 # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
189 # "posix2time", and "time2posix" to be added to the time conversion library.
190 # "tzsetwall" is like "tzset" except that it arranges for local wall clock
191 # time (rather than the time specified in the TZ environment variable)
192 # to be used.
193 # "offtime" is like "gmtime" except that it accepts a second (long) argument
194 # that gives an offset to add to the time_t when converting it.
195 # "timelocal" is equivalent to "mktime".
196 # "timegm" is like "timelocal" except that it turns a struct tm into
197 # a time_t using UT (rather than local time as "timelocal" does).
198 # "timeoff" is like "timegm" except that it accepts a second (long) argument
199 # that gives an offset to use when converting to a time_t.
200 # "posix2time" and "time2posix" are described in an included manual page.
201 # X3J11's work does not describe any of these functions.
202 # Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
203 # These functions may well disappear in future releases of the time
204 # conversion package.
205 #
206 # If you don't want functions that were inspired by NetBSD, add
207 # -DNETBSD_INSPIRED=0
208 # to the end of the "CFLAGS=" line. Otherwise, the functions
209 # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
210 # time library, and if STD_INSPIRED is also defined the functions
211 # "posix2time_z" and "time2posix_z" are added as well.
212 # The functions ending in "_z" (or "_rz") are like their unsuffixed
213 # (or suffixed-by-"_r") counterparts, except with an extra first
214 # argument of opaque type timezone_t that specifies the time zone.
215 # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
216 #
217 # If you want to allocate state structures in localtime, add
218 # -DALL_STATE
219 # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
220 #
221 # If you want an "altzone" variable (a la System V Release 3.1), add
222 # -DALTZONE
223 # to the end of the "CFLAGS=" line.
224 # This variable is not described in X3J11's work.
225 #
226 # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
227 # out by the National Institute of Standards and Technology
228 # which claims to test C and Posix conformance. If you want to pass PCTS, add
229 # -DPCTS
230 # to the end of the "CFLAGS=" line.
231 #
232 # If you want strict compliance with XPG4 as of 1994-04-09, add
233 # -DXPG4_1994_04_09
234 # to the end of the "CFLAGS=" line. This causes "strftime" to always return
235 # 53 as a week number (rather than 52 or 53) for those days in January that
236 # before the first Monday in January when a "%V" format is used and January 1
237 # falls on a Friday, Saturday, or Sunday.
238
239 CFLAGS=
240
241 # Linker flags. Default to $(LFLAGS) for backwards compatibility
242 # to tzcode2012h and earlier.
243
244 LDFLAGS= $(LFLAGS)
245
246 zic= ./zic
247 ZIC= $(zic) $(ZFLAGS)
248
249 ZFLAGS=
250
251 # The name of a Posix-compliant 'awk' on your system.
252 AWK= awk
253
254 # The full path name of a Posix-compliant shell, preferably one that supports
255 # the Korn shell's 'select' statement as an extension.
256 # These days, Bash is the most popular.
257 # It should be OK to set this to /bin/sh, on platforms where /bin/sh
258 # lacks 'select' or doesn't completely conform to Posix, but /bin/bash
259 # is typically nicer if it works.
260 KSHELL= /bin/bash
261
262 # The path where SGML DTDs are kept and the catalog file(s) to use when
263 # validating. The default is appropriate for Ubuntu 13.10.
264 SGML_TOPDIR= /usr
265 SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
266 SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
267 SGML_CATALOG_FILES= \
268 $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
269
270 # The name, arguments and environment of a program to validate your web pages.
271 # See <http://www.jclark.com/sp/> for a validator, and
272 # <http://validator.w3.org/source/> for a validation library.
273 VALIDATE = nsgmls
274 VALIDATE_FLAGS = -s -B -wall -wno-unused-param
275 VALIDATE_ENV = \
276 SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
277 SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
278 SP_CHARSET_FIXED=YES \
279 SP_ENCODING=UTF-8
280
281 # This expensive test requires USE_LTZ.
282 # To suppress it, define this macro to be empty.
283 CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
284
285 # SAFE_CHAR is a regular expression that matches a safe character.
286 # Some parts of this distribution are limited to safe characters;
287 # others can use any UTF-8 character.
288 # For now, the safe characters are a safe subset of ASCII.
289 # The caller must set the shell variable 'sharp' to the character '#',
290 # since Makefile macros cannot contain '#'.
291 # TAB_CHAR is a single tab character, in single quotes.
292 TAB_CHAR= ' '
293 SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
294 SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
295 SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
296 SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
297 SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]'
298
299 # OK_CHAR matches any character allowed in the distributed files.
300 # This is the same as SAFE_CHAR, except that multibyte letters are
301 # also allowed so that commentary can contain people's names and quote
302 # non-English sources. For non-letters the sources are limited to
303 # ASCII renderings for the convenience of maintainers whose text editors
304 # mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
305 OK_CHAR= '[][:alpha:]'$(SAFE_CHARSET)'-]'
306
307 # SAFE_LINE matches a line of safe characters.
308 # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
309 # this is so that comments can contain non-ASCII characters.
310 # OK_LINE matches a line of OK characters.
311 SAFE_LINE= '^'$(SAFE_CHAR)'*$$'
312 SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
313 OK_LINE= '^'$(OK_CHAR)'*$$'
314
315 # Flags to give 'tar' when making a distribution.
316 # Try to use flags appropriate for GNU tar.
317 GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w
318 TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
319 then echo $(GNUTARFLAGS); \
320 else :; \
321 fi`
322
323 # Flags to give 'gzip' when making a distribution.
324 GZIPFLAGS= -9 ${GZIP_N_FLAG}
325
326 ###############################################################################
327
328 #MAKE= make
329
330 cc= cc
331 CC= $(cc) -DTZDIR=\"$(TZDIR)\"
332
333 AR= ar
334
335 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
336 RANLIB= :
337
338 TZCOBJS= zic.o
339 TZDOBJS= zdump.o localtime.o asctime.o
340 DATEOBJS= date.o localtime.o strftime.o asctime.o
341 LIBSRCS= localtime.c asctime.c difftime.c
342 LIBOBJS= localtime.o asctime.o difftime.o
343 HEADERS= tzfile.h private.h
344 NONLIBSRCS= zic.c zdump.c
345 NEWUCBSRCS= date.c strftime.c
346 SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
347 tzselect.ksh workman.sh
348 MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
349 tzfile.5 tzselect.8 zic.8 zdump.8
350 MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
351 time2posix.3.txt \
352 tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
353 date.1.txt
354 COMMON= CONTRIBUTING Makefile NEWS README Theory
355 WEB_PAGES= tz-art.htm tz-link.htm
356 DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
357 PRIMARY_YDATA= africa antarctica asia australasia \
358 europe northamerica southamerica
359 YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward
360 NDATA= systemv factory
361 TDATA= $(YDATA) $(NDATA)
362 ZONETABLES= zone1970.tab zone.tab
363 TABDATA= iso3166.tab leapseconds $(ZONETABLES)
364 LEAP_DEPS= leapseconds.awk leap-seconds.list
365 DATA= $(YDATA) $(NDATA) backzone $(TABDATA) \
366 leap-seconds.list yearistype.sh
367 AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk
368 MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl
369 ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
370
371 # And for the benefit of csh users on systems that assume the user
372 # shell should be used to handle commands in Makefiles. . .
373
374 SHELL= /bin/sh
375
376 all: tzselect zic zdump libtz.a $(TABDATA)
377
378 ALL: all date $(ENCHILADA)
379
380 install: all $(DATA) $(REDO) $(MANS)
381 mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
382 $(DESTDIR)$(LIBDIR) \
383 $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
384 $(DESTDIR)$(MANDIR)/man8
385 $(ZIC) -y $(YEARISTYPE) \
386 -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
387 cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
388 cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
389 cp libtz.a $(DESTDIR)$(LIBDIR)/.
390 $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
391 cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
392 cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
393 cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
394
395 INSTALL: ALL install date.1
396 mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
397 cp date $(DESTDIR)$(BINDIR)/.
398 cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
399
400 version.h:
401 (echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
402 echo 'static char const TZVERSION[]="$(VERSION)";' && \
403 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
404
405 zdump: $(TZDOBJS)
406 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
407
408 zic: $(TZCOBJS) yearistype
409 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
410
411 yearistype: yearistype.sh
412 cp yearistype.sh yearistype
413 chmod +x yearistype
414
415 leapseconds: $(LEAP_DEPS)
416 $(AWK) -f leapseconds.awk leap-seconds.list >$@
417
418 posix_only: zic $(TDATA)
419 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
420 -L /dev/null $(TDATA)
421
422 right_only: zic leapseconds $(TDATA)
423 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
424 -L leapseconds $(TDATA)
425
426 # In earlier versions of this makefile, the other two directories were
427 # subdirectories of $(TZDIR). However, this led to configuration errors.
428 # For example, with posix_right under the earlier scheme,
429 # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
430 # but gmtime without leap seconds, which led to problems with applications
431 # like sendmail that subtract gmtime from localtime.
432 # Therefore, the other two directories are now siblings of $(TZDIR).
433 # You must replace all of $(TZDIR) to switch from not using leap seconds
434 # to using them, or vice versa.
435 right_posix: right_only leapseconds
436 rm -fr $(DESTDIR)$(TZDIR)-leaps
437 ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
438 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
439 -L leapseconds $(TDATA)
440 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
441 -L /dev/null $(TDATA)
442
443 posix_right: posix_only leapseconds
444 rm -fr $(DESTDIR)$(TZDIR)-posix
445 ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
446 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
447 -L /dev/null $(TDATA)
448 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
449 -L leapseconds $(TDATA)
450
451 posix_packrat: posix_only backzone
452 $(AWK) '/^Rule/' $(TDATA) | \
453 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
454 -L /dev/null - backzone
455
456 zones: $(REDO)
457
458 libtz.a: $(LIBOBJS)
459 $(AR) ru $@ $(LIBOBJS)
460 $(RANLIB) $@
461
462 date: $(DATEOBJS)
463 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
464
465 tzselect: tzselect.ksh
466 sed \
467 -e 's|#!/bin/bash|#!$(KSHELL)|g' \
468 -e 's|AWK=[^}]*|AWK=$(AWK)|g' \
469 -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
470 -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
471 -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
472 -e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \
473 <$? >$@
474 chmod +x $@
475
476 check: check_character_set check_white_space check_links check_sorted \
477 check_tables check_web
478
479 check_character_set: $(ENCHILADA)
480 LC_ALL=en_US.utf8 && export LC_ALL && \
481 sharp='#' && \
482 ! grep -Env $(SAFE_LINE) Makefile $(MANS) date.1 $(MANTXTS) \
483 $(MISC) $(SOURCES) $(WEB_PAGES) && \
484 ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
485 leapseconds yearistype.sh zone.tab && \
486 ! grep -Env $(OK_LINE) $(ENCHILADA)
487
488 check_white_space: $(ENCHILADA)
489 ! grep -En ' '$(TAB_CHAR)"|$$(printf '[\f\r\v]')" $(ENCHILADA)
490 ! grep -n '[[:space:]]$$' $(ENCHILADA)
491
492 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
493
494 check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
495 $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
496 $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
497 $(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
498 $(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
499 $(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
500 LC_ALL=C sort -c
501 $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
502 LC_ALL=C sort -cu
503
504 check_links: checklinks.awk $(TDATA)
505 $(AWK) -f checklinks.awk $(TDATA)
506
507 check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
508 for tab in $(ZONETABLES); do \
509 $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
510 || exit; \
511 done
512
513 check_web: $(WEB_PAGES)
514 $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
515
516 clean_misc:
517 rm -f core *.o *.out \
518 date tzselect version.h zdump zic yearistype libtz.a
519 clean: clean_misc
520 rm -fr tzpublic
521
522 maintainer-clean: clean
523 @echo 'This command is intended for maintainers to use; it'
524 @echo 'deletes files that may need special tools to rebuild.'
525 rm -f leapseconds $(MANTXTS) *.asc *.tar.gz
526
527 names:
528 @echo $(ENCHILADA)
529
530 public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \
531 tarballs signatures
532
533 date.1.txt: date.1
534 newctime.3.txt: newctime.3
535 newstrftime.3.txt: newstrftime.3
536 newtzset.3.txt: newtzset.3
537 time2posix.3.txt: time2posix.3
538 tzfile.5.txt: tzfile.5
539 tzselect.8.txt: tzselect.8
540 zdump.8.txt: zdump.8
541 zic.8.txt: zic.8
542
543 $(MANTXTS): workman.sh
544 LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@
545
546 # Set the time stamps to those of the git repository, if available,
547 # and if the files have not changed since then.
548 # This uses GNU 'touch' syntax 'touch -d@N FILE',
549 # where N is the number of seconds since 1970.
550 # If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
551 # Also, set the timestamp of each prebuilt file like 'leapseconds'
552 # to be the maximum of the files it depends on.
553 set-timestamps.out: $(ENCHILADA)
554 rm -f $@
555 if files=`git ls-files $(ENCHILADA)` && \
556 touch -md @1 test.out; then \
557 rm -f test.out && \
558 for file in $$files; do \
559 if git diff --quiet $$file; then \
560 time=`git log -1 --format='tformat:%ct' $$file` && \
561 touch -cmd @$$time $$file; \
562 else \
563 echo >&2 "$$file: warning: does not match repository"; \
564 fi || exit; \
565 done; \
566 fi
567 touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
568 for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
569 touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
570 exit; \
571 done
572 touch $@
573
574 # The zics below ensure that each data file can stand on its own.
575 # We also do an all-files run to catch links to links.
576
577 check_public:
578 $(MAKE) maintainer-clean
579 $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
580 mkdir tzpublic
581 for i in $(TDATA) ; do \
582 $(zic) -v -d tzpublic $$i 2>&1 || exit; \
583 done
584 $(zic) -v -d tzpublic $(TDATA)
585 rm -fr tzpublic
586
587 # Check that the code works under various alternative
588 # implementations of time_t.
589 check_time_t_alternatives:
590 if diff -q Makefile Makefile 2>/dev/null; then \
591 quiet_option='-q'; \
592 else \
593 quiet_option=''; \
594 fi && \
595 zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
596 for type in $(TIME_T_ALTERNATIVES); do \
597 mkdir -p tzpublic/$$type && \
598 $(MAKE) clean_misc && \
599 $(MAKE) TOPDIR=`pwd`/tzpublic/$$type \
600 CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
601 REDO='$(REDO)' \
602 install && \
603 diff $$quiet_option -r \
604 tzpublic/int64_t/etc/zoneinfo \
605 tzpublic/$$type/etc/zoneinfo && \
606 case $$type in \
607 int32_t) range=-2147483648,2147483647;; \
608 uint32_t) range=0,4294967296;; \
609 int64_t) continue;; \
610 *u*) range=0,10000000000;; \
611 *) range=-10000000000,10000000000;; \
612 esac && \
613 echo checking $$type zones ... && \
614 tzpublic/int64_t/etc/zdump -V -t $$range $$zones \
615 >tzpublic/int64_t.out && \
616 tzpublic/$$type/etc/zdump -V -t $$range $$zones \
617 >tzpublic/$$type.out && \
618 diff -u tzpublic/int64_t.out tzpublic/$$type.out \
619 || exit; \
620 done
621 rm -fr tzpublic
622
623 tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
624
625 tzcode$(VERSION).tar.gz: set-timestamps.out
626 LC_ALL=C && export LC_ALL && \
627 tar $(TARFLAGS) -cf - \
628 $(COMMON) $(DOCS) $(SOURCES) | \
629 ${TOOL_GZIP} $(GZIPFLAGS) > $@
630
631 tzdata$(VERSION).tar.gz: set-timestamps.out
632 LC_ALL=C && export LC_ALL && \
633 tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
634 ${TOOL_GZIP} $(GZIPFLAGS) > $@
635
636 signatures: tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc
637
638 tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
639 gpg --armor --detach-sign $?
640
641 tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
642 gpg --armor --detach-sign $?
643
644 typecheck:
645 $(MAKE) clean
646 for i in "long long" unsigned; \
647 do \
648 $(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
649 ./zdump -v Europe/Rome ; \
650 $(MAKE) clean ; \
651 done
652
653 zonenames: $(TDATA)
654 @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
655
656 asctime.o: private.h tzfile.h
657 date.o: private.h
658 difftime.o: private.h
659 localtime.o: private.h tzfile.h
660 strftime.o: private.h tzfile.h
661 zdump.o: version.h
662 zic.o: private.h tzfile.h version.h
663
664 .KEEP_STATE:
665
666 .PHONY: ALL INSTALL all
667 .PHONY: check check_character_set check_links
668 .PHONY: check_public check_sorted check_tables
669 .PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc
670 .PHONY: install maintainer-clean names posix_packrat posix_only posix_right
671 .PHONY: public right_only right_posix signatures tarballs typecheck
672 .PHONY: zonenames zones
673