diff --git a/build/mkdep b/build/mkdep
index 6620fbfe8f940ae7fe07595cb840e59375194820..852e7e636b698f1c63808e5f5b2f063424af8208 100755
--- a/build/mkdep
+++ b/build/mkdep
@@ -26,6 +26,7 @@ set -e				# exit immediately if any errors occur
 MAKE=Makefile			# default makefile name is "Makefile"
 NOSLASH="no"			# by default, / dependencies are included
 CC=${CC-cc}				# default compiler is cc
+: ${CC_MKDEP_FLAGS="-M"}	# cc -M usually produces dependencies
 SRCDIR=""
 SED=cat
 
@@ -127,7 +128,7 @@ cat << _EOF_ >> $TMP
 
 _EOF_
 
-$CC -M $files | \
+$CC $CC_MKDEP_FLAGS $files | \
 	sed -e 's; \./; ;g' | \
 	$SED | \
 awk '