1 # Copyright (C) 1991, 1992, 1993, 1994, 1995 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
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
20 # Makefile for time routines
24 headers
:= time.h sys
/time.h sys
/timeb.h
25 distribute
:= tzfile.h private.h scheck.c ialloc.c emkdir.c yearistype
26 extra-objs
= scheck.o ialloc.o emkdir.o zonenames
$(tzfiles
:%=z.
%)
28 routines
:= offtime asctime clock ctime difftime gmtime \
29 localtime mktime strftime time tzset tzfile \
30 gettimeofday settimeofday adjtime \
32 stime dysize timegm ftime
34 others
:= ap zdump zic
35 tests
:= test_time clocktest
37 tzfiles
:= africa antarctica asia australasia europe northamerica \
38 southamerica etcetera factory systemv backward
39 # pacificnew doesn't compile; if it is to be used, it should be included in
41 distribute
:= $(distribute
) $(tzfiles
) leapseconds pacificnew
43 install-sbin
:= zic zdump
45 include ..
/Makeconfig
# Get objpfx defined so we can use it below.
47 # zonenames uses this variable.
52 include $(objpfx
)zonenames
54 # Make these absolute file names.
55 installed-localtime-file
:= $(firstword $(filter /%,$(localtime-file
)) \
56 $(addprefix $(zonedir
)/, \
58 installed-posixrules-file
:= $(firstword $(filter /%,$(posixrules-file
)) \
59 $(addprefix $(zonedir
)/, \
62 ifndef cross-compiling
63 # Don't try to install the zoneinfo files since we can't run zic.
64 install-others
= $(addprefix $(zonedir
)/,$(zonenames
)) \
65 $(installed-localtime-file
) $(installed-posixrules-file
)
71 $(tzfiles
:%=$(objpfx
)z.
%): $(objpfx
)z.
%: % Makefile
72 # Kludge alert: we use an implicit rule (in what we are generating here)
73 # because that is the only way to tell Make that the one command builds all
75 (echo
'define $*-zones' ;\
76 awk
'$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^
;\
78 echo
'$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
79 echo
'ifdef $*-zones' ;\
80 echo
'$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
81 echo '$< $$(objpfx
)zic leapseconds yearistype
' ;\
82 echo ' $$(tzcompile
)' ;\
84 echo 'zonenames
:= $$(zonenames
) $$($*-zones
)' ;\
87 $(objpfx)zonenames: Makefile
88 (for file in $(tzfiles); do \
89 echo "include \$$(objpfx)z.$$file"; \
93 .PHONY: echo-zonenames
94 echo-zonenames: zonenames
95 @echo 'Known zones
: $(zonenames
)'
98 # Although $(zonedir) gets compiled into zic, it is useful to always
99 # specify it with -d on the command line so that it can be overridden on
100 # the command line of `make install' (e.g.
, "make install prefix=/foo").
101 zic-cmd
= $(dir $(word 2,$^
))$(notdir $(word 2,$^
)) -d
$(zonedir
)
103 $(zic-cmd
) -L
$(word 3,$^
) -y
$(dir $(word 4,$^
))$(notdir $(word 4,$^
)) $<
107 $(installed-localtime-file
): $(zonedir
)/$(localtime
) $(objpfx
)zic
108 $(zic-cmd
) -l
$(localtime
)
111 $(installed-posixrules-file
): $(zonedir
)/$(posixrules
) $(objpfx
)zic
112 $(zic-cmd
) -p
$(posixrules
)
116 $(objpfx
)zic
: $(objpfx
)scheck.o
$(objpfx
)ialloc.o
$(objpfx
)emkdir.o
118 $(objpfx
)tzfile.o
: tzfile.c
; $(tz-cc
)
119 $(objpfx
)zic.o
: zic.c
; $(tz-cc
)
121 # Some versions of GNU make have a bug with backslashes in define directives.
122 tz-cc
= $(COMPILE.c
) $(+gcc-nowarn
) \
123 -DTZDIR
='"$(zonedir)"' \
124 -DTZDEFAULT
='"$(localtime-file)"' \
125 -DTZDEFRULES
='"$(posixrules-file)"' \