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