unstack, sort: cleanup and improvement
[minix.git] / share / zoneinfo / Makefile
blobfff0b9ce2e38cd227a375918cf9b742df1f4a7c2
1 # $NetBSD: Makefile,v 1.43 2009/04/10 16:16:12 apb Exp $
3 .include <bsd.own.mk>
5 # Change the line below for your time zone (after finding the zone you want in
6 # the time zone files, or adding it to a time zone file).
7 # Alternately, if you discover you've got the wrong time zone, you can just
8 # zic -l rightzone
10 # If you want something other than Eastern United States time as a template
11 # for handling POSIX-style time zone environment variables,
12 # change the line below (after finding the zone you want in the
13 # time zone files, or adding it to a time zone file).
14 # Alternately, if you discover you've got the wrong time zone, you can just
15 # zic -p rightzone
17 POSIXRULES= US/Pacific
19 # Use an absolute path name for TZDIR unless you're just testing the software.
20 # Note: ${DESTDIR} is prepended to this for the actual copy.
22 TZDIR= /usr/share/zoneinfo
24 # If you always want time values interpreted as "seconds since the epoch
25 # (not counting leap seconds)", use
26 # REDO= posix_only
27 # below. If you always want right time values interpreted as "seconds since
28 # the epoch" (counting leap seconds)", use
29 # REDO= right_only
30 # below. If you want both sets of data available, with leap seconds not
31 # counted normally, use
32 # REDO= posix_right
33 # below. If you want both sets of data available, with leap seconds counted
34 # normally, use
35 # REDO= right_posix
36 # below.
38 REDO= posix_only
40 # Since "." may not be in PATH...
41 YEARISTYPE= "${HOST_SH} ${.CURDIR}/yearistype.sh"
43 YDATA= africa antarctica asia australasia \
44 europe northamerica southamerica pacificnew etcetera factory \
45 backward
46 NDATA= systemv
47 SDATA= solar87 solar88 solar89
48 TDATA= $(YDATA) $(NDATA) $(SDATA)
49 TABDATA= iso3166.tab zone.tab
50 DATA= $(YDATA) $(NDATA) $(SDATA) leapseconds # yearistype.sh
51 USNO= usno1988 usno1989
53 TZBUILDDIR= ${.OBJDIR}/builddir
55 .PHONY: posix_only
56 posix_only: ${TDATA}
57 ${_MKTARGET_CREATE}
58 mkdir -p ${TZBUILDDIR}
59 cd ${.CURDIR} && \
60 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -L /dev/null ${TDATA}
62 .PHONY: right_only
63 right_only: leapseconds ${TDATA}
64 ${_MKTARGET_CREATE}
65 mkdir -p ${TZBUILDDIR}
66 cd ${.CURDIR} && \
67 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -L leapseconds ${TDATA}
69 .PHONY: other_two
70 other_two: leapseconds ${TDATA}
71 ${_MKTARGET_CREATE}
72 mkdir -p ${TZBUILDDIR}
73 cd ${.CURDIR} && \
74 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR}/posix -L /dev/null ${TDATA}
75 cd ${.CURDIR} && \
76 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR}/right -L leapseconds ${TDATA}
78 .PHONY: posix_right
79 posix_right: posix_only other_two
81 .PHONY: right_posix
82 right_posix: right_only other_two
84 .if ${MKUNPRIVED} == "no"
85 TOOL_PAX.unpriv=-pe
86 .else
87 TOOL_PAX.unpriv=
88 .endif
90 .if ${MKSHARE} != "no"
91 afterinstall: ${DATA} ${REDO} ${TABDATA}
92 ${_MKMSG_CREATE} ${POSIXRULES}
93 mkdir -p ${TZBUILDDIR}
94 cd ${.CURDIR} && \
95 ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -p ${POSIXRULES}
96 cd ${TZBUILDDIR} && \
97 find . -type f -print | xargs ${TOOL_STAT} -qf '%d,%i %N' | sort \
98 | while read devino tzfile; do \
99 destfile=${DESTDIR}${TZDIR}/$${tzfile#./}; \
100 if [ "$$devino" = "$$lastdevino" ]; then \
101 if ldevino=`${TOOL_STAT} -qf '%d %i' $$lastfile` && \
102 tdevino=`${TOOL_STAT} -qf '%d %i' $$destfile` && \
103 [ "$$ldevino" = "$$tdevino" ]; then \
104 continue; \
105 fi; \
106 ${_MKSHMSG_INSTALL} $$destfile; \
107 ${_MKSHECHO} ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
108 -m ${NONBINMODE} $$lastfile $$destfile; \
109 ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
110 -m ${NONBINMODE} $$lastfile $$destfile; \
111 else \
112 lastdevino=$$devino; \
113 lastfile=$$destfile; \
114 cmp -s $$tzfile $$destfile >/dev/null 2>&1 && continue;\
115 ${_MKSHMSG_INSTALL} $$destfile; \
116 ${_MKSHECHO} ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
117 -m ${NONBINMODE} $$tzfile $$destfile; \
118 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
119 -m ${NONBINMODE} $$tzfile $$destfile; \
120 fi; \
121 done
122 for f in ${TABDATA}; do \
123 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
124 ${.CURDIR}/$$f ${DESTDIR}${TZDIR}; \
125 done
126 .else # ${MKSHARE} == "no"
127 afterinstall:
128 .endif # ${MKSHARE} == "no"
130 clean:
131 -rm -rf ${TZBUILDDIR}
133 .include <bsd.prog.mk>