diff --git a/Makefile.generating b/Makefile.generating
index 33b4ea6b2cb7f2b8994e663953d0e2b9f1cafa43..f50833a6382aec5813c3118388a9dae8abc48032 100644
--- a/Makefile.generating
+++ b/Makefile.generating
@@ -96,10 +96,12 @@ $(CONFIG_FILE): $(CONFIG_FILE).in VERSION share/Makefile.config Makefile.generat
 
 ifeq ("$(LOCAL_MACHDEP)","yes")
 
+MACHDEP_PATH=share
+
 # Create the machine dependency module
 # If the cl command cannot be run then the MSVC part will be identical to GCC
-.PHONY : machdep $(CIL_PATH)/local_machdep.ml
-machdep: $(CIL_PATH)/local_machdep.ml
+.PHONY : machdep $(MACHDEP_PATH)/local_machdep.ml
+machdep: $(MACHDEP_PATH)/local_machdep.ml
 bin/machdep.exe: machdep
 
 config.h: 
@@ -107,7 +109,8 @@ config.h:
 	$(ECHO) "missing config.h file generated at configure stage using --enable-localmachdep option."
 	exit 1;
 
-$(CIL_PATH)/local_machdep.ml: $(CIL_PATH)/machdep.c config.h Makefile.generating
+$(MACHDEP_PATH)/local_machdep.ml: \
+  $(MACHDEP_PATH)/machdep.c config.h Makefile.generating
 	$(PRINT_MAKING) $@
 	$(RM) $@
 	$(ECHO) "(* This module was generated automatically by code in Makefile and machdep.c *)" >$@