Makefile revision 1.2 1 # $NetBSD: Makefile,v 1.2 2014/08/08 09:17:03 apb Exp $
2
3 .include <bsd.own.mk>
4 .include "../../Makefile.inc"
5
6 .PATH: ${TZDISTDIR}
7
8 # If you want something other than Eastern United States time as a template
9 # for handling POSIX-style time zone environment variables,
10 # change the line below (after finding the zone you want in the
11 # time zone files, or adding it to a time zone file).
12 # (When a POSIX-style environment variable is handled, the rules in the
13 # template file are used to determine "spring forward" and "fall back" days and
14 # times; the environment variable itself specifies UT offsets of standard and
15 # summer time.)
16 # Alternately, if you discover you've got the wrong time zone, you can just
17 # zic -p rightzone
18 # to correct things.
19 # Use the command
20 # make zonenames
21 # to get a list of the values you can use for POSIXRULES.
22 # If you want POSIX compatibility, use "America/New_York".
23
24 POSIXRULES= America/New_York
25
26 # "Compiled" time zone information is placed in the "TZDIR" directory
27 # (and subdirectories).
28 # Use an absolute path name for TZDIR unless you're just testing the software.
29 # Note: ${DESTDIR} is prepended to this for the actual copy.
30
31 TZDIR= /usr/share/zoneinfo
32
33 # If you always want time values interpreted as "seconds since the epoch
34 # (not counting leap seconds)", use
35 # REDO= posix_only
36 # below. If you always want right time values interpreted as "seconds since
37 # the epoch" (counting leap seconds)", use
38 # REDO= right_only
39 # below. If you want both sets of data available, with leap seconds not
40 # counted normally, use
41 # REDO= posix_right
42 # below. If you want both sets of data available, with leap seconds counted
43 # normally, use
44 # REDO= right_posix
45 # below.
46
47 REDO= posix_only
48
49 # Since "." may not be in PATH...
50 YEARISTYPE= "${HOST_SH} ${TZDISTDIR}/yearistype.sh"
51
52 PRIMARY_YDATA= africa antarctica asia australasia \
53 europe northamerica southamerica
54 YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward
55 NDATA= systemv factory
56 TDATA= $(YDATA) $(NDATA)
57 ZONETABLES= zone1970.tab zone.tab
58 TABDATA= iso3166.tab leapseconds $(ZONETABLES)
59 DATA= $(YDATA) $(NDATA) $(TABDATA) # yearistype.sh
60
61 TZBUILDDIR= ${.OBJDIR}/builddir
62
63 .PHONY: posix_only
64 posix_only: ${TDATA}
65 ${_MKTARGET_CREATE}
66 mkdir -p ${TZBUILDDIR}
67 cd ${TZDISTDIR} && \
68 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -L /dev/null ${TDATA}
69
70 .PHONY: right_only
71 right_only: leapseconds ${TDATA}
72 ${_MKTARGET_CREATE}
73 mkdir -p ${TZBUILDDIR}
74 cd ${TZDISTDIR} && \
75 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -L leapseconds ${TDATA}
76
77 .PHONY: other_two
78 other_two: leapseconds ${TDATA}
79 ${_MKTARGET_CREATE}
80 mkdir -p ${TZBUILDDIR}
81 cd ${TZDISTDIR} && \
82 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR}/posix -L /dev/null ${TDATA}
83 cd ${TZDISTDIR} && \
84 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR}/right -L leapseconds ${TDATA}
85
86 .PHONY: posix_right
87 posix_right: posix_only other_two
88
89 .PHONY: right_posix
90 right_posix: right_only other_two
91
92 .if ${MKUNPRIVED} == "no"
93 TOOL_PAX.unpriv=-pe
94 .else
95 TOOL_PAX.unpriv=
96 .endif
97
98 .if ${MKSHARE} != "no"
99 afterinstall: ${DATA} ${REDO} ${TABDATA}
100 ${_MKMSG_CREATE} ${POSIXRULES}
101 mkdir -p ${TZBUILDDIR}
102 cd ${TZDISTDIR} && \
103 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -p ${POSIXRULES}
104 cd ${TZBUILDDIR} && \
105 find . -type f -print | xargs ${TOOL_STAT} -qf '%d,%i %N' | sort \
106 | while read devino tzfile; do \
107 destfile=${DESTDIR}${TZDIR}/$${tzfile#./}; \
108 destdir=$$(dirname $${destfile}); \
109 if [ ! -d "$$destdir" ]; then \
110 ${_MKSHMSG_INSTALL} $$destdir; \
111 ${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} \
112 $$destdir; \
113 ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} $$destdir; \
114 fi; \
115 if [ "$$devino" = "$$lastdevino" ]; then \
116 if ldevino=$$(${TOOL_STAT} -qf '%d %i' $$lastfile) && \
117 tdevino=$$(${TOOL_STAT} -qf '%d %i' $$destfile) && \
118 [ "$$ldevino" = "$$tdevino" ]; then \
119 continue; \
120 fi; \
121 ${_MKSHMSG_INSTALL} $$destfile; \
122 ${_MKSHECHO} ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
123 -m ${NONBINMODE} $$lastfile $$destfile; \
124 ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
125 -m ${NONBINMODE} $$lastfile $$destfile; \
126 else \
127 lastdevino=$$devino; \
128 lastfile=$$destfile; \
129 cmp -s $$tzfile $$destfile >/dev/null 2>&1 && continue;\
130 ${_MKSHMSG_INSTALL} $$destfile; \
131 ${_MKSHECHO} ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
132 -m ${NONBINMODE} $$tzfile $$destfile; \
133 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
134 -m ${NONBINMODE} $$tzfile $$destfile; \
135 fi; \
136 done
137 for f in ${TABDATA}; do \
138 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
139 ${TZDISTDIR}/$$f ${DESTDIR}${TZDIR}; \
140 done
141 .else # ${MKSHARE} == "no"
142 afterinstall:
143 .endif # ${MKSHARE} == "no"
144
145 clean:
146 -rm -rf ${TZBUILDDIR}
147
148 .include <bsd.prog.mk>
149