Makefile 24 KB

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