diff --git a/contribs/cray/Makefile.am b/contribs/cray/Makefile.am
index e6aa1e7dad8f65652b0629cabcddf4de74d4d0fe..e92e4a760d29a1fb23012a756e3dfb2607205566 100644
--- a/contribs/cray/Makefile.am
+++ b/contribs/cray/Makefile.am
@@ -24,8 +24,8 @@ opt_modulefiles_slurm: opt_modulefiles_slurm.in Makefile
 	sed -e 's|@prefix[@]|$(prefix)|g' \
 	    -e 's|@MUNGE_DIR[@]|$(MUNGE_DIR)|g' \
 	    -e 's|@libdir[@]|$(libdir)|g' \
-	    opt_modulefiles_slurm.in >opt_modulefiles_slurm
+	    ${abs_srcdir}/opt_modulefiles_slurm.in >opt_modulefiles_slurm
 
 slurmconfgen.py: slurmconfgen.py.in Makefile
 	sed -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-	    slurmconfgen.py.in >slurmconfgen.py
+	    ${abs_srcdir}/slurmconfgen.py.in >slurmconfgen.py
diff --git a/contribs/cray/Makefile.in b/contribs/cray/Makefile.in
index d3029c2375568ace2254dd20597b613db0c54738..43894d9e62c4cc82d8ac06b3bc6a7eaa4b0666af 100644
--- a/contribs/cray/Makefile.in
+++ b/contribs/cray/Makefile.in
@@ -665,11 +665,11 @@ opt_modulefiles_slurm: opt_modulefiles_slurm.in Makefile
 	sed -e 's|@prefix[@]|$(prefix)|g' \
 	    -e 's|@MUNGE_DIR[@]|$(MUNGE_DIR)|g' \
 	    -e 's|@libdir[@]|$(libdir)|g' \
-	    opt_modulefiles_slurm.in >opt_modulefiles_slurm
+	    ${abs_srcdir}/opt_modulefiles_slurm.in >opt_modulefiles_slurm
 
 slurmconfgen.py: slurmconfgen.py.in Makefile
 	sed -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-	    slurmconfgen.py.in >slurmconfgen.py
+	    ${abs_srcdir}/slurmconfgen.py.in >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.