--- dlfcn-win32-1.0.0/Makefile.orig	2015-06-09 13:37:21.704000000 +0300
+++ dlfcn-win32-1.0.0/Makefile	2015-06-09 13:36:26.672400000 +0300
@@ -3,18 +3,31 @@
 #
 include config.mak
 
+API_VERSION=0
+LIBRARY_NAME=libdl
+SHARED_EXTENSION=.dll
+STATIC_EXTENSION=.a
+ifeq ($(BUILD_MSVC),yes)
+	IMPORT_LIBRARY_EXTENSION=.lib
+else
+	IMPORT_LIBRARY_EXTENSION=.dll.a
+endif
+SHARED_LIBRARY_NAME=$(LIBRARY_NAME)-$(API_VERSION)$(SHARED_EXTENSION)
+STATIC_LIBRARY_NAME=$(LIBRARY_NAME)$(STATIC_EXTENSION)
+IMPORT_LIBRARY_NAME=$(LIBRARY_NAME)$(IMPORT_LIBRARY_EXTENSION)
+
 ifeq ($(BUILD_SHARED),yes)
-	TARGETS += libdl.dll libdl.dll.a
-	SHFLAGS += -Wl,--out-implib,libdl.dll.a
+	TARGETS += $(SHARED_LIBRARY_NAME)
+	SHFLAGS += -Wl,--out-implib,$(IMPORT_LIBRARY_NAME)
 	INSTALL += shared-install
 endif
 ifeq ($(BUILD_STATIC),yes)
-	TARGETS += libdl.a
+	TARGETS += $(STATIC_LIBRARY_NAME)
 	INSTALL += static-install
 endif
 ifeq ($(BUILD_MSVC),yes)
-    TARGETS += libdl.lib
-	SHFLAGS += -Wl,--output-def,libdl.def
+	TARGETS += $(IMPORT_LIBRARY_NAME)
+	SHFLAGS += -Wl,--output-def,$(LIBRARY_NAME).def
 	INSTALL += lib-install
 endif
 
@@ -26,14 +39,14 @@
 %.o: %.c
 	$(CC) -o $@ -c $< -Wall -O3 -fomit-frame-pointer
 
-libdl.a: $(LIB_OBJS)
+$(STATIC_LIBRARY_NAME): $(LIB_OBJS)
 	$(AR) cru $@ $^
 	$(RANLIB) libdl.a
 
-libdl.dll libdl.dll.a: $(LIB_OBJS)
+$(SHARED_LIBRARY_NAME): $(LIB_OBJS)
 	$(CC) $(SHFLAGS) -shared -o $@ $^
 
-libdl.lib: libdl.dll
+$(IMPORT_LIBRARY_NAME): $(SHARED_LIBRARY_NAME)
 	$(LIBCMD) /machine:i386 /def:libdl.def
 
 include-install: $(HEADERS)
@@ -42,18 +55,18 @@
 
 shared-install: include-install
 	mkdir -p $(DESTDIR)$(prefix)/bin
-	cp libdl.dll $(DESTDIR)$(prefix)/bin
-	$(STRIP) $(DESTDIR)$(prefix)/bin/libdl.dll
+	cp $(SHARED_LIBRARY_NAME) $(DESTDIR)$(prefix)/bin
+	$(STRIP) $(DESTDIR)$(prefix)/bin/$(SHARED_LIBRARY_NAME)
 	mkdir -p $(DESTDIR)$(libdir)
-	cp libdl.dll.a $(DESTDIR)$(libdir)
+	cp $(IMPORT_LIBRARY_NAME) $(DESTDIR)$(libdir)
 
 static-install: include-install
 	mkdir -p $(DESTDIR)$(libdir)
-	cp libdl.a $(DESTDIR)$(libdir)
+	cp $(STATIC_LIBRARY_NAME) $(DESTDIR)$(libdir)
 
 lib-install: $(LIBS)
 	mkdir -p $(DESTDIR)$(libdir)
-	cp libdl.lib $(DESTDIR)$(libdir)
+	cp $(IMPORT_LIBRARY_NAME) $(DESTDIR)$(libdir)
 
 install: $(INSTALL)
 
@@ -67,7 +80,7 @@
 	$(WINE) test.exe
 
 clean::
-	rm -f dlfcn.o libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp test.exe testdll.dll
+	rm -f dlfcn.o $(SHARED_LIBRARY_NAME) $(STATIC_LIBRARY_NAME) libdl.def $(IMPORT_LIBRARY_NAME) libdl.exp test.exe testdll.dll
 
 distclean: clean
 	rm -f config.mak
