]> granicus.if.org Git - postgresql/blob - src/timezone/Makefile
Don't try to create a temp install without abs_top_builddir.
[postgresql] / src / timezone / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile
4 #    Makefile for the timezone library
5
6 # IDENTIFICATION
7 #    src/timezone/Makefile
8 #
9 #-------------------------------------------------------------------------
10
11 PGFILEDESC = "zic - time zone compiler"
12 PGAPPICON = win32
13
14 subdir = src/timezone
15 top_builddir = ../..
16 include $(top_builddir)/src/Makefile.global
17
18 # files to build into backend
19 OBJS= localtime.o strftime.o pgtz.o
20
21 # files needed to build zic utility program
22 ZICOBJS= zic.o ialloc.o scheck.o localtime.o $(WIN32RES)
23
24 # timezone data files
25 TZDATA = africa antarctica asia australasia europe northamerica southamerica \
26         pacificnew etcetera factory backward systemv
27 TZDATAFILES = $(TZDATA:%=$(srcdir)/data/%)
28
29 # which zone should determine the DST rules (not the specific UTC offset!)
30 # for POSIX-style timezone specs
31 POSIXRULES = US/Eastern
32
33 # use system timezone data?
34 ifneq (,$(with_system_tzdata))
35 override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
36 endif
37
38 include $(top_srcdir)/src/backend/common.mk
39
40 ifeq (,$(with_system_tzdata))
41 all: zic
42 endif
43
44 # We could do this test in the action section:
45 #       $(if $(ZIC),$(ZIC),./zic)
46 # but GNU make versions <= 3.78.1 or perhaps later have a bug
47 # that causes a segfault;  GNU make 3.81 or later fixes this.
48 ifeq (,$(ZIC))
49 ZIC= ./zic
50 endif
51
52 zic: $(ZICOBJS) | submake-libpgport
53         $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
54
55 install: all installdirs
56 ifeq (,$(with_system_tzdata))
57         $(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
58 endif
59         $(MAKE) -C tznames $@
60
61 abbrevs.txt: zic $(TZDATAFILES)
62         mkdir junkdir
63         $(ZIC) -P -d junkdir -p '$(POSIXRULES)' $(TZDATAFILES) | LANG=C sort | uniq >abbrevs.txt
64         rm -rf junkdir
65
66 installdirs:
67         $(MKDIR_P) '$(DESTDIR)$(datadir)'
68
69 uninstall:
70 ifeq (,$(with_system_tzdata))
71         rm -rf '$(DESTDIR)$(datadir)/timezone'
72 endif
73         $(MAKE) -C tznames $@
74
75 clean distclean maintainer-clean:
76         rm -f zic$(X) $(ZICOBJS) abbrevs.txt