Fix indentation.
[glibc.git] / timezone / Makefile
blob99566cbf12189396a1af089d95e506065ed59089
1 # Copyright (C) 1998-2015 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 Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the 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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 # Makefile for timezone information
21 subdir := timezone
23 include ../Makeconfig
25 extra-objs := scheck.o ialloc.o
27 others := zdump zic
28 tests := test-tz tst-timezone tst-tzset
30 generated-dirs += testdata
32 generated += tzselect
34 testdata = $(objpfx)testdata
36 ifeq ($(enable-timezone-tools),yes)
37 install-sbin := zic zdump
38 install-bin-script = tzselect
39 endif
41 ifeq ($(run-built-tests),yes)
42 # List zones generated by separate commands running zic on the host.
43 # Each such zic run counts as a separate test.
44 test-zones := America/New_York Etc/UTC UTC Europe/Berlin \
45 Australia/Melbourne America/Sao_Paulo Asia/Tokyo
46 tests-special += $(addprefix $(testdata)/, $(test-zones))
47 endif
49 include ../Rules
52 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
54 $(objpfx)zic.o $(objpfx)zdump.o: $(objpfx)version.h
56 $(objpfx)version.h: $(common-objpfx)config.make
57 echo 'static char const TZVERSION[]="$(version)";' \
58 > $@.new
59 mv -f $@.new $@
61 tz-cflags = -DTZDIR='"$(zonedir)"' \
62 -DTZDEFAULT='"$(localtime-file)"' \
63 -DTZDEFRULES='"$(posixrules-file)"' \
64 -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
66 # The -Wno-unused-variable flag is used to prevent GCC 6
67 # from warning about time_t_min and time_t_max which are
68 # defined in private.h but not used.
69 CFLAGS-zdump.c = -fwrapv -DNOID $(tz-cflags) -DHAVE_GETTEXT
70 CFLAGS-zic.c = -DNOID $(tz-cflags) -DHAVE_GETTEXT -Wno-unused-variable
71 CFLAGS-ialloc.c = -DNOID -DHAVE_GETTEXT -Wno-unused-variable
72 CFLAGS-scheck.c = -DNOID -DHAVE_GETTEXT -Wno-unused-variable
74 # We have to make sure the data for testing the tz functions is available.
75 # Don't add leapseconds here since test-tz made checks that work only without
76 # leapseconds.
77 define build-testdata
78 $(built-program-cmd) -d $(testdata) -y ./yearistype $<; \
79 $(evaluate-test)
80 endef
82 $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
83 $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
84 Europe/Berlin Universal \
85 Australia/Melbourne \
86 America/Sao_Paulo Asia/Tokyo \
87 Europe/London)
88 $(objpfx)tst-tzset.out: $(addprefix $(testdata)/XT, 1 2 3 4)
90 test-tz-ENV = TZDIR=$(testdata)
91 tst-timezone-ENV = TZDIR=$(testdata)
92 tst-tzset-ENV = TZDIR=$(testdata)
94 # Note this must come second in the deps list for $(built-program-cmd) to work.
95 zic-deps = $(objpfx)zic $(leapseconds) yearistype
97 $(testdata)/America/New_York: northamerica $(zic-deps)
98 $(build-testdata)
99 $(testdata)/Etc/UTC: etcetera $(zic-deps)
100 $(build-testdata)
101 # Use a pattern rule to indicate the command produces both targets at once.
102 # Two separate targets built separately can collide if in parallel.
103 %/UTC %/Universal: simplebackw $(zic-deps) %/Etc/UTC
104 $(build-testdata)
105 { test -r $(@D)/Universal.test-result \
106 && cp $(@D)/Universal.test-result $(@D)/UTC.test-result \
107 && sed -i 's/Universal/UTC/' $(@D)/UTC.test-result ; exit 0; }
108 { test -r $(@D)/UTC.test-result \
109 && cp $(@D)/UTC.test-result $(@D)/Universal.test-result \
110 && sed -i 's/UTC/Universal/' $(@D)/Universal.test-result ; exit 0; }
111 $(testdata)/%/Berlin $(testdata)/%/London: europe $(zic-deps)
112 $(build-testdata)
113 $(testdata)/Australia/Melbourne: australasia $(zic-deps)
114 $(build-testdata)
115 $(testdata)/America/Sao_Paulo: southamerica $(zic-deps)
116 $(build-testdata)
117 $(testdata)/Asia/Tokyo: asia $(zic-deps)
118 $(build-testdata)
120 $(testdata)/XT%: testdata/XT%
121 $(make-target-directory)
122 cp $< $@
124 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
125 sed -e 's|/bin/bash|$(BASH)|' \
126 -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
127 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
128 -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
129 -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
130 < $< > $@.new
131 chmod 555 $@.new
132 mv -f $@.new $@