diff --git a/interfaces/f2003/bindGen.rb b/interfaces/f2003/bindGen.rb
index 1ee9c93b1f7f3e0af1f4de025fc1d1d220313923..faccd68d28a0175ed547d6f869b2b7baf16af677 100755
--- a/interfaces/f2003/bindGen.rb
+++ b/interfaces/f2003/bindGen.rb
@@ -938,6 +938,9 @@ def scanHeader(headerPath)
 	headerLines.each do |line|
 		line.chomp!
 
+		line.gsub!(/SizeType/,'int')
+		line.gsub!(/DateType/,'int')
+
 		if /^\s*$/.match(line)
 			#Empty lines are ignored.
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 6abc69fbca848c9708b74908ca8a110213f7efb0..d2e437cbf56faf429527371bc6ceaa6e7065316f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -282,9 +282,7 @@ endif
 #
 #	cat $(top_srcdir)/src/cdi.h |sed -e 's/SizeType/size_t/g' -e s/DateType/int64_t/g > cditmp.h
 mo_cdi.f90: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/src/cdi.h $(top_srcdir)/interfaces/f2003/bindGen.rb
-	cat $(top_srcdir)/src/cdi.h |sed -e 's/SizeType/int/g' -e s/DateType/int/g > cditmp.h
-	$(AM_V_GEN)$(RUBY) $(top_srcdir)/interfaces/f2003/bindGen.rb cditmp.h $@
-	rm cditmp.h
+	$(AM_V_GEN)$(RUBY) $(top_srcdir)/interfaces/f2003/bindGen.rb $(top_srcdir)/src/cdi.h $@
 
 if FORTRAN_MOD_UC
 MO_CDI.$(FCMODEXT): mo_cdi.lo