Makefile revision 1.26 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= 2015a
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 # -Dssize_t=long on ancient hosts that lack ssize_t
133 # -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
134 # not needed by the main-program tz code, which is single-threaded.
135 # Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
136 # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
137 # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
138 # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
139 # the default is system-supplied, typically "/usr/lib/locale"
140 # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
141 # -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems
142 # other than simply getting garbage data
143 # -DUSE_LTZ=0 to build zdump with the system time zone library
144 # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
145 # -DNO_ERROR_IN_DST_GAP=1
146 # if you want mktime() not to return an error in the DST gap.
147 # -DZIC_MAX_ABBR_LEN_WO_WARN=3
148 # (or some other number) to set the maximum time zone abbreviation length
149 # that zic will accept without a warning (the default is 6)
150 # $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
151 GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
152 -Wall -Wextra \
153 -Wbad-function-cast -Wcast-align -Wcast-qual \
154 -Wdeclaration-after-statement \
155 -Wformat=2 -Winit-self -Wjump-misses-init \
156 -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
157 -Wnested-externs -Wno-address -Wno-cast-qual \
158 -Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
159 -Wno-type-limits \
160 -Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
161 -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
162 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
163 -Wsuggest-attribute=pure -Wtrampolines \
164 -Wwrite-strings
165 #
166 # If you want to use System V compatibility code, add
167 # -DUSG_COMPAT
168 # to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight"
169 # variables to be kept up-to-date by the time conversion functions. Neither
170 # "timezone" nor "daylight" is described in X3J11's work.
171 #
172 # If your system has a "GMT offset" field in its "struct tm"s
173 # (or if you decide to add such a field in your system's "time.h" file),
174 # add the name to a define such as
175 # -DTM_GMTOFF=tm_gmtoff
176 # to the end of the "CFLAGS=" line. If not defined, the code attempts to
177 # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
178 # Similarly, if your system has a "zone abbreviation" field, define
179 # -DTM_ZONE=tm_zone
180 # and define NO_TM_ZONE to suppress any guessing. These two fields are not
181 # required by POSIX, but are widely available on GNU/Linux and BSD systems.
182 #
183 # If you want functions that were inspired by early versions of X3J11's work,
184 # add
185 # -DSTD_INSPIRED
186 # to the end of the "CFLAGS=" line. This arranges for the functions
187 # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
188 # "posix2time", and "time2posix" to be added to the time conversion library.
189 # "tzsetwall" is like "tzset" except that it arranges for local wall clock
190 # time (rather than the time specified in the TZ environment variable)
191 # to be used.
192 # "offtime" is like "gmtime" except that it accepts a second (long) argument
193 # that gives an offset to add to the time_t when converting it.
194 # "timelocal" is equivalent to "mktime".
195 # "timegm" is like "timelocal" except that it turns a struct tm into
196 # a time_t using UT (rather than local time as "timelocal" does).
197 # "timeoff" is like "timegm" except that it accepts a second (long) argument
198 # that gives an offset to use when converting to a time_t.
199 # "posix2time" and "time2posix" are described in an included manual page.
200 # X3J11's work does not describe any of these functions.
201 # Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
202 # These functions may well disappear in future releases of the time
203 # conversion package.
204 #
205 # If you don't want functions that were inspired by NetBSD, add
206 # -DNETBSD_INSPIRED=0
207 # to the end of the "CFLAGS=" line. Otherwise, the functions
208 # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
209 # time library, and if STD_INSPIRED is also defined the functions
210 # "posix2time_z" and "time2posix_z" are added as well.
211 # The functions ending in "_z" (or "_rz") are like their unsuffixed
212 # (or suffixed-by-"_r") counterparts, except with an extra first
213 # argument of opaque type timezone_t that specifies the time zone.
214 # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
215 #
216 # If you want to allocate state structures in localtime, add
217 # -DALL_STATE
218 # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
219 #
220 # If you want an "altzone" variable (a la System V Release 3.1), add
221 # -DALTZONE
222 # to the end of the "CFLAGS=" line.
223 # This variable is not described in X3J11's work.
224 #
225 # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
226 # out by the National Institute of Standards and Technology
227 # which claims to test C and Posix conformance. If you want to pass PCTS, add
228 # -DPCTS
229 # to the end of the "CFLAGS=" line.
230 #
231 # If you want strict compliance with XPG4 as of 1994-04-09, add
232 # -DXPG4_1994_04_09
233 # to the end of the "CFLAGS=" line. This causes "strftime" to always return
234 # 53 as a week number (rather than 52 or 53) for those days in January that
235 # before the first Monday in January when a "%V" format is used and January 1
236 # falls on a Friday, Saturday, or Sunday.
237
238 CFLAGS=
239
240 # Linker flags. Default to $(LFLAGS) for backwards compatibility
241 # to tzcode2012h and earlier.
242
243 LDFLAGS= $(LFLAGS)
244
245 zic= ./zic
246 ZIC= $(zic) $(ZFLAGS)
247
248 ZFLAGS=
249
250 # The name of a Posix-compliant 'awk' on your system.
251 AWK= awk
252
253 # The full path name of a Posix-compliant shell, preferably one that supports
254 # the Korn shell's 'select' statement as an extension.
255 # These days, Bash is the most popular.
256 # It should be OK to set this to /bin/sh, on platforms where /bin/sh
257 # lacks 'select' or doesn't completely conform to Posix, but /bin/bash
258 # is typically nicer if it works.
259 KSHELL= /bin/bash
260
261 # The path where SGML DTDs are kept and the catalog file(s) to use when
262 # validating. The default is appropriate for Ubuntu 13.10.
263 SGML_TOPDIR= /usr
264 SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
265 SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
266 SGML_CATALOG_FILES= \
267 $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
268
269 # The name, arguments and environment of a program to validate your web pages.
270 # See <http://www.jclark.com/sp/> for a validator, and
271 # <http://validator.w3.org/source/> for a validation library.
272 VALIDATE = nsgmls
273 VALIDATE_FLAGS = -s -B -wall -wno-unused-param
274 VALIDATE_ENV = \
275 SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
276 SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
277 SP_CHARSET_FIXED=YES \
278 SP_ENCODING=UTF-8
279
280 # This expensive test requires USE_LTZ.
281 # To suppress it, define this macro to be empty.
282 CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
283
284 # SAFE_CHAR is a regular expression that matches a safe character.
285 # Some parts of this distribution are limited to safe characters;
286 # others can use any UTF-8 character.
287 # For now, the safe characters are a safe subset of ASCII.
288 # The caller must set the shell variable 'sharp' to the character '#',
289 # since Makefile macros cannot contain '#'.
290 # TAB_CHAR is a single tab character, in single quotes.
291 TAB_CHAR= ' '
292 SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
293 SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
294 SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
295 SAFE_CHARSET= ]$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)-
296 SAFE_CHAR= '['$(SAFE_CHARSET)']'
297 # NONSYM_CHAR is a regular expression that matches any character
298 # except for a small number of symbols, where we prefer to stick with
299 # ASCII renderings for the convenience of maintainers whose text editors
300 # mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
301 NONSYM_CHAR= '[^]'
302
303 # SAFE_LINE matches a line of safe characters.
304 # SAFE_SHARP_LINE is similar, except any character can follow '#';
305 # this is so that comments can contain non-ASCII characters.
306 # NONSYM_LINE matches a line of non-symbols.
307 # VALID_LINE matches a line of any validly-encoded characters.
308 SAFE_LINE= '^'$(SAFE_CHAR)'*$$'
309 SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(NONSYM_CHAR)'*)?$$'
310 NONSYM_LINE= '^'$(NONSYM_CHAR)'*$$'
311 VALID_LINE= '^.*$$'
312
313 # Flags to give 'tar' when making a distribution.
314 # Try to use flags appropriate for GNU tar.
315 GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w
316 TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
317 then echo $(GNUTARFLAGS); \
318 else :; \
319 fi`
320
321 # Flags to give 'gzip' when making a distribution.
322 GZIPFLAGS= -9 ${GZIP_N_FLAG}
323
324 ###############################################################################
325
326 cc= cc
327 CC= $(cc) -DTZDIR=\"$(TZDIR)\"
328
329 AR= ar
330
331 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
332 RANLIB= :
333
334 TZCOBJS= zic.o scheck.o ialloc.o
335 TZDOBJS= zdump.o localtime.o asctime.o
336 DATEOBJS= date.o localtime.o strftime.o asctime.o
337 LIBSRCS= localtime.c asctime.c difftime.c
338 LIBOBJS= localtime.o asctime.o difftime.o
339 HEADERS= tzfile.h private.h
340 NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c
341 NEWUCBSRCS= date.c strftime.c
342 SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
343 tzselect.ksh workman.sh
344 MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
345 tzfile.5 tzselect.8 zic.8 zdump.8
346 MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
347 time2posix.3.txt \
348 tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
349 date.1.txt
350 COMMON= CONTRIBUTING Makefile NEWS README Theory
351 WEB_PAGES= tz-art.htm tz-link.htm
352 DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
353 PRIMARY_YDATA= africa antarctica asia australasia \
354 europe northamerica southamerica
355 YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward
356 NDATA= systemv factory
357 TDATA= $(YDATA) $(NDATA)
358 ZONETABLES= zone1970.tab zone.tab
359 TABDATA= iso3166.tab leapseconds $(ZONETABLES)
360 LEAP_DEPS= leapseconds.awk leap-seconds.list
361 DATA= $(YDATA) $(NDATA) backzone $(TABDATA) \
362 leap-seconds.list yearistype.sh
363 AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk
364 MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl
365 ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
366
367 # And for the benefit of csh users on systems that assume the user
368 # shell should be used to handle commands in Makefiles. . .
369
370 SHELL= /bin/sh
371
372 all: tzselect zic zdump libtz.a $(TABDATA)
373
374 ALL: all date
375
376 install: all $(DATA) $(REDO) $(MANS)
377 mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
378 $(DESTDIR)$(LIBDIR) \
379 $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
380 $(DESTDIR)$(MANDIR)/man8
381 $(ZIC) -y $(YEARISTYPE) \
382 -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
383 cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
384 cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
385 cp libtz.a $(DESTDIR)$(LIBDIR)/.
386 $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
387 cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
388 cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
389 cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
390
391 INSTALL: ALL install date.1
392 mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
393 cp date $(DESTDIR)$(BINDIR)/.
394 cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
395
396 version.h:
397 (echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
398 echo 'static char const TZVERSION[]="$(VERSION)";' && \
399 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
400
401 zdump: $(TZDOBJS)
402 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
403
404 zic: $(TZCOBJS) yearistype
405 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
406
407 yearistype: yearistype.sh
408 cp yearistype.sh yearistype
409 chmod +x yearistype
410
411 leapseconds: $(LEAP_DEPS)
412 $(AWK) -f leapseconds.awk leap-seconds.list >$@
413
414 posix_only: zic $(TDATA)
415 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
416 -L /dev/null $(TDATA)
417
418 right_only: zic leapseconds $(TDATA)
419 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
420 -L leapseconds $(TDATA)
421
422 # In earlier versions of this makefile, the other two directories were
423 # subdirectories of $(TZDIR). However, this led to configuration errors.
424 # For example, with posix_right under the earlier scheme,
425 # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
426 # but gmtime without leap seconds, which led to problems with applications
427 # like sendmail that subtract gmtime from localtime.
428 # Therefore, the other two directories are now siblings of $(TZDIR).
429 # You must replace all of $(TZDIR) to switch from not using leap seconds
430 # to using them, or vice versa.
431 right_posix: right_only leapseconds
432 rm -fr $(DESTDIR)$(TZDIR)-leaps
433 ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
434 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
435 -L leapseconds $(TDATA)
436 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
437 -L /dev/null $(TDATA)
438
439 posix_right: posix_only leapseconds
440 rm -fr $(DESTDIR)$(TZDIR)-posix
441 ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
442 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
443 -L /dev/null $(TDATA)
444 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
445 -L leapseconds $(TDATA)
446
447 posix_packrat: posix_only backzone
448 $(AWK) '/^Rule/' $(TDATA) | \
449 $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
450 -L /dev/null - backzone
451
452 zones: $(REDO)
453
454 libtz.a: $(LIBOBJS)
455 $(AR) ru $@ $(LIBOBJS)
456 $(RANLIB) $@
457
458 date: $(DATEOBJS)
459 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
460
461 tzselect: tzselect.ksh
462 sed \
463 -e 's|#!/bin/bash|#!$(KSHELL)|g' \
464 -e 's|AWK=[^}]*|AWK=$(AWK)|g' \
465 -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
466 -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
467 -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
468 -e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \
469 <$? >$@
470 chmod +x $@
471
472 check: check_character_set check_white_space check_links check_sorted \
473 check_tables check_web
474
475 check_character_set: $(ENCHILADA)
476 LC_ALL=en_US.utf8 && export LC_ALL && \
477 sharp='#' && \
478 ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
479 $(MISC) $(SOURCES) $(WEB_PAGES) && \
480 ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
481 iso3166.tab leapseconds yearistype.sh zone.tab && \
482 test $$(grep -Ecv $(SAFE_SHARP_LINE) Makefile) -eq 1 && \
483 ! grep -Env $(NONSYM_LINE) CONTRIBUTING NEWS README Theory \
484 $(MANS) date.1 zone1970.tab && \
485 ! grep -Env $(VALID_LINE) $(ENCHILADA)
486
487 check_white_space: $(ENCHILADA)
488 ! grep -En ' '$(TAB_CHAR)"|$$(printf '[\f\r\v]')" $(ENCHILADA)
489 ! grep -n '[[:space:]]$$' \
490 $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
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: $(ENCHILADA)
578 make maintainer-clean
579 make "CFLAGS=$(GCC_DEBUG_FLAGS)" $(ENCHILADA) 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 ialloc.o: private.h
660 localtime.o: private.h tzfile.h
661 scheck.o: private.h
662 strftime.o: private.h tzfile.h
663 zdump.o: version.h
664 zic.o: private.h tzfile.h version.h
665
666 .KEEP_STATE:
667
668 .PHONY: ALL INSTALL all
669 .PHONY: check check_character_set check_links
670 .PHONY: check_public check_sorted check_tables
671 .PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc
672 .PHONY: install maintainer-clean names posix_packrat posix_only posix_right
673 .PHONY: public right_only right_posix signatures tarballs typecheck
674 .PHONY: zonenames zones
675