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