summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/Makefile.global.in3
-rw-r--r--src/timezone/Makefile17
2 files changed, 15 insertions, 5 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 3bc7cfbbc53..f537682569f 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
# -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.214 2005/05/17 18:26:22 tgl Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.215 2005/07/03 18:54:28 petere Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -182,6 +182,7 @@ endif
endif # not PGXS
CC = @CC@
+CC_FOR_BUILD = @CC_FOR_BUILD@
GCC = @GCC@
CFLAGS = @CFLAGS@
diff --git a/src/timezone/Makefile b/src/timezone/Makefile
index e468b73dce6..86d25a814e1 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