Makefile revision 1.22
11.1Smlelstv# This file is in the public domain, so clarified as of
21.1Smlelstv# 2009-05-17 by Arthur David Olson.
31.1Smlelstv
41.10Schristos# Package name for the code distribution.
51.10SchristosPACKAGE=	tzcode
61.10Schristos
71.6Schristos# Version numbers of the code and data distributions.
81.22SchristosVERSION=	2014f
91.9Schristos
101.9Schristos# Email address for bug reports.
111.9SchristosBUGEMAIL=	tz@iana.org
121.6Schristos
131.1Smlelstv# Change the line below for your time zone (after finding the zone you want in
141.1Smlelstv# the time zone files, or adding it to a time zone file).
151.1Smlelstv# Alternately, if you discover you've got the wrong time zone, you can just
161.1Smlelstv#	zic -l rightzone
171.1Smlelstv# to correct things.
181.1Smlelstv# Use the command
191.1Smlelstv#	make zonenames
201.1Smlelstv# to get a list of the values you can use for LOCALTIME.
211.1Smlelstv
221.4SchristosLOCALTIME=	GMT
231.1Smlelstv
241.1Smlelstv# If you want something other than Eastern United States time as a template
251.1Smlelstv# for handling POSIX-style time zone environment variables,
261.1Smlelstv# change the line below (after finding the zone you want in the
271.1Smlelstv# time zone files, or adding it to a time zone file).
281.1Smlelstv# (When a POSIX-style environment variable is handled, the rules in the
291.1Smlelstv# template file are used to determine "spring forward" and "fall back" days and
301.15Schristos# times; the environment variable itself specifies UT offsets of standard and
311.1Smlelstv# summer time.)
321.1Smlelstv# Alternately, if you discover you've got the wrong time zone, you can just
331.1Smlelstv#	zic -p rightzone
341.1Smlelstv# to correct things.
351.1Smlelstv# Use the command
361.1Smlelstv#	make zonenames
371.1Smlelstv# to get a list of the values you can use for POSIXRULES.
381.1Smlelstv# If you want POSIX compatibility, use "America/New_York".
391.1Smlelstv
401.1SmlelstvPOSIXRULES=	America/New_York
411.1Smlelstv
421.1Smlelstv# Also see TZDEFRULESTRING below, which takes effect only
431.1Smlelstv# if the time zone files cannot be accessed.
441.1Smlelstv
451.1Smlelstv# Everything gets put in subdirectories of. . .
461.1Smlelstv
471.1SmlelstvTOPDIR=		/usr/local
481.1Smlelstv
491.1Smlelstv# "Compiled" time zone information is placed in the "TZDIR" directory
501.1Smlelstv# (and subdirectories).
511.1Smlelstv# Use an absolute path name for TZDIR unless you're just testing the software.
521.1Smlelstv
531.15SchristosTZDIR_BASENAME=	zoneinfo
541.15SchristosTZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
551.1Smlelstv
561.14Schristos# Types to try, as an alternative to time_t.  int64_t should be first.
571.14SchristosTIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
581.14Schristos
591.1Smlelstv# The "tzselect", "zic", and "zdump" commands get installed in. . .
601.1Smlelstv
611.1SmlelstvETCDIR=		$(TOPDIR)/etc
621.1Smlelstv
631.1Smlelstv# If you "make INSTALL", the "date" command gets installed in. . .
641.1Smlelstv
651.1SmlelstvBINDIR=		$(TOPDIR)/bin
661.1Smlelstv
671.1Smlelstv# Manual pages go in subdirectories of. . .
681.1Smlelstv
691.1SmlelstvMANDIR=		$(TOPDIR)/man
701.1Smlelstv
711.1Smlelstv# Library functions are put in an archive in LIBDIR.
721.1Smlelstv
731.1SmlelstvLIBDIR=		$(TOPDIR)/lib
741.1Smlelstv
751.1Smlelstv# If you always want time values interpreted as "seconds since the epoch
761.1Smlelstv# (not counting leap seconds)", use
771.1Smlelstv#	REDO=		posix_only
781.1Smlelstv# below.  If you always want right time values interpreted as "seconds since
791.1Smlelstv# the epoch" (counting leap seconds)", use
801.1Smlelstv#	REDO=		right_only
811.1Smlelstv# below.  If you want both sets of data available, with leap seconds not
821.1Smlelstv# counted normally, use
831.1Smlelstv#	REDO=		posix_right
841.1Smlelstv# below.  If you want both sets of data available, with leap seconds counted
851.1Smlelstv# normally, use
861.1Smlelstv#	REDO=		right_posix
871.1Smlelstv# below.
881.1Smlelstv# POSIX mandates that leap seconds not be counted; for compatibility with it,
891.1Smlelstv# use either "posix_only" or "posix_right".
901.1Smlelstv
911.1SmlelstvREDO=		posix_right
921.1Smlelstv
931.1Smlelstv# Since "." may not be in PATH...
941.1Smlelstv
951.1SmlelstvYEARISTYPE=	./yearistype
961.1Smlelstv
971.1Smlelstv# Non-default libraries needed to link.
981.22Schristos# Add -lintl if you want to use 'gettext' on Solaris.
991.1SmlelstvLDLIBS=
1001.1Smlelstv
1011.1Smlelstv# Add the following to the end of the "CFLAGS=" line as needed.
1021.19Schristos#  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
1031.22Schristos#  -DHAVE_ADJTIME=0 if 'adjtime' does not exist (SVR0?)
1041.14Schristos#  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
1051.22Schristos#  -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
1061.1Smlelstv#  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
1071.1Smlelstv#	ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
1081.14Schristos#  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
1091.16Schristos#  -DHAVE_LINK=0 if your system lacks a link function
1101.1Smlelstv#  -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?)
1111.1Smlelstv#  -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4)
1121.1Smlelstv#  -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
1131.1Smlelstv#  -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
1141.1Smlelstv#  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
1151.1Smlelstv#  -DHAVE_SYMLINK=0 if your system lacks the symlink function
1161.1Smlelstv#  -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
1171.1Smlelstv#  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
1181.1Smlelstv#  -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
1191.1Smlelstv#  -DHAVE_UTMPX_H=1 if your compiler has a "utmpx.h"
1201.14Schristos#  -DLOCALE_HOME=\"path\" if locales are in "path", not "/usr/lib/locale"
1211.14Schristos#  -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
1221.14Schristos#	if you do not want run time warnings about formats that may cause
1231.14Schristos#	year 2000 grief
1241.14Schristos#  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
1251.1Smlelstv#  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
1261.22Schristos#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
1271.1Smlelstv#	the default is system-supplied, typically "/usr/lib/locale"
1281.14Schristos#  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
1291.11Schristos#  -DNO_ERROR_IN_DST_GAP=1
1301.11Schristos#	if you want mktime() not to return an error in the DST gap.
1311.1Smlelstv#  -DZIC_MAX_ABBR_LEN_WO_WARN=3
1321.1Smlelstv#	(or some other number) to set the maximum time zone abbreviation length
1331.1Smlelstv#	that zic will accept without a warning (the default is 6)
1341.14Schristos#  $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
1351.7SchristosGCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
1361.7Schristos	-Wall -Wextra \
1371.7Schristos	-Wbad-function-cast -Wcast-align -Wcast-qual \
1381.22Schristos	-Wdeclaration-after-statement \
1391.22Schristos	-Wformat=2 -Winit-self -Wjump-misses-init \
1401.7Schristos	-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
1411.18Schristos	-Wnested-externs -Wno-address -Wno-cast-qual \
1421.7Schristos	-Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
1431.7Schristos	-Wno-type-limits \
1441.7Schristos	-Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
1451.7Schristos	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
1461.22Schristos	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
1471.22Schristos	-Wsuggest-attribute=pure -Wtrampolines \
1481.7Schristos	-Wwrite-strings
1491.1Smlelstv#
1501.1Smlelstv# If you want to use System V compatibility code, add
1511.1Smlelstv#	-DUSG_COMPAT
1521.1Smlelstv# to the end of the "CFLAGS=" line.  This arrange for "timezone" and "daylight"
1531.1Smlelstv# variables to be kept up-to-date by the time conversion functions.  Neither
1541.1Smlelstv# "timezone" nor "daylight" is described in X3J11's work.
1551.1Smlelstv#
1561.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s
1571.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
1581.1Smlelstv# add the name to a define such as
1591.1Smlelstv#	-DTM_GMTOFF=tm_gmtoff
1601.1Smlelstv# or
1611.1Smlelstv#	-DTM_GMTOFF=_tm_gmtoff
1621.1Smlelstv# to the end of the "CFLAGS=" line.
1631.1Smlelstv# Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work;
1641.1Smlelstv# in its work, use of "tm_gmtoff" is described as non-conforming.
1651.1Smlelstv# Both Linux and BSD have done the equivalent of defining TM_GMTOFF in
1661.1Smlelstv# their recent releases.
1671.1Smlelstv#
1681.1Smlelstv# If your system has a "zone abbreviation" field in its "struct tm"s
1691.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
1701.1Smlelstv# add the name to a define such as
1711.1Smlelstv#	-DTM_ZONE=tm_zone
1721.1Smlelstv# or
1731.1Smlelstv#	-DTM_ZONE=_tm_zone
1741.1Smlelstv# to the end of the "CFLAGS=" line.
1751.1Smlelstv# Neither tm_zone nor _tm_zone is described in X3J11's work;
1761.1Smlelstv# in its work, use of "tm_zone" is described as non-conforming.
1771.1Smlelstv# Both UCB and Sun have done the equivalent of defining TM_ZONE in
1781.1Smlelstv# their recent releases.
1791.1Smlelstv#
1801.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work,
1811.1Smlelstv# add
1821.1Smlelstv#	-DSTD_INSPIRED
1831.1Smlelstv# to the end of the "CFLAGS=" line.  This arranges for the functions
1841.1Smlelstv# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
1851.1Smlelstv# "posix2time", and "time2posix" to be added to the time conversion library.
1861.1Smlelstv# "tzsetwall" is like "tzset" except that it arranges for local wall clock
1871.1Smlelstv# time (rather than the time specified in the TZ environment variable)
1881.1Smlelstv# to be used.
1891.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument
1901.1Smlelstv# that gives an offset to add to the time_t when converting it.
1911.1Smlelstv# "timelocal" is equivalent to "mktime".
1921.1Smlelstv# "timegm" is like "timelocal" except that it turns a struct tm into
1931.15Schristos# a time_t using UT (rather than local time as "timelocal" does).
1941.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument
1951.1Smlelstv# that gives an offset to use when converting to a time_t.
1961.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page.
1971.1Smlelstv# X3J11's work does not describe any of these functions.
1981.1Smlelstv# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
1991.1Smlelstv# These functions may well disappear in future releases of the time
2001.1Smlelstv# conversion package.
2011.1Smlelstv#
2021.1Smlelstv# If you want to allocate state structures in localtime, add
2031.1Smlelstv#	-DALL_STATE
2041.1Smlelstv# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
2051.1Smlelstv#
2061.1Smlelstv# If you want an "altzone" variable (a la System V Release 3.1), add
2071.1Smlelstv#	-DALTZONE
2081.1Smlelstv# to the end of the "CFLAGS=" line.
2091.1Smlelstv# This variable is not described in X3J11's work.
2101.1Smlelstv#
2111.1Smlelstv# If you want a "gtime" function (a la MACH), add
2121.1Smlelstv#	-DCMUCS
2131.1Smlelstv# to the end of the "CFLAGS=" line
2141.1Smlelstv# This function is not described in X3J11's work.
2151.1Smlelstv#
2161.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
2171.1Smlelstv# out by the National Institute of Standards and Technology
2181.1Smlelstv# which claims to test C and Posix conformance.  If you want to pass PCTS, add
2191.1Smlelstv#	-DPCTS
2201.1Smlelstv# to the end of the "CFLAGS=" line.
2211.1Smlelstv#
2221.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add
2231.1Smlelstv#	-DXPG4_1994_04_09
2241.1Smlelstv# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
2251.1Smlelstv# 53 as a week number (rather than 52 or 53) for those days in January that
2261.1Smlelstv# before the first Monday in January when a "%V" format is used and January 1
2271.1Smlelstv# falls on a Friday, Saturday, or Sunday.
2281.1Smlelstv
2291.1SmlelstvCFLAGS=
2301.1Smlelstv
2311.9Schristos# Linker flags.  Default to $(LFLAGS) for backwards compatibility
2321.9Schristos# to tzcode2012h and earlier.
2331.9Schristos
2341.9SchristosLDFLAGS=	$(LFLAGS)
2351.1Smlelstv
2361.1Smlelstvzic=		./zic
2371.1SmlelstvZIC=		$(zic) $(ZFLAGS)
2381.1Smlelstv
2391.15SchristosZFLAGS=
2401.15Schristos
2411.22Schristos# The name of a Posix-compliant 'awk' on your system.
2421.9SchristosAWK=		awk
2431.9Schristos
2441.16Schristos# The full path name of a Posix-compliant shell, preferably one that supports
2451.16Schristos# the Korn shell's 'select' statement as an extension.
2461.16Schristos# These days, Bash is the most popular.
2471.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh
2481.16Schristos# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
2491.16Schristos# is typically nicer if it works.
2501.9SchristosKSHELL=		/bin/bash
2511.1Smlelstv
2521.18Schristos# The path where SGML DTDs are kept and the catalog file(s) to use when
2531.18Schristos# validating.  The default is appropriate for Ubuntu 13.10.
2541.10SchristosSGML_TOPDIR= /usr
2551.9SchristosSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
2561.9SchristosSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
2571.18SchristosSGML_CATALOG_FILES= \
2581.18Schristos  $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
2591.1Smlelstv
2601.1Smlelstv# The name, arguments and environment of a program to validate your web pages.
2611.1Smlelstv# See <http://www.jclark.com/sp/> for a validator, and
2621.1Smlelstv# <http://validator.w3.org/source/> for a validation library.
2631.1SmlelstvVALIDATE = nsgmls
2641.1SmlelstvVALIDATE_FLAGS = -s -B -wall -wno-unused-param
2651.1SmlelstvVALIDATE_ENV = \
2661.1Smlelstv  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
2671.1Smlelstv  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
2681.1Smlelstv  SP_CHARSET_FIXED=YES \
2691.1Smlelstv  SP_ENCODING=UTF-8
2701.1Smlelstv
2711.22Schristos# SAFE_CHAR is a regular expression that matches a safe character.
2721.22Schristos# Some parts of this distribution are limited to safe characters;
2731.22Schristos# others can use any UTF-8 character.
2741.22Schristos# For now, the safe characters are a safe subset of ASCII.
2751.9Schristos# The caller must set the shell variable 'sharp' to the character '#',
2761.9Schristos# since Makefile macros cannot contain '#'.
2771.9Schristos# TAB_CHAR is a single tab character, in single quotes.
2781.9SchristosTAB_CHAR=	'	'
2791.22SchristosSAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
2801.22SchristosSAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
2811.22SchristosSAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
2821.22SchristosSAFE_CHARSET=	]$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)-
2831.22SchristosSAFE_CHAR=	'['$(SAFE_CHARSET)']'
2841.22Schristos# NONSYM_CHAR is a regular expression that matches any character
2851.22Schristos# except for a small number of symbols, where we prefer to stick with
2861.22Schristos# ASCII renderings for the convenience of maintainers whose text editors
2871.22Schristos# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
2881.22SchristosNONSYM_CHAR=	'[^–—°′″≈≠≤≥±−×÷∞←→↔·•§¶«»‘’‚‛“”„‟‹›「」『』〝〞〟]'
2891.22Schristos
2901.22Schristos# SAFE_LINE matches a line of safe characters.
2911.22Schristos# SAFE_SHARP_LINE is similar, except any character can follow '#';
2921.22Schristos# this is so that comments can contain non-ASCII characters.
2931.22Schristos# NONSYM_LINE matches a line of non-symbols.
2941.22Schristos# VALID_LINE matches a line of any validly-encoded characters.
2951.22SchristosSAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
2961.22SchristosSAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(NONSYM_CHAR)'*)?$$'
2971.22SchristosNONSYM_LINE=	'^'$(NONSYM_CHAR)'*$$'
2981.22SchristosVALID_LINE=	'^.*$$'
2991.9Schristos
3001.6Schristos# Flags to give 'tar' when making a distribution.
3011.6Schristos# Try to use flags appropriate for GNU tar.
3021.6SchristosGNUTARFLAGS=	--numeric-owner --owner=0 --group=0 --mode=go+u,go-w
3031.6SchristosTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
3041.6Schristos		 then echo $(GNUTARFLAGS); \
3051.6Schristos		 else :; \
3061.6Schristos		 fi`
3071.6Schristos
3081.6Schristos# Flags to give 'gzip' when making a distribution.
3091.21SapbGZIPFLAGS=	-9 ${GZIP_N_FLAG}
3101.6Schristos
3111.1Smlelstv###############################################################################
3121.1Smlelstv
3131.1Smlelstvcc=		cc
3141.1SmlelstvCC=		$(cc) -DTZDIR=\"$(TZDIR)\"
3151.1Smlelstv
3161.16SchristosAR=		ar
3171.16Schristos
3181.16Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
3191.16SchristosRANLIB=		:
3201.16Schristos
3211.22SchristosTZCOBJS=	zic.o scheck.o ialloc.o
3221.16SchristosTZDOBJS=	zdump.o localtime.o ialloc.o asctime.o
3231.1SmlelstvDATEOBJS=	date.o localtime.o strftime.o asctime.o
3241.1SmlelstvLIBSRCS=	localtime.c asctime.c difftime.c
3251.1SmlelstvLIBOBJS=	localtime.o asctime.o difftime.o
3261.1SmlelstvHEADERS=	tzfile.h private.h
3271.1SmlelstvNONLIBSRCS=	zic.c zdump.c scheck.c ialloc.c
3281.1SmlelstvNEWUCBSRCS=	date.c strftime.c
3291.1SmlelstvSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh
3301.1SmlelstvMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
3311.1Smlelstv			tzfile.5 tzselect.8 zic.8 zdump.8
3321.16SchristosMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
3331.16Schristos			time2posix.3.txt \
3341.16Schristos			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
3351.16Schristos			date.1.txt
3361.16SchristosCOMMON=		Makefile README
3371.22SchristosWEB_PAGES=	tz-art.htm tz-link.htm
3381.22SchristosDOCS=		NEWS Theory $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
3391.1SmlelstvPRIMARY_YDATA=	africa antarctica asia australasia \
3401.1Smlelstv		europe northamerica southamerica
3411.4SchristosYDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
3421.4SchristosNDATA=		systemv factory
3431.16SchristosTDATA=		$(YDATA) $(NDATA)
3441.22SchristosZONETABLES=	zone1970.tab zone.tab
3451.22SchristosTABDATA=	iso3166.tab leapseconds $(ZONETABLES)
3461.16SchristosLEAP_DEPS=	leapseconds.awk leap-seconds.list
3471.16SchristosDATA=		$(YDATA) $(NDATA) $(TABDATA) \
3481.16Schristos			$(LEAP_DEPS) yearistype.sh
3491.15SchristosAWK_SCRIPTS=	checktab.awk leapseconds.awk
3501.22SchristosMISC=		$(AWK_SCRIPTS) workman.sh zoneinfo2tdf.pl
3511.7SchristosENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
3521.1Smlelstv
3531.1Smlelstv# And for the benefit of csh users on systems that assume the user
3541.1Smlelstv# shell should be used to handle commands in Makefiles. . .
3551.1Smlelstv
3561.1SmlelstvSHELL=		/bin/sh
3571.1Smlelstv
3581.16Schristosall:		tzselect zic zdump libtz.a $(TABDATA)
3591.1Smlelstv
3601.1SmlelstvALL:		all date
3611.1Smlelstv
3621.16Schristosinstall:	all $(DATA) $(REDO) $(MANS)
3631.16Schristos		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
3641.16Schristos			$(DESTDIR)$(LIBDIR) \
3651.16Schristos			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
3661.16Schristos			$(DESTDIR)$(MANDIR)/man8
3671.1Smlelstv		$(ZIC) -y $(YEARISTYPE) \
3681.15Schristos			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
3691.22Schristos		cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
3701.15Schristos		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
3711.16Schristos		cp libtz.a $(DESTDIR)$(LIBDIR)/.
3721.16Schristos		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
3731.16Schristos		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
3741.16Schristos		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
3751.16Schristos		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
3761.1Smlelstv
3771.1SmlelstvINSTALL:	ALL install date.1
3781.16Schristos		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
3791.15Schristos		cp date $(DESTDIR)$(BINDIR)/.
3801.16Schristos		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
3811.1Smlelstv
3821.6Schristosversion.h:
3831.9Schristos		(echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
3841.9Schristos		 echo 'static char const TZVERSION[]="$(VERSION)";' && \
3851.9Schristos		 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
3861.6Schristos
3871.1Smlelstvzdump:		$(TZDOBJS)
3881.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
3891.1Smlelstv
3901.1Smlelstvzic:		$(TZCOBJS) yearistype
3911.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
3921.1Smlelstv
3931.1Smlelstvyearistype:	yearistype.sh
3941.1Smlelstv		cp yearistype.sh yearistype
3951.1Smlelstv		chmod +x yearistype
3961.1Smlelstv
3971.16Schristosleapseconds:	$(LEAP_DEPS)
3981.15Schristos		$(AWK) -f leapseconds.awk leap-seconds.list >$@
3991.15Schristos
4001.1Smlelstvposix_only:	zic $(TDATA)
4011.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
4021.15Schristos			-L /dev/null $(TDATA)
4031.1Smlelstv
4041.1Smlelstvright_only:	zic leapseconds $(TDATA)
4051.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
4061.15Schristos			-L leapseconds $(TDATA)
4071.1Smlelstv
4081.1Smlelstv# In earlier versions of this makefile, the other two directories were
4091.1Smlelstv# subdirectories of $(TZDIR).  However, this led to configuration errors.
4101.1Smlelstv# For example, with posix_right under the earlier scheme,
4111.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
4121.1Smlelstv# but gmtime without leap seconds, which led to problems with applications
4131.1Smlelstv# like sendmail that subtract gmtime from localtime.
4141.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR).
4151.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds
4161.1Smlelstv# to using them, or vice versa.
4171.15Schristosright_posix:	right_only leapseconds
4181.15Schristos		rm -fr $(DESTDIR)$(TZDIR)-leaps
4191.15Schristos		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
4201.15Schristos		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
4211.15Schristos			-L leapseconds $(TDATA)
4221.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
4231.15Schristos			-L /dev/null $(TDATA)
4241.15Schristos
4251.15Schristosposix_right:	posix_only leapseconds
4261.15Schristos		rm -fr $(DESTDIR)$(TZDIR)-posix
4271.15Schristos		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
4281.15Schristos		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
4291.15Schristos			-L /dev/null $(TDATA)
4301.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
4311.15Schristos			-L leapseconds $(TDATA)
4321.1Smlelstv
4331.1Smlelstvzones:		$(REDO)
4341.1Smlelstv
4351.16Schristoslibtz.a:	$(LIBOBJS)
4361.16Schristos		$(AR) ru $@ $(LIBOBJS)
4371.16Schristos		$(RANLIB) $@
4381.1Smlelstv
4391.1Smlelstvdate:		$(DATEOBJS)
4401.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
4411.1Smlelstv
4421.1Smlelstvtzselect:	tzselect.ksh
4431.1Smlelstv		sed \
4441.9Schristos			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
4451.1Smlelstv			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
4461.9Schristos			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
4471.9Schristos			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
4481.1Smlelstv			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
4491.9Schristos			-e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \
4501.1Smlelstv			<$? >$@
4511.1Smlelstv		chmod +x $@
4521.1Smlelstv
4531.9Schristoscheck:		check_character_set check_tables check_web
4541.9Schristos
4551.9Schristoscheck_character_set: $(ENCHILADA)
4561.22Schristos		LC_ALL=en_US.utf8 && export LC_ALL && \
4571.22Schristos		sharp='#' && \
4581.22Schristos		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
4591.22Schristos			$(MISC) $(SOURCES) $(WEB_PAGES) && \
4601.22Schristos		! grep -Env $(SAFE_SHARP_LINE) $(YDATA) $(NDATA) iso3166.tab \
4611.22Schristos			zone.tab leapseconds $(LEAP_DEPS) yearistype.sh && \
4621.22Schristos		test $$(grep -Ecv $(SAFE_SHARP_LINE) Makefile) -eq 1 && \
4631.22Schristos		! grep -Env $(NONSYM_LINE) README NEWS Theory $(MANS) date.1 \
4641.22Schristos			zone1970.tab && \
4651.22Schristos		! grep -Env $(VALID_LINE) $(ENCHILADA)
4661.22Schristos
4671.22Schristoscheck_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
4681.22Schristos		for tab in $(ZONETABLES); do \
4691.22Schristos		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
4701.22Schristos		    || exit; \
4711.22Schristos		done
4721.1Smlelstv
4731.1Smlelstvcheck_web:	$(WEB_PAGES)
4741.1Smlelstv		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
4751.1Smlelstv
4761.14Schristosclean_misc:
4771.6Schristos		rm -f core *.o *.out \
4781.18Schristos		  date tzselect version.h zdump zic yearistype libtz.a
4791.14Schristosclean:		clean_misc
4801.16Schristos		rm -fr tzpublic
4811.1Smlelstv
4821.1Smlelstvmaintainer-clean: clean
4831.1Smlelstv		@echo 'This command is intended for maintainers to use; it'
4841.1Smlelstv		@echo 'deletes files that may need special tools to rebuild.'
4851.16Schristos		rm -f leapseconds $(MANTXTS) *.asc *.tar.gz
4861.1Smlelstv
4871.1Smlelstvnames:
4881.1Smlelstv		@echo $(ENCHILADA)
4891.1Smlelstv
4901.14Schristospublic:		check check_public check_time_t_alternatives \
4911.16Schristos		tarballs signatures
4921.16Schristos
4931.16Schristosdate.1.txt:	date.1
4941.16Schristosnewctime.3.txt:	newctime.3
4951.16Schristosnewstrftime.3.txt: newstrftime.3
4961.16Schristosnewtzset.3.txt:	newtzset.3
4971.16Schristostime2posix.3.txt: time2posix.3
4981.16Schristostzfile.5.txt:	tzfile.5
4991.16Schristostzselect.8.txt:	tzselect.8
5001.16Schristoszdump.8.txt:	zdump.8
5011.16Schristoszic.8.txt:	zic.8
5021.16Schristos
5031.16Schristos$(MANTXTS):	workman.sh
5041.16Schristos		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@
5051.9Schristos
5061.6Schristos# Set the time stamps to those of the git repository, if available,
5071.6Schristos# and if the files have not changed since then.
5081.6Schristos# This uses GNU 'touch' syntax 'touch -d@N FILE',
5091.6Schristos# where N is the number of seconds since 1970.
5101.16Schristos# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
5111.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds'
5121.16Schristos# to be the maximum of the files it depends on.
5131.16Schristosset-timestamps.out: $(ENCHILADA)
5141.16Schristos		rm -f $@
5151.16Schristos		if files=`git ls-files $(ENCHILADA)` && \
5161.16Schristos		   touch -md @1 test.out; then \
5171.16Schristos		  rm -f test.out && \
5181.16Schristos		  for file in $$files; do \
5191.16Schristos		    if git diff --quiet $$file; then \
5201.16Schristos		      time=`git log -1 --format='tformat:%ct' $$file` && \
5211.16Schristos		      touch -cmd @$$time $$file; \
5221.16Schristos		    else \
5231.16Schristos		      echo >&2 "$$file: warning: does not match repository"; \
5241.16Schristos		    fi || exit; \
5251.16Schristos		  done; \
5261.16Schristos		fi
5271.16Schristos		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
5281.16Schristos		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
5291.16Schristos		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
5301.16Schristos		    exit; \
5311.6Schristos		done
5321.16Schristos		touch $@
5331.6Schristos
5341.1Smlelstv# The zics below ensure that each data file can stand on its own.
5351.1Smlelstv# We also do an all-files run to catch links to links.
5361.1Smlelstv
5371.9Schristoscheck_public:	$(ENCHILADA)
5381.1Smlelstv		make maintainer-clean
5391.16Schristos		make "CFLAGS=$(GCC_DEBUG_FLAGS)" $(ENCHILADA) all
5401.9Schristos		mkdir tzpublic
5411.9Schristos		for i in $(TDATA) ; do \
5421.9Schristos		  $(zic) -v -d tzpublic $$i 2>&1 || exit; \
5431.9Schristos		done
5441.9Schristos		$(zic) -v -d tzpublic $(TDATA)
5451.16Schristos		rm -fr tzpublic
5461.9Schristos
5471.14Schristos# Check that the code works under various alternative
5481.14Schristos# implementations of time_t.
5491.14Schristoscheck_time_t_alternatives:
5501.22Schristos		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
5511.14Schristos		for type in $(TIME_T_ALTERNATIVES); do \
5521.16Schristos		  mkdir -p tzpublic/$$type && \
5531.14Schristos		  make clean_misc && \
5541.14Schristos		  make TOPDIR=`pwd`/tzpublic/$$type \
5551.14Schristos		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
5561.14Schristos		    install && \
5571.14Schristos		  diff -qr tzpublic/int64_t/etc/zoneinfo tzpublic/$$type/etc/zoneinfo && \
5581.14Schristos		  case $$type in \
5591.14Schristos		  int32_t) range=-2147483648,2147483647;; \
5601.14Schristos		  uint32_t) range=0,4294967296;; \
5611.14Schristos		  int64_t) continue;; \
5621.14Schristos		  *u*) range=0,10000000000;; \
5631.14Schristos		  *) range=-10000000000,10000000000;; \
5641.14Schristos		  esac && \
5651.14Schristos		  echo checking $$type zones ... && \
5661.14Schristos		  tzpublic/int64_t/etc/zdump -V -t $$range $$zones \
5671.14Schristos		      >tzpublic/int64_t.out && \
5681.14Schristos		  tzpublic/$$type/etc/zdump -V -t $$range $$zones \
5691.14Schristos		      >tzpublic/$$type.out && \
5701.14Schristos		  diff -u tzpublic/int64_t.out tzpublic/$$type.out \
5711.14Schristos		    || exit; \
5721.14Schristos		done
5731.16Schristos		rm -fr tzpublic
5741.14Schristos
5751.9Schristostarballs:	tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
5761.9Schristos
5771.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out
5781.6Schristos		LC_ALL=C && export LC_ALL && \
5791.7Schristos		tar $(TARFLAGS) -cf - \
5801.16Schristos		    $(COMMON) $(DOCS) $(SOURCES) $(MISC) | \
5811.17Sapb		  ${TOOL_GZIP} $(GZIPFLAGS) > $@
5821.10Schristos
5831.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out
5841.6Schristos		LC_ALL=C && export LC_ALL && \
5851.7Schristos		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) | \
5861.17Sapb		  ${TOOL_GZIP} $(GZIPFLAGS) > $@
5871.9Schristos
5881.9Schristossignatures:	tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc
5891.9Schristos
5901.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
5911.9Schristos		gpg --armor --detach-sign $?
5921.9Schristos
5931.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
5941.9Schristos		gpg --armor --detach-sign $?
5951.1Smlelstv
5961.1Smlelstvtypecheck:
5971.1Smlelstv		make clean
5981.15Schristos		for i in "long long" unsigned; \
5991.1Smlelstv		do \
6001.8Schristos			make CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
6011.1Smlelstv			./zdump -v Europe/Rome ; \
6021.1Smlelstv			make clean ; \
6031.1Smlelstv		done
6041.1Smlelstv
6051.1Smlelstvzonenames:	$(TDATA)
6061.1Smlelstv		@$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
6071.1Smlelstv
6081.1Smlelstvasctime.o:	private.h tzfile.h
6091.1Smlelstvdate.o:		private.h
6101.1Smlelstvdifftime.o:	private.h
6111.1Smlelstvialloc.o:	private.h
6121.1Smlelstvlocaltime.o:	private.h tzfile.h
6131.1Smlelstvscheck.o:	private.h
6141.1Smlelstvstrftime.o:	tzfile.h
6151.6Schristoszdump.o:	version.h
6161.6Schristoszic.o:		private.h tzfile.h version.h
6171.1Smlelstv
6181.1Smlelstv.KEEP_STATE:
6191.22Schristos
6201.22Schristos.PHONY: ALL INSTALL all
6211.22Schristos.PHONY: check check_character_set check_public check_tables
6221.22Schristos.PHONY: check_time_t_alternatives check_web clean clean_misc
6231.22Schristos.PHONY: install maintainer-clean names posix_only posix_right
6241.22Schristos.PHONY: public right_only right_posix signatures tarballs typecheck
6251.22Schristos.PHONY: zonenames zones
626