1# $OpenBSD: Makefile,v 1.19 2024/02/07 21:24:58 millert Exp $ 2 3# DATAFORM selects the data format. OpenBSD always uses "main" 4# Available formats represent essentially the same data, albeit 5# possibly with minor discrepancies that users are not likely to notice. 6# To get new features and the best data right away, use: 7# DATAFORM= vanguard 8# To wait a while before using new features, to give downstream users 9# time to upgrade zic (the default), use: 10# DATAFORM= main 11# To wait even longer for new features, use: 12# DATAFORM= rearguard 13# Rearguard users might also want "ZFLAGS = -b fat"; see below. 14DATAFORM= main 15 16# The POSIXRULES macro controls interpretation of POSIX-like TZ 17# settings like TZ='EET-2EEST' that lack DST transition rules. 18# If POSIXRULES is '-', no template is installed; this is the default. 19# Any other value for POSIXRULES is obsolete and should not be relied on, as: 20# * It does not work correctly in popular implementations such as GNU/Linux. 21# * It does not work even in tzcode, except for historical timestamps 22# that precede the last explicit transition in the POSIXRULES file. 23# Hence it typically does not work for current and future timestamps. 24# If, despite the above, you want a template for handling these settings, 25# you can change the line below (after finding the timezone you want in the 26# one of the $(TDATA) source files, or adding it to a source file). 27# Alternatively, if you discover you've got the wrong timezone, you can just 28# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. 29# Use the command 30# make zonenames 31# to get a list of the values you can use for POSIXRULES. 32POSIXRULES= US/Pacific 33 34# "Compiled" timezone information is placed in the "TZDIR" directory 35# (and subdirectories). 36# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. 37TZDIR_BASENAME= zoneinfo 38TZDIR= ${DESTDIR}/usr/share/zoneinfo 39 40# What kind of TZif data files to generate. (TZif is the binary time 41# zone data format that zic generates; see Internet RFC 8536.) 42# If you want only POSIX time, with time values interpreted as 43# seconds since the epoch (not counting leap seconds), use 44# REDO= posix_only 45# below. If you want only "right" time, with values interpreted 46# as seconds since the epoch (counting leap seconds), use 47# REDO= right_only 48# below. If you want both sets of data available, with leap seconds not 49# counted normally, use 50# REDO= posix_right 51# below. If you want both sets of data available, with leap seconds counted 52# normally, use 53# REDO= right_posix 54# below. POSIX mandates that leap seconds not be counted; for compatibility 55# with it, use "posix_only" or "posix_right". Use POSIX time on systems with 56# leap smearing; this can work better than unsmeared "right" time with 57# applications that are not leap second aware, and is closer to unsmeared 58# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). 59REDO= posix_only 60 61# Whether to put an "Expires" line in the leapseconds file. 62# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. 63# The EXPIRES_LINE value matters only if REDO's value contains "right". 64# If you change EXPIRES_LINE, remove the leapseconds file before running "make". 65# zic's support for the Expires line was introduced in tzdb 2020a, 66# and was modified in tzdb 2021b to generate version 4 TZif files. 67# EXPIRES_LINE defaults to 0 for now so that the leapseconds file 68# can be given to pre-2020a zic implementations and so that TZif files 69# built by newer zic implementations can be read by pre-2021b libraries. 70EXPIRES_LINE= 0 71 72# To install data in text form that has all the information of the TZif data, 73# (optionally incorporating leap second information), use 74# TZDATA_TEXT= tzdata.zi leapseconds 75# To install text data without leap second information (e.g., because 76# REDO='posix_only'), use 77# TZDATA_TEXT= tzdata.zi 78# To avoid installing text data, use 79# TZDATA_TEXT= 80TZDATA_TEXT= leapseconds tzdata.zi 81 82TDATA= africa antarctica asia australasia \ 83 europe northamerica southamerica etcetera factory \ 84 backward 85TABDATA= iso3166.tab zone.tab zone1970.tab zonenow.tab $(TZDATA_TEXT) 86DATA= $(TDATA) $(TABDATA) 87DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) 88 89ZIC= zic $(ZFLAGS) 90 91all: leapseconds tzdata.zi 92 93$(DATAFORM).zi: $(DSTDATA_ZI_DEPS) 94 (cd ${.CURDIR}/datfiles && \ 95 awk -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ../ziguard.awk \ 96 $(TDATA) >${.OBJDIR}/$@.out) 97 mv -f ${.OBJDIR}/$@.out ${.OBJDIR}/$@ 98 99tzdata.zi: $(DATAFORM).zi version zishrink.awk 100 (cd ${.CURDIR}/datfiles && version=`sed 1q ../version` && \ 101 LC_ALL=C awk \ 102 -v dataform='$(DATAFORM)' \ 103 -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ 104 -v redo='$(REDO)' \ 105 -v version="$$version" \ 106 -f ../zishrink.awk \ 107 ${.OBJDIR}/$(DATAFORM).zi >${.OBJDIR}/$@.out) 108 mv -f ${.OBJDIR}/$@.out ${.OBJDIR}/$@ 109 110leapseconds: leapseconds.awk datfiles/leap-seconds.list 111 awk -v EXPIRES_LINE=$(EXPIRES_LINE) -f ${.CURDIR}/leapseconds.awk \ 112 ${.CURDIR}/datfiles/leap-seconds.list >${.OBJDIR}/$@.out 113 mv -f ${.OBJDIR}/$@.out ${.OBJDIR}/$@ 114 115posix_only: ${TDATA} 116 (cd ${.CURDIR}/datfiles; \ 117 ${ZIC} -d ${TZDIR} -L /dev/null ${TDATA}) 118 119right_only: leapseconds ${TDATA} 120 (cd ${.CURDIR}/datfiles; \ 121 ${ZIC} -d ${TZDIR} -L leapseconds ${TDATA}) 122 123other_two: leapseconds ${TDATA} 124 (cd ${.CURDIR}/datfiles; \ 125 ${ZIC} -d ${TZDIR}/posix -L /dev/null ${TDATA}) 126 (cd ${.CURDIR}/datfiles; \ 127 ${ZIC} -d ${TZDIR}/right -L ${.OBJDIR}/leapseconds ${TDATA}) 128 129posix_right: posix_only other_two 130 131right_posix: right_only other_two 132 133realinstall: ${DATA} ${REDO} 134 (cd ${.CURDIR}/datfiles; \ 135 ${ZIC} -d ${TZDIR} -p ${POSIXRULES}) 136 chown -R ${BINOWN}:${BINGRP} ${TZDIR} 137 find ${TZDIR} \ 138 -type f -exec chmod a=r {} + -o \ 139 -type d -exec chmod a=rx,u+w {} + 140 ${INSTALL} -c -o root -g bin -m 644 ${.CURDIR}/datfiles/iso3166.tab \ 141 ${DESTDIR}/usr/share/misc 142 ${INSTALL} -c -o root -g bin -m 644 leapseconds \ 143 ${DESTDIR}/usr/share/zoneinfo 144 ${INSTALL} -c -o root -g bin -m 644 ${.CURDIR}/datfiles/leap-seconds.list \ 145 ${DESTDIR}/usr/share/zoneinfo 146 ${INSTALL} -c -o root -g bin -m 644 tzdata.zi \ 147 ${DESTDIR}/usr/share/zoneinfo 148 ${INSTALL} -c -o root -g bin -m 644 ${.CURDIR}/datfiles/zone.tab \ 149 ${DESTDIR}/usr/share/zoneinfo 150 ${INSTALL} -c -o root -g bin -m 644 ${.CURDIR}/datfiles/zone1970.tab \ 151 ${DESTDIR}/usr/share/zoneinfo 152 ${INSTALL} -c -o root -g bin -m 644 ${.CURDIR}/datfiles/zonenow.tab \ 153 ${DESTDIR}/usr/share/zoneinfo 154 155clean: 156 rm -f leapseconds *.zi 157 158.PATH: ${.CURDIR}/datfiles 159.include <bsd.prog.mk> 160