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