summaryrefslogtreecommitdiff
path: root/src/timezone
diff options
context:
space:
mode:
authorPeter Eisentraut2005-07-03 18:54:28 +0000
committerPeter Eisentraut2005-07-03 18:54:28 +0000
commit85884cb1de2de0640ec1d7540487195a34538a54 (patch)
tree9e4a32459e7ff7abf5f9f5ca77b4c2272a20f7b3 /src/timezone
parentcc9bcbc8a4cbce9d8d5d8cb7b6c4b1425e6cebfa (diff)
Support cross compilation by compiling "zic" with a native compiler. This
relies on the output of zic being platform independent, but that is currently the case.
Diffstat (limited to 'src/timezone')
-rw-r--r--src/timezone/Makefile17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/timezone/Makefile b/src/timezone/Makefile
index e468b73dce..86d25a814e 100644
--- a/src/timezone/Makefile
+++ b/src/timezone/Makefile
@@ -4,7 +4,7 @@
# Makefile for the timezone library
# IDENTIFICATION
-# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.17 2004/12/31 19:01:54 tgl Exp $
+# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.18 2005/07/03 18:54:28 petere Exp $
#
#-------------------------------------------------------------------------
@@ -18,7 +18,7 @@ override CPPFLAGS := $(CPPFLAGS)
OBJS= localtime.o strftime.o pgtz.o
# files needed to build zic utility program
-ZICOBJS= zic.o ialloc.o scheck.o localtime.o
+ZICOBJS= zic.o ialloc.o scheck.o localtime-zic.o
# timezone data files
TZDATA := africa antarctica asia australasia europe northamerica southamerica \
@@ -30,8 +30,17 @@ all: SUBSYS.o submake-libpgport zic
SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
+# In case of cross-compilation, zic needs to be built with a native
+# compiler because it is run during the build, not on the final
+# system.
+
+localtime-zic.c: localtime.c
+ $(LN_S) $< $@
+
+$(ZICOBJS): CC=$(CC_FOR_BUILD)
+
zic: $(ZICOBJS)
- $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
+ $(CC_FOR_BUILD) $(CFLAGS) $(ZICOBJS) -o $@$(X)
install: all installdirs
./zic -d $(DESTDIR)$(datadir)/timezone $(TZDATAFILES)
@@ -40,4 +49,4 @@ installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir)
clean distclean maintainer-clean:
- rm -f SUBSYS.o zic$(X) $(OBJS) $(ZICOBJS)
+ rm -f SUBSYS.o zic zic$(X) $(OBJS) $(ZICOBJS) localtime-zic.c