1# <pre> 2# This file is in the public domain, so clarified as of 3# 2009-05-17 by Arthur David Olson. 4 5# Package name for the code distribution. 6PACKAGE= tzcode 7 8# Version numbers of the code and data distributions. 9VERSION= 2013b 10 11# Email address for bug reports. 12BUGEMAIL= tz@iana.org 13 14# Change the line below for your time zone (after finding the zone you want in 15# the time zone files, or adding it to a time zone file). 16# Alternately, if you discover you've got the wrong time zone, you can just 17# zic -l rightzone 18# to correct things. 19# Use the command 20# make zonenames 21# to get a list of the values you can use for LOCALTIME. 22 23LOCALTIME= GMT 24 25# If you want something other than Eastern United States time as a template 26# for handling POSIX-style time zone environment variables, 27# change the line below (after finding the zone you want in the 28# time zone files, or adding it to a time zone file). 29# (When a POSIX-style environment variable is handled, the rules in the 30# template file are used to determine "spring forward" and "fall back" days and 31# times; the environment variable itself specifies UTC offsets of standard and 32# summer time.) 33# Alternately, if you discover you've got the wrong time zone, you can just 34# zic -p rightzone 35# to correct things. 36# Use the command 37# make zonenames 38# to get a list of the values you can use for POSIXRULES. 39# If you want POSIX compatibility, use "America/New_York". 40 41POSIXRULES= America/New_York 42 43# Also see TZDEFRULESTRING below, which takes effect only 44# if the time zone files cannot be accessed. 45 46# Everything gets put in subdirectories of. . . 47 48TOPDIR= /usr/local 49 50# "Compiled" time zone information is placed in the "TZDIR" directory 51# (and subdirectories). 52# Use an absolute path name for TZDIR unless you're just testing the software. 53 54TZDIR= $(TOPDIR)/etc/zoneinfo 55 56# The "tzselect", "zic", and "zdump" commands get installed in. . . 57 58ETCDIR= $(TOPDIR)/etc 59 60# If you "make INSTALL", the "date" command gets installed in. . . 61 62BINDIR= $(TOPDIR)/bin 63 64# Manual pages go in subdirectories of. . . 65 66MANDIR= $(TOPDIR)/man 67 68# Library functions are put in an archive in LIBDIR. 69 70LIBDIR= $(TOPDIR)/lib 71TZLIB= $(LIBDIR)/libtz.a 72 73# If you always want time values interpreted as "seconds since the epoch 74# (not counting leap seconds)", use 75# REDO= posix_only 76# below. If you always want right time values interpreted as "seconds since 77# the epoch" (counting leap seconds)", use 78# REDO= right_only 79# below. If you want both sets of data available, with leap seconds not 80# counted normally, use 81# REDO= posix_right 82# below. If you want both sets of data available, with leap seconds counted 83# normally, use 84# REDO= right_posix 85# below. 86# POSIX mandates that leap seconds not be counted; for compatibility with it, 87# use either "posix_only" or "posix_right". 88 89REDO= posix_right 90 91# Since "." may not be in PATH... 92 93YEARISTYPE= ./yearistype 94 95# Non-default libraries needed to link. 96# Add -lintl if you want to use `gettext' on Solaris. 97LDLIBS= 98 99# Add the following to the end of the "CFLAGS=" line as needed. 100# -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?) 101# -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see LDLIBS 102# -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares 103# ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8). 104# -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?) 105# -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4) 106# -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD) 107# -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD) 108# -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h" 109# -DHAVE_SYMLINK=0 if your system lacks the symlink function 110# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h" 111# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h" 112# -DLOCALE_HOME=\"path\" if locales are in "path", not "/usr/lib/locale" 113# -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?) 114# -DHAVE_UTMPX_H=1 if your compiler has a "utmpx.h" 115# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified 116# DST transitions if the time zone files cannot be accessed 117# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" 118# -TTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; 119# the default is system-supplied, typically "/usr/lib/locale" 120# $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking 121# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1 122# if you do not want run time warnings about formats that may cause 123# year 2000 grief 124# -DNO_ERROR_IN_DST_GAP=1 125# if you want mktime() not to return an error in the DST gap. 126# -DZIC_MAX_ABBR_LEN_WO_WARN=3 127# (or some other number) to set the maximum time zone abbreviation length 128# that zic will accept without a warning (the default is 6) 129GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \ 130 -Wall -Wextra \ 131 -Wbad-function-cast -Wcast-align -Wcast-qual \ 132 -Wformat=2 -Winit-self \ 133 -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \ 134 -Wnested-externs \ 135 -Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \ 136 -Wno-type-limits \ 137 -Wno-unused-parameter -Woverlength-strings -Wpointer-arith \ 138 -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \ 139 -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines \ 140 -Wwrite-strings 141# 142# If you want to use System V compatibility code, add 143# -DUSG_COMPAT 144# to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight" 145# variables to be kept up-to-date by the time conversion functions. Neither 146# "timezone" nor "daylight" is described in X3J11's work. 147# 148# If your system has a "GMT offset" field in its "struct tm"s 149# (or if you decide to add such a field in your system's "time.h" file), 150# add the name to a define such as 151# -DTM_GMTOFF=tm_gmtoff 152# or 153# -DTM_GMTOFF=_tm_gmtoff 154# to the end of the "CFLAGS=" line. 155# Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work; 156# in its work, use of "tm_gmtoff" is described as non-conforming. 157# Both Linux and BSD have done the equivalent of defining TM_GMTOFF in 158# their recent releases. 159# 160# If your system has a "zone abbreviation" field in its "struct tm"s 161# (or if you decide to add such a field in your system's "time.h" file), 162# add the name to a define such as 163# -DTM_ZONE=tm_zone 164# or 165# -DTM_ZONE=_tm_zone 166# to the end of the "CFLAGS=" line. 167# Neither tm_zone nor _tm_zone is described in X3J11's work; 168# in its work, use of "tm_zone" is described as non-conforming. 169# Both UCB and Sun have done the equivalent of defining TM_ZONE in 170# their recent releases. 171# 172# If you want functions that were inspired by early versions of X3J11's work, 173# add 174# -DSTD_INSPIRED 175# to the end of the "CFLAGS=" line. This arranges for the functions 176# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff", 177# "posix2time", and "time2posix" to be added to the time conversion library. 178# "tzsetwall" is like "tzset" except that it arranges for local wall clock 179# time (rather than the time specified in the TZ environment variable) 180# to be used. 181# "offtime" is like "gmtime" except that it accepts a second (long) argument 182# that gives an offset to add to the time_t when converting it. 183# "timelocal" is equivalent to "mktime". 184# "timegm" is like "timelocal" except that it turns a struct tm into 185# a time_t using UTC (rather than local time as "timelocal" does). 186# "timeoff" is like "timegm" except that it accepts a second (long) argument 187# that gives an offset to use when converting to a time_t. 188# "posix2time" and "time2posix" are described in an included manual page. 189# X3J11's work does not describe any of these functions. 190# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0. 191# These functions may well disappear in future releases of the time 192# conversion package. 193# 194# If you want Source Code Control System ID's left out of object modules, add 195# -DNOID 196# to the end of the "CFLAGS=" line. 197# 198# If you'll never want to handle solar-time-based time zones, add 199# -DNOSOLAR 200# to the end of the "CFLAGS=" line 201# (and comment out the "SDATA=" line below). 202# This reduces (slightly) the run-time data-space requirements of 203# the time conversion functions; it may reduce the acceptability of your system 204# to folks in oil- and cash-rich places. 205# 206# If you want to allocate state structures in localtime, add 207# -DALL_STATE 208# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 209# 210# If you want an "altzone" variable (a la System V Release 3.1), add 211# -DALTZONE 212# to the end of the "CFLAGS=" line. 213# This variable is not described in X3J11's work. 214# 215# If you want a "gtime" function (a la MACH), add 216# -DCMUCS 217# to the end of the "CFLAGS=" line 218# This function is not described in X3J11's work. 219# 220# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 221# out by the National Institute of Standards and Technology 222# which claims to test C and Posix conformance. If you want to pass PCTS, add 223# -DPCTS 224# to the end of the "CFLAGS=" line. 225# 226# If you want strict compliance with XPG4 as of 1994-04-09, add 227# -DXPG4_1994_04_09 228# to the end of the "CFLAGS=" line. This causes "strftime" to always return 229# 53 as a week number (rather than 52 or 53) for those days in January that 230# before the first Monday in January when a "%V" format is used and January 1 231# falls on a Friday, Saturday, or Sunday. 232 233CFLAGS= 234 235# Linker flags. Default to $(LFLAGS) for backwards compatibility 236# to tzcode2012h and earlier. 237 238LDFLAGS= $(LFLAGS) 239 240zic= ./zic 241ZIC= $(zic) $(ZFLAGS) 242 243# The name of a Posix-compliant `awk' on your system. 244AWK= awk 245 246# The full path name of a Posix-compliant shell that supports the Korn shell's 247# 'select' statement, as an extension. These days, Bash is the most popular. 248KSHELL= /bin/bash 249 250# The path where SGML DTDs are kept. 251# The default is appropriate for Ubuntu 12.10. 252SGML_TOPDIR= /usr 253SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd 254SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224 255 256# The catalog file(s) to use when validating. 257SGML_CATALOG_FILES= HTML4.cat 258 259# The name, arguments and environment of a program to validate your web pages. 260# See <http://www.jclark.com/sp/> for a validator, and 261# <http://validator.w3.org/source/> for a validation library. 262VALIDATE = nsgmls 263VALIDATE_FLAGS = -s -B -wall -wno-unused-param 264VALIDATE_ENV = \ 265 SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ 266 SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ 267 SP_CHARSET_FIXED=YES \ 268 SP_ENCODING=UTF-8 269 270# INVALID_CHAR is a regular expression that matches invalid characters in 271# distributed files. For now, stick to a safe subset of ASCII. 272# The caller must set the shell variable 'sharp' to the character '#', 273# since Makefile macros cannot contain '#'. 274# TAB_CHAR is a single tab character, in single quotes. 275TAB_CHAR= ' ' 276INVALID_CHAR1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' 277INVALID_CHAR2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' 278INVALID_CHAR3= 'abcdefghijklmnopqrstuvwxyz{|}~' 279INVALID_CHAR= '[^]'$(INVALID_CHAR1)$(INVALID_CHAR2)$(INVALID_CHAR3)'-]' 280 281# Flags to give 'tar' when making a distribution. 282# Try to use flags appropriate for GNU tar. 283GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w 284TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ 285 then echo $(GNUTARFLAGS); \ 286 else :; \ 287 fi` 288 289# Flags to give 'gzip' when making a distribution. 290GZIPFLAGS= -9n 291 292############################################################################### 293 294cc= cc 295CC= $(cc) -DTZDIR=\"$(TZDIR)\" 296 297TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c 298TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o 299TZDSRCS= zdump.c localtime.c ialloc.c 300TZDOBJS= zdump.o localtime.o ialloc.o 301DATESRCS= date.c localtime.c strftime.c asctime.c 302DATEOBJS= date.o localtime.o strftime.o asctime.o 303LIBSRCS= localtime.c asctime.c difftime.c 304LIBOBJS= localtime.o asctime.o difftime.o 305HEADERS= tzfile.h private.h 306NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c 307NEWUCBSRCS= date.c strftime.c 308SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh 309MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 310 tzfile.5 tzselect.8 zic.8 zdump.8 311COMMON= Makefile 312DOCS= README Theory $(MANS) date.1 313PRIMARY_YDATA= africa antarctica asia australasia \ 314 europe northamerica southamerica 315YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward 316NDATA= systemv factory 317SDATA= solar87 solar88 solar89 318TDATA= $(YDATA) $(NDATA) $(SDATA) 319TABDATA= iso3166.tab zone.tab 320DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) leapseconds yearistype.sh 321WEB_PAGES= tz-art.htm tz-link.htm 322MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \ 323 $(WEB_PAGES) checktab.awk workman.sh \ 324 zoneinfo2tdf.pl 325ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) 326 327# And for the benefit of csh users on systems that assume the user 328# shell should be used to handle commands in Makefiles. . . 329 330SHELL= /bin/sh 331 332all: tzselect zic zdump $(LIBOBJS) 333 334ALL: all date 335 336install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA) 337 $(ZIC) -y $(YEARISTYPE) \ 338 -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES) 339 -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab 340 cp iso3166.tab zone.tab $(TZDIR)/. 341 -mkdir $(TOPDIR) $(ETCDIR) 342 cp tzselect zic zdump $(ETCDIR)/. 343 -mkdir $(TOPDIR) $(MANDIR) \ 344 $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8 345 -rm -f $(MANDIR)/man3/newctime.3 \ 346 $(MANDIR)/man3/newtzset.3 \ 347 $(MANDIR)/man5/tzfile.5 \ 348 $(MANDIR)/man8/tzselect.8 \ 349 $(MANDIR)/man8/zdump.8 \ 350 $(MANDIR)/man8/zic.8 351 cp newctime.3 newtzset.3 $(MANDIR)/man3/. 352 cp tzfile.5 $(MANDIR)/man5/. 353 cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/. 354 355INSTALL: ALL install date.1 356 -mkdir $(TOPDIR) $(BINDIR) 357 cp date $(BINDIR)/. 358 -mkdir $(TOPDIR) $(MANDIR) $(MANDIR)/man1 359 -rm -f $(MANDIR)/man1/date.1 360 cp date.1 $(MANDIR)/man1/. 361 362version.h: 363 (echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \ 364 echo 'static char const TZVERSION[]="$(VERSION)";' && \ 365 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@ 366 367zdump: $(TZDOBJS) 368 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) 369 370zic: $(TZCOBJS) yearistype 371 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) 372 373yearistype: yearistype.sh 374 cp yearistype.sh yearistype 375 chmod +x yearistype 376 377posix_only: zic $(TDATA) 378 $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) 379 380right_only: zic leapseconds $(TDATA) 381 $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA) 382 383# In earlier versions of this makefile, the other two directories were 384# subdirectories of $(TZDIR). However, this led to configuration errors. 385# For example, with posix_right under the earlier scheme, 386# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 387# but gmtime without leap seconds, which led to problems with applications 388# like sendmail that subtract gmtime from localtime. 389# Therefore, the other two directories are now siblings of $(TZDIR). 390# You must replace all of $(TZDIR) to switch from not using leap seconds 391# to using them, or vice versa. 392other_two: zic leapseconds $(TDATA) 393 $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA) 394 $(ZIC) -y $(YEARISTYPE) \ 395 -d $(TZDIR)-leaps -L leapseconds $(TDATA) 396 397posix_right: posix_only other_two 398 399right_posix: right_only other_two 400 401zones: $(REDO) 402 403$(TZLIB): $(LIBOBJS) 404 -mkdir $(TOPDIR) $(LIBDIR) 405 ar ru $@ $(LIBOBJS) 406 if [ -x /usr/ucb/ranlib ] || [ -x /usr/bin/ranlib ]; \ 407 then ranlib $@ ; fi 408 409date: $(DATEOBJS) 410 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) 411 412tzselect: tzselect.ksh 413 sed \ 414 -e 's|#!/bin/bash|#!$(KSHELL)|g' \ 415 -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ 416 -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ 417 -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ 418 -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ 419 -e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \ 420 <$? >$@ 421 chmod +x $@ 422 423check: check_character_set check_tables check_web 424 425check_character_set: $(ENCHILADA) 426 sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA) 427 428check_tables: checktab.awk $(PRIMARY_YDATA) 429 $(AWK) -f checktab.awk $(PRIMARY_YDATA) 430 431check_web: $(WEB_PAGES) 432 $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) 433 434clean: 435 rm -f core *.o *.out \ 436 date tzselect version.h zdump zic yearistype 437 rm -f -r tzpublic 438 439maintainer-clean: clean 440 @echo 'This command is intended for maintainers to use; it' 441 @echo 'deletes files that may need special tools to rebuild.' 442 rm -f *.[1-8].txt *.asc *.tar.gz 443 444names: 445 @echo $(ENCHILADA) 446 447public: check check_public set-timestamps tarballs signatures 448 449# Set the time stamps to those of the git repository, if available, 450# and if the files have not changed since then. 451# This uses GNU 'touch' syntax 'touch -d@N FILE', 452# where N is the number of seconds since 1970. 453# If git or GNU 'touch' is absent, do nothing. 454set-timestamps: 455 -TZ=UTC0 && export TZ && files=`git ls-files` && \ 456 touch -d @1 test.out && rm -f test.out && \ 457 for file in $$files; do \ 458 test -z "`git diff --name-only $$file`" || continue; \ 459 cmd="touch -d @`git log -1 --format='format:%ct' $$file \ 460 ` $$file" && \ 461 echo "$$cmd" && \ 462 $$cmd || exit; \ 463 done 464 465# The zics below ensure that each data file can stand on its own. 466# We also do an all-files run to catch links to links. 467 468check_public: $(ENCHILADA) 469 make maintainer-clean 470 make "CFLAGS=$(GCC_DEBUG_FLAGS)" 471 mkdir tzpublic 472 for i in $(TDATA) ; do \ 473 $(zic) -v -d tzpublic $$i 2>&1 || exit; \ 474 done 475 $(zic) -v -d tzpublic $(TDATA) 476 rm -f -r tzpublic 477 478tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz 479 480tzcode$(VERSION).tar.gz: $(COMMON) $(DOCS) $(SOURCES) $(MISC) 481 for i in *.[1-8] ; do \ 482 LC_ALL=C sh workman.sh $$i > $$i.txt && \ 483 touch -r $$i $$i.txt || exit; \ 484 done 485 LC_ALL=C && export LC_ALL && \ 486 tar $(TARFLAGS) -cf - \ 487 $(COMMON) $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | \ 488 gzip $(GZIPFLAGS) > $@ 489 490tzdata$(VERSION).tar.gz: $(COMMON) $(DATA) 491 LC_ALL=C && export LC_ALL && \ 492 tar $(TARFLAGS) -cf - $(COMMON) $(DATA) | \ 493 gzip $(GZIPFLAGS) > $@ 494 495signatures: tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc 496 497tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz 498 gpg --armor --detach-sign $? 499 500tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz 501 gpg --armor --detach-sign $? 502 503typecheck: 504 make clean 505 for i in "long long" unsigned double; \ 506 do \ 507 make CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \ 508 ./zdump -v Europe/Rome ; \ 509 make clean ; \ 510 done 511 512zonenames: $(TDATA) 513 @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA) 514 515asctime.o: private.h tzfile.h 516date.o: private.h 517difftime.o: private.h 518ialloc.o: private.h 519localtime.o: private.h tzfile.h 520scheck.o: private.h 521strftime.o: tzfile.h 522zdump.o: version.h 523zic.o: private.h tzfile.h version.h 524 525.KEEP_STATE: 526