2004-04-30 06:09:23 +02:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2004-10-04 15:43:59 +02:00
|
|
|
# Makefile
|
2004-04-30 06:09:23 +02:00
|
|
|
# Makefile for the timezone library
|
|
|
|
|
|
|
|
# IDENTIFICATION
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/timezone/Makefile
|
2004-04-30 06:09:23 +02:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2014-08-19 04:59:53 +02:00
|
|
|
PGFILEDESC = "zic - time zone compiler"
|
|
|
|
PGAPPICON = win32
|
|
|
|
|
2004-04-30 16:24:14 +02:00
|
|
|
subdir = src/timezone
|
2004-04-30 06:31:52 +02:00
|
|
|
top_builddir = ../..
|
2004-04-30 06:09:23 +02:00
|
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
|
2004-05-21 07:08:06 +02:00
|
|
|
# files to build into backend
|
2019-11-05 23:41:07 +01:00
|
|
|
OBJS = \
|
|
|
|
localtime.o \
|
|
|
|
pgtz.o \
|
|
|
|
strftime.o
|
2004-04-30 06:09:23 +02:00
|
|
|
|
2004-05-21 07:08:06 +02:00
|
|
|
# files needed to build zic utility program
|
2019-11-05 23:41:07 +01:00
|
|
|
ZICOBJS = \
|
|
|
|
$(WIN32RES) \
|
|
|
|
zic.o
|
2004-05-21 07:08:06 +02:00
|
|
|
|
2017-11-25 21:30:11 +01:00
|
|
|
# we now distribute the timezone data as a single file
|
|
|
|
TZDATAFILES = $(srcdir)/data/tzdata.zi
|
2004-04-30 06:09:23 +02:00
|
|
|
|
2007-03-14 18:38:06 +01:00
|
|
|
# which zone should determine the DST rules (not the specific UTC offset!)
|
|
|
|
# for POSIX-style timezone specs
|
|
|
|
POSIXRULES = US/Eastern
|
|
|
|
|
2019-04-27 01:46:26 +02:00
|
|
|
# any custom options you might want to pass to zic while installing data files
|
|
|
|
ZIC_OPTIONS =
|
|
|
|
|
2007-08-25 22:29:25 +02:00
|
|
|
# use system timezone data?
|
|
|
|
ifneq (,$(with_system_tzdata))
|
|
|
|
override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
|
|
|
|
endif
|
|
|
|
|
2008-02-19 16:29:58 +01:00
|
|
|
include $(top_srcdir)/src/backend/common.mk
|
2007-08-25 22:29:25 +02:00
|
|
|
|
|
|
|
ifeq (,$(with_system_tzdata))
|
2010-11-12 21:15:16 +01:00
|
|
|
all: zic
|
2007-08-25 22:29:25 +02:00
|
|
|
endif
|
2004-04-30 06:09:23 +02:00
|
|
|
|
2009-01-06 03:25:29 +01:00
|
|
|
# We could do this test in the action section:
|
|
|
|
# $(if $(ZIC),$(ZIC),./zic)
|
2014-02-12 23:29:19 +01:00
|
|
|
# but GNU make versions <= 3.78.1 or perhaps later have a bug
|
|
|
|
# that causes a segfault; GNU make 3.81 or later fixes this.
|
2009-01-06 03:25:29 +01:00
|
|
|
ifeq (,$(ZIC))
|
|
|
|
ZIC= ./zic
|
|
|
|
endif
|
|
|
|
|
2010-11-12 21:15:16 +01:00
|
|
|
zic: $(ZICOBJS) | submake-libpgport
|
2010-07-05 20:54:38 +02:00
|
|
|
$(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
2004-04-30 06:09:23 +02:00
|
|
|
|
2004-05-18 06:10:33 +02:00
|
|
|
install: all installdirs
|
2007-08-20 10:53:12 +02:00
|
|
|
ifeq (,$(with_system_tzdata))
|
Use zic's new "-b slim" option to generate smaller timezone files.
IANA tzcode release 2019b adds an option that tells zic not to emit
the old 32-bit section of the timezone files, and to skip some other
space-wasting hacks needed for compatibility with old timezone client
libraries. Since we only expect our own code to use the timezone data
we install, and our code is up-to-date with 2019b, there's no apparent
reason not to generate the smallest possible files.
Unfortunately, while the individual zone files do get significantly
smaller in many cases, they were not that big to begin with; which
means that no real space savings ensues on filesystems that don't
optimize small files. (For instance, on ext4 with 4K block size,
"du" says the installed timezone tree is the same size as before.)
Still, it seems worth making the change, if only because this is
presumably the wave of the future. At the very least, we'll save
some cycles while reading a zone file.
But given the marginal value and the fact that this is a new code
path, it doesn't seem worth the risk of back-patching this change
into stable branches. Hence, unlike most of our timezone-related
changes, apply to HEAD only.
Discussion: https://postgr.es/m/24998.1563403327@sss.pgh.pa.us
2019-08-19 19:17:02 +02:00
|
|
|
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' -b slim $(ZIC_OPTIONS) $(TZDATAFILES)
|
2007-08-20 10:53:12 +02:00
|
|
|
endif
|
2006-07-25 05:51:23 +02:00
|
|
|
$(MAKE) -C tznames $@
|
2004-04-30 06:09:23 +02:00
|
|
|
|
2013-03-23 23:47:22 +01:00
|
|
|
abbrevs.txt: zic $(TZDATAFILES)
|
|
|
|
mkdir junkdir
|
|
|
|
$(ZIC) -P -d junkdir -p '$(POSIXRULES)' $(TZDATAFILES) | LANG=C sort | uniq >abbrevs.txt
|
|
|
|
rm -rf junkdir
|
|
|
|
|
2004-05-28 05:53:33 +02:00
|
|
|
installdirs:
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(datadir)'
|
2005-12-09 22:19:36 +01:00
|
|
|
|
|
|
|
uninstall:
|
2007-08-25 22:29:25 +02:00
|
|
|
ifeq (,$(with_system_tzdata))
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -rf '$(DESTDIR)$(datadir)/timezone'
|
2007-08-25 22:29:25 +02:00
|
|
|
endif
|
2006-07-25 05:51:23 +02:00
|
|
|
$(MAKE) -C tznames $@
|
2004-05-28 05:53:33 +02:00
|
|
|
|
2004-04-30 06:09:23 +02:00
|
|
|
clean distclean maintainer-clean:
|
2013-03-23 23:47:22 +01:00
|
|
|
rm -f zic$(X) $(ZICOBJS) abbrevs.txt
|