diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index c2985fd7881de6f7cf60d76a01beab47e48d1cd1..1db15ecb10828df8d9d7fa7339f36ee48a860f9e 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -111,7 +111,7 @@ modules.link:
 
 clean::
 	rm -f *.so *.o *.oo *.eo *.i *.ii
-	rm -f .*.o.d .*.oo.d
+	rm -f .*.d
 	rm -f *.s *.i
 	rm -f modules.link
 
@@ -124,7 +124,6 @@ uninstall::
 dist-clean::
 	rm -f .*.moduleinfo .moduleinfo
 	rm -f .*.makeopts .makeopts
-	rm -f .*.d
 
 .%.moduleinfo: %.c
 	@echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.o $(SUBDIR)/$*.so\">" > $@
diff --git a/Makefile.rules b/Makefile.rules
index 92fca37c93d5def87e3d9df62977386554b9ab8d..db44a876ba755208480c34a6a3fd625a7e38d421 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -19,6 +19,11 @@
 
 .PHONY: dist-clean
 
+# If 'make' decides to create intermediate files to satisfy a build requirement
+# (like producing a .i from a .c), we want to keep them, so tell make to keep
+# all intermediate files
+.SECONDARY:
+
 # extra cflags to build dependencies. Recursively expanded.
 MAKE_DEPS=-MD -MT $@ -MF .$(subst /,_,$@).d -MP
 
@@ -74,13 +79,9 @@ ifeq ($(COMPILE_DOUBLE),yes)
 endif
 	$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS)
 
+ifneq ($(COMPILE_DOUBLE),yes)
 %.o: %.c
 	$(ECHO_PREFIX) echo "   [CC] $< -> $@"
-ifeq ($(COMPILE_DOUBLE),yes)
-	$(CMD_PREFIX) $(CC) -o $(@:%.o=%.i) -E $< $(CC_CFLAGS) $(MAKE_DEPS)
-	$(CMD_PREFIX) $(CC) -o /dev/null -c $(@:%.o=%.i) $(CC_CFLAGS) $(OPTIMIZE)
-	$(CMD_PREFIX) $(CC) -o $@ -c $(@:%.o=%.i) $(CC_CFLAGS)
-else
 	$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS) $(MAKE_DEPS)
 endif
 
@@ -95,13 +96,9 @@ ifeq ($(COMPILE_DOUBLE),yes)
 endif
 	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(CXX_CFLAGS)
 
+ifneq ($(COMPILE_DOUBLE),yes)
 %.oo: %.cc
 	$(ECHO_PREFIX) echo "   [CXX] $< -> $@"
-ifeq ($(COMPILE_DOUBLE),yes)
-	$(CMD_PREFIX) $(CXX) -o $(@:%.oo=%.ii) -E $< $(CXX_CFLAGS) $(MAKE_DEPS)
-	$(CMD_PREFIX) $(CXX) -o /dev/null -c $(@:%.oo=%.ii) $(CXX_CFLAGS) $(MAKE_DEPS) $(OPTIMIZE)
-	$(CMD_PREFIX) $(CXX) -o $@ -c $(@:%.oo=%.ii) $(CXX_CFLAGS) $(MAKE_DEPS)
-else
 	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(CXX_CFLAGS) $(MAKE_DEPS)
 endif
 
diff --git a/agi/Makefile b/agi/Makefile
index d580a163297e7c553087a0b35b63cbb5caee861d..e8e57a9b9b9fb0748db52a74ac365ab291eb5273 100644
--- a/agi/Makefile
+++ b/agi/Makefile
@@ -48,8 +48,7 @@ uninstall:
 
 clean:
 	rm -f *.so *.o look eagi-test eagi-sphinx-test
-	rm -f .*.o.d .*.oo.d
-	rm -f *.s *.i
+	rm -f .*.d *.s *.i
 	rm -f strcompat.c
 
 ifneq ($(wildcard .*.d),)
diff --git a/utils/Makefile b/utils/Makefile
index 44fa848a3696a2d1cb1b200797ca9e6d8972b15c..3a280dcad1d4b6e7285b5bf345c4320d5b6d6e42 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -73,7 +73,7 @@ uninstall:
 
 clean:
 	rm -f *.o $(ALL_UTILS) check_expr
-	rm -f .*.o.d .*.oo.d
+	rm -f .*.d
 	rm -f *.s *.i
 	rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c hashtab.c
 	rm -f aelparse.c aelbison.c conf2ael