Home | History | Annotate | Line # | Download | only in time
Makefile revision 1.38
      1   1.1   mlelstv # This file is in the public domain, so clarified as of
      2   1.1   mlelstv # 2009-05-17 by Arthur David Olson.
      3   1.1   mlelstv 
      4  1.10  christos # Package name for the code distribution.
      5  1.10  christos PACKAGE=	tzcode
      6  1.10  christos 
      7  1.34  christos # Version number for the distribution, overridden in the 'tarballs' rule below.
      8  1.35  christos VERSION=	unknown
      9   1.9  christos 
     10   1.9  christos # Email address for bug reports.
     11   1.9  christos BUGEMAIL=	tz@iana.org
     12   1.6  christos 
     13   1.1   mlelstv # Change the line below for your time zone (after finding the zone you want in
     14   1.1   mlelstv # the time zone files, or adding it to a time zone file).
     15   1.1   mlelstv # Alternately, if you discover you've got the wrong time zone, you can just
     16   1.1   mlelstv #	zic -l rightzone
     17   1.1   mlelstv # to correct things.
     18   1.1   mlelstv # Use the command
     19   1.1   mlelstv #	make zonenames
     20   1.1   mlelstv # to get a list of the values you can use for LOCALTIME.
     21   1.1   mlelstv 
     22   1.4  christos LOCALTIME=	GMT
     23   1.1   mlelstv 
     24   1.1   mlelstv # If you want something other than Eastern United States time as a template
     25   1.1   mlelstv # for handling POSIX-style time zone environment variables,
     26   1.1   mlelstv # change the line below (after finding the zone you want in the
     27   1.1   mlelstv # time zone files, or adding it to a time zone file).
     28   1.1   mlelstv # (When a POSIX-style environment variable is handled, the rules in the
     29   1.1   mlelstv # template file are used to determine "spring forward" and "fall back" days and
     30  1.15  christos # times; the environment variable itself specifies UT offsets of standard and
     31   1.1   mlelstv # summer time.)
     32   1.1   mlelstv # Alternately, if you discover you've got the wrong time zone, you can just
     33   1.1   mlelstv #	zic -p rightzone
     34   1.1   mlelstv # to correct things.
     35   1.1   mlelstv # Use the command
     36   1.1   mlelstv #	make zonenames
     37   1.1   mlelstv # to get a list of the values you can use for POSIXRULES.
     38   1.1   mlelstv # If you want POSIX compatibility, use "America/New_York".
     39   1.1   mlelstv 
     40   1.1   mlelstv POSIXRULES=	America/New_York
     41   1.1   mlelstv 
     42   1.1   mlelstv # Also see TZDEFRULESTRING below, which takes effect only
     43   1.1   mlelstv # if the time zone files cannot be accessed.
     44   1.1   mlelstv 
     45   1.1   mlelstv # Everything gets put in subdirectories of. . .
     46   1.1   mlelstv 
     47   1.1   mlelstv TOPDIR=		/usr/local
     48   1.1   mlelstv 
     49   1.1   mlelstv # "Compiled" time zone information is placed in the "TZDIR" directory
     50   1.1   mlelstv # (and subdirectories).
     51   1.1   mlelstv # Use an absolute path name for TZDIR unless you're just testing the software.
     52  1.38  christos # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
     53   1.1   mlelstv 
     54  1.15  christos TZDIR_BASENAME=	zoneinfo
     55  1.15  christos TZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
     56   1.1   mlelstv 
     57  1.14  christos # Types to try, as an alternative to time_t.  int64_t should be first.
     58  1.14  christos TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
     59  1.14  christos 
     60   1.1   mlelstv # The "tzselect", "zic", and "zdump" commands get installed in. . .
     61   1.1   mlelstv 
     62   1.1   mlelstv ETCDIR=		$(TOPDIR)/etc
     63   1.1   mlelstv 
     64   1.1   mlelstv # If you "make INSTALL", the "date" command gets installed in. . .
     65   1.1   mlelstv 
     66   1.1   mlelstv BINDIR=		$(TOPDIR)/bin
     67   1.1   mlelstv 
     68   1.1   mlelstv # Manual pages go in subdirectories of. . .
     69   1.1   mlelstv 
     70   1.1   mlelstv MANDIR=		$(TOPDIR)/man
     71   1.1   mlelstv 
     72   1.1   mlelstv # Library functions are put in an archive in LIBDIR.
     73   1.1   mlelstv 
     74   1.1   mlelstv LIBDIR=		$(TOPDIR)/lib
     75   1.1   mlelstv 
     76  1.37  christos # If you want only POSIX time, with time values interpreted as
     77  1.37  christos # seconds since the epoch (not counting leap seconds), use
     78   1.1   mlelstv #	REDO=		posix_only
     79  1.38  christos # below.  If you want only "right" time, with values interpreted
     80  1.37  christos # as seconds since the epoch (counting leap seconds), use
     81   1.1   mlelstv #	REDO=		right_only
     82   1.1   mlelstv # below.  If you want both sets of data available, with leap seconds not
     83   1.1   mlelstv # counted normally, use
     84   1.1   mlelstv #	REDO=		posix_right
     85   1.1   mlelstv # below.  If you want both sets of data available, with leap seconds counted
     86   1.1   mlelstv # normally, use
     87   1.1   mlelstv #	REDO=		right_posix
     88  1.32  christos # below.  POSIX mandates that leap seconds not be counted; for compatibility
     89  1.37  christos # with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
     90  1.37  christos # leap smearing; this can work better than unsmeared "right" time with
     91  1.37  christos # applications that are not leap second aware, and is closer to unsmeared
     92  1.37  christos # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
     93   1.1   mlelstv 
     94   1.1   mlelstv REDO=		posix_right
     95   1.1   mlelstv 
     96  1.38  christos # To install data in text form that has all the information of the binary data,
     97  1.38  christos # (optionally incorporating leap second information), use
     98  1.38  christos #	TZDATA_TEXT=	tzdata.zi leapseconds
     99  1.38  christos # To install text data without leap second information (e.g., because
    100  1.38  christos # REDO='posix_only'), use
    101  1.38  christos #	TZDATA_TEXT=	tzdata.zi
    102  1.38  christos # To avoid installing text data, use
    103  1.38  christos #	TZDATA_TEXT=
    104  1.38  christos 
    105  1.38  christos TZDATA_TEXT=	leapseconds tzdata.zi
    106  1.38  christos 
    107  1.38  christos # For backward-compatibility links for old zone names, use
    108  1.38  christos #	BACKWARD=	backward pacificnew
    109  1.38  christos # To omit these links, use
    110  1.38  christos #	BACKWARD=
    111  1.38  christos 
    112  1.38  christos BACKWARD=	backward pacificnew
    113  1.38  christos 
    114  1.32  christos # If you want out-of-scope and often-wrong data from the file 'backzone', use
    115  1.32  christos #	PACKRATDATA=	backzone
    116  1.32  christos # To omit this data, use
    117  1.32  christos #	PACKRATDATA=
    118  1.32  christos 
    119  1.32  christos PACKRATDATA=
    120  1.32  christos 
    121  1.38  christos # The name of a locale using the UTF-8 encoding, used during self-tests.
    122  1.38  christos # The tests are skipped if the name does not appear to work on this system.
    123  1.38  christos 
    124  1.38  christos UTF8_LOCALE=	en_US.utf8
    125  1.38  christos 
    126   1.1   mlelstv # Since "." may not be in PATH...
    127   1.1   mlelstv 
    128   1.1   mlelstv YEARISTYPE=	./yearistype
    129   1.1   mlelstv 
    130   1.1   mlelstv # Non-default libraries needed to link.
    131   1.1   mlelstv LDLIBS=
    132   1.1   mlelstv 
    133  1.38  christos # Add the following to the end of the "CFLAGS=" line as needed to override
    134  1.38  christos # defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
    135  1.19  christos #  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
    136  1.38  christos #  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
    137  1.38  christos #	formats that generate only the last two digits of year numbers
    138  1.38  christos #  -DEPOCH_LOCAL if the 'time' function returns local time not UT
    139  1.38  christos #  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
    140  1.38  christos #	than what POSIX specifies, assuming local time is UT.
    141  1.38  christos #	For example, N is 252460800 on AmigaOS.
    142  1.32  christos #  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
    143  1.38  christos #  -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
    144  1.32  christos #  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
    145  1.38  christos #  -DHAVE_GENERIC=0 if _Generic does not work
    146  1.38  christos #  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
    147  1.38  christos #  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
    148  1.35  christos #	ctime_r and asctime_r incompatibly with the POSIX standard
    149  1.35  christos #	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
    150  1.38  christos #  -DHAVE_INTTYPES_H if you have a non-C99 compiler with <inttypes.h>
    151  1.16  christos #  -DHAVE_LINK=0 if your system lacks a link function
    152  1.23  christos #  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
    153  1.23  christos #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
    154  1.23  christos #	localtime_rz can make zdump significantly faster, but is nonstandard.
    155  1.32  christos #  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
    156  1.32  christos #	functions like 'link' or variables like 'tzname' required by POSIX
    157  1.38  christos #  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
    158  1.38  christos #  -DHAVE_STDBOOL_H if you have a non-C99 compiler with <stdbool.h>
    159  1.38  christos #  -DHAVE_STDINT_H if you have a non-C99 compiler with <stdint.h>
    160  1.38  christos #  -DHAVE_STRFTIME_L if <time.h> declares locale_t and strftime_l
    161  1.28  christos #  -DHAVE_STRDUP=0 if your system lacks the strdup function
    162   1.1   mlelstv #  -DHAVE_SYMLINK=0 if your system lacks the symlink function
    163  1.38  christos #  -DHAVE_SYS_STAT_H=0 if your compiler lacks a <sys/stat.h>
    164  1.38  christos #  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a <sys/wait.h>
    165  1.23  christos #  -DHAVE_TZSET=0 if your system lacks a tzset function
    166  1.38  christos #  -DHAVE_UNISTD_H=0 if your compiler lacks a <unistd.h>
    167  1.38  christos #  -Dlocale_t=XXX if your system uses XXX instead of locale_t
    168  1.38  christos #  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
    169  1.38  christos #  -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
    170  1.23  christos #	not needed by the main-program tz code, which is single-threaded.
    171  1.23  christos #	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.
    172  1.14  christos #  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
    173  1.38  christos #	This is intended for internal use only; it mangles external names.
    174   1.1   mlelstv #  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
    175  1.22  christos #  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
    176   1.1   mlelstv #	the default is system-supplied, typically "/usr/lib/locale"
    177  1.14  christos #  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
    178  1.38  christos #	DST transitions if the time zone files cannot be accessed
    179  1.38  christos #  -DUNINIT_TRAP if reading uninitialized storage can cause problems
    180  1.23  christos #	other than simply getting garbage data
    181  1.23  christos #  -DUSE_LTZ=0 to build zdump with the system time zone library
    182  1.23  christos #	Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below.
    183   1.1   mlelstv #  -DZIC_MAX_ABBR_LEN_WO_WARN=3
    184   1.1   mlelstv #	(or some other number) to set the maximum time zone abbreviation length
    185   1.1   mlelstv #	that zic will accept without a warning (the default is 6)
    186  1.30  christos #  $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
    187  1.38  christos # Select instrumentation via "make GCC_INSTRUMENT='whatever'".
    188  1.38  christos GCC_INSTRUMENT = \
    189  1.38  christos   -fsanitize=undefined -fsanitize-address-use-after-scope \
    190  1.38  christos   -fsanitize-undefined-trap-on-error -fstack-protector
    191  1.38  christos GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
    192  1.38  christos   $(GCC_INSTRUMENT) \
    193  1.38  christos   -Wall -Wextra \
    194  1.38  christos   -Walloc-size-larger-than=100000 -Warray-bounds=2 \
    195  1.38  christos   -Wbad-function-cast -Wcast-align -Wdate-time \
    196  1.38  christos   -Wdeclaration-after-statement -Wdouble-promotion \
    197  1.38  christos   -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
    198  1.38  christos   -Winit-self -Wjump-misses-init -Wlogical-op \
    199  1.38  christos   -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
    200  1.38  christos   -Wold-style-definition -Woverlength-strings -Wpointer-arith \
    201  1.38  christos   -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
    202  1.38  christos   -Wsuggest-attribute=const -Wsuggest-attribute=format \
    203  1.38  christos   -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
    204  1.38  christos   -Wtrampolines -Wundef -Wuninitialized -Wunused \
    205  1.38  christos   -Wvariadic-macros -Wvla -Wwrite-strings \
    206  1.38  christos   -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
    207  1.38  christos   -Wno-type-limits -Wno-unused-parameter
    208   1.1   mlelstv #
    209   1.1   mlelstv # If your system has a "GMT offset" field in its "struct tm"s
    210   1.1   mlelstv # (or if you decide to add such a field in your system's "time.h" file),
    211   1.1   mlelstv # add the name to a define such as
    212   1.1   mlelstv #	-DTM_GMTOFF=tm_gmtoff
    213  1.23  christos # to the end of the "CFLAGS=" line.  If not defined, the code attempts to
    214  1.23  christos # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
    215  1.23  christos # Similarly, if your system has a "zone abbreviation" field, define
    216   1.1   mlelstv #	-DTM_ZONE=tm_zone
    217  1.23  christos # and define NO_TM_ZONE to suppress any guessing.  These two fields are not
    218  1.23  christos # required by POSIX, but are widely available on GNU/Linux and BSD systems.
    219   1.1   mlelstv #
    220  1.38  christos # The next batch of options control support for external variables
    221  1.38  christos # exported by tzcode.  In practice these variables are less useful
    222  1.38  christos # than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
    223  1.38  christos # #
    224  1.38  christos # # To omit or support the external variable "tzname", add one of:
    225  1.38  christos # #	-DHAVE_TZNAME=0
    226  1.38  christos # #	-DHAVE_TZNAME=1
    227  1.38  christos # # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
    228  1.38  christos # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
    229  1.38  christos # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
    230  1.38  christos # # crashes when combined with some platforms' standard libraries,
    231  1.38  christos # # presumably due to memory allocation issues.
    232  1.38  christos # #
    233  1.38  christos # # To omit or support the external variables "timezone" and "daylight", add
    234  1.38  christos # #	-DUSG_COMPAT=0
    235  1.38  christos # #	-DUSG_COMPAT=1
    236  1.38  christos # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
    237  1.38  christos # # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
    238  1.38  christos # # If not defined, the code attempts to guess USG_COMPAT from other macros.
    239  1.38  christos # #
    240  1.38  christos # # To support the external variable "altzone", add
    241  1.38  christos # #	-DALTZONE
    242  1.38  christos # # to the end of the "CFLAGS=" line; although "altzone" appeared in
    243  1.38  christos # # System V Release 3.1 it has not been standardized.
    244  1.38  christos #
    245   1.1   mlelstv # If you want functions that were inspired by early versions of X3J11's work,
    246   1.1   mlelstv # add
    247   1.1   mlelstv #	-DSTD_INSPIRED
    248   1.1   mlelstv # to the end of the "CFLAGS=" line.  This arranges for the functions
    249   1.1   mlelstv # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
    250   1.1   mlelstv # "posix2time", and "time2posix" to be added to the time conversion library.
    251   1.1   mlelstv # "tzsetwall" is like "tzset" except that it arranges for local wall clock
    252   1.1   mlelstv # time (rather than the time specified in the TZ environment variable)
    253   1.1   mlelstv # to be used.
    254   1.1   mlelstv # "offtime" is like "gmtime" except that it accepts a second (long) argument
    255   1.1   mlelstv # that gives an offset to add to the time_t when converting it.
    256   1.1   mlelstv # "timelocal" is equivalent to "mktime".
    257   1.1   mlelstv # "timegm" is like "timelocal" except that it turns a struct tm into
    258  1.15  christos # a time_t using UT (rather than local time as "timelocal" does).
    259   1.1   mlelstv # "timeoff" is like "timegm" except that it accepts a second (long) argument
    260   1.1   mlelstv # that gives an offset to use when converting to a time_t.
    261   1.1   mlelstv # "posix2time" and "time2posix" are described in an included manual page.
    262   1.1   mlelstv # X3J11's work does not describe any of these functions.
    263   1.1   mlelstv # Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
    264   1.1   mlelstv # These functions may well disappear in future releases of the time
    265   1.1   mlelstv # conversion package.
    266   1.1   mlelstv #
    267  1.23  christos # If you don't want functions that were inspired by NetBSD, add
    268  1.23  christos #	-DNETBSD_INSPIRED=0
    269  1.23  christos # to the end of the "CFLAGS=" line.  Otherwise, the functions
    270  1.23  christos # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
    271  1.23  christos # time library, and if STD_INSPIRED is also defined the functions
    272  1.23  christos # "posix2time_z" and "time2posix_z" are added as well.
    273  1.23  christos # The functions ending in "_z" (or "_rz") are like their unsuffixed
    274  1.23  christos # (or suffixed-by-"_r") counterparts, except with an extra first
    275  1.23  christos # argument of opaque type timezone_t that specifies the time zone.
    276  1.23  christos # "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
    277  1.23  christos #
    278   1.1   mlelstv # If you want to allocate state structures in localtime, add
    279   1.1   mlelstv #	-DALL_STATE
    280   1.1   mlelstv # to the end of the "CFLAGS=" line.  Storage is obtained by calling malloc.
    281   1.1   mlelstv #
    282   1.1   mlelstv # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
    283   1.1   mlelstv # out by the National Institute of Standards and Technology
    284   1.1   mlelstv # which claims to test C and Posix conformance.  If you want to pass PCTS, add
    285   1.1   mlelstv #	-DPCTS
    286   1.1   mlelstv # to the end of the "CFLAGS=" line.
    287   1.1   mlelstv #
    288   1.1   mlelstv # If you want strict compliance with XPG4 as of 1994-04-09, add
    289   1.1   mlelstv #	-DXPG4_1994_04_09
    290   1.1   mlelstv # to the end of the "CFLAGS=" line.  This causes "strftime" to always return
    291  1.38  christos # 53 as a week number (rather than 52 or 53) for January days before
    292  1.38  christos # January's first Monday when a "%V" format is used and January 1
    293   1.1   mlelstv # falls on a Friday, Saturday, or Sunday.
    294   1.1   mlelstv 
    295   1.1   mlelstv CFLAGS=
    296   1.1   mlelstv 
    297   1.9  christos # Linker flags.  Default to $(LFLAGS) for backwards compatibility
    298  1.34  christos # to release 2012h and earlier.
    299   1.9  christos 
    300   1.9  christos LDFLAGS=	$(LFLAGS)
    301   1.1   mlelstv 
    302  1.32  christos # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
    303  1.32  christos # submake command lines.  The default is no leap seconds.
    304  1.32  christos 
    305  1.32  christos LEAPSECONDS=
    306  1.32  christos 
    307  1.32  christos # The zic command and its arguments.
    308  1.32  christos 
    309   1.1   mlelstv zic=		./zic
    310   1.1   mlelstv ZIC=		$(zic) $(ZFLAGS)
    311   1.1   mlelstv 
    312  1.15  christos ZFLAGS=
    313  1.15  christos 
    314  1.34  christos # How to use zic to install tz binary files.
    315  1.32  christos 
    316  1.38  christos ZIC_INSTALL=	$(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
    317  1.32  christos 
    318  1.22  christos # The name of a Posix-compliant 'awk' on your system.
    319   1.9  christos AWK=		awk
    320   1.9  christos 
    321  1.16  christos # The full path name of a Posix-compliant shell, preferably one that supports
    322  1.16  christos # the Korn shell's 'select' statement as an extension.
    323  1.16  christos # These days, Bash is the most popular.
    324  1.16  christos # It should be OK to set this to /bin/sh, on platforms where /bin/sh
    325  1.16  christos # lacks 'select' or doesn't completely conform to Posix, but /bin/bash
    326  1.16  christos # is typically nicer if it works.
    327   1.9  christos KSHELL=		/bin/bash
    328   1.1   mlelstv 
    329  1.18  christos # The path where SGML DTDs are kept and the catalog file(s) to use when
    330  1.34  christos # validating.  The default should work on both Debian and Red Hat.
    331  1.10  christos SGML_TOPDIR= /usr
    332   1.9  christos SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
    333   1.9  christos SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
    334  1.18  christos SGML_CATALOG_FILES= \
    335  1.34  christos   $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat:$(SGML_TOPDIR)/share/sgml/html/4.01/HTML4.cat
    336   1.1   mlelstv 
    337   1.1   mlelstv # The name, arguments and environment of a program to validate your web pages.
    338  1.34  christos # See <http://openjade.sourceforge.net/doc/> for a validator, and
    339  1.34  christos # <https://validator.w3.org/source/> for a validation library.
    340  1.38  christos # Set VALIDATE=':' if you do not have such a program.
    341   1.1   mlelstv VALIDATE = nsgmls
    342   1.1   mlelstv VALIDATE_FLAGS = -s -B -wall -wno-unused-param
    343   1.1   mlelstv VALIDATE_ENV = \
    344   1.1   mlelstv   SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
    345   1.1   mlelstv   SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
    346   1.1   mlelstv   SP_CHARSET_FIXED=YES \
    347   1.1   mlelstv   SP_ENCODING=UTF-8
    348   1.1   mlelstv 
    349  1.23  christos # This expensive test requires USE_LTZ.
    350  1.23  christos # To suppress it, define this macro to be empty.
    351  1.23  christos CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives
    352  1.23  christos 
    353  1.22  christos # SAFE_CHAR is a regular expression that matches a safe character.
    354  1.22  christos # Some parts of this distribution are limited to safe characters;
    355  1.22  christos # others can use any UTF-8 character.
    356  1.22  christos # For now, the safe characters are a safe subset of ASCII.
    357   1.9  christos # The caller must set the shell variable 'sharp' to the character '#',
    358   1.9  christos # since Makefile macros cannot contain '#'.
    359   1.9  christos # TAB_CHAR is a single tab character, in single quotes.
    360   1.9  christos TAB_CHAR=	'	'
    361  1.22  christos SAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
    362  1.22  christos SAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
    363  1.22  christos SAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
    364  1.29  christos SAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
    365  1.29  christos SAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
    366  1.29  christos 
    367  1.29  christos # OK_CHAR matches any character allowed in the distributed files.
    368  1.29  christos # This is the same as SAFE_CHAR, except that multibyte letters are
    369  1.29  christos # also allowed so that commentary can contain people's names and quote
    370  1.29  christos # non-English sources.  For non-letters the sources are limited to
    371  1.22  christos # ASCII renderings for the convenience of maintainers whose text editors
    372  1.22  christos # mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
    373  1.29  christos OK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
    374  1.22  christos 
    375  1.22  christos # SAFE_LINE matches a line of safe characters.
    376  1.29  christos # SAFE_SHARP_LINE is similar, except any OK character can follow '#';
    377  1.22  christos # this is so that comments can contain non-ASCII characters.
    378  1.29  christos # OK_LINE matches a line of OK characters.
    379  1.22  christos SAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
    380  1.29  christos SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
    381  1.29  christos OK_LINE=	'^'$(OK_CHAR)'*$$'
    382   1.9  christos 
    383   1.6  christos # Flags to give 'tar' when making a distribution.
    384   1.6  christos # Try to use flags appropriate for GNU tar.
    385  1.34  christos GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
    386   1.6  christos TARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
    387   1.6  christos 		 then echo $(GNUTARFLAGS); \
    388   1.6  christos 		 else :; \
    389   1.6  christos 		 fi`
    390   1.6  christos 
    391   1.6  christos # Flags to give 'gzip' when making a distribution.
    392  1.38  christos GZIPFLAGS=	-9n
    393   1.6  christos 
    394   1.1   mlelstv ###############################################################################
    395   1.1   mlelstv 
    396  1.29  christos #MAKE=		make
    397  1.29  christos 
    398   1.1   mlelstv cc=		cc
    399   1.1   mlelstv CC=		$(cc) -DTZDIR=\"$(TZDIR)\"
    400   1.1   mlelstv 
    401  1.16  christos AR=		ar
    402  1.16  christos 
    403  1.16  christos # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
    404  1.16  christos RANLIB=		:
    405  1.16  christos 
    406  1.28  christos TZCOBJS=	zic.o
    407  1.38  christos TZDOBJS=	zdump.o localtime.o asctime.o strftime.o
    408   1.1   mlelstv DATEOBJS=	date.o localtime.o strftime.o asctime.o
    409   1.1   mlelstv LIBSRCS=	localtime.c asctime.c difftime.c
    410   1.1   mlelstv LIBOBJS=	localtime.o asctime.o difftime.o
    411   1.1   mlelstv HEADERS=	tzfile.h private.h
    412  1.28  christos NONLIBSRCS=	zic.c zdump.c
    413   1.1   mlelstv NEWUCBSRCS=	date.c strftime.c
    414  1.23  christos SOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
    415  1.35  christos 			tzselect.ksh workman.sh
    416   1.1   mlelstv MANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
    417   1.1   mlelstv 			tzfile.5 tzselect.8 zic.8 zdump.8
    418  1.16  christos MANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
    419  1.16  christos 			time2posix.3.txt \
    420  1.16  christos 			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
    421  1.16  christos 			date.1.txt
    422  1.38  christos COMMON=		calendars CONTRIBUTING LICENSE Makefile \
    423  1.38  christos 			NEWS README theory.html version
    424  1.32  christos WEB_PAGES=	tz-art.htm tz-how-to.html tz-link.htm
    425  1.23  christos DOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
    426   1.1   mlelstv PRIMARY_YDATA=	africa antarctica asia australasia \
    427   1.1   mlelstv 		europe northamerica southamerica
    428  1.38  christos YDATA=		$(PRIMARY_YDATA) etcetera $(BACKWARD)
    429   1.4  christos NDATA=		systemv factory
    430  1.16  christos TDATA=		$(YDATA) $(NDATA)
    431  1.22  christos ZONETABLES=	zone1970.tab zone.tab
    432  1.38  christos TABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
    433  1.16  christos LEAP_DEPS=	leapseconds.awk leap-seconds.list
    434  1.38  christos TZDATA_ZI_DEPS=	zishrink.awk $(TDATA) $(PACKRATDATA)
    435  1.38  christos DATA=		$(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \
    436  1.38  christos 			leapseconds yearistype.sh $(ZONETABLES)
    437  1.38  christos AWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk zishrink.awk
    438  1.23  christos MISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
    439  1.34  christos TZS_YEAR=	2050
    440  1.34  christos TZS=		to$(TZS_YEAR).tzs
    441  1.34  christos TZS_NEW=	to$(TZS_YEAR)new.tzs
    442  1.34  christos TZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
    443  1.34  christos 			private.h tzfile.h zdump.c zic.c
    444  1.38  christos ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
    445  1.34  christos 
    446  1.34  christos # Consult these files when deciding whether to rebuild the 'version' file.
    447  1.34  christos # This list is not the same as the output of 'git ls-files', since
    448  1.34  christos # .gitignore is not distributed.
    449  1.34  christos VERSION_DEPS= \
    450  1.38  christos 		calendars CONTRIBUTING LICENSE Makefile NEWS README \
    451  1.34  christos 		africa antarctica asctime.c asia australasia \
    452  1.34  christos 		backward backzone \
    453  1.34  christos 		checklinks.awk checktab.awk \
    454  1.34  christos 		date.1 date.c difftime.c \
    455  1.34  christos 		etcetera europe factory iso3166.tab \
    456  1.34  christos 		leap-seconds.list leapseconds.awk localtime.c \
    457  1.34  christos 		newctime.3 newstrftime.3 newtzset.3 northamerica \
    458  1.34  christos 		pacificnew private.h \
    459  1.38  christos 		southamerica strftime.c systemv theory.html \
    460  1.34  christos 		time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \
    461  1.34  christos 		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
    462  1.34  christos 		workman.sh yearistype.sh \
    463  1.34  christos 		zdump.8 zdump.c zic.8 zic.c \
    464  1.34  christos 		zone.tab zone1970.tab zoneinfo2tdf.pl
    465   1.1   mlelstv 
    466   1.1   mlelstv # And for the benefit of csh users on systems that assume the user
    467   1.1   mlelstv # shell should be used to handle commands in Makefiles. . .
    468   1.1   mlelstv 
    469   1.1   mlelstv SHELL=		/bin/sh
    470   1.1   mlelstv 
    471  1.32  christos all:		tzselect yearistype zic zdump libtz.a $(TABDATA)
    472   1.1   mlelstv 
    473  1.29  christos ALL:		all date $(ENCHILADA)
    474   1.1   mlelstv 
    475  1.16  christos install:	all $(DATA) $(REDO) $(MANS)
    476  1.16  christos 		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
    477  1.16  christos 			$(DESTDIR)$(LIBDIR) \
    478  1.16  christos 			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
    479  1.16  christos 			$(DESTDIR)$(MANDIR)/man8
    480  1.32  christos 		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES)
    481  1.38  christos 		cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/.
    482  1.15  christos 		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
    483  1.16  christos 		cp libtz.a $(DESTDIR)$(LIBDIR)/.
    484  1.16  christos 		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
    485  1.16  christos 		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
    486  1.16  christos 		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
    487  1.16  christos 		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
    488   1.1   mlelstv 
    489   1.1   mlelstv INSTALL:	ALL install date.1
    490  1.16  christos 		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
    491  1.15  christos 		cp date $(DESTDIR)$(BINDIR)/.
    492  1.16  christos 		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
    493   1.1   mlelstv 
    494  1.34  christos version:	$(VERSION_DEPS)
    495  1.35  christos 		{ (type git) >/dev/null 2>&1 && \
    496  1.35  christos 		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
    497  1.35  christos 				--abbrev=7 --dirty` || \
    498  1.34  christos 		  V=$(VERSION); } && \
    499  1.35  christos 		printf '%s\n' "$$V" >$@.out
    500  1.35  christos 		mv $@.out $@
    501  1.34  christos 
    502  1.38  christos # This file can be tailored by setting BACKWARD, PACKRATDATA, etc.
    503  1.38  christos tzdata.zi:	$(TZDATA_ZI_DEPS)
    504  1.38  christos 		LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out
    505  1.38  christos 		mv $@.out $@
    506  1.38  christos 
    507  1.34  christos version.h:	version
    508  1.35  christos 		VERSION=`cat version` && printf '%s\n' \
    509  1.35  christos 		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
    510  1.35  christos 		  "static char const TZVERSION[]=\"$$VERSION\";" \
    511  1.35  christos 		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
    512  1.35  christos 		  >$@.out
    513  1.35  christos 		mv $@.out $@
    514   1.6  christos 
    515   1.1   mlelstv zdump:		$(TZDOBJS)
    516   1.9  christos 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
    517   1.1   mlelstv 
    518  1.32  christos zic:		$(TZCOBJS)
    519   1.9  christos 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
    520   1.1   mlelstv 
    521   1.1   mlelstv yearistype:	yearistype.sh
    522   1.1   mlelstv 		cp yearistype.sh yearistype
    523   1.1   mlelstv 		chmod +x yearistype
    524   1.1   mlelstv 
    525  1.16  christos leapseconds:	$(LEAP_DEPS)
    526  1.35  christos 		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
    527  1.35  christos 		mv $@.out $@
    528  1.15  christos 
    529  1.32  christos # Arguments to pass to submakes of install_data.
    530  1.32  christos # They can be overridden by later submake arguments.
    531  1.32  christos INSTALLARGS = \
    532  1.38  christos  BACKWARD=$(BACKWARD) \
    533  1.32  christos  DESTDIR=$(DESTDIR) \
    534  1.32  christos  LEAPSECONDS='$(LEAPSECONDS)' \
    535  1.32  christos  PACKRATDATA='$(PACKRATDATA)' \
    536  1.32  christos  TZDIR=$(TZDIR) \
    537  1.32  christos  YEARISTYPE=$(YEARISTYPE) \
    538  1.32  christos  ZIC='$(ZIC)'
    539  1.32  christos 
    540  1.32  christos # 'make install_data' installs one set of tz binary files.
    541  1.38  christos install_data:	zic leapseconds yearistype tzdata.zi
    542  1.38  christos 		$(ZIC_INSTALL) tzdata.zi
    543  1.32  christos 
    544  1.32  christos posix_only:
    545  1.32  christos 		$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
    546  1.32  christos 
    547  1.32  christos right_only:
    548  1.32  christos 		$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
    549  1.32  christos 			install_data
    550   1.1   mlelstv 
    551   1.1   mlelstv # In earlier versions of this makefile, the other two directories were
    552   1.1   mlelstv # subdirectories of $(TZDIR).  However, this led to configuration errors.
    553   1.1   mlelstv # For example, with posix_right under the earlier scheme,
    554   1.1   mlelstv # TZ='right/Australia/Adelaide' got you localtime with leap seconds,
    555   1.1   mlelstv # but gmtime without leap seconds, which led to problems with applications
    556   1.1   mlelstv # like sendmail that subtract gmtime from localtime.
    557   1.1   mlelstv # Therefore, the other two directories are now siblings of $(TZDIR).
    558   1.1   mlelstv # You must replace all of $(TZDIR) to switch from not using leap seconds
    559   1.1   mlelstv # to using them, or vice versa.
    560  1.32  christos right_posix:	right_only
    561  1.15  christos 		rm -fr $(DESTDIR)$(TZDIR)-leaps
    562  1.15  christos 		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
    563  1.32  christos 		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
    564  1.32  christos 		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
    565  1.15  christos 
    566  1.32  christos posix_right:	posix_only
    567  1.15  christos 		rm -fr $(DESTDIR)$(TZDIR)-posix
    568  1.15  christos 		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
    569  1.32  christos 		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
    570  1.32  christos 		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
    571  1.32  christos 
    572  1.32  christos # This obsolescent rule is present for backwards compatibility with
    573  1.32  christos # tz releases 2014g through 2015g.  It should go away eventually.
    574  1.32  christos posix_packrat:
    575  1.32  christos 		$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
    576  1.23  christos 
    577   1.1   mlelstv zones:		$(REDO)
    578   1.1   mlelstv 
    579  1.38  christos $(TZS_NEW):	tzdata.zi zdump zic
    580  1.34  christos 		mkdir -p tzs.dir
    581  1.38  christos 		$(zic) -d tzs.dir tzdata.zi
    582  1.38  christos 		$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
    583  1.38  christos 		   tzdata.zi | LC_ALL=C sort >$@.out
    584  1.35  christos 		wd=`pwd` && \
    585  1.35  christos 		zones=`$(AWK) -v wd="$$wd" \
    586  1.38  christos 				'/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \
    587  1.35  christos 			 | LC_ALL=C sort` && \
    588  1.34  christos 		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
    589  1.35  christos 		sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out
    590  1.34  christos 		rm -fr tzs.dir $@.out
    591  1.35  christos 		mv $@.sed.out $@
    592  1.34  christos 
    593  1.34  christos # If $(TZS) does not already exist (e.g., old-format tarballs), create it.
    594  1.34  christos # If it exists but 'make check_tzs' fails, a maintainer should inspect the
    595  1.34  christos # failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
    596  1.34  christos $(TZS):
    597  1.34  christos 		$(MAKE) force_tzs
    598  1.34  christos 
    599  1.34  christos force_tzs:	$(TZS_NEW)
    600  1.34  christos 		cp $(TZS_NEW) $(TZS)
    601  1.34  christos 
    602  1.16  christos libtz.a:	$(LIBOBJS)
    603  1.37  christos 		rm -f $@
    604  1.37  christos 		$(AR) -rc $@ $(LIBOBJS)
    605  1.16  christos 		$(RANLIB) $@
    606   1.1   mlelstv 
    607   1.1   mlelstv date:		$(DATEOBJS)
    608   1.9  christos 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
    609   1.1   mlelstv 
    610  1.34  christos tzselect:	tzselect.ksh version
    611  1.35  christos 		VERSION=`cat version` && sed \
    612   1.9  christos 			-e 's|#!/bin/bash|#!$(KSHELL)|g' \
    613   1.1   mlelstv 			-e 's|AWK=[^}]*|AWK=$(AWK)|g' \
    614   1.9  christos 			-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
    615   1.9  christos 			-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
    616   1.1   mlelstv 			-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
    617  1.35  christos 			-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
    618  1.35  christos 			<$@.ksh >$@.out
    619  1.35  christos 		chmod +x $@.out
    620  1.35  christos 		mv $@.out $@
    621   1.1   mlelstv 
    622  1.38  christos check:		check_character_set check_white_space check_links \
    623  1.38  christos 		  check_name_lengths check_sorted \
    624  1.38  christos 		  check_tables check_web check_zishrink check_tzs
    625   1.9  christos 
    626   1.9  christos check_character_set: $(ENCHILADA)
    627  1.38  christos 	test ! '$(UTF8_LOCALE)' || \
    628  1.38  christos 	! printf 'A\304\200B\n' | \
    629  1.38  christos 	  LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
    630  1.38  christos 		LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
    631  1.22  christos 		sharp='#' && \
    632  1.35  christos 		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
    633  1.35  christos 			$(MISC) $(SOURCES) $(WEB_PAGES) \
    634  1.38  christos 			CONTRIBUTING LICENSE Makefile README \
    635  1.38  christos 			version tzdata.zi && \
    636  1.23  christos 		! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
    637  1.29  christos 			leapseconds yearistype.sh zone.tab && \
    638  1.38  christos 		! grep -Env $(OK_LINE) $(ENCHILADA); \
    639  1.38  christos 	}
    640  1.22  christos 
    641  1.23  christos check_white_space: $(ENCHILADA)
    642  1.35  christos 		patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
    643  1.35  christos 		! grep -En "$$pat" $(ENCHILADA)
    644  1.27  christos 		! grep -n '[[:space:]]$$' $(ENCHILADA)
    645  1.23  christos 
    646  1.38  christos PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
    647  1.38  christos FILE_NAME_COMPONENT_TOO_LONG = \
    648  1.38  christos   $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
    649  1.38  christos 
    650  1.38  christos check_name_lengths: $(TDATA) backzone
    651  1.38  christos 		! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone
    652  1.38  christos 
    653  1.23  christos CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
    654  1.23  christos 
    655  1.23  christos check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
    656  1.23  christos 		$(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu
    657  1.23  christos 		$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
    658  1.23  christos 		$(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu
    659  1.23  christos 		$(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c
    660  1.23  christos 		$(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \
    661  1.23  christos 		  LC_ALL=C sort -c
    662  1.23  christos 		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
    663  1.23  christos 		  LC_ALL=C sort -cu
    664  1.23  christos 
    665  1.26  christos check_links:	checklinks.awk $(TDATA)
    666  1.26  christos 		$(AWK) -f checklinks.awk $(TDATA)
    667  1.38  christos 		$(AWK) -f checklinks.awk tzdata.zi
    668  1.26  christos 
    669  1.22  christos check_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
    670  1.22  christos 		for tab in $(ZONETABLES); do \
    671  1.22  christos 		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
    672  1.22  christos 		    || exit; \
    673  1.22  christos 		done
    674   1.1   mlelstv 
    675  1.34  christos check_tzs:	$(TZS) $(TZS_NEW)
    676  1.34  christos 		diff -u $(TZS) $(TZS_NEW)
    677  1.34  christos 
    678  1.38  christos # This checks only the HTML 4.01 strict page.
    679  1.38  christos # To check the the other pages, use <https://validator.w3.org/>.
    680  1.38  christos check_web:	tz-how-to.html
    681  1.38  christos 		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
    682  1.38  christos 
    683  1.38  christos # Check that tzdata.zi generates the same binary data that its sources do.
    684  1.38  christos check_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA)
    685  1.38  christos 		for type in posix right; do \
    686  1.38  christos 		  mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \
    687  1.38  christos 		  case $$type in \
    688  1.38  christos 		    right) leap='-L leapseconds';; \
    689  1.38  christos 	            *) leap=;; \
    690  1.38  christos 		  esac && \
    691  1.38  christos 		  $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \
    692  1.38  christos 		  $(AWK) '/^Rule/' $(TDATA) | \
    693  1.38  christos 		    $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \
    694  1.38  christos 		  $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
    695  1.38  christos 		  diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
    696  1.38  christos 		done
    697  1.38  christos 		rm -fr time_t.dir
    698   1.1   mlelstv 
    699  1.14  christos clean_misc:
    700   1.6  christos 		rm -f core *.o *.out \
    701  1.18  christos 		  date tzselect version.h zdump zic yearistype libtz.a
    702  1.14  christos clean:		clean_misc
    703  1.38  christos 		rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW)
    704   1.1   mlelstv 
    705   1.1   mlelstv maintainer-clean: clean
    706   1.1   mlelstv 		@echo 'This command is intended for maintainers to use; it'
    707   1.1   mlelstv 		@echo 'deletes files that may need special tools to rebuild.'
    708  1.34  christos 		rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.*
    709   1.1   mlelstv 
    710   1.1   mlelstv names:
    711   1.1   mlelstv 		@echo $(ENCHILADA)
    712   1.1   mlelstv 
    713  1.23  christos public:		check check_public $(CHECK_TIME_T_ALTERNATIVES) \
    714  1.16  christos 		tarballs signatures
    715  1.16  christos 
    716  1.16  christos date.1.txt:	date.1
    717  1.16  christos newctime.3.txt:	newctime.3
    718  1.16  christos newstrftime.3.txt: newstrftime.3
    719  1.16  christos newtzset.3.txt:	newtzset.3
    720  1.16  christos time2posix.3.txt: time2posix.3
    721  1.16  christos tzfile.5.txt:	tzfile.5
    722  1.16  christos tzselect.8.txt:	tzselect.8
    723  1.16  christos zdump.8.txt:	zdump.8
    724  1.16  christos zic.8.txt:	zic.8
    725  1.16  christos 
    726  1.16  christos $(MANTXTS):	workman.sh
    727  1.35  christos 		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
    728  1.35  christos 		mv $@.out $@
    729   1.9  christos 
    730   1.6  christos # Set the time stamps to those of the git repository, if available,
    731   1.6  christos # and if the files have not changed since then.
    732   1.6  christos # This uses GNU 'touch' syntax 'touch -d@N FILE',
    733   1.6  christos # where N is the number of seconds since 1970.
    734  1.16  christos # If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
    735  1.16  christos # Also, set the timestamp of each prebuilt file like 'leapseconds'
    736  1.16  christos # to be the maximum of the files it depends on.
    737  1.16  christos set-timestamps.out: $(ENCHILADA)
    738  1.16  christos 		rm -f $@
    739  1.35  christos 		if (type git) >/dev/null 2>&1 && \
    740  1.35  christos 		   files=`git ls-files $(ENCHILADA)` && \
    741  1.16  christos 		   touch -md @1 test.out; then \
    742  1.16  christos 		  rm -f test.out && \
    743  1.16  christos 		  for file in $$files; do \
    744  1.16  christos 		    if git diff --quiet $$file; then \
    745  1.16  christos 		      time=`git log -1 --format='tformat:%ct' $$file` && \
    746  1.16  christos 		      touch -cmd @$$time $$file; \
    747  1.16  christos 		    else \
    748  1.16  christos 		      echo >&2 "$$file: warning: does not match repository"; \
    749  1.16  christos 		    fi || exit; \
    750  1.16  christos 		  done; \
    751  1.16  christos 		fi
    752  1.16  christos 		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
    753  1.16  christos 		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
    754  1.16  christos 		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
    755  1.16  christos 		    exit; \
    756   1.6  christos 		done
    757  1.38  christos 		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
    758  1.35  christos 		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
    759  1.35  christos 		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
    760  1.16  christos 		touch $@
    761   1.6  christos 
    762   1.1   mlelstv # The zics below ensure that each data file can stand on its own.
    763   1.1   mlelstv # We also do an all-files run to catch links to links.
    764   1.1   mlelstv 
    765  1.29  christos check_public:
    766  1.29  christos 		$(MAKE) maintainer-clean
    767  1.29  christos 		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
    768  1.34  christos 		mkdir -p public.dir
    769  1.38  christos 		for i in $(TDATA) tzdata.zi; do \
    770  1.34  christos 		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
    771   1.9  christos 		done
    772  1.34  christos 		$(zic) -v -d public.dir $(TDATA)
    773  1.34  christos 		rm -fr public.dir
    774   1.9  christos 
    775  1.14  christos # Check that the code works under various alternative
    776  1.14  christos # implementations of time_t.
    777  1.14  christos check_time_t_alternatives:
    778  1.23  christos 		if diff -q Makefile Makefile 2>/dev/null; then \
    779  1.23  christos 		  quiet_option='-q'; \
    780  1.23  christos 		else \
    781  1.23  christos 		  quiet_option=''; \
    782  1.23  christos 		fi && \
    783  1.35  christos 		wd=`pwd` && \
    784  1.22  christos 		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
    785  1.14  christos 		for type in $(TIME_T_ALTERNATIVES); do \
    786  1.34  christos 		  mkdir -p time_t.dir/$$type && \
    787  1.29  christos 		  $(MAKE) clean_misc && \
    788  1.35  christos 		  $(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
    789  1.14  christos 		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
    790  1.23  christos 		    REDO='$(REDO)' \
    791  1.14  christos 		    install && \
    792  1.23  christos 		  diff $$quiet_option -r \
    793  1.34  christos 		    time_t.dir/int64_t/etc/zoneinfo \
    794  1.34  christos 		    time_t.dir/$$type/etc/zoneinfo && \
    795  1.14  christos 		  case $$type in \
    796  1.14  christos 		  int32_t) range=-2147483648,2147483647;; \
    797  1.14  christos 		  uint32_t) range=0,4294967296;; \
    798  1.14  christos 		  int64_t) continue;; \
    799  1.14  christos 		  *u*) range=0,10000000000;; \
    800  1.14  christos 		  *) range=-10000000000,10000000000;; \
    801  1.14  christos 		  esac && \
    802  1.14  christos 		  echo checking $$type zones ... && \
    803  1.34  christos 		  time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \
    804  1.34  christos 		      >time_t.dir/int64_t.out && \
    805  1.34  christos 		  time_t.dir/$$type/etc/zdump -V -t $$range $$zones \
    806  1.34  christos 		      >time_t.dir/$$type.out && \
    807  1.34  christos 		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
    808  1.14  christos 		    || exit; \
    809  1.14  christos 		done
    810  1.34  christos 		rm -fr time_t.dir
    811  1.34  christos 
    812  1.35  christos tarballs traditional_tarballs signatures traditional_signatures: version
    813  1.35  christos 		VERSION=`cat version` && \
    814  1.35  christos 		$(MAKE) VERSION="$$VERSION" $@_version
    815  1.35  christos 
    816  1.38  christos tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
    817  1.38  christos traditional_tarballs_version: \
    818  1.38  christos   tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
    819  1.35  christos signatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
    820  1.35  christos traditional_signatures_version: \
    821  1.35  christos   tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \
    822   1.9  christos 
    823  1.16  christos tzcode$(VERSION).tar.gz: set-timestamps.out
    824   1.6  christos 		LC_ALL=C && export LC_ALL && \
    825   1.7  christos 		tar $(TARFLAGS) -cf - \
    826  1.23  christos 		    $(COMMON) $(DOCS) $(SOURCES) | \
    827  1.38  christos 		  gzip $(GZIPFLAGS) >$@.out
    828  1.35  christos 		mv $@.out $@
    829  1.10  christos 
    830  1.16  christos tzdata$(VERSION).tar.gz: set-timestamps.out
    831   1.6  christos 		LC_ALL=C && export LC_ALL && \
    832  1.23  christos 		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
    833  1.38  christos 		  gzip $(GZIPFLAGS) >$@.out
    834  1.35  christos 		mv $@.out $@
    835   1.9  christos 
    836  1.34  christos tzdb-$(VERSION).tar.lz: set-timestamps.out
    837  1.34  christos 		rm -fr tzdb-$(VERSION)
    838  1.34  christos 		mkdir tzdb-$(VERSION)
    839  1.34  christos 		ln $(ENCHILADA) tzdb-$(VERSION)
    840  1.35  christos 		touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION)
    841  1.34  christos 		LC_ALL=C && export LC_ALL && \
    842  1.35  christos 		tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
    843  1.35  christos 		mv $@.out $@
    844   1.9  christos 
    845   1.9  christos tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
    846   1.9  christos 		gpg --armor --detach-sign $?
    847   1.9  christos 
    848   1.9  christos tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
    849   1.9  christos 		gpg --armor --detach-sign $?
    850   1.1   mlelstv 
    851  1.34  christos tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
    852  1.34  christos 		gpg --armor --detach-sign $?
    853  1.34  christos 
    854   1.1   mlelstv typecheck:
    855  1.29  christos 		$(MAKE) clean
    856  1.15  christos 		for i in "long long" unsigned; \
    857   1.1   mlelstv 		do \
    858  1.29  christos 			$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
    859   1.1   mlelstv 			./zdump -v Europe/Rome ; \
    860  1.29  christos 			$(MAKE) clean ; \
    861   1.1   mlelstv 		done
    862   1.1   mlelstv 
    863  1.38  christos zonenames:	tzdata.zi
    864  1.38  christos 		@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
    865   1.1   mlelstv 
    866   1.1   mlelstv asctime.o:	private.h tzfile.h
    867   1.1   mlelstv date.o:		private.h
    868   1.1   mlelstv difftime.o:	private.h
    869   1.1   mlelstv localtime.o:	private.h tzfile.h
    870  1.23  christos strftime.o:	private.h tzfile.h
    871   1.6  christos zdump.o:	version.h
    872   1.6  christos zic.o:		private.h tzfile.h version.h
    873   1.1   mlelstv 
    874   1.1   mlelstv .KEEP_STATE:
    875  1.22  christos 
    876  1.22  christos .PHONY: ALL INSTALL all
    877  1.26  christos .PHONY: check check_character_set check_links
    878  1.26  christos .PHONY: check_public check_sorted check_tables
    879  1.34  christos .PHONY: check_time_t_alternatives check_tzs check_web check_white_space
    880  1.38  christos .PHONY: check_zishrink
    881  1.34  christos .PHONY: clean clean_misc force_tzs
    882  1.32  christos .PHONY: install install_data maintainer-clean names
    883  1.32  christos .PHONY: posix_only posix_packrat posix_right
    884  1.34  christos .PHONY: public right_only right_posix signatures signatures_version
    885  1.34  christos .PHONY: tarballs tarballs_version typecheck
    886  1.22  christos .PHONY: zonenames zones
    887