1 # Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
20 # Makefile for time routines
24 headers
:= time.h sys
/time.h sys
/timeb.h timebits.h
25 distribute
:= tzfile.h private.h scheck.c ialloc.c yearistype \
26 iso3166.tab zone.tab tzselect.ksh checktab.awk \
28 extra-objs
= scheck.o ialloc.o
$(tzfiles
:%=z.
%)
30 routines
:= offtime asctime clock ctime ctime_r difftime \
31 gmtime localtime mktime strftime time tzset \
32 tzfile gettimeofday settimeofday adjtime \
34 stime dysize timegm ftime \
37 others
:= ap zdump zic
38 tests
:= test_time clocktest test-tz
40 tzbases
:= africa antarctica asia australasia europe northamerica \
41 southamerica etcetera factory systemv \
42 solar87 solar88 solar89
44 tzfiles
:= $(tzbases
) $(tzlinks
)
45 # pacificnew doesn't compile; if it is to be used, it should be included in
47 distribute
+= $(tzfiles
) leapseconds pacificnew simplebackw
49 install-sbin
:= zic zdump
51 generated-dirs
= testdata
53 all: # Make this the default target; it will be defined in Rules.
55 include ..
/Makeconfig
# Get objpfx defined so we can use it below.
57 # z.* use this variable.
62 -include $(addprefix $(objpfx
)z.
,$(tzfiles
))
64 # Make these absolute file names.
65 installed-localtime-file
:= $(firstword $(filter /%,$(inst_localtime-file
)) \
66 $(addprefix $(inst_zonedir
)/, \
68 installed-posixrules-file
:= $(firstword $(filter /%,$(posixrules-file
)) \
69 $(addprefix $(inst_zonedir
)/, \
72 ifeq ($(cross-compiling
),no
)
73 # Don't try to install the zoneinfo files since we can't run zic.
74 install-others
= $(addprefix $(inst_zonedir
)/,$(zonenames
) \
75 $(zonenames
:%=posix
/%) \
76 $(zonenames
:%=right
/%)) \
77 $(installed-localtime-file
) $(installed-posixrules-file
)
80 ifeq ($(have-ksh
),yes
)
81 install-others
+= $(inst_zonedir
)/iso3166.tab
$(inst_zonedir
)/zone.tab
82 install-bin
+= tzselect
88 $(tzfiles
:%=$(objpfx
)z.
%): $(objpfx
)z.
%: % Makefile
89 # Kludge alert: we use an implicit rule (in what we are generating here)
90 # because that is the only way to tell Make that the one command builds all
92 # The extra kludge for the $(tzlinks) files is necessary since running zic
93 # this file requires all other files to exist. Blech!
94 (echo
'define $*-zones' ;\
95 awk
'$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^
;\
97 echo
'$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
98 echo
'ifdef $*-zones' ;\
99 if
test x
$(findstring $*, $(tzlinks
)) != x
; then \
100 echo
'$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\
101 echo '$$(foreach t
,$$(tzbases
),$$(addprefix $$(inst_zonedir
)/right
/,$$($$t-zones
)))' ;\
102 echo '$$(addprefix $$(inst_zonedir
)/posix
/,$$($*-zones
)): \';\
103 echo
'$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\
104 echo
'$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\
105 echo '$$(foreach t
,$$(tzbases
),$$(addprefix $$(inst_zonedir
)/,$$($$t-zones
)))' ;\
107 echo '$$(addprefix $$(inst_datadir
)/zone
%/right
/,$$($*-zones
)): \' ;\
108 echo
'$< $$(objpfx)zic leapseconds yearistype' ;\
109 echo
' $$(tzcompile)' ;\
110 echo
'$$(addprefix $$(inst_datadir)/zone%/posix/,$$($*-zones)): \' ;\
111 echo '$< $$(objpfx
)zic
/dev
/null yearistype
' ;\
112 echo ' $$(tzcompile
)' ;\
113 echo '$$(addprefix $$(inst_datadir
)/zone
%/,$$($*-zones
)): \' ;\
114 echo
'$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
115 echo
' $$(tzcompile)' ;\
117 echo
'zonenames := $$(zonenames) $$($*-zones)' ;\
121 .PHONY
: echo-zonenames
123 @echo
'Known zones: $(zonenames)'
126 # We have to use `-d $(inst_zonedir)' to explictly tell zic where to
127 # place the output files although $(zonedir) is compiled in. But the
128 # user might have set $(install_root) on the command line of `make install'.
129 zic-cmd
= $(built-program-cmd
) -d
$(inst_zonedir
)
130 tzcompile
= $(zic-cmd
)$(target-zone-flavor
) -L
$(word 3,$^
) \
131 -y
$(dir $(word 4,$^
))$(notdir $(word 4,$^
)) $<
133 # The source files specify the zone names relative to the -d directory,
134 # so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix
135 # and the like. This magic extracts /posix or /right if it's the first
136 # component after $(inst_zonedir) in the target name $@.
137 target-zone-flavor
= $(filter /posix
/right
, \
138 /$(firstword $(subst /, , \
139 $(patsubst $(inst_zonedir
)/%,%,$@
))))
142 $(installed-localtime-file
): $(inst_zonedir
)/$(localtime
) $(objpfx
)zic
143 $(make-target-directory
)
144 if
test -r
$@
; then \
145 echo Site timezone NOT reset to Factory.
; \
148 $(SHELL
) $(..
)/rellns-sh
$< $@T
; \
153 $(installed-posixrules-file
): $(inst_zonedir
)/$(posixrules
) $(objpfx
)zic
154 $(zic-cmd
) -p
$(posixrules
)
158 $(objpfx
)zic
: $(objpfx
)scheck.o
$(objpfx
)ialloc.o
160 tz-cflags
= -DTZDIR
='"$(zonedir)"' \
161 -DTZDEFAULT
='"$(localtime-file)"' \
162 -DTZDEFRULES
='"$(posixrules-file)"'
164 CFLAGS-zdump.c
= -Wno-strict-prototypes
-DNOID
165 CFLAGS-zic.c
= -Wno-strict-prototypes
-DNOID
$(tz-cflags
)
166 CFLAGS-ialloc.c
= -Wno-strict-prototypes
-DNOID
167 CFLAGS-scheck.c
= -Wno-strict-prototypes
-DNOID
168 CFLAGS-tzfile.c
= $(tz-cflags
)
169 CFLAGS-tzset.c
= $(tz-cflags
)
171 # We have to make sure the data for testing the tz functions is available.
172 $(objpfx
)test-tz.out
: $(addprefix $(objpfx
)testdata
/, America
/New_York \
175 $(objpfx
)testdata
/America
/New_York
: northamerica
$(objpfx
)zic \
176 $(leapseconds
) yearistype
177 $(built-program-cmd
) -d
$(objpfx
)testdata
-L
$(leapseconds
) \
178 -y yearistype northamerica
179 $(objpfx
)testdata
/Etc
/UTC
: etcetera
$(objpfx
)zic
$(leapseconds
) yearistype
180 $(built-program-cmd
) -d
$(objpfx
)testdata
-L
$(leapseconds
) \
181 -y yearistype etcetera
182 $(objpfx
)testdata
/UTC
: simplebackw
$(objpfx
)zic
$(objpfx
)testdata
/Etc
/UTC \
183 $(leapseconds
) yearistype
184 $(built-program-cmd
) -d
$(objpfx
)testdata
-L
$(leapseconds
) \
185 -y yearistype simplebackw
187 test-tz-ENV
= TZDIR
=$(objpfx
)testdata
190 $(objpfx
)tzselect
: tzselect.ksh
$(common-objpfx
)config.make
191 sed
-e
's%@KSH@%$(KSH)%g' \
192 -e
's%@TZDIR@%$(zonedir)%g' < $< > $@.new
196 $(addprefix $(inst_zonedir
)/,iso3166.tab zone.tab
): $(inst_zonedir
)/%: %