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