diff --git a/contribs/cray/Makefile.am b/contribs/cray/Makefile.am
index e92e4a760d29a1fb23012a756e3dfb2607205566..3262483bdac30b81b6f99bd00dda5432d3790f58 100644
--- a/contribs/cray/Makefile.am
+++ b/contribs/cray/Makefile.am
@@ -16,8 +16,9 @@ if HAVE_NATIVE_CRAY
 sbin_SCRIPTS = slurmconfgen.py
 endif
 
+if HAVE_REAL_CRAY
 noinst_DATA = opt_modulefiles_slurm
-
+endif
 
 # Don't rely on autoconf to replace variables outside of makefiles
 opt_modulefiles_slurm: opt_modulefiles_slurm.in Makefile
@@ -29,3 +30,6 @@ opt_modulefiles_slurm: opt_modulefiles_slurm.in Makefile
 slurmconfgen.py: slurmconfgen.py.in Makefile
 	sed -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
 	    ${abs_srcdir}/slurmconfgen.py.in >slurmconfgen.py
+
+clean-generic:
+	rm -f opt_modulefiles_slurm slurmconfgen.py
diff --git a/contribs/cray/Makefile.in b/contribs/cray/Makefile.in
index 43894d9e62c4cc82d8ac06b3bc6a7eaa4b0666af..0e8541ccd5f7b199ccf0e943c6bbc4f724cd4b25 100644
--- a/contribs/cray/Makefile.in
+++ b/contribs/cray/Makefile.in
@@ -430,7 +430,7 @@ EXTRA_DIST = \
 	slurmconfgen.py.in
 
 @HAVE_NATIVE_CRAY_TRUE@sbin_SCRIPTS = slurmconfgen.py
-noinst_DATA = opt_modulefiles_slurm
+@HAVE_REAL_CRAY_TRUE@noinst_DATA = opt_modulefiles_slurm
 all: all-am
 
 .SUFFIXES:
@@ -570,8 +570,6 @@ install-strip:
 	fi
 mostlyclean-generic:
 
-clean-generic:
-
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
@@ -671,6 +669,9 @@ slurmconfgen.py: slurmconfgen.py.in Makefile
 	sed -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
 	    ${abs_srcdir}/slurmconfgen.py.in >slurmconfgen.py
 
+clean-generic:
+	rm -f opt_modulefiles_slurm slurmconfgen.py
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT: