]> git.ipfire.org Git - thirdparty/glibc.git/blob - time/Makefile
Sat Jun 8 15:15:07 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[thirdparty/glibc.git] / time / Makefile
1 # Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
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 #
22 subdir := time
23
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.%)
27
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
34
35 others := ap zdump zic
36 tests := test_time clocktest test-tz
37
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
44
45 install-sbin := zic zdump
46
47 all: # Make this the default target; it will be defined in Rules.
48
49 include ../Makeconfig # Get objpfx defined so we can use it below.
50
51 # z.* use this variable.
52 define nl
53
54
55 endef
56 -include $(addprefix $(objpfx)z.,$(tzfiles))
57
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)))
65
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
73
74 include ../Rules
75
76
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 $@
99
100 .PHONY: echo-zonenames
101 echo-zonenames: zonenames
102 @echo 'Known zones: $(zonenames)'
103
104
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,$^)) $<
111
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)/%,%,$@))))
119
120 ifdef localtime
121 $(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
122 $(zic-cmd) -l $(localtime)
123 endif
124 ifdef posixrules
125 $(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
126 $(zic-cmd) -p $(posixrules)
127 endif
128
129
130 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
131
132 tz-cflags = -DTZDIR='"$(zonedir)"' \
133 -DTZDEFAULT='"$(localtime-file)"' \
134 -DTZDEFRULES='"$(posixrules-file)"'
135
136 CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID
137 CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
138 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
139 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
140 CFLAGS-tzfile.c = $(tz-cflags)