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
27 extra-objs
= scheck.o ialloc.o
$(tzfiles
:%=z.
%)
29 routines
:= offtime asctime clock ctime ctime_r difftime \
30 gmtime localtime mktime strftime time tzset \
31 tzfile gettimeofday settimeofday adjtime \
33 stime dysize timegm ftime \
36 others
:= ap zdump zic
37 tests
:= test_time clocktest test-tz
39 # Before the test-tz test can be run we need the data to be installed.
40 tests
: install-test-data
43 tzfiles
:= africa antarctica asia australasia europe northamerica \
44 southamerica etcetera factory systemv backward \
45 solar87 solar88 solar89
46 # pacificnew doesn't compile; if it is to be used, it should be included in
48 distribute
:= $(distribute
) $(tzfiles
) leapseconds pacificnew simplebackw
50 install-sbin
:= zic zdump
52 generated-dirs
= testdata
54 all: # Make this the default target; it will be defined in Rules.
56 include ..
/Makeconfig
# Get objpfx defined so we can use it below.
58 # z.* use this variable.
63 -include $(addprefix $(objpfx
)z.
,$(tzfiles
))
65 # Make these absolute file names.
66 installed-localtime-file
:= $(firstword $(filter /%,$(localtime-file
)) \
67 $(addprefix $(zonedir
)/, \
69 installed-posixrules-file
:= $(firstword $(filter /%,$(posixrules-file
)) \
70 $(addprefix $(zonedir
)/, \
73 ifeq ($(cross-compiling
),no
)
74 # Don't try to install the zoneinfo files since we can't run zic.
75 install-others
= $(addprefix $(zonedir
)/,$(zonenames
) \
76 $(zonenames
:%=posix
/%) \
77 $(zonenames
:%=right
/%)) \
78 $(installed-localtime-file
) $(installed-posixrules-file
)
81 ifeq ($(have-ksh
),yes
)
82 install-others
+= $(zonedir
)/iso3166.tab
$(zonedir
)/zone.tab
83 install-bin
+= tzselect
89 $(tzfiles
:%=$(objpfx
)z.
%): $(objpfx
)z.
%: % Makefile
90 # Kludge alert: we use an implicit rule (in what we are generating here)
91 # because that is the only way to tell Make that the one command builds all
93 (echo
'define $*-zones' ;\
94 awk
'$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^
;\
96 echo
'$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
97 echo
'ifdef $*-zones' ;\
98 echo
'$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\
99 echo '$< $$(objpfx
)zic leapseconds yearistype
' ;\
100 echo ' $$(tzcompile
)' ;\
101 echo '$$(addprefix $$(datadir)/zone
%/posix
/,$$($*-zones
)): \' ;\
102 echo
'$< $$(objpfx)zic /dev/null yearistype' ;\
103 echo
' $$(tzcompile)' ;\
104 echo
'$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
105 echo '$< $$(objpfx
)zic
$$(leapseconds
) yearistype
' ;\
106 echo ' $$(tzcompile
)' ;\
108 echo 'zonenames
:= $$(zonenames
) $$($*-zones
)' ;\
112 .PHONY: echo-zonenames
114 @echo 'Known zones
: $(zonenames
)'
117 # Although $(zonedir) gets compiled into zic, it is useful to always
118 # specify it with -d on the command line so that it can be overridden on
119 # the command line of `make install' (e.g.
, "make install prefix=/foo").
120 zic-cmd
= $(built-program-cmd
) -d
$(zonedir
)
121 tzcompile
= $(zic-cmd
)$(target-zone-flavor
) -L
$(word 3,$^
) \
122 -y
$(dir $(word 4,$^
))$(notdir $(word 4,$^
)) $<
124 # The source files specify the zone names relative to the -d directory,
125 # so for the posix/ and right/ flavors we need to pass -d $(zonedir)/posix
126 # and the like. This magic extracts /posix or /right if it's the first
127 # component after $(zonedir) in the target name $@.
128 target-zone-flavor
= $(filter /posix
/right
, \
129 /$(firstword $(subst /, , \
130 $(patsubst $(zonedir
)/%,%,$@
))))
133 $(installed-localtime-file
): $(zonedir
)/$(localtime
) $(objpfx
)zic
134 $(make-target-directory
)
135 if
test -r
$@
; then \
136 echo Site timezone NOT reset to Factory.
; \
139 $(SHELL
) $(..
)/rellns-sh
$< $@T
; \
144 $(installed-posixrules-file
): $(zonedir
)/$(posixrules
) $(objpfx
)zic
145 $(zic-cmd
) -p
$(posixrules
)
149 $(objpfx
)zic
: $(objpfx
)scheck.o
$(objpfx
)ialloc.o
151 tz-cflags
= -DTZDIR
='"$(zonedir)"' \
152 -DTZDEFAULT
='"$(localtime-file)"' \
153 -DTZDEFRULES
='"$(posixrules-file)"'
155 CFLAGS-zdump.c
= -Wno-strict-prototypes
-DNOID
156 CFLAGS-zic.c
= -Wno-strict-prototypes
-DNOID
$(tz-cflags
)
157 CFLAGS-ialloc.c
= -Wno-strict-prototypes
-DNOID
158 CFLAGS-scheck.c
= -Wno-strict-prototypes
-DNOID
159 CFLAGS-tzfile.c
= $(tz-cflags
)
161 # We have to make sure the data for testing the tz functions is available.
162 .PHONY
: install-test-data
163 install-test-data
: northamerica
$(objpfx
)zic
$(leapseconds
) yearistype \
165 -mkdir
$(objpfx
)testdata
166 $(built-program-cmd
) -d
$(objpfx
)testdata
-L
$(leapseconds
) \
167 -y yearistype northamerica
168 $(built-program-cmd
) -d
$(objpfx
)testdata
-L
$(leapseconds
) \
169 -y yearistype etcetera
170 $(built-program-cmd
) -d
$(objpfx
)testdata
-L
$(leapseconds
) \
171 -y yearistype simplebackw
172 test-tz-ENV
= TZDIR
=$(objpfx
)testdata
175 $(objpfx
)tzselect
: tzselect.ksh
176 sed
-e
's%@KSH@%$(KSH)%g' \
177 -e
's%@TZDIR@%$(zonedir)%g' < $< > $@.new
181 $(addprefix $(zonedir
)/,iso3166.tab zone.tab
): $(zonedir
)/%: %; $(do-install
)