]> git.ipfire.org Git - thirdparty/glibc.git/blame - time/Makefile
* time/Makefile (tzcompile): Add missing backslash.
[thirdparty/glibc.git] / time / Makefile
CommitLineData
429ed67b 1# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
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.
8
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.
13
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.
18
19#
20# Makefile for time routines
21#
22subdir := time
23
f8cac037 24headers := time.h sys/time.h sys/timeb.h timebits.h
6c2f0507 25distribute := tzfile.h private.h scheck.c ialloc.c yearistype
45086082 26extra-objs = scheck.o ialloc.o $(tzfiles:%=z.%)
28f540f4
RM
27
28routines := offtime asctime clock ctime difftime gmtime \
29 localtime mktime strftime time tzset tzfile \
30 gettimeofday settimeofday adjtime \
31 getitimer setitimer \
f8adc70c
RM
32 stime dysize timegm ftime \
33 strptime
28f540f4
RM
34
35others := ap zdump zic
36tests := test_time clocktest
37
38tzfiles := africa antarctica asia australasia europe northamerica \
39 southamerica etcetera factory systemv backward
40# pacificnew doesn't compile; if it is to be used, it should be included in
41# northamerica.
42distribute := $(distribute) $(tzfiles) leapseconds pacificnew
43
44install-sbin := zic zdump
45
bfc04a9f
RM
46all: # Make this the default target; it will be defined in Rules.
47
28f540f4
RM
48include ../Makeconfig # Get objpfx defined so we can use it below.
49
45086082 50# z.* use this variable.
28f540f4
RM
51define nl
52
53
54endef
45086082 55-include $(addprefix $(objpfx)z.,$(tzfiles))
28f540f4
RM
56
57# Make these absolute file names.
58installed-localtime-file := $(firstword $(filter /%,$(localtime-file)) \
59 $(addprefix $(zonedir)/, \
60 $(localtime-file)))
61installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
62 $(addprefix $(zonedir)/, \
63 $(posixrules-file)))
64
429ed67b 65ifeq ($(cross-compiling),no)
28f540f4 66# Don't try to install the zoneinfo files since we can't run zic.
59dd8641
RM
67install-others = $(addprefix $(zonedir)/,$(zonenames) \
68 $(zonenames:%=posix/%) \
69 $(zonenames:%=right/%)) \
28f540f4
RM
70 $(installed-localtime-file) $(installed-posixrules-file)
71endif
72
73include ../Rules
74
75
76$(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
77# Kludge alert: we use an implicit rule (in what we are generating here)
78# because that is the only way to tell Make that the one command builds all
79# the files.
80 (echo 'define $*-zones' ;\
81 awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
82 echo 'endef' ;\
83 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
84 echo 'ifdef $*-zones' ;\
85 echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
59dd8641
RM
86 echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
87 echo ' $$(tzcompile)' ;\
88 echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\
28f540f4
RM
89 echo '$< $$(objpfx)zic leapseconds yearistype' ;\
90 echo ' $$(tzcompile)' ;\
59dd8641
RM
91 echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \' ;\
92 echo '$< $$(objpfx)zic /dev/null yearistype' ;\
93 echo ' $$(tzcompile)' ;\
28f540f4
RM
94 echo 'endif' ;\
95 echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
96 ) > $@.new
97 mv $@.new $@
28f540f4
RM
98
99.PHONY: echo-zonenames
100echo-zonenames: zonenames
101 @echo 'Known zones: $(zonenames)'
102
103
104# Although $(zonedir) gets compiled into zic, it is useful to always
105# specify it with -d on the command line so that it can be overridden on
106# the command line of `make install' (e.g., "make install prefix=/foo").
03a75825 107zic-cmd = $(built-program-cmd) -d $(zonedir)
71a40c74
RM
108tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
109 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
28f540f4 110
59dd8641
RM
111# The source files specify the zone names relative to the -d directory,
112# so for the posix/ and right/ flavors we need to pass -d $(zonedir)/posix
113# and the like. This magic extracts /posix or /right if it's the first
114# component after $(zonedir) in the target name $@.
115target-zone-flavor = $(filter /posix /right, \
116 /$(firstword $(subst /, , \
117 $(patsubst $(zonedir)/%,%,$@))))
118
28f540f4
RM
119ifdef localtime
120$(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
121 $(zic-cmd) -l $(localtime)
122endif
123ifdef posixrules
124$(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
125 $(zic-cmd) -p $(posixrules)
126endif
127
128
6c2f0507 129$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
28f540f4 130
9e720468
RM
131tz-cflags = -DTZDIR='"$(zonedir)"' \
132 -DTZDEFAULT='"$(localtime-file)"' \
133 -DTZDEFRULES='"$(posixrules-file)"'
429ed67b 134
6a032d81 135CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID
9e720468 136CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
6a032d81
RM
137CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
138CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
9e720468 139CFLAGS-tzfile.c = $(tz-cflags)