Makefile revision 322100
1# $FreeBSD: stable/10/share/zoneinfo/Makefile 322100 2017-08-05 16:55:07Z ngie $
2
3#
4# HOW TO UPDATE THE ZONEINFO DATA
5#
6# With the use of subversion, this is a little bit simpler than the CVS method.
7#
8# Import the new sources to the vendor branch:
9#
10# $ cd ~/svn/vendor/tzdata/dist
11# $ tar zxvf /usr/ports/distfile/tzdata2008X.tar.gz
12#   (check with "svn stat" and "svn diff" if it all makes sense)
13# $ svn commit	# Commit message: "Vendor import of tzdata2008X (+details)" 
14#
15# Tag it
16#
17# $ cd ~/svn/vendor/tzdata
18# $ svn cp svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist \
19#	svn+ssh://svn.freebsd.org/base/vendor/tzdata/tzdata2008X
20# $ svn update	# Commit message: "Tag of tzdata2008X"
21#
22# Merge-from-vendor
23#
24# $ cd ~/svn/head/share/zoneinfo
25# $ svn update
26# $ svn merge -c X --accept=postpone \
27#	svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist .
28# $ svn update	# Commit message: "MFV of tzdata2008X"
29#
30
31.include <bsd.own.mk>
32
33CLEANFILES+=	yearistype
34CLEANDIRS+=	builddir
35CONTRIBDIR=	${.CURDIR}/../../contrib/tzdata/
36.PATH:		${CONTRIBDIR}
37
38.if defined(LEAPSECONDS)
39.warning "Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead"
40MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes
41.endif
42
43.if defined(OLDTIMEZONES)
44.warning "Using backwards compatibility variable for OLDTIMEZONES; please use WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT instead"
45MK_ZONEINFO_OLD_TIMEZONES_SUPPORT= yes
46.endif
47
48.if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no"
49LEAPFILE=	-L ${CONTRIBDIR}leapseconds
50.else
51LEAPFILE=
52.endif
53
54TZFILES=	africa antarctica asia australasia etcetera europe \
55		factory northamerica southamerica
56POSIXRULES=	America/New_York
57
58.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
59TZFILES+=	backward systemv
60.endif
61
62TZFILES:=	${TZFILES:S/^/${CONTRIBDIR}/}
63
64TZBUILDDIR=	${.OBJDIR}/builddir
65TZBUILDSUBDIRS=	\
66		Africa \
67		America/Argentina \
68		America/Indiana \
69		America/Kentucky \
70		America/North_Dakota \
71		Antarctica \
72		Arctic \
73		Asia \
74		Atlantic \
75		Australia \
76		Etc \
77		Europe \
78		Indian \
79		Pacific \
80		SystemV
81
82.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
83TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
84.endif
85
86all: zoneinfo
87
88.PHONY: zoneinfo
89zoneinfo: yearistype ${TDATA}
90	mkdir -p ${TZBUILDDIR}
91	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
92	umask 022; cd ${.CURDIR}; \
93	zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
94	    ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
95
96beforeinstall:
97	mkdir -p ${DESTDIR}/usr/share/zoneinfo
98	cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
99	cd ${TZBUILDDIR} && \
100	    find -s * -type f -print -exec ${INSTALL} \
101	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
102	    \{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
103	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
104	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
105
106afterinstall:
107#
108# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
109# and the contents of it exists in /usr/share/zoneinfo, then reinstall
110# it.
111#
112	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
113	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
114		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
115		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
116			if [ ! -z "${DESTDIR}" ]; then \
117				optC="-C ${DESTDIR}"; \
118			fi; \
119			echo "Updating /etc/localtime"; \
120			tzsetup $${optC} -r; \
121		fi; \
122	else \
123		echo "Run tzsetup(8) manually to update /etc/localtime."; \
124	fi
125
126.if ${MK_TESTS} != "no"
127SUBDIR+=	tests
128.endif
129
130.include <bsd.prog.mk>
131