update from main archive 961116
[glibc.git] / time / Makefile
blob772461c778ccf4fbe2e2aa197d2b5ee0fba000d8
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 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 \
32 getitimer setitimer \
33 stime dysize timegm ftime \
34 strptime
36 others := ap zdump zic
37 tests := test_time clocktest test-tz
39 tzfiles := africa antarctica asia australasia europe northamerica \
40 southamerica etcetera factory systemv backward \
41 solar87 solar88 solar89
42 # pacificnew doesn't compile; if it is to be used, it should be included in
43 # northamerica.
44 distribute := $(distribute) $(tzfiles) leapseconds pacificnew
46 install-sbin := zic zdump
48 all: # Make this the default target; it will be defined in Rules.
50 include ../Makeconfig # Get objpfx defined so we can use it below.
52 # z.* use this variable.
53 define nl
56 endef
57 -include $(addprefix $(objpfx)z.,$(tzfiles))
59 # Make these absolute file names.
60 installed-localtime-file := $(firstword $(filter /%,$(localtime-file)) \
61 $(addprefix $(zonedir)/, \
62 $(localtime-file)))
63 installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
64 $(addprefix $(zonedir)/, \
65 $(posixrules-file)))
67 ifeq ($(cross-compiling),no)
68 # Don't try to install the zoneinfo files since we can't run zic.
69 install-others = $(addprefix $(zonedir)/,$(zonenames) \
70 $(zonenames:%=posix/%) \
71 $(zonenames:%=right/%)) \
72 $(installed-localtime-file) $(installed-posixrules-file)
73 endif
75 include ../Rules
78 $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
79 # Kludge alert: we use an implicit rule (in what we are generating here)
80 # because that is the only way to tell Make that the one command builds all
81 # the files.
82 (echo 'define $*-zones' ;\
83 awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
84 echo 'endef' ;\
85 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
86 echo 'ifdef $*-zones' ;\
87 echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\
88 echo '$< $$(objpfx)zic leapseconds yearistype' ;\
89 echo ' $$(tzcompile)' ;\
90 echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \' ;\
91 echo '$< $$(objpfx)zic /dev/null yearistype' ;\
92 echo ' $$(tzcompile)' ;\
93 echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
94 echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
95 echo ' $$(tzcompile)' ;\
96 echo 'endif' ;\
97 echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
98 ) > $@.new
99 mv $@.new $@
101 .PHONY: echo-zonenames
102 echo-zonenames: zonenames
103 @echo 'Known zones: $(zonenames)'
106 # Although $(zonedir) gets compiled into zic, it is useful to always
107 # specify it with -d on the command line so that it can be overridden on
108 # the command line of `make install' (e.g., "make install prefix=/foo").
109 zic-cmd = $(built-program-cmd) -d $(zonedir)
110 tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
111 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
113 # The source files specify the zone names relative to the -d directory,
114 # so for the posix/ and right/ flavors we need to pass -d $(zonedir)/posix
115 # and the like. This magic extracts /posix or /right if it's the first
116 # component after $(zonedir) in the target name $@.
117 target-zone-flavor = $(filter /posix /right, \
118 /$(firstword $(subst /, , \
119 $(patsubst $(zonedir)/%,%,$@))))
121 ifdef localtime
122 $(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
123 $(make-target-directory)
124 if test -r $@; then \
125 echo Site timezone NOT reset to Factory.; \
126 else \
127 rm -f $@T; \
128 $(SHELL) $(top_absdir)/rellns-sh $< $@T; \
129 mv -f $@T $@; \
131 endif
132 ifdef posixrules
133 $(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
134 $(zic-cmd) -p $(posixrules)
135 endif
138 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
140 tz-cflags = -DTZDIR='"$(zonedir)"' \
141 -DTZDEFAULT='"$(localtime-file)"' \
142 -DTZDEFRULES='"$(posixrules-file)"'
144 CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID
145 CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
146 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
147 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
148 CFLAGS-tzfile.c = $(tz-cflags)