--- luajit/src/Makefile.orig	2014-12-04 10:17:07.822800000 +0300
+++ luajit/src/Makefile	2014-12-04 10:17:48.273600000 +0300
@@ -305,7 +305,7 @@
 TARGET_SYS?= $(HOST_SYS)
 ifeq (Windows,$(TARGET_SYS))
   TARGET_STRIP+= --strip-unneeded
-  TARGET_XSHLDFLAGS= -shared
+  TARGET_XSHLDFLAGS= -shared -Wl,--out-implib,libluajit-${ABIVER}.dll.a
   TARGET_DYNXLDOPTS=
 else
 ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1))
@@ -517,6 +517,7 @@

 # Mixed mode defaults.
 TARGET_O= $(LUAJIT_A)
+TARGET_LO= $(TARGET_O)
 TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)
 TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)
 
@@ -572,6 +572,11 @@
   TARGET_DYNCC= @:
   LJVMCORE_DYNO= $(LJVMCORE_O)
   TARGET_O= $(LUAJIT_SO)
+  ifeq (Windows,$(TARGET_SYS))
+    TARGET_LO= libluajit-${ABIVER}.dll.a
+  else
+    TARGET_LO= $(TARGET_O)
+  endif
   TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS)
 else
 ifeq (Darwin,$(TARGET_SYS))
@@ -709,7 +714,7 @@
 
 $(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP)
 	$(E) "LINK      $@"
-	$(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS)
+	$(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_LO) $(TARGET_ALIBS)
 	$(Q)$(TARGET_STRIP) $@
 	$(E) "OK        Successfully built LuaJIT"
 
