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