Makefile 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  1. # Make and install tzdb code and data.
  2. # Request POSIX conformance; this must be the first non-comment line.
  3. .POSIX:
  4. # This file is in the public domain, so clarified as of
  5. # 2009-05-17 by Arthur David Olson.
  6. # Package name for the code distribution.
  7. PACKAGE= tzcode
  8. # Version number for the distribution, overridden in the 'tarballs' rule below.
  9. VERSION= unknown
  10. # Email address for bug reports.
  11. BUGEMAIL= tz@iana.org
  12. # DATAFORM selects the data format.
  13. # Available formats represent essentially the same data, albeit
  14. # possibly with minor discrepancies that users are not likely to notice.
  15. # To get new features and the best data right away, use:
  16. # DATAFORM= vanguard
  17. # To wait a while before using new features, to give downstream users
  18. # time to upgrade zic (the default), use:
  19. # DATAFORM= main
  20. # To wait even longer for new features, use:
  21. # DATAFORM= rearguard
  22. # Rearguard users might also want "ZFLAGS = -b fat"; see below.
  23. DATAFORM= main
  24. # Change the line below for your timezone (after finding the one you want in
  25. # one of the $(TDATA) source files, or adding it to a source file).
  26. # Alternatively, if you discover you've got the wrong timezone, you can just
  27. # 'zic -l -' to remove it, or 'zic -l rightzone' to change it.
  28. # Use the command
  29. # make zonenames
  30. # to get a list of the values you can use for LOCALTIME.
  31. LOCALTIME= Factory
  32. # The POSIXRULES macro controls interpretation of POSIX-like TZ
  33. # settings like TZ='EET-2EEST' that lack DST transition rules.
  34. # If POSIXRULES is '-', no template is installed; this is the default.
  35. # Any other value for POSIXRULES is obsolete and should not be relied on, as:
  36. # * It does not work correctly in popular implementations such as GNU/Linux.
  37. # * It does not work even in tzcode, except for historical timestamps
  38. # that precede the last explicit transition in the POSIXRULES file.
  39. # Hence it typically does not work for current and future timestamps.
  40. # If, despite the above, you want a template for handling these settings,
  41. # you can change the line below (after finding the timezone you want in the
  42. # one of the $(TDATA) source files, or adding it to a source file).
  43. # Alternatively, if you discover you've got the wrong timezone, you can just
  44. # 'zic -p -' to remove it, or 'zic -p rightzone' to change it.
  45. # Use the command
  46. # make zonenames
  47. # to get a list of the values you can use for POSIXRULES.
  48. POSIXRULES= -
  49. # Also see TZDEFRULESTRING below, which takes effect only
  50. # if POSIXRULES is '-' or if the template file cannot be accessed.
  51. # Installation locations.
  52. #
  53. # The defaults are suitable for Debian, except that if REDO is
  54. # posix_right or right_posix then files that Debian puts under
  55. # /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
  56. # put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
  57. # respectively. Problems with the Debian approach are discussed in
  58. # the commentary for the right_posix rule (below).
  59. # Destination directory, which can be used for staging.
  60. # 'make DESTDIR=/stage install' installs under /stage (e.g., to
  61. # /stage/etc/localtime instead of to /etc/localtime). Files under
  62. # /stage are not intended to work as-is, but can be copied by hand to
  63. # the root directory later. If DESTDIR is empty, 'make install' does
  64. # not stage, but installs directly into production locations.
  65. DESTDIR =
  66. # Everything is installed into subdirectories of TOPDIR, and used there.
  67. # TOPDIR should be empty (meaning the root directory),
  68. # or a directory name that does not end in "/".
  69. # TOPDIR should be empty or an absolute name unless you're just testing.
  70. TOPDIR =
  71. # The default local timezone is taken from the file TZDEFAULT.
  72. TZDEFAULT = $(TOPDIR)/etc/localtime
  73. # The subdirectory containing installed program and data files, and
  74. # likewise for installed files that can be shared among architectures.
  75. # These should be relative file names.
  76. USRDIR = usr
  77. USRSHAREDIR = $(USRDIR)/share
  78. # "Compiled" timezone information is placed in the "TZDIR" directory
  79. # (and subdirectories).
  80. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
  81. TZDIR_BASENAME= zoneinfo
  82. TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
  83. # The "tzselect" and (if you do "make INSTALL") "date" commands go in:
  84. BINDIR = $(TOPDIR)/$(USRDIR)/bin
  85. # The "zdump" command goes in:
  86. ZDUMPDIR = $(BINDIR)
  87. # The "zic" command goes in:
  88. ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
  89. # Manual pages go in subdirectories of. . .
  90. MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
  91. # Library functions are put in an archive in LIBDIR.
  92. LIBDIR = $(TOPDIR)/$(USRDIR)/lib
  93. # Types to try, as an alternative to time_t.
  94. TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
  95. TIME_T_ALTERNATIVES_HEAD = int_least64_t
  96. TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
  97. # What kind of TZif data files to generate. (TZif is the binary time
  98. # zone data format that zic generates; see Internet RFC 8536.)
  99. # If you want only POSIX time, with time values interpreted as
  100. # seconds since the epoch (not counting leap seconds), use
  101. # REDO= posix_only
  102. # below. If you want only "right" time, with values interpreted
  103. # as seconds since the epoch (counting leap seconds), use
  104. # REDO= right_only
  105. # below. If you want both sets of data available, with leap seconds not
  106. # counted normally, use
  107. # REDO= posix_right
  108. # below. If you want both sets of data available, with leap seconds counted
  109. # normally, use
  110. # REDO= right_posix
  111. # below. POSIX mandates that leap seconds not be counted; for compatibility
  112. # with it, use "posix_only" or "posix_right". Use POSIX time on systems with
  113. # leap smearing; this can work better than unsmeared "right" time with
  114. # applications that are not leap second aware, and is closer to unsmeared
  115. # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
  116. REDO= posix_right
  117. # Whether to put an "Expires" line in the leapseconds file.
  118. # Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
  119. # The EXPIRES_LINE value matters only if REDO's value contains "right".
  120. # If you change EXPIRES_LINE, remove the leapseconds file before running "make".
  121. # zic's support for the Expires line was introduced in tzdb 2020a,
  122. # and was modified in tzdb 2021b to generate version 4 TZif files.
  123. # EXPIRES_LINE defaults to 0 for now so that the leapseconds file
  124. # can be given to pre-2020a zic implementations and so that TZif files
  125. # built by newer zic implementations can be read by pre-2021b libraries.
  126. EXPIRES_LINE= 0
  127. # To install data in text form that has all the information of the TZif data,
  128. # (optionally incorporating leap second information), use
  129. # TZDATA_TEXT= tzdata.zi leapseconds
  130. # To install text data without leap second information (e.g., because
  131. # REDO='posix_only'), use
  132. # TZDATA_TEXT= tzdata.zi
  133. # To avoid installing text data, use
  134. # TZDATA_TEXT=
  135. TZDATA_TEXT= leapseconds tzdata.zi
  136. # For backward-compatibility links for old zone names, use
  137. # BACKWARD= backward
  138. # To omit these links, use
  139. # BACKWARD=
  140. BACKWARD= backward
  141. # If you want out-of-scope and often-wrong data from the file 'backzone',
  142. # but only for entries listed in the backward-compatibility file zone.tab, use
  143. # PACKRATDATA= backzone
  144. # PACKRATLIST= zone.tab
  145. # If you want all the 'backzone' data, use
  146. # PACKRATDATA= backzone
  147. # PACKRATLIST=
  148. # To omit this data, use
  149. # PACKRATDATA=
  150. # PACKRATLIST=
  151. PACKRATDATA=
  152. PACKRATLIST=
  153. # The name of a locale using the UTF-8 encoding, used during self-tests.
  154. # The tests are skipped if the name does not appear to work on this system.
  155. UTF8_LOCALE= en_US.utf8
  156. # Non-default libraries needed to link.
  157. # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
  158. LDLIBS=
  159. # Add the following to the end of the "CFLAGS=" line as needed to override
  160. # defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1".
  161. # -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
  162. # formats that generate only the last two digits of year numbers
  163. # -DEPOCH_LOCAL if the 'time' function returns local time not UT
  164. # -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
  165. # than what POSIX specifies, assuming local time is UT.
  166. # For example, N is 252460800 on AmigaOS.
  167. # -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
  168. # -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
  169. # -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
  170. # -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
  171. # -DHAVE__GENERIC=0 if _Generic does not work*
  172. # -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
  173. # -DHAVE_GETRANDOM=0 to avoid using getrandom
  174. # -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
  175. # where LDLIBS also needs to contain -lintl on some hosts;
  176. # -DHAVE_GETTEXT=0 to avoid using gettext
  177. # -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
  178. # ctime_r and asctime_r incompatibly with the POSIX standard
  179. # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
  180. # -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
  181. # -DHAVE_LINK=0 if your system lacks a link function
  182. # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
  183. # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
  184. # localtime_rz can make zdump significantly faster, but is nonstandard.
  185. # -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
  186. # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
  187. # functions like 'link' or variables like 'tzname' required by POSIX
  188. # -DHAVE_SETENV=0 if your system lacks the setenv function
  189. # -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+
  190. # -DHAVE_STDCKDINT_H=0 if neither <stdckdint.h> nor substitutes like
  191. # __builtin_add_overflow work*
  192. # -DHAVE_STDINT_H=0 if <stdint.h> does not work*+
  193. # -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
  194. # -DHAVE_STRDUP=0 if your system lacks the strdup function
  195. # -DHAVE_STRTOLL=0 if your system lacks the strtoll function+
  196. # -DHAVE_SYMLINK=0 if your system lacks the symlink function
  197. # -DHAVE_SYS_STAT_H=0 if <sys/stat.h> does not work*
  198. # -DHAVE_TZSET=0 if your system lacks a tzset function
  199. # -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
  200. # -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
  201. # -Dlocale_t=XXX if your system uses XXX instead of locale_t
  202. # -DPORT_TO_C89 if tzcode should also run on C89 platforms+
  203. # Typically it is better to use a later standard. For example,
  204. # with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
  205. # -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
  206. # with external linkage, e.g., applications cannot define 'localtime'.
  207. # -Dssize_t=long on hosts like MS-Windows that lack ssize_t
  208. # -DSUPPORT_C89 if the tzcode library should support C89 callers+
  209. # -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
  210. # security implications and is not recommended for general use
  211. # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
  212. # not needed by the main-program tz code, which is single-threaded.
  213. # Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
  214. # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
  215. # This is intended for internal use only; it mangles external names.
  216. # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
  217. # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
  218. # the default is system-supplied, typically "/usr/lib/locale"
  219. # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
  220. # DST transitions for POSIX-style TZ strings lacking them,
  221. # in the usual case where POSIXRULES is '-'. If not specified,
  222. # TZDEFRULESTRING defaults to US rules for future DST transitions.
  223. # This mishandles some past timestamps, as US DST rules have changed.
  224. # It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
  225. # as Europe and US DST rules differ.
  226. # -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
  227. # -DUNINIT_TRAP if reading uninitialized storage can cause problems
  228. # other than simply getting garbage data
  229. # -DUSE_LTZ=0 to build zdump with the system time zone library
  230. # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
  231. # -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and
  232. # similarly for "slim". Fat TZif files work around incompatibilities
  233. # and bugs in some TZif readers, notably older ones that
  234. # ignore or otherwise mishandle 64-bit data in TZif files;
  235. # however, fat TZif files may trigger bugs in newer TZif readers.
  236. # Slim TZif files are more efficient, and are the default.
  237. # -DZIC_MAX_ABBR_LEN_WO_WARN=3
  238. # (or some other number) to set the maximum time zone abbreviation length
  239. # that zic will accept without a warning (the default is 6)
  240. # $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
  241. #
  242. # * Options marked "*" can be omitted if your compiler is C23 compatible.
  243. # * Options marked "+" are obsolescent and are planned to be removed
  244. # once the code assumes C99 or later.
  245. #
  246. # Select instrumentation via "make GCC_INSTRUMENT='whatever'".
  247. GCC_INSTRUMENT = \
  248. -fsanitize=undefined -fsanitize-address-use-after-scope \
  249. -fsanitize-undefined-trap-on-error -fstack-protector
  250. # Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
  251. GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
  252. $(GCC_INSTRUMENT) \
  253. -Wall -Wextra \
  254. -Walloc-size-larger-than=100000 -Warray-bounds=2 \
  255. -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
  256. -Wdeclaration-after-statement -Wdouble-promotion \
  257. -Wduplicated-branches -Wduplicated-cond \
  258. -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
  259. -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
  260. -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
  261. -Wnull-dereference \
  262. -Wold-style-definition -Woverlength-strings -Wpointer-arith \
  263. -Wshadow -Wshift-overflow=2 -Wstrict-overflow \
  264. -Wstrict-prototypes -Wstringop-overflow=4 \
  265. -Wstringop-truncation -Wsuggest-attribute=cold \
  266. -Wsuggest-attribute=const -Wsuggest-attribute=format \
  267. -Wsuggest-attribute=malloc \
  268. -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
  269. -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
  270. -Wvariadic-macros -Wvla -Wwrite-strings \
  271. -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
  272. -Wno-type-limits
  273. #
  274. # If your system has a "GMT offset" field in its "struct tm"s
  275. # (or if you decide to add such a field in your system's "time.h" file),
  276. # add the name to a define such as
  277. # -DTM_GMTOFF=tm_gmtoff
  278. # to the end of the "CFLAGS=" line. If not defined, the code attempts to
  279. # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
  280. # Similarly, if your system has a "zone abbreviation" field, define
  281. # -DTM_ZONE=tm_zone
  282. # and define NO_TM_ZONE to suppress any guessing. Although these two fields
  283. # not required by POSIX, a future version of POSIX is planned to require them
  284. # and they are widely available on GNU/Linux and BSD systems.
  285. #
  286. # The next batch of options control support for external variables
  287. # exported by tzcode. In practice these variables are less useful
  288. # than TM_GMTOFF and TM_ZONE. However, most of them are standardized.
  289. # #
  290. # # To omit or support the external variable "tzname", add one of:
  291. # # -DHAVE_TZNAME=0 # do not support "tzname"
  292. # # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library
  293. # # -DHAVE_TZNAME=2 # support and define "tzname"
  294. # # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later.
  295. # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
  296. # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
  297. # # crashes when combined with some platforms' standard libraries,
  298. # # presumably due to memory allocation issues.
  299. # #
  300. # # To omit or support the external variables "timezone" and "daylight", add
  301. # # -DUSG_COMPAT=0 # do not support
  302. # # -DUSG_COMPAT=1 # support, and variables are defined by system library
  303. # # -DUSG_COMPAT=2 # support and define variables
  304. # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
  305. # # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
  306. # # If not defined, the code attempts to guess USG_COMPAT from other macros.
  307. # #
  308. # # To support the external variable "altzone", add
  309. # # -DALTZONE=0 # do not support
  310. # # -DALTZONE=1 # support "altzone", which is defined by system library
  311. # # -DALTZONE=2 # support and define "altzone"
  312. # # to the end of the "CFLAGS=" line; although "altzone" appeared in
  313. # # System V Release 3.1 it has not been standardized.
  314. # # If not defined, the code attempts to guess ALTZONE from other macros.
  315. #
  316. # If you want functions that were inspired by early versions of X3J11's work,
  317. # add
  318. # -DSTD_INSPIRED
  319. # to the end of the "CFLAGS=" line. This arranges for the following
  320. # functions to be added to the time conversion library.
  321. # "offtime" is like "gmtime" except that it accepts a second (long) argument
  322. # that gives an offset to add to the time_t when converting it.
  323. # I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone.
  324. # "timelocal" is nearly equivalent to "mktime".
  325. # "timeoff" is like "timegm" except that it accepts a second (long) argument
  326. # that gives an offset to use when converting to a time_t.
  327. # I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone.
  328. # "posix2time" and "time2posix" are described in an included manual page.
  329. # X3J11's work does not describe any of these functions.
  330. # These functions may well disappear in future releases of the time
  331. # conversion package.
  332. #
  333. # If you don't want functions that were inspired by NetBSD, add
  334. # -DNETBSD_INSPIRED=0
  335. # to the end of the "CFLAGS=" line. Otherwise, the functions
  336. # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
  337. # time library, and if STD_INSPIRED is also defined to nonzero the functions
  338. # "posix2time_z" and "time2posix_z" are added as well.
  339. # The functions ending in "_z" (or "_rz") are like their unsuffixed
  340. # (or suffixed-by-"_r") counterparts, except with an extra first
  341. # argument of opaque type timezone_t that specifies the timezone.
  342. # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
  343. #
  344. # If you want to allocate state structures in localtime, add
  345. # -DALL_STATE
  346. # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
  347. #
  348. # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
  349. # out by the National Institute of Standards and Technology
  350. # which claims to test C and Posix conformance. If you want to pass PCTS, add
  351. # -DPCTS
  352. # to the end of the "CFLAGS=" line.
  353. #
  354. # If you want strict compliance with XPG4 as of 1994-04-09, add
  355. # -DXPG4_1994_04_09
  356. # to the end of the "CFLAGS=" line. This causes "strftime" to always return
  357. # 53 as a week number (rather than 52 or 53) for January days before
  358. # January's first Monday when a "%V" format is used and January 1
  359. # falls on a Friday, Saturday, or Sunday.
  360. CFLAGS=
  361. # Linker flags. Default to $(LFLAGS) for backwards compatibility
  362. # to release 2012h and earlier.
  363. LDFLAGS= $(LFLAGS)
  364. # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
  365. # submake command lines. The default is no leap seconds.
  366. LEAPSECONDS=
  367. # The zic command and its arguments.
  368. zic= ./zic
  369. ZIC= $(zic) $(ZFLAGS)
  370. # To shrink the size of installed TZif files,
  371. # append "-r @N" to omit data before N-seconds-after-the-Epoch.
  372. # To grow the files and work around bugs in older applications,
  373. # possibly at the expense of introducing bugs in newer ones,
  374. # append "-b fat"; see ZIC_BLOAT_DEFAULT above.
  375. # See the zic man page for more about -b and -r.
  376. ZFLAGS=
  377. # How to use zic to install TZif files.
  378. ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
  379. # The name of a Posix-compliant 'awk' on your system.
  380. # mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
  381. # Also, it is better (though not essential) if 'awk' supports UTF-8,
  382. # and unfortunately mawk and busybox awk do not support UTF-8.
  383. # Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems.
  384. AWK= awk
  385. # The full path name of a Posix-compliant shell, preferably one that supports
  386. # the Korn shell's 'select' statement as an extension.
  387. # These days, Bash is the most popular.
  388. # It should be OK to set this to /bin/sh, on platforms where /bin/sh
  389. # lacks 'select' or doesn't completely conform to Posix, but /bin/bash
  390. # is typically nicer if it works.
  391. KSHELL= /bin/bash
  392. # Name of curl <https://curl.haxx.se/>, used for HTML validation.
  393. CURL= curl
  394. # Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
  395. GPG= gpg
  396. # This expensive test requires USE_LTZ.
  397. # To suppress it, define this macro to be empty.
  398. CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
  399. # SAFE_CHAR is a regular expression that matches a safe character.
  400. # Some parts of this distribution are limited to safe characters;
  401. # others can use any UTF-8 character.
  402. # For now, the safe characters are a safe subset of ASCII.
  403. # The caller must set the shell variable 'sharp' to the character '#',
  404. # since Makefile macros cannot contain '#'.
  405. # TAB_CHAR is a single tab character, in single quotes.
  406. TAB_CHAR= ' '
  407. SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
  408. SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
  409. SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
  410. SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
  411. SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]'
  412. # These non-alphabetic, non-ASCII printable characters are Latin-1,
  413. # and so are likely displayable even in editors like XEmacs 21
  414. # that have limited display capabilities.
  415. UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷
  416. # Non-ASCII non-letters that OK_CHAR allows, as these characters are
  417. # useful in commentary.
  418. UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)
  419. # Put this in a bracket expression to match spaces.
  420. s = [:space:]
  421. # OK_CHAR matches any character allowed in the distributed files.
  422. # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
  423. # multibyte letters are also allowed so that commentary can contain a
  424. # few safe symbols and people's names and can quote non-English sources.
  425. # Other non-letters are limited to ASCII renderings for the
  426. # convenience of maintainers using XEmacs 21.5.34, which by default
  427. # mishandles Unicode characters U+0100 and greater.
  428. OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]'
  429. # SAFE_LINE matches a line of safe characters.
  430. # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
  431. # this is so that comments can contain non-ASCII characters.
  432. # OK_LINE matches a line of OK characters.
  433. SAFE_LINE= '^'$(SAFE_CHAR)'*$$'
  434. SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
  435. OK_LINE= '^'$(OK_CHAR)'*$$'
  436. # Flags to give 'tar' when making a distribution.
  437. # Try to use flags appropriate for GNU tar.
  438. GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
  439. --numeric-owner --owner=0 --group=0 \
  440. --mode=go+u,go-w --sort=name
  441. TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
  442. then echo $(GNUTARFLAGS); \
  443. else :; \
  444. fi`
  445. # Flags to give 'gzip' when making a distribution.
  446. GZIPFLAGS= -9n
  447. # When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
  448. # This makes it easier to see which Zone has been affected.
  449. DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \
  450. || echo ' -F^TZ=')
  451. ###############################################################################
  452. #MAKE= make
  453. cc= cc
  454. CC= $(cc) -DTZDIR='"$(TZDIR)"'
  455. AR= ar
  456. # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
  457. RANLIB= :
  458. TZCOBJS= zic.o
  459. TZDOBJS= zdump.o localtime.o asctime.o strftime.o
  460. DATEOBJS= date.o localtime.o strftime.o asctime.o
  461. LIBSRCS= localtime.c asctime.c difftime.c strftime.c
  462. LIBOBJS= localtime.o asctime.o difftime.o strftime.o
  463. HEADERS= tzfile.h private.h
  464. NONLIBSRCS= zic.c zdump.c
  465. NEWUCBSRCS= date.c
  466. SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
  467. tzselect.ksh workman.sh
  468. MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
  469. tzfile.5 tzselect.8 zic.8 zdump.8
  470. MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
  471. time2posix.3.txt \
  472. tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
  473. date.1.txt
  474. COMMON= calendars CONTRIBUTING LICENSE Makefile \
  475. NEWS README SECURITY theory.html version
  476. WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
  477. CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
  478. check_tz-how-to.html check_tz-link.html
  479. DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
  480. PRIMARY_YDATA= africa antarctica asia australasia \
  481. europe northamerica southamerica
  482. YDATA= $(PRIMARY_YDATA) etcetera
  483. NDATA= factory
  484. TDATA_TO_CHECK= $(YDATA) $(NDATA) backward
  485. TDATA= $(YDATA) $(NDATA) $(BACKWARD)
  486. ZONETABLES= zone1970.tab zone.tab
  487. TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
  488. LEAP_DEPS= leapseconds.awk leap-seconds.list
  489. TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \
  490. $(PACKRATDATA) $(PACKRATLIST)
  491. DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
  492. DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
  493. leapseconds $(ZONETABLES)
  494. AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \
  495. ziguard.awk zishrink.awk
  496. MISC= $(AWK_SCRIPTS)
  497. TZS_YEAR= 2050
  498. TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
  499. TZS= to$(TZS_YEAR).tzs
  500. TZS_NEW= to$(TZS_YEAR)new.tzs
  501. TZS_DEPS= $(YDATA) asctime.c localtime.c \
  502. private.h tzfile.h zdump.c zic.c
  503. TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
  504. # EIGHT_YARDS is just a yard short of the whole ENCHILADA.
  505. EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
  506. ENCHILADA = $(EIGHT_YARDS) $(TZS)
  507. # Consult these files when deciding whether to rebuild the 'version' file.
  508. # This list is not the same as the output of 'git ls-files', since
  509. # .gitignore is not distributed.
  510. VERSION_DEPS= \
  511. calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
  512. africa antarctica asctime.c asia australasia \
  513. backward backzone \
  514. checklinks.awk checktab.awk \
  515. date.1 date.c difftime.c \
  516. etcetera europe factory iso3166.tab \
  517. leap-seconds.list leapseconds.awk localtime.c \
  518. newctime.3 newstrftime.3 newtzset.3 northamerica \
  519. private.h southamerica strftime.c theory.html \
  520. time2posix.3 tz-art.html tz-how-to.html tz-link.html \
  521. tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
  522. workman.sh zdump.8 zdump.c zic.8 zic.c \
  523. ziguard.awk zishrink.awk \
  524. zone.tab zone1970.tab
  525. # And for the benefit of csh users on systems that assume the user
  526. # shell should be used to handle commands in Makefiles. . .
  527. SHELL= /bin/sh
  528. all: tzselect zic zdump libtz.a $(TABDATA) \
  529. vanguard.zi main.zi rearguard.zi
  530. ALL: all date $(ENCHILADA)
  531. install: all $(DATA) $(REDO) $(MANS)
  532. mkdir -p '$(DESTDIR)$(BINDIR)' \
  533. '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \
  534. '$(DESTDIR)$(LIBDIR)' \
  535. '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
  536. '$(DESTDIR)$(MANDIR)/man8'
  537. $(ZIC_INSTALL) -l $(LOCALTIME) \
  538. `case '$(POSIXRULES)' in ?*) echo '-p';; esac \
  539. ` $(POSIXRULES) \
  540. -t '$(DESTDIR)$(TZDEFAULT)'
  541. cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
  542. cp tzselect '$(DESTDIR)$(BINDIR)/.'
  543. cp zdump '$(DESTDIR)$(ZDUMPDIR)/.'
  544. cp zic '$(DESTDIR)$(ZICDIR)/.'
  545. cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
  546. $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
  547. cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
  548. cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
  549. cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
  550. INSTALL: ALL install date.1
  551. mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
  552. cp date '$(DESTDIR)$(BINDIR)/.'
  553. cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
  554. # Calculate version number from git, if available.
  555. # Otherwise, use $(VERSION) unless it is "unknown" and there is already
  556. # a 'version' file, in which case reuse the existing 'version' contents
  557. # and append "-dirty" if the contents do not already end in "-dirty".
  558. version: $(VERSION_DEPS)
  559. { (type git) >/dev/null 2>&1 && \
  560. V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
  561. --abbrev=7 --dirty` || \
  562. if test '$(VERSION)' = unknown && V=`cat $@`; then \
  563. case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
  564. else \
  565. V='$(VERSION)'; \
  566. fi; } && \
  567. printf '%s\n' "$$V" >$@.out
  568. mv $@.out $@
  569. # These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
  570. vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
  571. $(AWK) \
  572. -v DATAFORM=`expr $@ : '\(.*\).zi'` \
  573. -v PACKRATDATA='$(PACKRATDATA)' \
  574. -v PACKRATLIST='$(PACKRATLIST)' \
  575. -f ziguard.awk \
  576. $(TDATA) $(PACKRATDATA) >$@.out
  577. mv $@.out $@
  578. # This file has a version comment that attempts to capture any tailoring
  579. # via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
  580. tzdata.zi: $(DATAFORM).zi version zishrink.awk
  581. version=`sed 1q version` && \
  582. LC_ALL=C $(AWK) \
  583. -v dataform='$(DATAFORM)' \
  584. -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
  585. -v redo='$(REDO)' \
  586. -v version="$$version" \
  587. -f zishrink.awk \
  588. $(DATAFORM).zi >$@.out
  589. mv $@.out $@
  590. version.h: version
  591. VERSION=`cat version` && printf '%s\n' \
  592. 'static char const PKGVERSION[]="($(PACKAGE)) ";' \
  593. "static char const TZVERSION[]=\"$$VERSION\";" \
  594. 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
  595. >$@.out
  596. mv $@.out $@
  597. zdump: $(TZDOBJS)
  598. $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
  599. zic: $(TZCOBJS)
  600. $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
  601. leapseconds: $(LEAP_DEPS)
  602. $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
  603. -f leapseconds.awk leap-seconds.list >$@.out
  604. mv $@.out $@
  605. # Arguments to pass to submakes of install_data.
  606. # They can be overridden by later submake arguments.
  607. INSTALLARGS = \
  608. BACKWARD='$(BACKWARD)' \
  609. DESTDIR='$(DESTDIR)' \
  610. LEAPSECONDS='$(LEAPSECONDS)' \
  611. PACKRATDATA='$(PACKRATDATA)' \
  612. PACKRATLIST='$(PACKRATLIST)' \
  613. TZDEFAULT='$(TZDEFAULT)' \
  614. TZDIR='$(TZDIR)' \
  615. ZIC='$(ZIC)'
  616. INSTALL_DATA_DEPS = zic leapseconds tzdata.zi
  617. # 'make install_data' installs one set of TZif files.
  618. install_data: $(INSTALL_DATA_DEPS)
  619. $(ZIC_INSTALL) tzdata.zi
  620. posix_only: $(INSTALL_DATA_DEPS)
  621. $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
  622. right_only: $(INSTALL_DATA_DEPS)
  623. $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
  624. install_data
  625. # In earlier versions of this makefile, the other two directories were
  626. # subdirectories of $(TZDIR). However, this led to configuration errors.
  627. # For example, with posix_right under the earlier scheme,
  628. # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
  629. # but gmtime without leap seconds, which led to problems with applications
  630. # like sendmail that subtract gmtime from localtime.
  631. # Therefore, the other two directories are now siblings of $(TZDIR).
  632. # You must replace all of $(TZDIR) to switch from not using leap seconds
  633. # to using them, or vice versa.
  634. right_posix: right_only
  635. rm -fr '$(DESTDIR)$(TZDIR)-leaps'
  636. ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
  637. $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
  638. $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
  639. posix_right: posix_only
  640. rm -fr '$(DESTDIR)$(TZDIR)-posix'
  641. ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
  642. $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
  643. $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
  644. zones: $(REDO)
  645. # dummy.zd is not a real file; it is mentioned here only so that the
  646. # top-level 'make' does not have a syntax error.
  647. ZDS = dummy.zd
  648. # Rule used only by submakes invoked by the $(TZS_NEW) rule.
  649. # It is separate so that GNU 'make -j' can run instances in parallel.
  650. $(ZDS): zdump
  651. ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
  652. >$@
  653. TZS_NEW_DEPS = tzdata.zi zdump zic
  654. $(TZS_NEW): $(TZS_NEW_DEPS)
  655. rm -fr tzs$(TZS_YEAR).dir
  656. mkdir tzs$(TZS_YEAR).dir
  657. $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
  658. $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
  659. tzdata.zi | LC_ALL=C sort >$@.out
  660. wd=`pwd` && \
  661. x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
  662. tzdata.zi \
  663. | LC_ALL=C sort -t . -k 2,2` && \
  664. set x $$x && \
  665. shift && \
  666. ZDS=$$* && \
  667. $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
  668. ZDS="$$ZDS" $$ZDS && \
  669. sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
  670. rm -fr tzs$(TZS_YEAR).dir
  671. mv $@.out $@
  672. # If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
  673. # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
  674. $(TZS):
  675. touch $@
  676. force_tzs: $(TZS_NEW)
  677. cp $(TZS_NEW) $(TZS)
  678. libtz.a: $(LIBOBJS)
  679. rm -f $@
  680. $(AR) -rc $@ $(LIBOBJS)
  681. $(RANLIB) $@
  682. date: $(DATEOBJS)
  683. $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
  684. tzselect: tzselect.ksh version
  685. VERSION=`cat version` && sed \
  686. -e 's|#!/bin/bash|#!$(KSHELL)|g' \
  687. -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \
  688. -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
  689. -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
  690. -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
  691. -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
  692. <$@.ksh >$@.out
  693. chmod +x $@.out
  694. mv $@.out $@
  695. check: check_back check_mild
  696. check_mild: check_character_set check_white_space check_links \
  697. check_name_lengths check_slashed_abbrs check_sorted \
  698. check_tables check_web check_ziguard check_zishrink check_tzs
  699. check_character_set: $(ENCHILADA)
  700. test ! '$(UTF8_LOCALE)' || \
  701. ! printf 'A\304\200B\n' | \
  702. LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
  703. LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
  704. sharp='#' && \
  705. ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
  706. $(MISC) $(SOURCES) $(WEB_PAGES) \
  707. CONTRIBUTING LICENSE README SECURITY \
  708. version tzdata.zi && \
  709. ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
  710. Makefile && \
  711. ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
  712. leapseconds zone.tab && \
  713. ! grep -Env $(OK_LINE) $(ENCHILADA); \
  714. }
  715. touch $@
  716. check_white_space: $(ENCHILADA)
  717. patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
  718. ! grep -En "$$pat" \
  719. $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
  720. ! grep -n '[$s]$$' \
  721. $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
  722. touch $@
  723. PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
  724. FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
  725. check_name_lengths: $(TDATA_TO_CHECK) backzone
  726. ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
  727. $(TDATA_TO_CHECK) backzone
  728. touch $@
  729. PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
  730. STDOFF = [-+]?[0-9:.]+
  731. RULELESS_SAVE = (-|$(STDOFF)[sd]?)
  732. RULELESS_SLASHED_ABBRS = \
  733. $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
  734. check_slashed_abbrs: $(TDATA_TO_CHECK)
  735. ! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
  736. touch $@
  737. CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
  738. check_sorted: backward backzone
  739. $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
  740. backward | LC_ALL=C sort -cu
  741. $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
  742. touch $@
  743. check_back: checklinks.awk $(TDATA_TO_CHECK)
  744. $(AWK) \
  745. -v DATAFORM=$(DATAFORM) \
  746. -v backcheck=backward \
  747. -f checklinks.awk $(TDATA_TO_CHECK)
  748. touch $@
  749. check_links: checklinks.awk tzdata.zi
  750. $(AWK) \
  751. -v DATAFORM=$(DATAFORM) \
  752. -f checklinks.awk tzdata.zi
  753. touch $@
  754. check_tables: checktab.awk $(YDATA) backward $(ZONETABLES)
  755. for tab in $(ZONETABLES); do \
  756. test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
  757. $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
  758. || exit; \
  759. done
  760. touch $@
  761. check_tzs: $(TZS) $(TZS_NEW)
  762. if test -s $(TZS); then \
  763. $(DIFF_TZS) $(TZS) $(TZS_NEW); \
  764. else \
  765. cp $(TZS_NEW) $(TZS); \
  766. fi
  767. touch $@
  768. check_web: $(CHECK_WEB_PAGES)
  769. check_theory.html: theory.html
  770. check_tz-art.html: tz-art.html
  771. check_tz-how-to.html: tz-how-to.html
  772. check_tz-link.html: tz-link.html
  773. check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
  774. $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
  775. -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
  776. test ! -s $@.out || { cat $@.out; exit 1; }
  777. mv $@.out $@
  778. check_ziguard: rearguard.zi vanguard.zi ziguard.awk
  779. $(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
  780. diff -u rearguard.zi -
  781. $(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
  782. diff -u vanguard.zi -
  783. touch $@
  784. # Check that zishrink.awk does not alter the data, and that ziguard.awk
  785. # preserves main-format data.
  786. check_zishrink: check_zishrink_posix check_zishrink_right
  787. check_zishrink_posix check_zishrink_right: \
  788. zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
  789. $(TDATA) $(DATAFORM).zi tzdata.zi
  790. rm -fr $@.dir $@-t.dir $@-shrunk.dir
  791. mkdir $@.dir $@-t.dir $@-shrunk.dir
  792. case $@ in \
  793. *_right) leap='-L leapseconds';; \
  794. *) leap=;; \
  795. esac && \
  796. $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
  797. $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
  798. case $(DATAFORM),$(PACKRATLIST) in \
  799. main,) \
  800. $(ZIC) $$leap -d $@-t.dir $(TDATA) && \
  801. $(AWK) '/^Rule/' $(TDATA) | \
  802. $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
  803. diff -r $@.dir $@-t.dir;; \
  804. esac
  805. diff -r $@.dir $@-shrunk.dir
  806. rm -fr $@.dir $@-t.dir $@-shrunk.dir
  807. touch $@
  808. clean_misc:
  809. rm -fr check_*.dir
  810. rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
  811. check_* core typecheck_* \
  812. date tzselect version.h zdump zic libtz.a
  813. clean: clean_misc
  814. rm -fr *.dir tzdb-*/
  815. rm -f *.zi $(TZS_NEW)
  816. maintainer-clean: clean
  817. @echo 'This command is intended for maintainers to use; it'
  818. @echo 'deletes files that may need special tools to rebuild.'
  819. rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
  820. names:
  821. @echo $(ENCHILADA)
  822. public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \
  823. tarballs signatures
  824. date.1.txt: date.1
  825. newctime.3.txt: newctime.3
  826. newstrftime.3.txt: newstrftime.3
  827. newtzset.3.txt: newtzset.3
  828. time2posix.3.txt: time2posix.3
  829. tzfile.5.txt: tzfile.5
  830. tzselect.8.txt: tzselect.8
  831. zdump.8.txt: zdump.8
  832. zic.8.txt: zic.8
  833. $(MANTXTS): workman.sh
  834. LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
  835. mv $@.out $@
  836. # Set file timestamps deterministically if possible,
  837. # so that tarballs containing the timestamps are reproducible.
  838. #
  839. # '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
  840. # file DEST to the maximum of the timestamps of the files A B C ...,
  841. # plus N if GNU ls and touch are available.
  842. SET_TIMESTAMP_N = sh -c '\
  843. n=$$0 dest=$$1; shift; \
  844. <"$$dest" && \
  845. if test $$n != 0 && \
  846. lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \
  847. set x $$lsout && \
  848. timestamp=`expr $$7 + $$n` && \
  849. echo "+ touch -md @$$timestamp $$dest" && \
  850. touch -md @$$timestamp "$$dest"; \
  851. else \
  852. newest=`ls -t "$$@" | sed 1q` && \
  853. echo "+ touch -mr $$newest $$dest" && \
  854. touch -mr "$$newest" "$$dest"; \
  855. fi'
  856. # If DEST depends on A B C ... in this Makefile, callers should use
  857. # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
  858. # downstream 'make' that considers equal timestamps to be out of date.
  859. # POSIX allows this 'make' behavior, and HP-UX 'make' does it.
  860. # If all that matters is that the timestamp be reproducible
  861. # and plausible, use $(SET_TIMESTAMP).
  862. SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
  863. SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
  864. # Set the timestamps to those of the git repository, if available,
  865. # and if the files have not changed since then.
  866. # This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
  867. # and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
  868. # If git or GNU is absent, don't bother to sync with git timestamps.
  869. # Also, set the timestamp of each prebuilt file like 'leapseconds'
  870. # to be the maximum of the files it depends on.
  871. set-timestamps.out: $(EIGHT_YARDS)
  872. rm -f $@
  873. if (type git) >/dev/null 2>&1 && \
  874. files=`git ls-files $(EIGHT_YARDS)` && \
  875. touch -md @1 test.out; then \
  876. rm -f test.out && \
  877. for file in $$files; do \
  878. if git diff --quiet $$file; then \
  879. time=`TZ=UTC0 git log -1 \
  880. --format='tformat:%cd' \
  881. --date='format:%Y-%m-%dT%H:%M:%SZ' \
  882. $$file` && \
  883. echo "+ touch -md $$time $$file" && \
  884. touch -md $$time $$file; \
  885. else \
  886. echo >&2 "$$file: warning: does not match repository"; \
  887. fi || exit; \
  888. done; \
  889. fi
  890. $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
  891. for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
  892. $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
  893. exit; \
  894. done
  895. $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
  896. $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
  897. touch $@
  898. set-tzs-timestamp.out: $(TZS)
  899. $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
  900. touch $@
  901. # The zics below ensure that each data file can stand on its own.
  902. # We also do an all-files run to catch links to links.
  903. check_public: $(VERSION_DEPS)
  904. rm -fr public.dir
  905. mkdir public.dir
  906. ln $(VERSION_DEPS) public.dir
  907. cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
  908. for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
  909. public.dir/vanguard.zi public.dir/main.zi \
  910. public.dir/rearguard.zi; \
  911. do \
  912. public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
  913. done
  914. public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
  915. :
  916. : Also check 'backzone' syntax.
  917. rm public.dir/main.zi
  918. cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
  919. public.dir/zic -d public.dir/zoneinfo main.zi
  920. rm public.dir/main.zi
  921. cd public.dir && \
  922. $(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
  923. public.dir/zic -d public.dir/zoneinfo main.zi
  924. :
  925. rm -fr public.dir
  926. touch $@
  927. # Check that the code works under various alternative
  928. # implementations of time_t.
  929. check_time_t_alternatives: $(TIME_T_ALTERNATIVES)
  930. $(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
  931. $(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
  932. rm -fr $@.dir
  933. mkdir $@.dir
  934. ln $(VERSION_DEPS) $@.dir
  935. case $@ in \
  936. int*32_t) range=-2147483648,2147483648;; \
  937. u*) range=0,4294967296;; \
  938. *) range=-4294967296,4294967296;; \
  939. esac && \
  940. wd=`pwd` && \
  941. zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
  942. if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
  943. range_target=; \
  944. else \
  945. range_target=to$$range.tzs; \
  946. fi && \
  947. (cd $@.dir && \
  948. $(MAKE) TOPDIR="$$wd/$@.dir" \
  949. CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
  950. REDO='$(REDO)' \
  951. D=$$wd/$@.dir \
  952. TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
  953. install $$range_target) && \
  954. test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
  955. (cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
  956. $(MAKE) TOPDIR="$$wd/$@.dir" \
  957. TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
  958. D=$$wd/$@.dir \
  959. to$$range.tzs) && \
  960. $(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
  961. $@.dir/to$$range.tzs && \
  962. if diff -q Makefile Makefile 2>/dev/null; then \
  963. quiet_option='-q'; \
  964. else \
  965. quiet_option=''; \
  966. fi && \
  967. diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
  968. $@.dir/etc && \
  969. diff $$quiet_option -r \
  970. $(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
  971. $@.dir/usr/share; \
  972. }
  973. touch $@
  974. TRADITIONAL_ASC = \
  975. tzcode$(VERSION).tar.gz.asc \
  976. tzdata$(VERSION).tar.gz.asc
  977. REARGUARD_ASC = \
  978. tzdata$(VERSION)-rearguard.tar.gz.asc
  979. ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
  980. tzdb-$(VERSION).tar.lz.asc
  981. tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
  982. signatures rearguard_signatures traditional_signatures: \
  983. version set-timestamps.out rearguard.zi vanguard.zi
  984. VERSION=`cat version` && \
  985. $(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
  986. # These *_version rules are intended for use if VERSION is set by some
  987. # other means. Ordinarily these rules are used only by the above
  988. # non-_version rules, which set VERSION on the 'make' command line.
  989. tarballs_version: traditional_tarballs_version rearguard_tarballs_version \
  990. tzdb-$(VERSION).tar.lz
  991. rearguard_tarballs_version: \
  992. tzdata$(VERSION)-rearguard.tar.gz
  993. traditional_tarballs_version: \
  994. tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
  995. tailored_tarballs_version: \
  996. tzdata$(VERSION)-tailored.tar.gz
  997. signatures_version: $(ALL_ASC)
  998. rearguard_signatures_version: $(REARGUARD_ASC)
  999. traditional_signatures_version: $(TRADITIONAL_ASC)
  1000. tzcode$(VERSION).tar.gz: set-timestamps.out
  1001. LC_ALL=C && export LC_ALL && \
  1002. tar $(TARFLAGS) -cf - \
  1003. $(COMMON) $(DOCS) $(SOURCES) | \
  1004. gzip $(GZIPFLAGS) >$@.out
  1005. mv $@.out $@
  1006. tzdata$(VERSION).tar.gz: set-timestamps.out
  1007. LC_ALL=C && export LC_ALL && \
  1008. tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
  1009. gzip $(GZIPFLAGS) >$@.out
  1010. mv $@.out $@
  1011. # Create empty files with a reproducible timestamp.
  1012. CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
  1013. # The obsolescent *rearguard* targets and related macros are present
  1014. # for backwards compatibility with tz releases 2018e through 2022a.
  1015. # They should go away eventually. To build rearguard tarballs you
  1016. # can instead use 'make DATAFORM=rearguard tailored_tarballs'.
  1017. tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
  1018. rm -fr $@.dir
  1019. mkdir $@.dir
  1020. ln $(TZDATA_DIST) $@.dir
  1021. cd $@.dir && rm -f $(TDATA) $(PACKRATDATA) version
  1022. for f in $(TDATA) $(PACKRATDATA); do \
  1023. rearf=$@.dir/$$f; \
  1024. $(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
  1025. $(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
  1026. done
  1027. sed '1s/$$/-rearguard/' <version >$@.dir/version
  1028. : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
  1029. $(CREATE_EMPTY) $@.dir/pacificnew
  1030. touch -mr version $@.dir/version
  1031. LC_ALL=C && export LC_ALL && \
  1032. (cd $@.dir && \
  1033. tar $(TARFLAGS) -cf - \
  1034. $(TZDATA_DIST) pacificnew | \
  1035. gzip $(GZIPFLAGS)) >$@.out
  1036. mv $@.out $@
  1037. # Create a tailored tarball suitable for TZUpdater and compatible tools.
  1038. # For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
  1039. # useful for testing whether TZUpdater supports vanguard form.
  1040. # The generated tarball is not byte-for-byte equivalent to a hand-tailored
  1041. # traditional tarball, as data entries are put into 'etcetera' even if they
  1042. # came from some other source file. However, the effect should be the same
  1043. # for ordinary use, which reads all the source files.
  1044. tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
  1045. rm -fr $@.dir
  1046. mkdir $@.dir
  1047. : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
  1048. cd $@.dir && \
  1049. $(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
  1050. `test $(DATAFORM) = vanguard || echo pacificnew`
  1051. (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
  1052. >$@.dir/etcetera
  1053. touch -mr tzdata.zi $@.dir/etcetera
  1054. sed -n \
  1055. -e '/^# *version *\(.*\)/h' \
  1056. -e '/^# *ddeps */H' \
  1057. -e '$$!d' \
  1058. -e 'g' \
  1059. -e 's/^# *version *//' \
  1060. -e 's/\n# *ddeps */-/' \
  1061. -e 's/ /-/g' \
  1062. -e 'p' \
  1063. <tzdata.zi >$@.dir/version
  1064. touch -mr version $@.dir/version
  1065. links= && \
  1066. for file in $(TZDATA_DIST); do \
  1067. test -f $@.dir/$$file || links="$$links $$file"; \
  1068. done && \
  1069. ln $$links $@.dir
  1070. LC_ALL=C && export LC_ALL && \
  1071. (cd $@.dir && \
  1072. tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out
  1073. mv $@.out $@
  1074. tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
  1075. rm -fr tzdb-$(VERSION)
  1076. mkdir tzdb-$(VERSION)
  1077. ln $(ENCHILADA) tzdb-$(VERSION)
  1078. $(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
  1079. LC_ALL=C && export LC_ALL && \
  1080. tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
  1081. mv $@.out $@
  1082. tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
  1083. tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
  1084. tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
  1085. tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
  1086. $(ALL_ASC):
  1087. $(GPG) --armor --detach-sign $?
  1088. TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
  1089. typecheck: typecheck_long_long typecheck_unsigned
  1090. typecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
  1091. rm -fr $@.dir
  1092. mkdir $@.dir
  1093. ln $(VERSION_DEPS) $@.dir
  1094. cd $@.dir && \
  1095. case $@ in \
  1096. *_long_long) i="long long";; \
  1097. *_unsigned ) i="unsigned" ;; \
  1098. esac && \
  1099. typecheck_cflags='' && \
  1100. $(MAKE) \
  1101. CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
  1102. TOPDIR="`pwd`" \
  1103. install
  1104. $@.dir/zdump -i -c 1970,1971 Europe/Rome
  1105. touch $@
  1106. zonenames: tzdata.zi
  1107. @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
  1108. asctime.o: private.h tzfile.h
  1109. date.o: private.h
  1110. difftime.o: private.h
  1111. localtime.o: private.h tzfile.h
  1112. strftime.o: private.h tzfile.h
  1113. zdump.o: version.h
  1114. zic.o: private.h tzfile.h version.h
  1115. .PHONY: ALL INSTALL all
  1116. .PHONY: check check_mild check_time_t_alternatives
  1117. .PHONY: check_web check_zishrink
  1118. .PHONY: clean clean_misc dummy.zd force_tzs
  1119. .PHONY: install install_data maintainer-clean names
  1120. .PHONY: posix_only posix_right public
  1121. .PHONY: rearguard_signatures rearguard_signatures_version
  1122. .PHONY: rearguard_tarballs rearguard_tarballs_version
  1123. .PHONY: right_only right_posix signatures signatures_version
  1124. .PHONY: tarballs tarballs_version
  1125. .PHONY: traditional_signatures traditional_signatures_version
  1126. .PHONY: traditional_tarballs traditional_tarballs_version
  1127. .PHONY: tailored_tarballs tailored_tarballs_version
  1128. .PHONY: typecheck
  1129. .PHONY: zonenames zones
  1130. .PHONY: $(ZDS)