diff --git a/build/autoMakefile.am b/build/autoMakefile.am
index 3ecd19008d618af27c99709c24e86439e8629a7f..e101bef7117a7c4f9bcacd177443d0a5d69aa903 100644
--- a/build/autoMakefile.am
+++ b/build/autoMakefile.am
@@ -10,6 +10,8 @@ EXTRA_DIST := Makefile Makefile.in.toplevel		       \
 
 CONFIG_CLEAN_FILES := lustre.spec
 
+MOSTLYCLEANFILES = .*.flags *.o *.ko *.mod.c
+
 distclean: distclean-recursive
 	@true
 
diff --git a/lnet/libcfs/autoMakefile.am b/lnet/libcfs/autoMakefile.am
index 5bc2c08d085dd10e9e2c7f44d03bce487e4ba30b..ea3b47c73fa87ec1115e3418088e2e341b190608 100644
--- a/lnet/libcfs/autoMakefile.am
+++ b/lnet/libcfs/autoMakefile.am
@@ -41,5 +41,6 @@ install-data-hook: $(install_data_hook)
 
 EXTRA_DIST := Info.plist
 
-MOSTLYCLEANFILES := *.o *.ko *.mod.c linux-*.c linux/*.o darwin/*.o libcfs
+MOSTLYCLEANFILES := .*.flags *.o *.ko *.mod.c linux-*.c 
+MOSTLYCLEANFILES += linux/*.o darwin/*.o libcfs
 DIST_SOURCES := $(libcfs-all-objs:%.o=%.c) tracefile.h