Makefile 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. # <pre>
  2. # %W%
  3. # This file is in the public domain, so clarified as of
  4. # 2009-05-17 by Arthur David Olson.
  5. # Change the line below for your time zone (after finding the zone you want in
  6. # the time zone files, or adding it to a time zone file).
  7. # Alternately, if you discover you've got the wrong time zone, you can just
  8. # zic -l rightzone
  9. # to correct things.
  10. # Use the command
  11. # make zonenames
  12. # to get a list of the values you can use for LOCALTIME.
  13. LOCALTIME= GMT
  14. # If you want something other than Eastern United States time as a template
  15. # for handling POSIX-style time zone environment variables,
  16. # change the line below (after finding the zone you want in the
  17. # time zone files, or adding it to a time zone file).
  18. # (When a POSIX-style environment variable is handled, the rules in the
  19. # template file are used to determine "spring forward" and "fall back" days and
  20. # times; the environment variable itself specifies UTC offsets of standard and
  21. # summer time.)
  22. # Alternately, if you discover you've got the wrong time zone, you can just
  23. # zic -p rightzone
  24. # to correct things.
  25. # Use the command
  26. # make zonenames
  27. # to get a list of the values you can use for POSIXRULES.
  28. # If you want POSIX compatibility, use "America/New_York".
  29. POSIXRULES= America/New_York
  30. # Also see TZDEFRULESTRING below, which takes effect only
  31. # if the time zone files cannot be accessed.
  32. # Everything gets put in subdirectories of. . .
  33. TOPDIR= /usr/local
  34. # "Compiled" time zone information is placed in the "TZDIR" directory
  35. # (and subdirectories).
  36. # Use an absolute path name for TZDIR unless you're just testing the software.
  37. TZDIR= $(TOPDIR)/etc/zoneinfo
  38. # The "tzselect", "zic", and "zdump" commands get installed in. . .
  39. ETCDIR= $(TOPDIR)/etc
  40. # If you "make INSTALL", the "date" command gets installed in. . .
  41. BINDIR= $(TOPDIR)/bin
  42. # Manual pages go in subdirectories of. . .
  43. MANDIR= $(TOPDIR)/man
  44. # Library functions are put in an archive in LIBDIR.
  45. LIBDIR= $(TOPDIR)/lib
  46. TZLIB= $(LIBDIR)/libtz.a
  47. # If you always want time values interpreted as "seconds since the epoch
  48. # (not counting leap seconds)", use
  49. # REDO= posix_only
  50. # below. If you always want right time values interpreted as "seconds since
  51. # the epoch" (counting leap seconds)", use
  52. # REDO= right_only
  53. # below. If you want both sets of data available, with leap seconds not
  54. # counted normally, use
  55. # REDO= posix_right
  56. # below. If you want both sets of data available, with leap seconds counted
  57. # normally, use
  58. # REDO= right_posix
  59. # below.
  60. # POSIX mandates that leap seconds not be counted; for compatibility with it,
  61. # use either "posix_only" or "posix_right".
  62. REDO= posix_right
  63. # Since "." may not be in PATH...
  64. YEARISTYPE= ./yearistype
  65. # Non-default libraries needed to link.
  66. # Add -lintl if you want to use `gettext' on Solaris.
  67. LDLIBS=
  68. # Add the following to the end of the "CFLAGS=" line as needed.
  69. # -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?)
  70. # -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see LDLIBS
  71. # -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
  72. # ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
  73. # -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?)
  74. # -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4)
  75. # -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
  76. # -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
  77. # -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
  78. # -DHAVE_SYMLINK=0 if your system lacks the symlink function
  79. # -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
  80. # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
  81. # -DLOCALE_HOME=\"path\" if locales are in "path", not "/usr/lib/locale"
  82. # -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
  83. # -DHAVE_UTMPX_H=1 if your compiler has a "utmpx.h"
  84. # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
  85. # DST transitions if the time zone files cannot be accessed
  86. # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
  87. # -TTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
  88. # the default is system-supplied, typically "/usr/lib/locale"
  89. # $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
  90. # -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
  91. # if you do not want run time warnings about formats that may cause
  92. # year 2000 grief
  93. # -DZIC_MAX_ABBR_LEN_WO_WARN=3
  94. # (or some other number) to set the maximum time zone abbreviation length
  95. # that zic will accept without a warning (the default is 6)
  96. GCC_DEBUG_FLAGS = -Dlint -g -O3 -fno-common \
  97. -Wall -Wcast-qual -Wconversion -Wmissing-prototypes \
  98. -Wnested-externs -Wpointer-arith -Wshadow \
  99. -Wtraditional # -Wstrict-prototypes -Wwrite-strings
  100. #
  101. # If you want to use System V compatibility code, add
  102. # -DUSG_COMPAT
  103. # to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight"
  104. # variables to be kept up-to-date by the time conversion functions. Neither
  105. # "timezone" nor "daylight" is described in X3J11's work.
  106. #
  107. # If your system has a "GMT offset" field in its "struct tm"s
  108. # (or if you decide to add such a field in your system's "time.h" file),
  109. # add the name to a define such as
  110. # -DTM_GMTOFF=tm_gmtoff
  111. # or
  112. # -DTM_GMTOFF=_tm_gmtoff
  113. # to the end of the "CFLAGS=" line.
  114. # Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work;
  115. # in its work, use of "tm_gmtoff" is described as non-conforming.
  116. # Both Linux and BSD have done the equivalent of defining TM_GMTOFF in
  117. # their recent releases.
  118. #
  119. # If your system has a "zone abbreviation" field in its "struct tm"s
  120. # (or if you decide to add such a field in your system's "time.h" file),
  121. # add the name to a define such as
  122. # -DTM_ZONE=tm_zone
  123. # or
  124. # -DTM_ZONE=_tm_zone
  125. # to the end of the "CFLAGS=" line.
  126. # Neither tm_zone nor _tm_zone is described in X3J11's work;
  127. # in its work, use of "tm_zone" is described as non-conforming.
  128. # Both UCB and Sun have done the equivalent of defining TM_ZONE in
  129. # their recent releases.
  130. #
  131. # If you want functions that were inspired by early versions of X3J11's work,
  132. # add
  133. # -DSTD_INSPIRED
  134. # to the end of the "CFLAGS=" line. This arranges for the functions
  135. # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
  136. # "posix2time", and "time2posix" to be added to the time conversion library.
  137. # "tzsetwall" is like "tzset" except that it arranges for local wall clock
  138. # time (rather than the time specified in the TZ environment variable)
  139. # to be used.
  140. # "offtime" is like "gmtime" except that it accepts a second (long) argument
  141. # that gives an offset to add to the time_t when converting it.
  142. # "timelocal" is equivalent to "mktime".
  143. # "timegm" is like "timelocal" except that it turns a struct tm into
  144. # a time_t using UTC (rather than local time as "timelocal" does).
  145. # "timeoff" is like "timegm" except that it accepts a second (long) argument
  146. # that gives an offset to use when converting to a time_t.
  147. # "posix2time" and "time2posix" are described in an included manual page.
  148. # X3J11's work does not describe any of these functions.
  149. # Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
  150. # These functions may well disappear in future releases of the time
  151. # conversion package.
  152. #
  153. # If you want Source Code Control System ID's left out of object modules, add
  154. # -DNOID
  155. # to the end of the "CFLAGS=" line.
  156. #
  157. # If you'll never want to handle solar-time-based time zones, add
  158. # -DNOSOLAR
  159. # to the end of the "CFLAGS=" line
  160. # (and comment out the "SDATA=" line below).
  161. # This reduces (slightly) the run-time data-space requirements of
  162. # the time conversion functions; it may reduce the acceptability of your system
  163. # to folks in oil- and cash-rich places.
  164. #
  165. # If you want to allocate state structures in localtime, add
  166. # -DALL_STATE
  167. # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
  168. #
  169. # If you want an "altzone" variable (a la System V Release 3.1), add
  170. # -DALTZONE
  171. # to the end of the "CFLAGS=" line.
  172. # This variable is not described in X3J11's work.
  173. #
  174. # If you want a "gtime" function (a la MACH), add
  175. # -DCMUCS
  176. # to the end of the "CFLAGS=" line
  177. # This function is not described in X3J11's work.
  178. #
  179. # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
  180. # out by the National Institute of Standards and Technology
  181. # which claims to test C and Posix conformance. If you want to pass PCTS, add
  182. # -DPCTS
  183. # to the end of the "CFLAGS=" line.
  184. #
  185. # If you want strict compliance with XPG4 as of 1994-04-09, add
  186. # -DXPG4_1994_04_09
  187. # to the end of the "CFLAGS=" line. This causes "strftime" to always return
  188. # 53 as a week number (rather than 52 or 53) for those days in January that
  189. # before the first Monday in January when a "%V" format is used and January 1
  190. # falls on a Friday, Saturday, or Sunday.
  191. CFLAGS=
  192. # If you want zic's -s option used when installing, uncomment the next line
  193. # ZFLAGS= -s
  194. zic= ./zic
  195. ZIC= $(zic) $(ZFLAGS)
  196. # The name of a Posix-compliant `awk' on your system.
  197. AWK= nawk
  198. # The path where SGML DTDs are kept.
  199. SGML_SEARCH_PATH= $(TOPDIR)/share/doc/sgml-lib/REC-html401-19991224/
  200. # The catalog file(s) to use when validating.
  201. SGML_CATALOG_FILES= HTML4.cat
  202. # The name, arguments and environment of a program to validate your web pages.
  203. # See <http://www.jclark.com/sp/> for a validator, and
  204. # <http://validator.w3.org/source/> for a validation library.
  205. VALIDATE = nsgmls
  206. VALIDATE_FLAGS = -s -B -wall -wno-unused-param
  207. VALIDATE_ENV = \
  208. SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
  209. SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
  210. SP_CHARSET_FIXED=YES \
  211. SP_ENCODING=UTF-8
  212. ###############################################################################
  213. cc= cc
  214. CC= $(cc) -DTZDIR=\"$(TZDIR)\"
  215. TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
  216. TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
  217. TZDSRCS= zdump.c localtime.c ialloc.c
  218. TZDOBJS= zdump.o localtime.o ialloc.o
  219. DATESRCS= date.c localtime.c strftime.c asctime.c
  220. DATEOBJS= date.o localtime.o strftime.o asctime.o
  221. LIBSRCS= localtime.c asctime.c difftime.c
  222. LIBOBJS= localtime.o asctime.o difftime.o
  223. HEADERS= tzfile.h private.h
  224. NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c
  225. NEWUCBSRCS= date.c strftime.c
  226. SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh
  227. MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
  228. tzfile.5 tzselect.8 zic.8 zdump.8
  229. DOCS= README Theory $(MANS) date.1 Makefile
  230. PRIMARY_YDATA= africa antarctica asia australasia \
  231. europe northamerica southamerica
  232. YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward
  233. NDATA= systemv factory
  234. SDATA= solar87 solar88 solar89
  235. TDATA= $(YDATA) $(NDATA) $(SDATA)
  236. TABDATA= iso3166.tab zone.tab
  237. DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) leapseconds yearistype.sh
  238. WEB_PAGES= tz-art.htm tz-link.htm
  239. MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
  240. itca.jpg $(WEB_PAGES) checktab.awk workman.sh \
  241. zoneinfo2tdf.pl
  242. ENCHILADA= $(DOCS) $(SOURCES) $(DATA) $(MISC)
  243. # And for the benefit of csh users on systems that assume the user
  244. # shell should be used to handle commands in Makefiles. . .
  245. SHELL= /bin/sh
  246. all: tzselect zic zdump $(LIBOBJS)
  247. ALL: all date
  248. install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
  249. $(ZIC) -y $(YEARISTYPE) \
  250. -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
  251. -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
  252. cp iso3166.tab zone.tab $(TZDIR)/.
  253. -mkdir $(TOPDIR) $(ETCDIR)
  254. cp tzselect zic zdump $(ETCDIR)/.
  255. -mkdir $(TOPDIR) $(MANDIR) \
  256. $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
  257. -rm -f $(MANDIR)/man3/newctime.3 \
  258. $(MANDIR)/man3/newtzset.3 \
  259. $(MANDIR)/man5/tzfile.5 \
  260. $(MANDIR)/man8/tzselect.8 \
  261. $(MANDIR)/man8/zdump.8 \
  262. $(MANDIR)/man8/zic.8
  263. cp newctime.3 newtzset.3 $(MANDIR)/man3/.
  264. cp tzfile.5 $(MANDIR)/man5/.
  265. cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
  266. INSTALL: ALL install date.1
  267. -mkdir $(TOPDIR) $(BINDIR)
  268. cp date $(BINDIR)/.
  269. -mkdir $(TOPDIR) $(MANDIR) $(MANDIR)/man1
  270. -rm -f $(MANDIR)/man1/date.1
  271. cp date.1 $(MANDIR)/man1/.
  272. zdump: $(TZDOBJS)
  273. $(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
  274. zic: $(TZCOBJS) yearistype
  275. $(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
  276. yearistype: yearistype.sh
  277. cp yearistype.sh yearistype
  278. chmod +x yearistype
  279. posix_only: zic $(TDATA)
  280. $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA)
  281. right_only: zic leapseconds $(TDATA)
  282. $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
  283. # In earlier versions of this makefile, the other two directories were
  284. # subdirectories of $(TZDIR). However, this led to configuration errors.
  285. # For example, with posix_right under the earlier scheme,
  286. # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
  287. # but gmtime without leap seconds, which led to problems with applications
  288. # like sendmail that subtract gmtime from localtime.
  289. # Therefore, the other two directories are now siblings of $(TZDIR).
  290. # You must replace all of $(TZDIR) to switch from not using leap seconds
  291. # to using them, or vice versa.
  292. other_two: zic leapseconds $(TDATA)
  293. $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
  294. $(ZIC) -y $(YEARISTYPE) \
  295. -d $(TZDIR)-leaps -L leapseconds $(TDATA)
  296. posix_right: posix_only other_two
  297. right_posix: right_only other_two
  298. zones: $(REDO)
  299. $(TZLIB): $(LIBOBJS)
  300. -mkdir $(TOPDIR) $(LIBDIR)
  301. ar ru $@ $(LIBOBJS)
  302. if [ -x /usr/ucb/ranlib -o -x /usr/bin/ranlib ] ; \
  303. then ranlib $@ ; fi
  304. date: $(DATEOBJS)
  305. $(CC) $(CFLAGS) date.o localtime.o asctime.o strftime.o \
  306. $(LDLIBS) -lc -o $@
  307. tzselect: tzselect.ksh
  308. sed \
  309. -e 's|AWK=[^}]*|AWK=$(AWK)|g' \
  310. -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
  311. <$? >$@
  312. chmod +x $@
  313. check: check_tables check_web
  314. check_tables: checktab.awk $(PRIMARY_YDATA)
  315. $(AWK) -f checktab.awk $(PRIMARY_YDATA)
  316. check_web: $(WEB_PAGES)
  317. $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
  318. clean:
  319. rm -f core *.o *.out tzselect zdump zic yearistype date
  320. maintainer-clean: clean
  321. @echo 'This command is intended for maintainers to use; it'
  322. @echo 'deletes files that may need special tools to rebuild.'
  323. rm -f *.[1-8].txt tzcode.tar.gz tzdata.tar.gz
  324. names:
  325. @echo $(ENCHILADA)
  326. # The zics below ensure that each data file can stand on its own.
  327. # We also do an all-files run to catch links to links.
  328. public: $(ENCHILADA)
  329. make maintainer-clean
  330. make "CFLAGS=$(GCC_DEBUG_FLAGS)"
  331. -mkdir /tmp/,tzpublic
  332. -for i in $(TDATA) ; do zic -v -d /tmp/,tzpublic $$i 2>&1 | grep -v "starting year" ; done
  333. for i in $(TDATA) ; do zic -d /tmp/,tzpublic $$i || exit; done
  334. zic -v -d /tmp/,tzpublic $(TDATA) || exit
  335. rm -f -r /tmp/,tzpublic
  336. for i in *.[1-8] ; do sh workman.sh $$i > $$i.txt || exit; done
  337. $(AWK) -f checktab.awk $(PRIMARY_YDATA)
  338. tar cf - $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | gzip -9 > tzcode.tar.gz
  339. tar cf - $(DATA) | gzip -9 > tzdata.tar.gz
  340. typecheck:
  341. make clean
  342. for i in "long long" unsigned double; \
  343. do \
  344. make CFLAGS="-DTYPECHECK -D_TIME_T \"-Dtime_t=$$i\"" ; \
  345. ./zdump -v Europe/Rome ; \
  346. make clean ; \
  347. done
  348. zonenames: $(TDATA)
  349. @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
  350. asctime.o: private.h tzfile.h
  351. date.o: private.h
  352. difftime.o: private.h
  353. ialloc.o: private.h
  354. localtime.o: private.h tzfile.h
  355. scheck.o: private.h
  356. strftime.o: tzfile.h
  357. zic.o: private.h tzfile.h
  358. .KEEP_STATE: