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