diff -Naur libdeflate-1.7.orig/Makefile libdeflate-1.7/Makefile
--- libdeflate-1.7.orig/Makefile       2020-11-10 04:29:50.000000000 +0100
+++ libdeflate-1.7/Makefile    2020-11-12 15:54:02.152338000 +0100
@@ -84,14 +84,18 @@
 HARD_LINKS         := 1
 
 # Compiling for Windows with MinGW?
-ifneq ($(findstring -mingw,$(shell $(CC) -dumpmachine 2>/dev/null)),)
-    STATIC_LIB_SUFFIX  := static.lib
+DUMPMACHINE := $(shell $(CC) -dumpmachine 2>/dev/null)
+ifneq ($(findstring -mingw,$(DUMPMACHINE))$(findstring -windows-gnu,$(DUMPMACHINE)),)
     SHARED_LIB         := libdeflate.dll
     SHARED_LIB_SYMLINK :=
     SHARED_LIB_CFLAGS  :=
-    SHARED_LIB_LDFLAGS := -Wl,--out-implib,libdeflate.lib \
-                          -Wl,--output-def,libdeflate.def \
-                          -Wl,--add-stdcall-alias
+    SHARED_LIB_LDFLAGS := -Wl,--out-implib,libdeflate.dll.a \
+                          -Wl,--output-def,libdeflate.def
+    # only if not clang
+    ifeq ($(findstring -windows-gnu,$(DUMPMACHINE)),)
+        SHARED_LIB_LDFLAGS += -Wl,--add-stdcall-alias
+    endif
+
     PROG_SUFFIX        := .exe
     PROG_CFLAGS        := -static -municode
     HARD_LINKS         :=
@@ -107,7 +107,7 @@
     # On Windows it may also have a .exe extension.
     ifeq ($(AR),ar)
         AR := $(shell echo $(CC) | \
-                sed -E 's/g?cc(-?[0-9]+(\.[0-9]+)*)?(\.exe)?$$/ar\3/')
+                sed -E 's/(g?cc|clang)(-?[0-9]+(\.[0-9]+)*)?(\.exe)?$$/ar\4/')
     endif
 
 # macOS?
@@ -305,7 +309,8 @@
 install:all
 	install -d $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
 	install -m644 $(STATIC_LIB) $(DESTDIR)$(LIBDIR)
-	install -m755 $(SHARED_LIB) $(DESTDIR)$(LIBDIR)
+	install -m644 $(SHARED_LIB).a $(DESTDIR)$(LIBDIR)
+	install -m755 $(SHARED_LIB) $(DESTDIR)$(BINDIR)
 	install -m644 libdeflate.h $(DESTDIR)$(INCDIR)
 	install -m755 gzip$(PROG_SUFFIX) \
 		$(DESTDIR)$(BINDIR)/libdeflate-gzip$(PROG_SUFFIX)
@@ -318,7 +323,8 @@
 
 uninstall:
 	rm -f $(DESTDIR)$(LIBDIR)/$(STATIC_LIB)				\
-	      $(DESTDIR)$(LIBDIR)/$(SHARED_LIB)				\
+	      $(DESTDIR)$(LIBDIR)/$(SHARED_LIB).a			\
+	      $(DESTDIR)$(BINDIR)/$(SHARED_LIB)				\
 	      $(DESTDIR)$(INCDIR)/libdeflate.h				\
 	      $(DESTDIR)$(BINDIR)/libdeflate-gzip$(PROG_SUFFIX)		\
 	      $(DESTDIR)$(BINDIR)/libdeflate-gunzip$(PROG_SUFFIX)
