--- w-tzdata-2013d-1.orig/Makefile	2013-07-05 16:38:01.000000000 +0200
+++ w-tzdata-2013d-1/Makefile	2013-10-04 11:29:22.000000000 +0200
@@ -231,7 +231,7 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-co
 # before the first Monday in January when a "%V" format is used and January 1
 # falls on a Friday, Saturday, or Sunday.
 
-CFLAGS=
+CFLAGS?=
 
 # Linker flags.  Default to $(LFLAGS) for backwards compatibility
 # to tzcode2012h and earlier.
@@ -239,7 +239,7 @@ CFLAGS=
 LDFLAGS=	$(LFLAGS)
 
 zic=		./zic
-ZIC=		$(zic) $(ZFLAGS)
+ZIC=		./zic_for_build $(ZFLAGS)
 
 # The name of a Posix-compliant `awk' on your system.
 AWK=		awk
@@ -330,7 +330,7 @@ ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) 
 
 SHELL=		/bin/sh
 
-all:		tzselect zic zdump $(LIBOBJS)
+all:		zic_for_build tzselect zic zdump $(LIBOBJS)
 
 ALL:		all date
 
@@ -365,6 +365,14 @@ version.h:
 		 echo 'static char const TZVERSION[]="$(VERSION)";' && \
 		 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
 
+zic_for_build: version.h
+		$(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) zic.c -o zic_build.o
+		$(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) localtime.c -o localtime_build.o
+		$(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) asctime.c -o asctime_build.o
+		$(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) scheck.c -o scheck_build.o
+		$(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) ialloc.c -o ialloc_build.o
+		$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ zic_build.o localtime_build.o asctime_build.o scheck_build.o ialloc_build.o 
+
 zdump:		$(TZDOBJS)
 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
 
@@ -375,10 +383,10 @@ yearistype:	yearistype.sh
 		cp yearistype.sh yearistype
 		chmod +x yearistype
 
-posix_only:	zic $(TDATA)
+posix_only:	zic_for_build $(TDATA)
 		$(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA)
 
-right_only:	zic leapseconds $(TDATA)
+right_only:	zic_for_build leapseconds $(TDATA)
 		$(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
 
 # In earlier versions of this makefile, the other two directories were
@@ -390,7 +398,7 @@ right_only:	zic leapseconds $(TDATA)
 # Therefore, the other two directories are now siblings of $(TZDIR).
 # You must replace all of $(TZDIR) to switch from not using leap seconds
 # to using them, or vice versa.
-other_two:	zic leapseconds $(TDATA)
+other_two:	zic_for_build leapseconds $(TDATA)
 		$(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
 		$(ZIC) -y $(YEARISTYPE) \
 			-d $(TZDIR)-leaps -L leapseconds $(TDATA)
