* elf/dl-reloc.c: Include "dynamic-link.h" at file scope.
[glibc.git] / time / Makefile
blobd77c6c5f2d5a37a08825636c356615aaef554e87
1 # Copyright (C) 1991, 92, 93, 94, 95, 96 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
22 subdir := time
24 headers := time.h sys/time.h sys/timeb.h timebits.h
25 distribute := tzfile.h private.h scheck.c ialloc.c yearistype
26 extra-objs = scheck.o ialloc.o $(tzfiles:%=z.%)
28 routines := offtime asctime clock ctime difftime gmtime \
29 localtime mktime strftime time tzset tzfile \
30 gettimeofday settimeofday adjtime \
31 getitimer setitimer \
32 stime dysize timegm ftime \
33 strptime
35 others := ap zdump zic
36 tests := test_time clocktest test-tz
38 tzfiles := africa antarctica asia australasia europe northamerica \
39 southamerica etcetera factory systemv backward \
40 solar87 solar88 solar89
41 # pacificnew doesn't compile; if it is to be used, it should be included in
42 # northamerica.
43 distribute := $(distribute) $(tzfiles) leapseconds pacificnew
45 install-sbin := zic zdump
47 all: # Make this the default target; it will be defined in Rules.
49 include ../Makeconfig # Get objpfx defined so we can use it below.
51 # z.* use this variable.
52 define nl
55 endef
56 -include $(addprefix $(objpfx)z.,$(tzfiles))
58 # Make these absolute file names.
59 installed-localtime-file := $(firstword $(filter /%,$(localtime-file)) \
60 $(addprefix $(zonedir)/, \
61 $(localtime-file)))
62 installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
63 $(addprefix $(zonedir)/, \
64 $(posixrules-file)))
66 ifeq ($(cross-compiling),no)
67 # Don't try to install the zoneinfo files since we can't run zic.
68 install-others = $(addprefix $(zonedir)/,$(zonenames) \
69 $(zonenames:%=posix/%) \
70 $(zonenames:%=right/%)) \
71 $(installed-localtime-file) $(installed-posixrules-file)
72 endif
74 include ../Rules
77 $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
78 # Kludge alert: we use an implicit rule (in what we are generating here)
79 # because that is the only way to tell Make that the one command builds all
80 # the files.
81 (echo 'define $*-zones' ;\
82 awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
83 echo 'endef' ;\
84 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
85 echo 'ifdef $*-zones' ;\
86 echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\
87 echo '$< $$(objpfx)zic leapseconds yearistype' ;\
88 echo ' $$(tzcompile)' ;\
89 echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \' ;\
90 echo '$< $$(objpfx)zic /dev/null yearistype' ;\
91 echo ' $$(tzcompile)' ;\
92 echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
93 echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
94 echo ' $$(tzcompile)' ;\
95 echo 'endif' ;\
96 echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
97 ) > $@.new
98 mv $@.new $@
100 .PHONY: echo-zonenames
101 echo-zonenames: zonenames
102 @echo 'Known zones: $(zonenames)'
105 # Although $(zonedir) gets compiled into zic, it is useful to always
106 # specify it with -d on the command line so that it can be overridden on
107 # the command line of `make install' (e.g., "make install prefix=/foo").
108 zic-cmd = $(built-program-cmd) -d $(zonedir)
109 tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
110 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
112 # The source files specify the zone names relative to the -d directory,
113 # so for the posix/ and right/ flavors we need to pass -d $(zonedir)/posix
114 # and the like. This magic extracts /posix or /right if it's the first
115 # component after $(zonedir) in the target name $@.
116 target-zone-flavor = $(filter /posix /right, \
117 /$(firstword $(subst /, , \
118 $(patsubst $(zonedir)/%,%,$@))))
120 ifdef localtime
121 $(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
122 $(make-target-directory)
123 if test -r $@; then echo Site timezone NOT reset to Factory.; else \
124 ln -s -f $< $@; fi
125 endif
126 ifdef posixrules
127 $(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
128 $(zic-cmd) -p $(posixrules)
129 endif
132 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
134 tz-cflags = -DTZDIR='"$(zonedir)"' \
135 -DTZDEFAULT='"$(localtime-file)"' \
136 -DTZDEFRULES='"$(posixrules-file)"'
138 CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID
139 CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
140 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
141 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
142 CFLAGS-tzfile.c = $(tz-cflags)