Makefile 44 KB

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