Blame timezone/Makefile

Packit Service 82fcde
# Copyright (C) 1998-2018 Free Software Foundation, Inc.
Packit Service 82fcde
# This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
# The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
# modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
# License as published by the Free Software Foundation; either
Packit Service 82fcde
# version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
# The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
# Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
# You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
# License along with the GNU C Library; if not, see
Packit Service 82fcde
# <http://www.gnu.org/licenses/>.
Packit Service 82fcde
Packit Service 82fcde
#
Packit Service 82fcde
#	Makefile for timezone information
Packit Service 82fcde
#
Packit Service 82fcde
subdir	:= timezone
Packit Service 82fcde
Packit Service 82fcde
include ../Makeconfig
Packit Service 82fcde
Packit Service 82fcde
others	:= zdump zic
Packit Service 82fcde
tests	:= test-tz tst-timezone tst-tzset
Packit Service 82fcde
Packit Service 82fcde
generated-dirs += testdata
Packit Service 82fcde
Packit Service 82fcde
generated += tzselect
Packit Service 82fcde
Packit Service 82fcde
testdata = $(objpfx)testdata
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(enable-timezone-tools),yes)
Packit Service 82fcde
install-sbin := zic zdump
Packit Service 82fcde
install-bin-script = tzselect
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
ifeq ($(run-built-tests),yes)
Packit Service 82fcde
# List zones generated by separate commands running zic on the host.
Packit Service 82fcde
# Each such zic run counts as a separate test.
Packit Service 82fcde
test-zones := America/New_York Etc/UTC UTC Europe/Berlin \
Packit Service 82fcde
	      Australia/Melbourne America/Sao_Paulo Asia/Tokyo \
Packit Service 82fcde
	      $(posixrules-file)
Packit Service 82fcde
tests-special += $(addprefix $(testdata)/, $(test-zones))
Packit Service 82fcde
endif
Packit Service 82fcde
Packit Service 82fcde
include ../Rules
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)zic.o $(objpfx)zdump.o: $(objpfx)version.h
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)version.h: $(common-objpfx)config.make
Packit Service 82fcde
	echo 'static char const TZVERSION[]="$(version)";' \
Packit Service 82fcde
	    > $@.new
Packit Service 82fcde
	mv -f $@.new $@
Packit Service 82fcde
Packit Service 82fcde
tz-cflags = -DTZDIR='"$(zonedir)"' \
Packit Service 82fcde
	    -DTZDEFAULT='"$(localtime-file)"' \
Packit Service 82fcde
	    -DTZDEFRULES='"$(posixrules-file)"' \
Packit Service 82fcde
	    -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone \
Packit Service 82fcde
	    -DHAVE_GETTEXT -DUSE_LTZ=0 -D_ISOMAC -DTZ_DOMAIN='"libc"' \
Packit Service 82fcde
	    -include $(common-objpfx)config.h -Wno-maybe-uninitialized
Packit Service 82fcde
Packit Service 82fcde
# The -Wno-unused-variable flag is used to prevent GCC 6
Packit Service 82fcde
# from warning about time_t_min and time_t_max which are
Packit Service 82fcde
# defined in private.h but not used.
Packit Service 82fcde
CFLAGS-zdump.c += $(tz-cflags)
Packit Service 82fcde
CFLAGS-zic.c += $(tz-cflags) -Wno-unused-variable
Packit Service 82fcde
Packit Service 82fcde
# We have to make sure the data for testing the tz functions is available.
Packit Service 82fcde
# Don't add leapseconds here since test-tz made checks that work only without
Packit Service 82fcde
# leapseconds.
Packit Service 82fcde
define build-testdata
Packit Service 82fcde
$(built-program-cmd) -d $(testdata) -y ./yearistype $<; \
Packit Service 82fcde
$(evaluate-test)
Packit Service 82fcde
endef
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
Packit Service 82fcde
$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
Packit Service 82fcde
				       Europe/Berlin Universal \
Packit Service 82fcde
				       Australia/Melbourne \
Packit Service 82fcde
				       America/New_York \
Packit Service 82fcde
				       America/Sao_Paulo Asia/Tokyo \
Packit Service 82fcde
				       Europe/London)
Packit Service 82fcde
$(objpfx)tst-tzset.out: $(addprefix $(testdata)/XT, 1 2 3 4)
Packit Service 82fcde
Packit Service 82fcde
test-tz-ENV = TZDIR=$(testdata)
Packit Service 82fcde
tst-timezone-ENV = TZDIR=$(testdata)
Packit Service 82fcde
tst-tzset-ENV = TZDIR=$(testdata)
Packit Service 82fcde
Packit Service 82fcde
# Note this must come second in the deps list for $(built-program-cmd) to work.
Packit Service 82fcde
zic-deps = $(objpfx)zic $(leapseconds) yearistype
Packit Service 82fcde
Packit Service 82fcde
$(testdata)/America/New_York: northamerica $(zic-deps)
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
$(testdata)/$(posixrules-file): $(testdata)/America/New_York
Packit Service 82fcde
	$(make-link); $(evaluate-test)
Packit Service 82fcde
$(testdata)/Etc/UTC: etcetera $(zic-deps)
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
# Use a pattern rule to indicate the command produces both targets at once.
Packit Service 82fcde
# Two separate targets built separately can collide if in parallel.
Packit Service 82fcde
%/UTC %/Universal: simplebackw $(zic-deps) %/Etc/UTC
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
	{ test -r $(@D)/Universal.test-result \
Packit Service 82fcde
	&& cp $(@D)/Universal.test-result $(@D)/UTC.test-result \
Packit Service 82fcde
	&& sed -i 's/Universal/UTC/' $(@D)/UTC.test-result ; exit 0; }
Packit Service 82fcde
	{ test -r $(@D)/UTC.test-result \
Packit Service 82fcde
	&& cp $(@D)/UTC.test-result $(@D)/Universal.test-result \
Packit Service 82fcde
	&& sed -i 's/UTC/Universal/' $(@D)/Universal.test-result ; exit 0; }
Packit Service 82fcde
$(testdata)/%/Berlin $(testdata)/%/London: europe $(zic-deps)
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
$(testdata)/Australia/Melbourne: australasia $(zic-deps)
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
$(testdata)/America/Sao_Paulo: southamerica $(zic-deps)
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
$(testdata)/Asia/Tokyo: asia $(zic-deps)
Packit Service 82fcde
	$(build-testdata)
Packit Service 82fcde
Packit Service 82fcde
$(testdata)/XT%: testdata/XT%
Packit Service 82fcde
	$(make-target-directory)
Packit Service 82fcde
	cp $< $@
Packit Service 82fcde
Packit Service 82fcde
$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
Packit Service 82fcde
	sed -e 's|/bin/bash|$(BASH)|' \
Packit Service 82fcde
	    -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
Packit Service 82fcde
	    -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
Packit Service 82fcde
	    -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
Packit Service 82fcde
	    -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
Packit Service 82fcde
	    < $< > $@.new
Packit Service 82fcde
	chmod 555 $@.new
Packit Service 82fcde
	mv -f $@.new $@