]>
Commit | Line | Data |
---|---|---|
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 | # | |
22 | subdir := time | |
23 | ||
f8cac037 | 24 | headers := time.h sys/time.h sys/timeb.h timebits.h |
6c2f0507 | 25 | distribute := tzfile.h private.h scheck.c ialloc.c yearistype |
45086082 | 26 | extra-objs = scheck.o ialloc.o $(tzfiles:%=z.%) |
28f540f4 RM |
27 | |
28 | routines := 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 | |
35 | others := ap zdump zic | |
36 | tests := test_time clocktest | |
37 | ||
38 | tzfiles := 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. | |
42 | distribute := $(distribute) $(tzfiles) leapseconds pacificnew | |
43 | ||
44 | install-sbin := zic zdump | |
45 | ||
bfc04a9f RM |
46 | all: # Make this the default target; it will be defined in Rules. |
47 | ||
28f540f4 RM |
48 | include ../Makeconfig # Get objpfx defined so we can use it below. |
49 | ||
45086082 | 50 | # z.* use this variable. |
28f540f4 RM |
51 | define nl |
52 | ||
53 | ||
54 | endef | |
45086082 | 55 | -include $(addprefix $(objpfx)z.,$(tzfiles)) |
28f540f4 RM |
56 | |
57 | # Make these absolute file names. | |
58 | installed-localtime-file := $(firstword $(filter /%,$(localtime-file)) \ | |
59 | $(addprefix $(zonedir)/, \ | |
60 | $(localtime-file))) | |
61 | installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \ | |
62 | $(addprefix $(zonedir)/, \ | |
63 | $(posixrules-file))) | |
64 | ||
429ed67b | 65 | ifeq ($(cross-compiling),no) |
28f540f4 | 66 | # Don't try to install the zoneinfo files since we can't run zic. |
59dd8641 RM |
67 | install-others = $(addprefix $(zonedir)/,$(zonenames) \ |
68 | $(zonenames:%=posix/%) \ | |
69 | $(zonenames:%=right/%)) \ | |
28f540f4 RM |
70 | $(installed-localtime-file) $(installed-posixrules-file) |
71 | endif | |
72 | ||
73 | include ../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 | |
100 | echo-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 | 107 | zic-cmd = $(built-program-cmd) -d $(zonedir) |
71a40c74 RM |
108 | tzcompile = $(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 $@. | |
115 | target-zone-flavor = $(filter /posix /right, \ | |
116 | /$(firstword $(subst /, , \ | |
117 | $(patsubst $(zonedir)/%,%,$@)))) | |
118 | ||
28f540f4 RM |
119 | ifdef localtime |
120 | $(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic | |
121 | $(zic-cmd) -l $(localtime) | |
122 | endif | |
123 | ifdef posixrules | |
124 | $(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic | |
125 | $(zic-cmd) -p $(posixrules) | |
126 | endif | |
127 | ||
128 | ||
6c2f0507 | 129 | $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o |
28f540f4 | 130 | |
9e720468 RM |
131 | tz-cflags = -DTZDIR='"$(zonedir)"' \ |
132 | -DTZDEFAULT='"$(localtime-file)"' \ | |
133 | -DTZDEFRULES='"$(posixrules-file)"' | |
429ed67b | 134 | |
6a032d81 | 135 | CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID |
9e720468 | 136 | CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags) |
6a032d81 RM |
137 | CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID |
138 | CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID | |
9e720468 | 139 | CFLAGS-tzfile.c = $(tz-cflags) |