Makefile revision 1.2
1# <pre> 2# @(#)Makefile 8.8 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= Factory 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# $(GCC_OVERFLOW_FLAGS) if you are using GCC 3.4 or later. 114# If you are using a compiler other than GCC, and if it defaults to 115# undefined behavior on integer overflow, then you need to specify a flag 116# saying that integer arithmetic is supposed to wrap around on overflow. 117# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1 118# if you do not want run time warnings about formats that may cause 119# year 2000 grief 120# -DZIC_MAX_ABBR_LEN_WO_WARN=3 121# (or some other number) to set the maximum time zone abbreviation length 122# that zic will accept without a warning (the default is 6) 123GCC_DEBUG_FLAGS = -Dlint -g -O -fno-common \ 124 -Wall -Wcast-qual -Wconversion -Wmissing-prototypes \ 125 -Wnested-externs -Wpointer-arith -Wshadow \ 126 -Wtraditional # -Wstrict-prototypes -Wwrite-strings 127GCC_OVERFLOW_FLAGS = -fwrapv 128# 129# If you want to use System V compatibility code, add 130# -DUSG_COMPAT 131# to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight" 132# variables to be kept up-to-date by the time conversion functions. Neither 133# "timezone" nor "daylight" is described in X3J11's work. 134# 135# If your system has a "GMT offset" field in its "struct tm"s 136# (or if you decide to add such a field in your system's "time.h" file), 137# add the name to a define such as 138# -DTM_GMTOFF=tm_gmtoff 139# or 140# -DTM_GMTOFF=_tm_gmtoff 141# to the end of the "CFLAGS=" line. 142# Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work; 143# in its work, use of "tm_gmtoff" is described as non-conforming. 144# Both Linux and BSD have done the equivalent of defining TM_GMTOFF in 145# their recent releases. 146# 147# If your system has a "zone abbreviation" field in its "struct tm"s 148# (or if you decide to add such a field in your system's "time.h" file), 149# add the name to a define such as 150# -DTM_ZONE=tm_zone 151# or 152# -DTM_ZONE=_tm_zone 153# to the end of the "CFLAGS=" line. 154# Neither tm_zone nor _tm_zone is described in X3J11's work; 155# in its work, use of "tm_zone" is described as non-conforming. 156# Both UCB and Sun have done the equivalent of defining TM_ZONE in 157# their recent releases. 158# 159# If you want functions that were inspired by early versions of X3J11's work, 160# add 161# -DSTD_INSPIRED 162# to the end of the "CFLAGS=" line. This arranges for the functions 163# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff", 164# "posix2time", and "time2posix" to be added to the time conversion library. 165# "tzsetwall" is like "tzset" except that it arranges for local wall clock 166# time (rather than the time specified in the TZ environment variable) 167# to be used. 168# "offtime" is like "gmtime" except that it accepts a second (long) argument 169# that gives an offset to add to the time_t when converting it. 170# "timelocal" is equivalent to "mktime". 171# "timegm" is like "timelocal" except that it turns a struct tm into 172# a time_t using UTC (rather than local time as "timelocal" does). 173# "timeoff" is like "timegm" except that it accepts a second (long) argument 174# that gives an offset to use when converting to a time_t. 175# "posix2time" and "time2posix" are described in an included manual page. 176# X3J11's work does not describe any of these functions. 177# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0. 178# These functions may well disappear in future releases of the time 179# conversion package. 180# 181# If you want Source Code Control System ID's left out of object modules, add 182# -DNOID 183# to the end of the "CFLAGS=" line. 184# 185# If you'll never want to handle solar-time-based time zones, add 186# -DNOSOLAR 187# to the end of the "CFLAGS=" line 188# (and comment out the "SDATA=" line below). 189# This reduces (slightly) the run-time data-space requirements of 190# the time conversion functions; it may reduce the acceptability of your system 191# to folks in oil- and cash-rich places. 192# 193# If you want to allocate state structures in localtime, add 194# -DALL_STATE 195# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. 196# 197# If you want an "altzone" variable (a la System V Release 3.1), add 198# -DALTZONE 199# to the end of the "CFLAGS=" line. 200# This variable is not described in X3J11's work. 201# 202# If you want a "gtime" function (a la MACH), add 203# -DCMUCS 204# to the end of the "CFLAGS=" line 205# This function is not described in X3J11's work. 206# 207# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put 208# out by the National Institute of Standards and Technology 209# which claims to test C and Posix conformance. If you want to pass PCTS, add 210# -DPCTS 211# to the end of the "CFLAGS=" line. 212# 213# If you want strict compliance with XPG4 as of 1994-04-09, add 214# -DXPG4_1994_04_09 215# to the end of the "CFLAGS=" line. This causes "strftime" to always return 216# 53 as a week number (rather than 52 or 53) for those days in January that 217# before the first Monday in January when a "%V" format is used and January 1 218# falls on a Friday, Saturday, or Sunday. 219 220CFLAGS= 221 222# If you want zic's -s option used when installing, uncomment the next line 223# ZFLAGS= -s 224 225zic= ./zic 226ZIC= $(zic) $(ZFLAGS) 227 228# The name of a Posix-compliant `awk' on your system. 229AWK= nawk 230 231# The path where SGML DTDs are kept. 232SGML_SEARCH_PATH= $(TOPDIR)/share/doc/sgml-lib/REC-html401-19991224/ 233 234# The catalog file(s) to use when validating. 235SGML_CATALOG_FILES= HTML4.cat 236 237# The name, arguments and environment of a program to validate your web pages. 238# See <http://www.jclark.com/sp/> for a validator, and 239# <http://validator.w3.org/source/> for a validation library. 240VALIDATE = nsgmls 241VALIDATE_FLAGS = -s -B -wall -wno-unused-param 242VALIDATE_ENV = \ 243 SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ 244 SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ 245 SP_CHARSET_FIXED=YES \ 246 SP_ENCODING=UTF-8 247 248############################################################################### 249 250cc= cc 251CC= $(cc) -DTZDIR=\"$(TZDIR)\" 252 253TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c 254TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o 255TZDSRCS= zdump.c localtime.c ialloc.c 256TZDOBJS= zdump.o localtime.o ialloc.o 257DATESRCS= date.c localtime.c strftime.c asctime.c 258DATEOBJS= date.o localtime.o strftime.o asctime.o 259LIBSRCS= localtime.c asctime.c difftime.c 260LIBOBJS= localtime.o asctime.o difftime.o 261HEADERS= tzfile.h private.h 262NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c 263NEWUCBSRCS= date.c strftime.c 264SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh 265MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ 266 tzfile.5 tzselect.8 zic.8 zdump.8 267DOCS= README Theory $(MANS) date.1 Makefile 268PRIMARY_YDATA= africa antarctica asia australasia \ 269 europe northamerica southamerica 270YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward 271NDATA= systemv 272SDATA= solar87 solar88 solar89 273TDATA= $(YDATA) $(NDATA) $(SDATA) 274TABDATA= iso3166.tab zone.tab 275DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) leapseconds yearistype.sh 276WEB_PAGES= tz-art.htm tz-link.htm 277MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \ 278 itca.jpg $(WEB_PAGES) checktab.awk workman.sh \ 279 zoneinfo2tdf.pl 280ENCHILADA= $(DOCS) $(SOURCES) $(DATA) $(MISC) 281 282# And for the benefit of csh users on systems that assume the user 283# shell should be used to handle commands in Makefiles. . . 284 285SHELL= /bin/sh 286 287all: tzselect zic zdump $(LIBOBJS) 288 289ALL: all date 290 291install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA) 292 $(ZIC) -y $(YEARISTYPE) \ 293 -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES) 294 -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab 295 cp iso3166.tab zone.tab $(TZDIR)/. 296 -mkdir $(TOPDIR) $(ETCDIR) 297 cp tzselect zic zdump $(ETCDIR)/. 298 -mkdir $(TOPDIR) $(MANDIR) \ 299 $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8 300 -rm -f $(MANDIR)/man3/newctime.3 \ 301 $(MANDIR)/man3/newtzset.3 \ 302 $(MANDIR)/man5/tzfile.5 \ 303 $(MANDIR)/man8/tzselect.8 \ 304 $(MANDIR)/man8/zdump.8 \ 305 $(MANDIR)/man8/zic.8 306 cp newctime.3 newtzset.3 $(MANDIR)/man3/. 307 cp tzfile.5 $(MANDIR)/man5/. 308 cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/. 309 310INSTALL: ALL install date.1 311 -mkdir $(TOPDIR) $(BINDIR) 312 cp date $(BINDIR)/. 313 -mkdir $(TOPDIR) $(MANDIR) $(MANDIR)/man1 314 -rm -f $(MANDIR)/man1/date.1 315 cp date.1 $(MANDIR)/man1/. 316 317zdump: $(TZDOBJS) 318 $(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@ 319 320zic: $(TZCOBJS) yearistype 321 $(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@ 322 323yearistype: yearistype.sh 324 cp yearistype.sh yearistype 325 chmod +x yearistype 326 327posix_only: zic $(TDATA) 328 $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA) 329 330right_only: zic leapseconds $(TDATA) 331 $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA) 332 333# In earlier versions of this makefile, the other two directories were 334# subdirectories of $(TZDIR). However, this led to configuration errors. 335# For example, with posix_right under the earlier scheme, 336# TZ='right/Australia/Adelaide' got you localtime with leap seconds, 337# but gmtime without leap seconds, which led to problems with applications 338# like sendmail that subtract gmtime from localtime. 339# Therefore, the other two directories are now siblings of $(TZDIR). 340# You must replace all of $(TZDIR) to switch from not using leap seconds 341# to using them, or vice versa. 342other_two: zic leapseconds $(TDATA) 343 $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA) 344 $(ZIC) -y $(YEARISTYPE) \ 345 -d $(TZDIR)-leaps -L leapseconds $(TDATA) 346 347posix_right: posix_only other_two 348 349right_posix: right_only other_two 350 351zones: $(REDO) 352 353$(TZLIB): $(LIBOBJS) 354 -mkdir $(TOPDIR) $(LIBDIR) 355 ar ru $@ $(LIBOBJS) 356 if [ -x /usr/ucb/ranlib -o -x /usr/bin/ranlib ] ; \ 357 then ranlib $@ ; fi 358 359date: $(DATEOBJS) 360 $(CC) $(CFLAGS) date.o localtime.o asctime.o strftime.o \ 361 $(LDLIBS) -lc -o $@ 362 363tzselect: tzselect.ksh 364 sed \ 365 -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ 366 -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ 367 <$? >$@ 368 chmod +x $@ 369 370check: check_tables check_web 371 372check_tables: checktab.awk $(PRIMARY_YDATA) 373 $(AWK) -f checktab.awk $(PRIMARY_YDATA) 374 375check_web: $(WEB_PAGES) 376 $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) 377 378clean: 379 rm -f core *.o *.out tzselect zdump zic yearistype date 380 381maintainer-clean: clean 382 @echo 'This command is intended for maintainers to use; it' 383 @echo 'deletes files that may need special tools to rebuild.' 384 rm -f *.[1-8].txt tzcode.tar.gz tzdata.tar.gz 385 386names: 387 @echo $(ENCHILADA) 388 389# The zics below ensure that each data file can stand on its own. 390# We also do an all-files run to catch links to links. 391 392public: $(ENCHILADA) 393 make maintainer-clean 394 make "CFLAGS=$(GCC_DEBUG_FLAGS) $(GCC_OVERFLOW_FLAGS)" 395 -mkdir /tmp/,tzpublic 396 -for i in $(TDATA) ; do zic -v -d /tmp/,tzpublic $$i 2>&1 | grep -v "starting year" ; done 397 for i in $(TDATA) ; do zic -d /tmp/,tzpublic $$i || exit; done 398 zic -v -d /tmp/,tzpublic $(TDATA) || exit 399 rm -f -r /tmp/,tzpublic 400 for i in *.[1-8] ; do sh workman.sh $$i > $$i.txt || exit; done 401 $(AWK) -f checktab.awk $(PRIMARY_YDATA) 402 tar cf - $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | gzip -9 > tzcode.tar.gz 403 tar cf - $(DATA) | gzip -9 > tzdata.tar.gz 404 405typecheck: 406 make clean 407 for i in "long long" unsigned double; \ 408 do \ 409 make CFLAGS="-DTYPECHECK -D_TIME_T \"-Dtime_t=$$i\"" ; \ 410 ./zdump -v Europe/Rome ; \ 411 make clean ; \ 412 done 413 414zonenames: $(TDATA) 415 @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA) 416 417asctime.o: private.h tzfile.h 418date.o: private.h 419difftime.o: private.h 420ialloc.o: private.h 421localtime.o: private.h tzfile.h 422scheck.o: private.h 423strftime.o: tzfile.h 424zic.o: private.h tzfile.h 425 426.KEEP_STATE: 427