diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
--- FreeImage/Makefile.fip	2015-09-17 22:51:21.797196208 +0200
+++ FreeImage-new/Makefile.fip	2015-09-24 01:18:01.576395215 +0200
@@ -3,6 +3,14 @@
 # This file can be generated by ./genfipsrclist.sh
 include fipMakefile.srcs
 
+CC = gcc
+CXX = g++
+LD = g++
+AR = ar
+DLLTOOL = dlltool
+RC = windres
+PKGCONFIG = pkg-config
+
 # General configuration variables:
 DESTDIR ?= /
 INCDIR ?= $(DESTDIR)/usr/include
@@ -24,24 +32,21 @@ override CFLAGS += -DNO_LCMS
 override CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
 override CFLAGS += $(INCLUDE)
 CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
+override CXXFLAGS += -DFIP_EXPORTS
 # LibJXR
 override CXXFLAGS += -D__ANSI__
 override CXXFLAGS += $(INCLUDE)
 LDFLAGS ?=
-override LDFLAGS += -LDist -lfreeimage-$(VER_MAJOR).$(VER_MINOR)
-
-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
-	override CFLAGS += -fPIC
-	override CXXFLAGS += -fPIC
-endif
+override LDFLAGS += -LDist -lfreeimage-$(VER_MAJOR) -lgdi32
 
 TARGET  = freeimageplus
 STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
-LIBNAME	= lib$(TARGET).so
-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).dll
+IMPORTLIB = lib$(TARGET).dll.a
+EXPORTLIB = lib$(TARGET).exp
 HEADER = Source/FreeImage.h
 HEADERFIP = Wrapper/FreeImagePlus/FreeImagePlus.h
+RCFILE = Wrapper/FreeImagePlus/FreeImagePlus.rc
 
 
 default: all
@@ -51,7 +56,8 @@ all: dist
 dist: FreeImage
 	mkdir -p Dist
 	cp *.a Dist/
-	cp *.so Dist/
+	cp *.dll Dist/
+	cp *.dll.a Dist/
 	cp Source/FreeImage.h Dist/
 	cp Wrapper/FreeImagePlus/FreeImagePlus.h Dist/
 
@@ -66,21 +72,14 @@ FreeImage: $(STATICLIB) $(SHAREDLIB)
 .cpp.o:
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
-$(STATICLIB): $(MODULES)
-	$(AR) r $@ $(MODULES)
+%.coff: %.rc
+	$(RC) $(RCFLAGS) -o $@ $<
 
-$(SHAREDLIB): $(MODULES)
-	$(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
-
-install:
-	install -d $(INCDIR) $(INSTALLDIR)
-	install -m 644 -o root -g root $(HEADER) $(INCDIR)
-	install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
-	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
-	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
-	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
-	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)	
+$(STATICLIB): $(MODULES)
+	$(AR) rs $@ $(MODULES)
 
-clean:
-	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
+	$(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
 
+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
+	$(LD) -shared -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LDFLAGS)
diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
--- FreeImage/Makefile.gnu	2015-09-17 22:51:21.798196232 +0200
+++ FreeImage-new/Makefile.gnu	2015-09-24 01:24:52.381788259 +0200
@@ -3,6 +3,14 @@
 # This file can be generated by ./gensrclist.sh
 include Makefile.srcs
 
+CC = gcc
+CXX = g++
+LD = g++
+AR = ar
+DLLTOOL = dlltool
+RC = windres
+PKGCONFIG = pkg-config
+
 # General configuration variables:
 DESTDIR ?= /
 INCDIR ?= $(DESTDIR)/usr/include
@@ -16,18 +24,14 @@ LIBRARIES = -lstdc++
 MODULES = $(SRCS:.c=.o)
 MODULES := $(MODULES:.cpp=.o)
 CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
-override CFLAGS += $(INCLUDE) -D__ANSI__ -I/usr/include/jxrlib $(shell pkg-config --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
-override LDFLAGS += -ljpeg -ljpegxr -ljxrglue $(shell pkg-config --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
-
-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
-	override CFLAGS += -fPIC
-endif
+override CFLAGS += $(INCLUDE) -D__ANSI__ -DFREEIMAGE_EXPORTS -I$(shell ${PKGCONFIG} --variable pc_system_includedirs pkg-config)/jxrlib $(shell ${PKGCONFIG} --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
+override LDFLAGS += -ljpeg -ljpegxr -ljxrglue $(shell ${PKGCONFIG} --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
 
 TARGET  = freeimage
 STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
-LIBNAME	= lib$(TARGET).so
-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).dll
+IMPORTLIB = lib$(TARGET).dll.a
+EXPORTLIB = lib$(TARGET).exp
 HEADER = Source/FreeImage.h
 
 
@@ -39,7 +43,8 @@ all: dist
 dist: FreeImage
 	mkdir -p Dist
 	cp *.a Dist/
-	cp *.so Dist/
+	cp *.dll Dist/
+	cp *.dll.a Dist/
 	cp Source/FreeImage.h Dist/
 
 dos2unix:
@@ -54,20 +59,10 @@ FreeImage: $(STATICLIB) $(SHAREDLIB)
 	$(CXX) $(CFLAGS) -c $< -o $@
 
 $(STATICLIB): $(MODULES)
-	$(AR) r $@ $(MODULES)
-
-$(SHAREDLIB): $(MODULES)
-	$(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
-
-install:
-	install -d $(INCDIR) $(INSTALLDIR)
-	install -m 644 -o root -g root $(HEADER) $(INCDIR)
-	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
-	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
-	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
-	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)	
-#	ldconfig
+	$(AR) rs $@ $(MODULES)
 
-clean:
-	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
+	$(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
 
+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
+	$(LD) -shared -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LDFLAGS)
