Makefile revision 1.18
11.1Smlelstv# <pre>
21.1Smlelstv# This file is in the public domain, so clarified as of
31.1Smlelstv# 2009-05-17 by Arthur David Olson.
41.1Smlelstv
51.10Schristos# Package name for the code distribution.
61.10SchristosPACKAGE=	tzcode
71.10Schristos
81.6Schristos# Version numbers of the code and data distributions.
91.18SchristosVERSION=	2014c
101.9Schristos
111.9Schristos# Email address for bug reports.
121.9SchristosBUGEMAIL=	tz@iana.org
131.6Schristos
141.1Smlelstv# Change the line below for your time zone (after finding the zone you want in
151.1Smlelstv# the time zone files, or adding it to a time zone file).
161.1Smlelstv# Alternately, if you discover you've got the wrong time zone, you can just
171.1Smlelstv#	zic -l rightzone
181.1Smlelstv# to correct things.
191.1Smlelstv# Use the command
201.1Smlelstv#	make zonenames
211.1Smlelstv# to get a list of the values you can use for LOCALTIME.
221.1Smlelstv
231.4SchristosLOCALTIME=	GMT
241.1Smlelstv
251.1Smlelstv# If you want something other than Eastern United States time as a template
261.1Smlelstv# for handling POSIX-style time zone environment variables,
271.1Smlelstv# change the line below (after finding the zone you want in the
281.1Smlelstv# time zone files, or adding it to a time zone file).
291.1Smlelstv# (When a POSIX-style environment variable is handled, the rules in the
301.1Smlelstv# template file are used to determine "spring forward" and "fall back" days and
311.15Schristos# times; the environment variable itself specifies UT offsets of standard and
321.1Smlelstv# summer time.)
331.1Smlelstv# Alternately, if you discover you've got the wrong time zone, you can just
341.1Smlelstv#	zic -p rightzone
351.1Smlelstv# to correct things.
361.1Smlelstv# Use the command
371.1Smlelstv#	make zonenames
381.1Smlelstv# to get a list of the values you can use for POSIXRULES.
391.1Smlelstv# If you want POSIX compatibility, use "America/New_York".
401.1Smlelstv
411.1SmlelstvPOSIXRULES=	America/New_York
421.1Smlelstv
431.1Smlelstv# Also see TZDEFRULESTRING below, which takes effect only
441.1Smlelstv# if the time zone files cannot be accessed.
451.1Smlelstv
461.1Smlelstv# Everything gets put in subdirectories of. . .
471.1Smlelstv
481.1SmlelstvTOPDIR=		/usr/local
491.1Smlelstv
501.1Smlelstv# "Compiled" time zone information is placed in the "TZDIR" directory
511.1Smlelstv# (and subdirectories).
521.1Smlelstv# Use an absolute path name for TZDIR unless you're just testing the software.
531.1Smlelstv
541.15SchristosTZDIR_BASENAME=	zoneinfo
551.15SchristosTZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
561.1Smlelstv
571.14Schristos# Types to try, as an alternative to time_t.  int64_t should be first.
581.14SchristosTIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
591.14Schristos
601.1Smlelstv# The "tzselect", "zic", and "zdump" commands get installed in. . .
611.1Smlelstv
621.1SmlelstvETCDIR=		$(TOPDIR)/etc
631.1Smlelstv
641.1Smlelstv# If you "make INSTALL", the "date" command gets installed in. . .
651.1Smlelstv
661.1SmlelstvBINDIR=		$(TOPDIR)/bin
671.1Smlelstv
681.1Smlelstv# Manual pages go in subdirectories of. . .
691.1Smlelstv
701.1SmlelstvMANDIR=		$(TOPDIR)/man
711.1Smlelstv
721.1Smlelstv# Library functions are put in an archive in LIBDIR.
731.1Smlelstv
741.1SmlelstvLIBDIR=		$(TOPDIR)/lib
751.1Smlelstv
761.1Smlelstv# If you always want time values interpreted as "seconds since the epoch
771.1Smlelstv# (not counting leap seconds)", use
781.1Smlelstv#	REDO=		posix_only
791.1Smlelstv# below.  If you always want right time values interpreted as "seconds since
801.1Smlelstv# the epoch" (counting leap seconds)", use
811.1Smlelstv#	REDO=		right_only
821.1Smlelstv# below.  If you want both sets of data available, with leap seconds not
831.1Smlelstv# counted normally, use
841.1Smlelstv#	REDO=		posix_right
851.1Smlelstv# below.  If you want both sets of data available, with leap seconds counted
861.1Smlelstv# normally, use
871.1Smlelstv#	REDO=		right_posix
881.1Smlelstv# below.
891.1Smlelstv# POSIX mandates that leap seconds not be counted; for compatibility with it,
901.1Smlelstv# use either "posix_only" or "posix_right".
911.1Smlelstv
921.1SmlelstvREDO=		posix_right
931.1Smlelstv
941.1Smlelstv# Since "." may not be in PATH...
951.1Smlelstv
961.1SmlelstvYEARISTYPE=	./yearistype
971.1Smlelstv
981.1Smlelstv# Non-default libraries needed to link.
991.1Smlelstv# Add -lintl if you want to use `gettext' on Solaris.
1001.1SmlelstvLDLIBS=
1011.1Smlelstv
1021.1Smlelstv# Add the following to the end of the "CFLAGS=" line as needed.
1031.1Smlelstv#  -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.1Smlelstv#  -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.1Smlelstv#  -TTZ_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.7Schristos	-Wformat=2 -Winit-self \
1391.7Schristos	-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
1401.18Schristos	-Wnested-externs -Wno-address -Wno-cast-qual \
1411.7Schristos	-Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
1421.7Schristos	-Wno-type-limits \
1431.7Schristos	-Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
1441.7Schristos	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
1451.7Schristos	-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines \
1461.7Schristos	-Wwrite-strings
1471.1Smlelstv#
1481.1Smlelstv# If you want to use System V compatibility code, add
1491.1Smlelstv#	-DUSG_COMPAT
1501.1Smlelstv# to the end of the "CFLAGS=" line.  This arrange for "timezone" and "daylight"
1511.1Smlelstv# variables to be kept up-to-date by the time conversion functions.  Neither
1521.1Smlelstv# "timezone" nor "daylight" is described in X3J11's work.
1531.1Smlelstv#
1541.1Smlelstv# If your system has a "GMT offset" field in its "struct tm"s
1551.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
1561.1Smlelstv# add the name to a define such as
1571.1Smlelstv#	-DTM_GMTOFF=tm_gmtoff
1581.1Smlelstv# or
1591.1Smlelstv#	-DTM_GMTOFF=_tm_gmtoff
1601.1Smlelstv# to the end of the "CFLAGS=" line.
1611.1Smlelstv# Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work;
1621.1Smlelstv# in its work, use of "tm_gmtoff" is described as non-conforming.
1631.1Smlelstv# Both Linux and BSD have done the equivalent of defining TM_GMTOFF in
1641.1Smlelstv# their recent releases.
1651.1Smlelstv#
1661.1Smlelstv# If your system has a "zone abbreviation" field in its "struct tm"s
1671.1Smlelstv# (or if you decide to add such a field in your system's "time.h" file),
1681.1Smlelstv# add the name to a define such as
1691.1Smlelstv#	-DTM_ZONE=tm_zone
1701.1Smlelstv# or
1711.1Smlelstv#	-DTM_ZONE=_tm_zone
1721.1Smlelstv# to the end of the "CFLAGS=" line.
1731.1Smlelstv# Neither tm_zone nor _tm_zone is described in X3J11's work;
1741.1Smlelstv# in its work, use of "tm_zone" is described as non-conforming.
1751.1Smlelstv# Both UCB and Sun have done the equivalent of defining TM_ZONE in
1761.1Smlelstv# their recent releases.
1771.1Smlelstv#
1781.1Smlelstv# If you want functions that were inspired by early versions of X3J11's work,
1791.1Smlelstv# add
1801.1Smlelstv#	-DSTD_INSPIRED
1811.1Smlelstv# to the end of the "CFLAGS=" line.  This arranges for the functions
1821.1Smlelstv# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
1831.1Smlelstv# "posix2time", and "time2posix" to be added to the time conversion library.
1841.1Smlelstv# "tzsetwall" is like "tzset" except that it arranges for local wall clock
1851.1Smlelstv# time (rather than the time specified in the TZ environment variable)
1861.1Smlelstv# to be used.
1871.1Smlelstv# "offtime" is like "gmtime" except that it accepts a second (long) argument
1881.1Smlelstv# that gives an offset to add to the time_t when converting it.
1891.1Smlelstv# "timelocal" is equivalent to "mktime".
1901.1Smlelstv# "timegm" is like "timelocal" except that it turns a struct tm into
1911.15Schristos# a time_t using UT (rather than local time as "timelocal" does).
1921.1Smlelstv# "timeoff" is like "timegm" except that it accepts a second (long) argument
1931.1Smlelstv# that gives an offset to use when converting to a time_t.
1941.1Smlelstv# "posix2time" and "time2posix" are described in an included manual page.
1951.1Smlelstv# X3J11's work does not describe any of these functions.
1961.1Smlelstv# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
1971.1Smlelstv# These functions may well disappear in future releases of the time
1981.1Smlelstv# conversion package.
1991.1Smlelstv#
2001.1Smlelstv# If you want to allocate state structures in localtime, add
2011.1Smlelstv#	-DALL_STATE
2021.1Smlelstv# to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
2031.1Smlelstv#
2041.1Smlelstv# If you want an "altzone" variable (a la System V Release 3.1), add
2051.1Smlelstv#	-DALTZONE
2061.1Smlelstv# to the end of the "CFLAGS=" line.
2071.1Smlelstv# This variable is not described in X3J11's work.
2081.1Smlelstv#
2091.1Smlelstv# If you want a "gtime" function (a la MACH), add
2101.1Smlelstv#	-DCMUCS
2111.1Smlelstv# to the end of the "CFLAGS=" line
2121.1Smlelstv# This function is not described in X3J11's work.
2131.1Smlelstv#
2141.1Smlelstv# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
2151.1Smlelstv# out by the National Institute of Standards and Technology
2161.1Smlelstv# which claims to test C and Posix conformance.  If you want to pass PCTS, add
2171.1Smlelstv#	-DPCTS
2181.1Smlelstv# to the end of the "CFLAGS=" line.
2191.1Smlelstv#
2201.1Smlelstv# If you want strict compliance with XPG4 as of 1994-04-09, add
2211.1Smlelstv#	-DXPG4_1994_04_09
2221.1Smlelstv# to the end of the "CFLAGS=" line.  This causes "strftime" to always return
2231.1Smlelstv# 53 as a week number (rather than 52 or 53) for those days in January that
2241.1Smlelstv# before the first Monday in January when a "%V" format is used and January 1
2251.1Smlelstv# falls on a Friday, Saturday, or Sunday.
2261.1Smlelstv
2271.1SmlelstvCFLAGS=
2281.1Smlelstv
2291.9Schristos# Linker flags.  Default to $(LFLAGS) for backwards compatibility
2301.9Schristos# to tzcode2012h and earlier.
2311.9Schristos
2321.9SchristosLDFLAGS=	$(LFLAGS)
2331.1Smlelstv
2341.1Smlelstvzic=		./zic
2351.1SmlelstvZIC=		$(zic) $(ZFLAGS)
2361.1Smlelstv
2371.15SchristosZFLAGS=
2381.15Schristos
2391.1Smlelstv# The name of a Posix-compliant `awk' on your system.
2401.9SchristosAWK=		awk
2411.9Schristos
2421.16Schristos# The full path name of a Posix-compliant shell, preferably one that supports
2431.16Schristos# the Korn shell's 'select' statement as an extension.
2441.16Schristos# These days, Bash is the most popular.
2451.16Schristos# It should be OK to set this to /bin/sh, on platforms where /bin/sh
2461.16Schristos# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
2471.16Schristos# is typically nicer if it works.
2481.9SchristosKSHELL=		/bin/bash
2491.1Smlelstv
2501.18Schristos# The path where SGML DTDs are kept and the catalog file(s) to use when
2511.18Schristos# validating.  The default is appropriate for Ubuntu 13.10.
2521.10SchristosSGML_TOPDIR= /usr
2531.9SchristosSGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
2541.9SchristosSGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
2551.18SchristosSGML_CATALOG_FILES= \
2561.18Schristos  $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
2571.1Smlelstv
2581.1Smlelstv# The name, arguments and environment of a program to validate your web pages.
2591.1Smlelstv# See <http://www.jclark.com/sp/> for a validator, and
2601.1Smlelstv# <http://validator.w3.org/source/> for a validation library.
2611.1SmlelstvVALIDATE = nsgmls
2621.1SmlelstvVALIDATE_FLAGS = -s -B -wall -wno-unused-param
2631.1SmlelstvVALIDATE_ENV = \
2641.1Smlelstv  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
2651.1Smlelstv  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
2661.1Smlelstv  SP_CHARSET_FIXED=YES \
2671.1Smlelstv  SP_ENCODING=UTF-8
2681.1Smlelstv
2691.9Schristos# INVALID_CHAR is a regular expression that matches invalid characters in
2701.9Schristos# distributed files.  For now, stick to a safe subset of ASCII.
2711.9Schristos# The caller must set the shell variable 'sharp' to the character '#',
2721.9Schristos# since Makefile macros cannot contain '#'.
2731.9Schristos# TAB_CHAR is a single tab character, in single quotes.
2741.9SchristosTAB_CHAR=	'	'
2751.9SchristosINVALID_CHAR1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
2761.9SchristosINVALID_CHAR2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
2771.9SchristosINVALID_CHAR3=	'abcdefghijklmnopqrstuvwxyz{|}~'
2781.9SchristosINVALID_CHAR=	'[^]'$(INVALID_CHAR1)$(INVALID_CHAR2)$(INVALID_CHAR3)'-]'
2791.9Schristos
2801.6Schristos# Flags to give 'tar' when making a distribution.
2811.6Schristos# Try to use flags appropriate for GNU tar.
2821.6SchristosGNUTARFLAGS=	--numeric-owner --owner=0 --group=0 --mode=go+u,go-w
2831.6SchristosTARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
2841.6Schristos		 then echo $(GNUTARFLAGS); \
2851.6Schristos		 else :; \
2861.6Schristos		 fi`
2871.6Schristos
2881.6Schristos# Flags to give 'gzip' when making a distribution.
2891.6SchristosGZIPFLAGS=	-9n
2901.6Schristos
2911.1Smlelstv###############################################################################
2921.1Smlelstv
2931.1Smlelstvcc=		cc
2941.1SmlelstvCC=		$(cc) -DTZDIR=\"$(TZDIR)\"
2951.1Smlelstv
2961.16SchristosAR=		ar
2971.16Schristos
2981.16Schristos# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
2991.16SchristosRANLIB=		:
3001.16Schristos
3011.1SmlelstvTZCOBJS=	zic.o localtime.o asctime.o scheck.o ialloc.o
3021.16SchristosTZDOBJS=	zdump.o localtime.o ialloc.o asctime.o
3031.1SmlelstvDATEOBJS=	date.o localtime.o strftime.o asctime.o
3041.1SmlelstvLIBSRCS=	localtime.c asctime.c difftime.c
3051.1SmlelstvLIBOBJS=	localtime.o asctime.o difftime.o
3061.1SmlelstvHEADERS=	tzfile.h private.h
3071.1SmlelstvNONLIBSRCS=	zic.c zdump.c scheck.c ialloc.c
3081.1SmlelstvNEWUCBSRCS=	date.c strftime.c
3091.1SmlelstvSOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh
3101.1SmlelstvMANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
3111.1Smlelstv			tzfile.5 tzselect.8 zic.8 zdump.8
3121.16SchristosMANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
3131.16Schristos			time2posix.3.txt \
3141.16Schristos			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
3151.16Schristos			date.1.txt
3161.16SchristosCOMMON=		Makefile README
3171.16SchristosDOCS=		NEWS Theory $(MANS) date.1 $(MANTXTS)
3181.1SmlelstvPRIMARY_YDATA=	africa antarctica asia australasia \
3191.1Smlelstv		europe northamerica southamerica
3201.4SchristosYDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
3211.4SchristosNDATA=		systemv factory
3221.16SchristosTDATA=		$(YDATA) $(NDATA)
3231.16SchristosTABDATA=	iso3166.tab zone.tab leapseconds
3241.16SchristosLEAP_DEPS=	leapseconds.awk leap-seconds.list
3251.16SchristosDATA=		$(YDATA) $(NDATA) $(TABDATA) \
3261.16Schristos			$(LEAP_DEPS) yearistype.sh
3271.1SmlelstvWEB_PAGES=	tz-art.htm tz-link.htm
3281.15SchristosAWK_SCRIPTS=	checktab.awk leapseconds.awk
3291.1SmlelstvMISC=		usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
3301.15Schristos			$(WEB_PAGES) $(AWK_SCRIPTS) workman.sh \
3311.1Smlelstv			zoneinfo2tdf.pl
3321.7SchristosENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
3331.1Smlelstv
3341.1Smlelstv# And for the benefit of csh users on systems that assume the user
3351.1Smlelstv# shell should be used to handle commands in Makefiles. . .
3361.1Smlelstv
3371.1SmlelstvSHELL=		/bin/sh
3381.1Smlelstv
3391.16Schristosall:		tzselect zic zdump libtz.a $(TABDATA)
3401.1Smlelstv
3411.1SmlelstvALL:		all date
3421.1Smlelstv
3431.16Schristosinstall:	all $(DATA) $(REDO) $(MANS)
3441.16Schristos		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
3451.16Schristos			$(DESTDIR)$(LIBDIR) \
3461.16Schristos			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
3471.16Schristos			$(DESTDIR)$(MANDIR)/man8
3481.1Smlelstv		$(ZIC) -y $(YEARISTYPE) \
3491.15Schristos			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
3501.16Schristos		cp -f iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
3511.15Schristos		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
3521.16Schristos		cp libtz.a $(DESTDIR)$(LIBDIR)/.
3531.16Schristos		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
3541.16Schristos		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
3551.16Schristos		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
3561.16Schristos		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
3571.1Smlelstv
3581.1SmlelstvINSTALL:	ALL install date.1
3591.16Schristos		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
3601.15Schristos		cp date $(DESTDIR)$(BINDIR)/.
3611.16Schristos		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
3621.1Smlelstv
3631.6Schristosversion.h:
3641.9Schristos		(echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
3651.9Schristos		 echo 'static char const TZVERSION[]="$(VERSION)";' && \
3661.9Schristos		 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
3671.6Schristos
3681.1Smlelstvzdump:		$(TZDOBJS)
3691.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
3701.1Smlelstv
3711.1Smlelstvzic:		$(TZCOBJS) yearistype
3721.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
3731.1Smlelstv
3741.1Smlelstvyearistype:	yearistype.sh
3751.1Smlelstv		cp yearistype.sh yearistype
3761.1Smlelstv		chmod +x yearistype
3771.1Smlelstv
3781.16Schristosleapseconds:	$(LEAP_DEPS)
3791.15Schristos		$(AWK) -f leapseconds.awk leap-seconds.list >$@
3801.15Schristos
3811.1Smlelstvposix_only:	zic $(TDATA)
3821.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
3831.15Schristos			-L /dev/null $(TDATA)
3841.1Smlelstv
3851.1Smlelstvright_only:	zic leapseconds $(TDATA)
3861.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
3871.15Schristos			-L leapseconds $(TDATA)
3881.1Smlelstv
3891.1Smlelstv# In earlier versions of this makefile, the other two directories were
3901.1Smlelstv# subdirectories of $(TZDIR).  However, this led to configuration errors.
3911.1Smlelstv# For example, with posix_right under the earlier scheme,
3921.1Smlelstv# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
3931.1Smlelstv# but gmtime without leap seconds, which led to problems with applications
3941.1Smlelstv# like sendmail that subtract gmtime from localtime.
3951.1Smlelstv# Therefore, the other two directories are now siblings of $(TZDIR).
3961.1Smlelstv# You must replace all of $(TZDIR) to switch from not using leap seconds
3971.1Smlelstv# to using them, or vice versa.
3981.15Schristosright_posix:	right_only leapseconds
3991.15Schristos		rm -fr $(DESTDIR)$(TZDIR)-leaps
4001.15Schristos		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
4011.15Schristos		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
4021.15Schristos			-L leapseconds $(TDATA)
4031.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
4041.15Schristos			-L /dev/null $(TDATA)
4051.15Schristos
4061.15Schristosposix_right:	posix_only leapseconds
4071.15Schristos		rm -fr $(DESTDIR)$(TZDIR)-posix
4081.15Schristos		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
4091.15Schristos		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
4101.15Schristos			-L /dev/null $(TDATA)
4111.15Schristos		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
4121.15Schristos			-L leapseconds $(TDATA)
4131.1Smlelstv
4141.1Smlelstvzones:		$(REDO)
4151.1Smlelstv
4161.16Schristoslibtz.a:	$(LIBOBJS)
4171.16Schristos		$(AR) ru $@ $(LIBOBJS)
4181.16Schristos		$(RANLIB) $@
4191.1Smlelstv
4201.1Smlelstvdate:		$(DATEOBJS)
4211.9Schristos		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
4221.1Smlelstv
4231.1Smlelstvtzselect:	tzselect.ksh
4241.1Smlelstv		sed \
4251.9Schristos			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
4261.1Smlelstv			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
4271.9Schristos			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
4281.9Schristos			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
4291.1Smlelstv			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
4301.9Schristos			-e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \
4311.1Smlelstv			<$? >$@
4321.1Smlelstv		chmod +x $@
4331.1Smlelstv
4341.9Schristoscheck:		check_character_set check_tables check_web
4351.9Schristos
4361.9Schristoscheck_character_set: $(ENCHILADA)
4371.9Schristos		sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA)
4381.1Smlelstv
4391.1Smlelstvcheck_tables:	checktab.awk $(PRIMARY_YDATA)
4401.1Smlelstv		$(AWK) -f checktab.awk $(PRIMARY_YDATA)
4411.1Smlelstv
4421.1Smlelstvcheck_web:	$(WEB_PAGES)
4431.1Smlelstv		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
4441.1Smlelstv
4451.14Schristosclean_misc:
4461.6Schristos		rm -f core *.o *.out \
4471.18Schristos		  date tzselect version.h zdump zic yearistype libtz.a
4481.14Schristosclean:		clean_misc
4491.16Schristos		rm -fr tzpublic
4501.1Smlelstv
4511.1Smlelstvmaintainer-clean: clean
4521.1Smlelstv		@echo 'This command is intended for maintainers to use; it'
4531.1Smlelstv		@echo 'deletes files that may need special tools to rebuild.'
4541.16Schristos		rm -f leapseconds $(MANTXTS) *.asc *.tar.gz
4551.1Smlelstv
4561.1Smlelstvnames:
4571.1Smlelstv		@echo $(ENCHILADA)
4581.1Smlelstv
4591.14Schristospublic:		check check_public check_time_t_alternatives \
4601.16Schristos		tarballs signatures
4611.16Schristos
4621.16Schristosdate.1.txt:	date.1
4631.16Schristosnewctime.3.txt:	newctime.3
4641.16Schristosnewstrftime.3.txt: newstrftime.3
4651.16Schristosnewtzset.3.txt:	newtzset.3
4661.16Schristostime2posix.3.txt: time2posix.3
4671.16Schristostzfile.5.txt:	tzfile.5
4681.16Schristostzselect.8.txt:	tzselect.8
4691.16Schristoszdump.8.txt:	zdump.8
4701.16Schristoszic.8.txt:	zic.8
4711.16Schristos
4721.16Schristos$(MANTXTS):	workman.sh
4731.16Schristos		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@
4741.9Schristos
4751.6Schristos# Set the time stamps to those of the git repository, if available,
4761.6Schristos# and if the files have not changed since then.
4771.6Schristos# This uses GNU 'touch' syntax 'touch -d@N FILE',
4781.6Schristos# where N is the number of seconds since 1970.
4791.16Schristos# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
4801.16Schristos# Also, set the timestamp of each prebuilt file like 'leapseconds'
4811.16Schristos# to be the maximum of the files it depends on.
4821.16Schristosset-timestamps.out: $(ENCHILADA)
4831.16Schristos		rm -f $@
4841.16Schristos		if files=`git ls-files $(ENCHILADA)` && \
4851.16Schristos		   touch -md @1 test.out; then \
4861.16Schristos		  rm -f test.out && \
4871.16Schristos		  for file in $$files; do \
4881.16Schristos		    if git diff --quiet $$file; then \
4891.16Schristos		      time=`git log -1 --format='tformat:%ct' $$file` && \
4901.16Schristos		      touch -cmd @$$time $$file; \
4911.16Schristos		    else \
4921.16Schristos		      echo >&2 "$$file: warning: does not match repository"; \
4931.16Schristos		    fi || exit; \
4941.16Schristos		  done; \
4951.16Schristos		fi
4961.16Schristos		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
4971.16Schristos		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
4981.16Schristos		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
4991.16Schristos		    exit; \
5001.6Schristos		done
5011.16Schristos		touch $@
5021.6Schristos
5031.1Smlelstv# The zics below ensure that each data file can stand on its own.
5041.1Smlelstv# We also do an all-files run to catch links to links.
5051.1Smlelstv
5061.9Schristoscheck_public:	$(ENCHILADA)
5071.1Smlelstv		make maintainer-clean
5081.16Schristos		make "CFLAGS=$(GCC_DEBUG_FLAGS)" $(ENCHILADA) all
5091.9Schristos		mkdir tzpublic
5101.9Schristos		for i in $(TDATA) ; do \
5111.9Schristos		  $(zic) -v -d tzpublic $$i 2>&1 || exit; \
5121.9Schristos		done
5131.9Schristos		$(zic) -v -d tzpublic $(TDATA)
5141.16Schristos		rm -fr tzpublic
5151.9Schristos
5161.14Schristos# Check that the code works under various alternative
5171.14Schristos# implementations of time_t.
5181.14Schristoscheck_time_t_alternatives:
5191.14Schristos		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone.tab` && \
5201.14Schristos		for type in $(TIME_T_ALTERNATIVES); do \
5211.16Schristos		  mkdir -p tzpublic/$$type && \
5221.14Schristos		  make clean_misc && \
5231.14Schristos		  make TOPDIR=`pwd`/tzpublic/$$type \
5241.14Schristos		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
5251.14Schristos		    install && \
5261.14Schristos		  diff -qr tzpublic/int64_t/etc/zoneinfo tzpublic/$$type/etc/zoneinfo && \
5271.14Schristos		  case $$type in \
5281.14Schristos		  int32_t) range=-2147483648,2147483647;; \
5291.14Schristos		  uint32_t) range=0,4294967296;; \
5301.14Schristos		  int64_t) continue;; \
5311.14Schristos		  *u*) range=0,10000000000;; \
5321.14Schristos		  *) range=-10000000000,10000000000;; \
5331.14Schristos		  esac && \
5341.14Schristos		  echo checking $$type zones ... && \
5351.14Schristos		  tzpublic/int64_t/etc/zdump -V -t $$range $$zones \
5361.14Schristos		      >tzpublic/int64_t.out && \
5371.14Schristos		  tzpublic/$$type/etc/zdump -V -t $$range $$zones \
5381.14Schristos		      >tzpublic/$$type.out && \
5391.14Schristos		  diff -u tzpublic/int64_t.out tzpublic/$$type.out \
5401.14Schristos		    || exit; \
5411.14Schristos		done
5421.16Schristos		rm -fr tzpublic
5431.14Schristos
5441.9Schristostarballs:	tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
5451.9Schristos
5461.16Schristostzcode$(VERSION).tar.gz: set-timestamps.out
5471.6Schristos		LC_ALL=C && export LC_ALL && \
5481.7Schristos		tar $(TARFLAGS) -cf - \
5491.16Schristos		    $(COMMON) $(DOCS) $(SOURCES) $(MISC) | \
5501.17Sapb		  ${TOOL_GZIP} $(GZIPFLAGS) > $@
5511.10Schristos
5521.16Schristostzdata$(VERSION).tar.gz: set-timestamps.out
5531.6Schristos		LC_ALL=C && export LC_ALL && \
5541.7Schristos		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) | \
5551.17Sapb		  ${TOOL_GZIP} $(GZIPFLAGS) > $@
5561.9Schristos
5571.9Schristossignatures:	tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc
5581.9Schristos
5591.9Schristostzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
5601.9Schristos		gpg --armor --detach-sign $?
5611.9Schristos
5621.9Schristostzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
5631.9Schristos		gpg --armor --detach-sign $?
5641.1Smlelstv
5651.1Smlelstvtypecheck:
5661.1Smlelstv		make clean
5671.15Schristos		for i in "long long" unsigned; \
5681.1Smlelstv		do \
5691.8Schristos			make CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
5701.1Smlelstv			./zdump -v Europe/Rome ; \
5711.1Smlelstv			make clean ; \
5721.1Smlelstv		done
5731.1Smlelstv
5741.1Smlelstvzonenames:	$(TDATA)
5751.1Smlelstv		@$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
5761.1Smlelstv
5771.1Smlelstvasctime.o:	private.h tzfile.h
5781.1Smlelstvdate.o:		private.h
5791.1Smlelstvdifftime.o:	private.h
5801.1Smlelstvialloc.o:	private.h
5811.1Smlelstvlocaltime.o:	private.h tzfile.h
5821.1Smlelstvscheck.o:	private.h
5831.1Smlelstvstrftime.o:	tzfile.h
5841.6Schristoszdump.o:	version.h
5851.6Schristoszic.o:		private.h tzfile.h version.h
5861.1Smlelstv
5871.1Smlelstv.KEEP_STATE:
588