]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/zoneinfo/Makefile
vt: fix git mismerge
[FreeBSD/FreeBSD.git] / share / zoneinfo / Makefile
1 # $FreeBSD$
2
3 #
4 # HOW TO UPDATE THE ZONEINFO DATA
5 #
6 # Import the new sources to the vendor branch:
7 #
8 # $ cd ~/freebsd/src
9 # $ git worktree add ../tzdata vendor/tzdata
10 # $ pushd ../tzdata
11 # $ tar -xvf ../tzdata-latest.tar.gz
12 #   (check with "git status" and "git diff" if it all makes sense)
13 # $ git add -A
14 # $ git commit -m "Import tzdata 20XXX"
15 # $ git tag -a -m "Tag import of tzdata 20XXX" vendor/tzdata/tzdata20XXX
16 # $ git push --follow-tags freebsd vendor/tzdata
17 # $ popd
18 #
19 # Merge-from-vendor
20 #
21 # $ git subtree merge -P contrib/tzdata vendor/tzdata
22 #   (write a meaningful commit message)
23 # $ git push freebsd HEAD:main
24 #
25 # MFC
26 #
27 # $ git checkout -b freebsd/stable/12 stable-12
28 # $ git cherry-pick -x [hash of merge commit to main] -m 1 --edit
29 #   (write a meaningful commit message)
30 # $ git push freebsd HEAD:stable/12
31 #
32
33 .include <src.opts.mk>
34
35 PACKAGE=        zoneinfo
36 CLEANFILES+=    yearistype
37 CLEANDIRS+=     builddir
38 CONTRIBDIR=     ${SRCTOP}/contrib/tzdata/
39 .PATH:          ${CONTRIBDIR}
40
41 .if defined(LEAPSECONDS)
42 .warning "Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead"
43 MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes
44 .endif
45
46 .if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no"
47 LEAPFILE=       -L ${CONTRIBDIR}leapseconds
48 .else
49 LEAPFILE=
50 .endif
51
52 TZFILES=        africa antarctica asia australasia etcetera europe \
53                 factory northamerica southamerica
54 TZFILES+=       backward systemv
55 POSIXRULES=     America/New_York
56
57 TZFILES:=       ${TZFILES:S/^/${CONTRIBDIR}/}
58
59 TZBUILDDIR=     ${.OBJDIR}/builddir
60 TZBUILDSUBDIRS= \
61                 Africa \
62                 America/Argentina \
63                 America/Indiana \
64                 America/Kentucky \
65                 America/North_Dakota \
66                 Antarctica \
67                 Arctic \
68                 Asia \
69                 Atlantic \
70                 Australia \
71                 Etc \
72                 Europe \
73                 Indian \
74                 Pacific \
75                 SystemV
76 TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
77
78 .if !defined(_SKIP_BUILD)
79 all: zoneinfo
80 .endif
81 META_TARGETS+=  zoneinfo install-zoneinfo
82
83 zoneinfo: yearistype ${TDATA}
84         mkdir -p ${TZBUILDDIR}
85         cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
86         umask 022; cd ${.CURDIR}; \
87         zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
88             ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
89
90 #
91 # Sort TZS to ensure they are the same every build. find -s might
92 # be a shorter way to express this, but it's non-portable. Any
93 # differences between the two don't matter for this purpose.
94 #
95 .if make(*install*)
96 TZS!= cd ${TZBUILDDIR} && find * -type f | LC_ALL=C sort
97 .endif
98
99 beforeinstall: install-zoneinfo
100 install-zoneinfo:
101         mkdir -p ${DESTDIR}/usr/share/zoneinfo
102         cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
103 .for f in ${TZS}
104         ${INSTALL} ${TAG_ARGS} \
105             -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
106             ${TZBUILDDIR}/${f} ${DESTDIR}/usr/share/zoneinfo/${f}
107 .endfor
108         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
109             ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
110         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
111             ${CONTRIBDIR}/zone1970.tab ${DESTDIR}/usr/share/zoneinfo/
112
113 afterinstall:
114 #
115 # If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
116 # and the contents of it exists in /usr/share/zoneinfo, then reinstall
117 # it.
118 #
119         @if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
120             -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
121                 zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
122                 if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
123                         if [ ! -z "${DESTDIR}" ]; then \
124                                 optC="-C ${DESTDIR}"; \
125                         fi; \
126                         echo "Updating /etc/localtime"; \
127                         tzsetup $${optC} -r; \
128                 fi; \
129         else \
130                 echo "Run tzsetup(8) manually to update /etc/localtime."; \
131         fi
132
133 HAS_TESTS=
134 SUBDIR.${MK_TESTS}+= tests
135
136 .include <bsd.prog.mk>