--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,8 @@
 
 ifeq ($(shell uname),Darwin)
   SO = dylib
+else ifeq ($(shell uname -o),Msys)
+  SO = dll
 else
   SO = so
 endif
@@ -33,7 +35,7 @@
 
 ifneq ($(HAVE_READLINE),no)
   READLINE_CFLAGS = -DHAVE_READLINE
-  READLINE_LIBS = -lreadline
+  READLINE_LIBS = -lreadline -ltermcap
 endif
 
 SRCS = \
@@ -97,14 +99,14 @@
 
 build/release/libmujs.$(SO): one.c $(SRCS) $(HDRS)
 	@mkdir -p $(@D)
-	$(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -o $@ one.c -lm
+	$(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -Wl,--out-implib,build/release/libmujs.$(SO).a -o $@ one.c -lm
 build/release/libmujs.o: one.c $(SRCS) $(HDRS)
 	@mkdir -p $(@D)
 	$(CC) $(CFLAGS) $(OPTIM) -c -o $@ one.c
 build/release/libmujs.a: build/release/libmujs.o
 	$(AR) cr $@ $^
 build/release/mujs: main.c build/release/libmujs.o
-	$(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS)
+	$(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm $(READLINE_CFLAGS) -static $(READLINE_LIBS)
 build/release/mujs-pp: pp.c build/release/libmujs.o
 	$(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm
 
@@ -131,9 +133,10 @@
 	install -m 644 build/release/libmujs.a $(DESTDIR)$(libdir)
 
 install-shared: install-common build/release/libmujs.$(SO)
-	install -m 755 build/release/libmujs.$(SO) $(DESTDIR)$(libdir)
+	install -m 755 build/release/libmujs.$(SO) $(DESTDIR)$(bindir)
+	install -m 755 build/release/libmujs.$(SO).a $(DESTDIR)$(libdir)
 
-install: install-static
+install: install-static install-shared
 
 uninstall:
 	rm -f $(DESTDIR)$(bindir)/mujs
